Run a local JSON-RPC node, build, deploy and verify the contracts execute as expected.
Start a local JSON-RPC node with Hardhat.
npx hardhat node
Contracts are best deployed to a local Hardhat JSON-RPC node with scripts.
A JSON-RPC node running locally, with no Etherscan service available.
The following environment variables:
${TOKEN_SWEEP_BENEFICIARY}
: Address that will receive ERC20 tokens from any sweep performed.
Set the temporary environment variables by substituting EnterYourAddressHere
with a valid Ethereum address (EoA or Contract).
export TOKEN_SWEEP_BENEFICIARY=${EnterYourAddressHere}
npx hardhat run ./scripts/deploy/deploy-all-no-etherscan.ts --network local
The terminal running the JSON-RPC node will output the contract addresses, these are needed for later:
${BondMediator}
: Performance Bond Mediator contract address.${BondFactory}
: Performance Bond Factory contract address.${StakingPoolMediator}
: Staking Pool Mediator contract address.${StakingPoolFactory}
: Staking Pool Factory contract address.${BitToken}
: Collateral token contract address (BIT).${Treausy}
: Any valid address to use as the treasury.
Check the contract deployment and operation with the test scripts.
Before any Bonds can be created, a number of setup steps are needed.
Set the temporary environment variables by substituting the value running the lines in your terminal.
export BOND_MEDIATOR_CONTRACT=${BondMediator}
export BOND_FACTORY_CONTRACT=${BondFactory}
export COLLATERAL_TOKENS_CONTRACT=${BitToken}
export TREASURY_ADDRESS=${Treasury}
All Performance Bond operations occur within the scope of a DAO.
The script creates a new DAO using BOND_MEDIATOR_CONTRACT
and TREASURY_ADDRESS
npx hardhat run ./scripts/verify/create-bond-dao.ts
Note the BigNumber
values from the CreateDao
event, convert from hex to decimal and that is the DAO id.
Set the temporary environment variables by substituting the value running the line in your terminal.
export DAO_ID=${DAO_ID}
Only whitelisted tokens are accepted as collateral.
The script whitelists the value of the environment variable COLLATERAL_TOKENS_CONTRACT
with the BOND_MEDIATOR_CONTRACT
.
npx hardhat run ./scripts/verify/whitelist-bond-collateral.ts
A Performance Bond managed within the scope of a DAO.
The script creates a bond using the environment variables BOND_MEDIATOR_CONTRACT
, BOND_FACTORY_CONTRACT
and DAO_ID
npx hardhat run ./scripts/verify/create-managed-bond.ts --network local
Before any Staking Pools can be created, a number of setup steps are needed.
Set the temporary environment variables by substituting the value running the lines in your terminal.
export STAKING_POOL_MEDIATOR_ADDRESS=${StakingPoolMediator}
export STAKING_POOL_FACTORY_ADDRESS=${StakingPoolFactory}
export COLLATERAL_TOKENS_CONTRACT=${BitToken} // do we need this?
export TREASURY_ADDRESS=${Treasury}
All Performance Bond operations occur within the scope of a DAO.
The script creates a new DAO using STAKING_POOL_MEDIATOR_ADDRESS
and TREASURY_ADDRESS
npx hardhat run ./scripts/verify/create-staking-pool-dao.ts --network local
Note the BigNumber
values from the CreateDao
event, convert from hex to decimal and that is the DAO id.
Set the temporary environment variables by substituting the value running the line in your terminal.
export DAO_ID=${DAO_ID}
Only whitelisted tokens are accepted as collateral.
The script whitelists the value of the environment variable COLLATERAL_TOKENS_CONTRACT
with the STAKING_POOL_MEDIATOR_ADDRESS
.
npx hardhat run ./scripts/verify/whitelist-staking-pool-collateral.ts --network local
A Staking Pool managed within the scope of a DAO.
The script creates a staking pool using the environment variables STAKING_POOL_MEDIATOR_ADDRESS
, STAKING_POOL_FACTORY_ADDRESS
and DAO_ID
npx hardhat run ./scripts/verify/create-staking-pool.ts --network local