- Use nodejs v8.12:
nvm install 8.12 && nvm alias default 8.12
- Install local dependencies:
You need a node to run contracts. Use
ganache-clifor developing purposes.
- Install Ganache globally:
npm install -g ganache-cli;
npm run ganache-cli
- Or using Docker:
docker pull trufflesuite/ganache-cli;
docker run -d -p 8545:8545 trufflesuite/ganache-cli:latest
- With Docker:See this repo: https://github.com/rsksmart/artifacts/tree/master/Dockerfiles/RSK-Node
npm run test
Tests With Coverage
Coverage tests use their own node, so there is no need to run Ganache separately.
npm run coverage
./coverage/index.htmlinside the project's folder.
Truffle suite is recommended to compile and deploy the contracts. There are a set of scripts to easy this process for the different known environments. Each environment (and network) might defer in its configuration settings, you can adjust this values in the the
At the end of the deployment the addresses of the most relevant contracts will be displayed. If you are interested in another contracts you should look inside some files depending if the contracts is upgradeable or not.
The addresses of the deployed proxies will be in a file called
zos.<network-id>.json. There you will have to look inside the proxies object and look for the
addressof the proxy you are interested in. If you are interested in the address of a contract that has not a proxy you should look for it in the prints of the deployment or inside the
- 1.Edit truffle.js and change add network changes and point to your
ganache-clior RSK node.
migrations/config/config.jsonand make changes
npm run truffle-compileto compile the code
npm run migrate-developmentto deploy the contracts
- initialPrice: Bitcoin initial (current) price
- initialEma: Bitcoin initial EMA (exponential moving average) price
- dayBlockSpan: Average amount of blocks expected to be mined in a calendar day in this network.
- settlementDays: Amount of days in between settlement to allowed executions
- gas: Gas to use on MoC.sol contract deploy.
- startStoppable: If set to true, the MoC contract can be stopped after the deployment. If set to false, before pausing the contract you should make it stoppable with governance(this together with the blockage of the governance system can result in a blockage of the pausing system too).
- oracle: Moc Price Provider compatible address (see
contracts/interface/PriceProvider.sol). You can deploy this contract using the
oracleproject or (in development) the mock:
contracts/mocks/BtcPriceProviderMock.sol(which is deployed on development migration by default).
- mocOracle: MoCToken Price Provider compatible address (see
contracts/interface/PriceProvider.sol). You can deploy this contract in development using the mock:
contracts/mocks/MoCPriceProviderMock.sol(which is deployed on development migration by default).
- governor: Address of the Governor contract
- stopper: Address of the Stopper contract
- proxyAdmin: Address of the Proxy Admin contract
- commissionSplitter: Defines an address for an existing CommissionSplitter. If none is set, then the CommissionSplitter will be deployed.
- mocCommissionProportion: Defines the proportion of commissions that will be injected as collateral to MoC. This configuration only works if no commissionSplitter address is set.
- btcxTmin: Minimum interest rate.
- btcxPower: Power is a parameter for interest rate calculation.
- btcxTmax: Maximun interest rate.
- bitProHolderRate: BitPro holder interest rate.
- daysBitProHolderExecutePayment: Days to execute payment
- targetAddressBitProInterest: Target address to transfer the weekly BitPro holders
- targetAddressCommissionPayment: Target addres to transfer commissions of mint/redeem
- docTmin: Upgrade to support red doc inrate parameter.
- docPower: Upgrade to support red doc inrate parameter.
- docTmax: Upgrade to support red doc inrate parameter.
- c0Cobj: Bucket C0 objective coverage.
- x2Cobj: Bucket X2 objective coverage.
- liq: Liquidation limit.
- utpdu: BPro with discount limit (discount coverage threshold).
- maxDiscRate: Reflects the discount spot rate at Liquidation level.
- smoothFactor: Weight coefficient for EMA calculation.
- maxMintBPro: Max value posible to mint of BPro.
- liquidationEnabled: If set to true, the MoC contract reached liquidation state.
- protected: If global coverage reaches this value, then the MoC system will operate in protection mode.
- vendorGuardianAddress: This address will be the only one authorized to register and unregister vendors in the platform.