git submodule init
git submodule update
Initialize packages
yarn install
Compile contracts (requires latest CDT installed) [https://github.com/AntelopeIO/cdt]
mkdir build
cd build
cmake ..
make
Run tests (requires Docker installed) [https://docs.docker.com/engine/install/]
yarn run test
The .env file contains keys for local, testnet, and potentially mainnet
It also contains a compiler setting - use either local compiler or Docker based compiler
Copy the example to .env
cp .env.example .env
The COMPILER variable can either be docker or local - if you have eos-cpp installed on your local machine you can use local, if you want to use a docker container make sure docker is running and it'll do everything for you.
npm install
The local testnet is required for unit tests.
nodeos -e -p eosio --plugin eosio::producer_plugin --plugin eosio::producer_api_plugin --plugin eosio::chain_api_plugin --plugin eosio::http_plugin --plugin eosio::history_plugin --plugin eosio::history_api_plugin --filter-on="*" --access-control-allow-origin='*' --access-control-allow-headers "*" --contracts-console --http-validate-host=false --delete-all-blocks --delete-state-history --verbose-http-errors >> nodeos.log 2>&1
This requires a wallet capable of signing the "create account" action, for example cleos
.
cleos wallet create --to-console
cleos wallet import --private-key 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 # LOCAL_PRIVATE_KEY in .env file
cleos create account eosio owner EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV # Public key matching above
Use the do.js script to
./scripts/do.js init
This command will update all permissions for a contract
It will check if a permission is already set and only set permissions that have been added or have been changed.
Permissions for a contract can affect other contracts, example give contract A eosio.code permission on contract B.
Permissions are defined in helper.js / contractPermissions
./scripts/do.js permissions <contract>
./scripts/do.js compile harvest => compiles harvest.cpp
./scripts/do.js deploy joinhypha => deploys account creator contract
./scripts/do.js test harvest => run unit tests on harvest contract
./scripts/do.js run harvest => compile, deploy, and run unit tests
Contract is a varadic parameter
./scripts/do.js run accounts onboarding organization
EOSIO_NETWORK=telosTestnet ./scripts/do.js deploy joinhypha
EOSIO_NETWORK=telosMainnet ./scripts/do.js deploy joinhypha
Note: For EOS deployment, make sure to call powerup on the contract that will be deployed, so it has enough CPU and NET.
EOSIO_NETWORK=eosMainnet ./scripts/do.js deploy joinhypha
Note: For EOS test deployment, make sure to call powerup on the contract that will be deployed, so it has enough CPU and NET. Use faucet and powerup on EOS jungle 4 website: https://monitor4.jungletestnet.io/#home
EOSIO_NETWORK=eosTestnet ./scripts/do.js deploy joinhypha
./scripts/do.js <command> <contract name> [additional contract names...]
command = compile | deploy | test | run
This is good for local iterations.
example:
./scripts/do.js run harvest => compiles seeds.harvest.cpp, deploys it
This command will generate html automatically based on the contract ABI files.
The tags inside the documents will be left untouched, even when they are regenerated.
This will generate docs only for the accounts
contract.
./scripts/do.js docsgen accounts:
This will generate all contracts:
./scripts/do.js docsgen all
This will regenerate the index.html file:
./scripts/do.js docsgen index