A middleware python package for interacting with the MECAnywhere smart contracts
Project description
pymeca
A python package for interacting with the MECAnywhere smart contracts
Installation
pip install pymeca
Build from source
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
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)
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:
poetry shell
pytest
Usage
Launch the ganache test chain in a terminal to watch
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. The sample assumes that a ganache chain launched with the sample commands with 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
and the py-pkgs-cookiecutter
template.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pymeca-0.1.2.tar.gz
.
File metadata
- Download URL: pymeca-0.1.2.tar.gz
- Upload date:
- Size: 26.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0d03b78a04c7b782b52de3745990bb47fedaff4f9053d91ef8522c1d66de643 |
|
MD5 | 78c12191201ced832d0be23da5fdcd2e |
|
BLAKE2b-256 | be26441fc2039110e8b809d140e9dd23bceda80d34524609ae2e764e155dc566 |
File details
Details for the file pymeca-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: pymeca-0.1.2-py3-none-any.whl
- Upload date:
- Size: 33.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | add8cae177a2d265047e5aba66cc55948035aec9963e404457e9d751fcf440a2 |
|
MD5 | cfd7a6ca7bdd04292636717f7894009a |
|
BLAKE2b-256 | 197806448f803525e079e5fcae82b3e7c146f1286fc80a2f7eedd95e60752844 |