Skip to main content

A middleware python package for interacting with the MECA smart contracts

Project description

pymeca

A python package for interacting with the MECA 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

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 meca-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 \
--port 9000 \
--ganache-server-script-path ../../../meca-contracts/src/ganache/index.js \
--accounts_file_path ../../config/accounts.json \
--dao-address-file-path ../dao_contract_address.txt \
--dao-file-path \
../../../meca-contracts/src/contracts/MecaContract.sol \
--scheduler-file-path \
../../../meca-contracts/src/contracts/SchedulerContract.sol \
--host-file-path \
../../../meca-contracts/src/contracts/HostContract.sol \
--tower-file-path \
../../../meca-contracts/src/contracts/TowerContract.sol \
--task-file-path \
../../../meca-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

pymeca-0.0.0.tar.gz (24.2 kB view hashes)

Uploaded Source

Built Distribution

pymeca-0.0.0-py3-none-any.whl (31.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page