Build, deploy and verify the contracts execute as expected to a remote RPC endpoint e.g. Pre-production or production.
Contracts are best deployed using the deploy scripts.
Set the following environment variables:
${TOKEN_SWEEP_BENEFICIARY}
: Address that will receive ERC20 tokens from any sweep performed.${RPC_ENDPOINT_URL}
: The URL for the Web3 endpoint to use when deploying and accessing the contracts.${DEPLOYER_PRIVATE_KEY}
: Private key for the account to use (and pay with) when deploying contracts.${ETHERSCAN_API_KEY}
: API key to use when verifying the deployed contracts with Etherscan.
Set the temporary environment variables by substituting EnterYourAddressHere
with a valid Ethereum address (EoA or Contract).
export TOKEN_SWEEP_BENEFICIARY=${EnterYourAddressHere}
export RPC_ENDPOINT_URL=${EnterTheRpcEndpointHere}
export DEPLOYER_PRIVATE_KEY=[${EnterYourPrivateKeyHere}]
export ETHERSCAN_API_KEY=${EtherYourApiKey}
npx hardhat run ./scripts/deploy/deploy-all.ts --network remote
npx hardhat run ./scripts/deploy/bond-deploy.ts --network remote
npx hardhat run ./scripts/deploy/staking-pool-deploy.ts --network remote
In production (Mainnet) existing ERC20 token contract should be used
As verify scripts require a collateral token, for which the BIT token contract may be used.
npx hardhat run ./scripts/deploy/bitdao-deploy-no-etherscan.ts --network remote
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).${Treasury}
: Any valid address to use as the treasury.
Check the contract deployment and operation with the test scripts.
Before any Performance 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 --network remote
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 --network remote
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 remote
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}
export TREASURY_ADDRESS=${Treasury}
export DAO_METADATA=${DaoMetadata}
All Staking Pool 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 remote
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 remote
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 remote