Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sbip-sg/pymeca
A python package for interacting with the MECAnywhere smart contracts.
https://github.com/sbip-sg/pymeca
Last synced: about 2 months ago
JSON representation
A python package for interacting with the MECAnywhere smart contracts.
- Host: GitHub
- URL: https://github.com/sbip-sg/pymeca
- Owner: sbip-sg
- License: mit
- Created: 2024-02-29T23:53:55.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-09-06T04:10:33.000Z (4 months ago)
- Last Synced: 2024-09-07T04:25:18.902Z (4 months ago)
- Language: Python
- Homepage:
- Size: 267 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# pymeca
A python package for interacting with the MECAnywhere smart contracts
## Installation
```bash
pip install pymeca
```## Build from source
```bash
git clone https://github.com/sbip-sg/pymeca.git
cd pymeca
git submodule init
git submodule update --recursive
pip install poetry
poetry install
```## Run tests
Requirements: poetry
```bash
pip install poetry
poetry install
cd ./mecanywhere_contracts/src/ganach && npm install
```Requirements: node.js 20.11.1 and npm (tested with 8.5.5)
```bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
export NVM_DIR="${HOME}/.nvm" && ."$NVM_DIR/nvm.sh"
cd mecanywhere_contracts/src/ganache && nvm install .nvmrc && nvm use .nvmrc && nvm install-latest-npm && npm install
```From the main directory:
```bash
poetry shell
pytest
```## Usage
Launch the ganache test chain in a terminal to watch
```bash
cd src/pymeca/scripts
python3 ganache.py \
--host http://localhost \
--port 9000 \
--ganache-server-script-path ../../../mecanywhere_contracts/src/ganache/index.js \
--generate-accounts \
--accounts_file_path ../../config/accounts.json \
--dao-address-file-path ../dao_contract_address.txt \
--dao-file-path \
../../../mecanywhere_contracts/src/contracts/MecaContract.sol \
--scheduler-file-path \
../../../mecanywhere_contracts/src/contracts/SchedulerContract.sol \
--host-file-path \
../../../mecanywhere_contracts/src/contracts/HostContract.sol \
--tower-file-path \
../../../mecanywhere_contracts/src/contracts/TowerContract.sol \
--task-file-path \
../../../mecanywhere_contracts/src/contracts/TaskContract.sol \
--scheduler-fee 100 \
--host-register-fee 100 \
--host-initial-stake 100 \
--host-task-register-fee 100 \
--host-failed-task-penalty 100 \
--tower-initial-stake 100 \
--tower-host-request-fee 100 \
--tower-failed-task-penalty 100 \
--task-addition-fee 100
```- A sample workflow of how DAO entities interact with each other is provided [here](./sample/sample.py). The sample assumes that a ganache chain launched with the sample commands with [ganache.py](./src/pymeca/scripts/ganache.py) to setup corresponding accounts.
## Contributing
Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.
## License
`pymeca` was created by Stefan-Dan Ciocirlan (sdcioc). It is licensed under the terms of the MIT license.
## Credits
`pymeca` was created with [`cookiecutter`](https://cookiecutter.readthedocs.io/en/latest/) and the `py-pkgs-cookiecutter` [template](https://github.com/py-pkgs/py-pkgs-cookiecutter).