Skip to content

Commit

Permalink
Merge pull request #9 from com-chain/transfertRule
Browse files Browse the repository at this point in the history
Transfert rule
  • Loading branch information
FlorianDubath authored Sep 30, 2024
2 parents d911121 + 87d3ffb commit 0cf2afb
Show file tree
Hide file tree
Showing 23 changed files with 3,904 additions and 244 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.sol linguist-language=Solidity
*.vy linguist-language=Python
45 changes: 45 additions & 0 deletions .github/workflow/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
on: ["push", "pull_request"]

name: main workflow

env:
# ETHERSCAN_TOKEN:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# WEB3_INFURA_PROJECT_ID:

# increasing available memory for node reduces issues with ganache crashing
# https://nodejs.org/api/cli.html#cli_max_old_space_size_size_in_megabytes
NODE_OPTIONS: --max_old_space_size=4096

jobs:

tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Cache Compiler Installations
uses: actions/cache@v2
with:
path: |
~/.solcx
~/.vvm
key: compiler-cache

- name: Setup Node.js
uses: actions/setup-node@v1

- name: Install Ganache
run: npm install -g [email protected]

- name: Setup Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install Requirements
run: pip install -r requirements.txt

- name: Run Tests
run: brownie test
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
__pycache__
.env
.history
.hypothesis/
build/
reports/
12 changes: 12 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
eth-brownie = "*"

[requires]
python_version = "3.10.8"
1,393 changes: 1,393 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

100 changes: 90 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,118 @@
# currency

Smart-contract templates for com-chain hosted currency

Those are free and open-source Smartcontracts to run an ethereum token based currency and barter system.
It was created and by Florian and Dominique on behalf of Monnaie Leman the Leman Lake Local Currency. Then maintained and used as templates for the other currency hosted by Com-Chain (see com-chain.org)
Those are free and open-source Smartcontracts to run an ethereum token
based currency and barter system. It was created and by Florian and
Dominique on behalf of Monnaie Leman the Leman Lake Local
Currency. Then maintained and used as templates for the other currency
hosted by Com-Chain (see com-chain.org)

## Features

The smartContracts permit to do :

- Payments
- Reverse Payment
- Automatic approval of reverse payment
- Payement on behalf of an other user

Account management includes:

- Account activation/inactivation
- Changing account type
- Setting barter limits
- Sending initial monney

## Configuration

- If you are planning to use the contract withing the Com-Chain framework, you must keep the function signature.
- Unused function can have their body replaced by a revert() statment.
- You should choose in the pledge function between two check: one is checking for overflow, the second also check for non-negative pledge.
- If you are planning to use the contract within the Com-Chain
framework, you must keep the function signature.

- Unused function can have their body replaced by a revert() statement.

- You should choose in the pledge function between two check: one is
checking for overflow, the second also check for non-negative
pledge.

## Our Philosophy

- Empower the people: Give people the ability to interact with the Ethereum blockchain easily, without having to run a full node.
- Empower the people: Give people the ability to interact with the
Ethereum blockchain easily, without having to run a full node.

- Make it easy & free: Everyone should be able to create a wallet and send Tokens without additional cost.
People are the Priority: People are the most important.
- Make it easy & free: Everyone should be able to create a wallet and
send Tokens without additional cost. People are the Priority:
People are the most important.

- If it can be hacked, it will be hacked: Never save, store, or transmit secret info, like passwords or keys. Open source & auditable.
- If it can be hacked, it will be hacked: Never save, store, or
transmit secret info, like passwords or keys. Open source &
auditable.

## Contact

If you can think of any other features or run into bugs, let us know. You can drop a line at it {at} monnaie {-} leman dot org.
If you can think of any other features or run into bugs, let us
know. You can drop a line at it {at} monnaie {-} leman dot org.

## Install for developpement

You should ensure you have a working `pipenv` [installed on your
system](https://github.com/pypa/pipenv#installation).

First, clone this source code, and from the root of the project, run:

```shell
pipenv install ## only to be run the first time
```

This will gather python dependency to setup `brownie`.

## Usage

Remember to hop into the python local environment before using `brownie`:

```shell
pipenv shell ## from root of the project
```

## Test

Run the tests with:

```shell
brownie test
```

## Get the signatures of the functions

You must compile first with:

```shell
brownie compile
```

Then this will provide the list of all signatures

```shell
cat build/contracts/cccur.json |
jq '.abi[] | select(.name != null) |
( .name + "(" + ([ .inputs[].type ] | join(",")) + ")" )'
```

To provide the ethereum selector with the signature, you could:

```shell
cat build/contracts/cccur.json |
jq -r '.abi[] | select(.name != null) |
( .name + "(" + ([ .inputs[].type ] | join(",")) + ")" )' |
while read sig; do
echo "$sig:$(selector "$sig")"
done | sort > hashes
```

This will produce a `hashes` file in your current directory that you
can compare for `hashes.legacy`, the hashes of the legacy comchain
smartcontract. For instance:

```shell
diff -u0 hashes.legacy hashes | grep -v '^@' | tail -n +3
```
Loading

0 comments on commit 0cf2afb

Please sign in to comment.