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
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
Deploy Testnet or Mainnet (not develop)
To deploy on production we need anothers steps:
Contract Governanza project already deployed, you can get it (here)[https://github.com/money-on-chain/Areopagus-Governance]
Contract Oracle project already deployed, you can get it (here)[https://github.com/money-on-chain/Amphiraos-Oracle]
Deploy gobernanza
Clone gobernanza
Install requirements
We reach our private node?
Give us something like this
We have need to know our account private key. Mine: XXX
Change truffle.js:
Edit governance/migrations/config.json
Add this key to config, or edit if already exist:
ubnblockAt is date format unix epoch. Is the date that the contract is unblock to gobernanza.
Change package.json
Finally deploy the contract
Write down the contract adresses we are going to use later
Deploy Rif Oracle
We are going to deploy a new oracle for rif
We are going to use 'oracle' only
Install dependencies
Edit truffle.js and change Private key with yours
Edit migrations/configs/config.json, fill with governor address and initial rif price
For the price take a look at this page:
Migrate:
When finish take a look to contract adresses
Write down the contract adresses we are going to use later
MoCMedianizer is our oracle contract write down this address: 0x504EfCadFB020d6bBaeC8a5c5BB21453719d0E00
Deploy Main Stable Token Contract
Finally deploy main contract
Edit truffle.js
Edit migrations/configs/config.json and filled with the contracts already deployed
take a note that reserveToken:
This is the address of the rifToken
Private key to enviroment
Run migrations
Give us..., write down because adressess of the contracts
Price Feeder
To run your own price feeder on USDRIF. Take a look on repository (page)[https://github.com/money-on-chain/price-feeder/tree/develop]
Clone price feeder repository
requirements:
Install dependencies
Use this config as template (https://github.com/money-on-chain/price-feeder/blob/develop/config_rdoc.json)[https://github.com/money-on-chain/price-feeder/blob/develop/config_rdoc.json] Change to correct addresses
Then run
Pricefeeder Deployment Tutorial using Docker: example USDRIF Testnet
I'm going to use docker method.
We need to have our account to sign transactions, also we need pk and funds. In my example I am going to use: 0xbc6d77a5adfa6fb09c3d2cb8b4765d5729e7b8ba
Initiate the process of whitelisting sending the address of the account from the step 1 to MOC team.
Clone the repository:
Set the base config por our deployment in our case config_rdoc.json is our base
Edit config.json and change to ensure this:
Build docker
Run
Replace (PRIVATE KEY) with private key
Security and Audits
Settings
initialPrice: RIF initial (current) price
initialEma: RIF 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/interfaces/PriceProvider.sol
). You can deploy this contract using theoracle
project or (in development) the mock:contracts/mocks/PriceProviderMock.sol
(which is deployed on development migration by default).mocOracle: MoCToken Price Provider compatible address (see
contracts/interfaces/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.
riskProxTmin: Minimum interest rate.
riskProxPower: Power is a parameter for interest rate calculation.
riskProxTmax: Maximun interest rate.
riskProHolderRate: RiskPro holder interest rate.
daysRiskProHolderExecutePayment: Days to execute payment
targetAddressRiskProInterest: Target address to transfer the weekly BitPro holders
targetAddressCommissionPayment: Target addres to transfer commissions of mint/redeem
stableTmin: Upgrade to support red stable inrate parameter.
stablePower: Upgrade to support red stable inrate parameter.
stableTmax: Upgrade to support red stable inrate parameter.
c0Cobj: Bucket C0 objective coverage.
x2Cobj: Bucket X2 objective coverage.
liq: Liquidation limit.
utpdu: RiskPro with discount limit (discount coverage threshold).
maxDiscRate: Reflects the discount spot rate at Liquidation level.
smoothFactor: Weight coefficient for EMA calculation.
maxMintRiskPro: 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.
Last updated