Getting started
Install dependencies
Use nodejs v8.12:
nvm install 8.12 && nvm alias default 8.12
Install local dependencies:
npm install
Node
You need a node to run contracts. Use ganache-cli
for developing purposes.
Install Ganache globally:
Or using Docker:
Run RSK Local Node
With Docker:
See this repo: https://github.com/rsksmart/artifacts/tree/master/Dockerfiles/RSK-Node
Run Tests
run:
npm run test
Tests With Coverage
Coverage tests use their own node, so there is no need to run Ganache separately.
run:
npm run coverage
browse:
./coverage/index.html
inside the project's folder.
Deploy
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 migrations/config/config.json
file.
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 address
of 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 builds/<contract-name>.json
file.
Edit truffle.js and change add network changes and point to your
ganache-cli
or RSK node.Edit
migrations/config/config.json
and make changesRun
npm run truffle-compile
to compile the codeRun
npm run migrate-development
to deploy the contracts
Security and Audits
For more technical information you can see our ABI documentation.
Settings
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 theoracle
project 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.
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.
commissionRates: Certain mint and redeem operations have different commission rates applied to them. This section defines the values for each one. The commission fees are explained here.
Last updated