Deployment guide - percent-finance/percent-dev GitHub Wiki
Overview
To deploy Percent, we need to:
- Deploy PCT token contract
- Deploy oracle proxy contract
- Deploy Unitroller (Comptroller's storage)
- Deploy Comptroller (Comptroller's implementation)
- Config Unitroller and Comptroller
- Deploy pTokens
Deploy PCT token contract
- Source code: https://github.com/percent-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol
- Flatten source code: https://etherscan.io/address/0xbc16da9df0A22f01A16BC0620a27e7D6d6488550#code
- Compiler Version: v0.5.16+commit.9c3226ce
- Optimization Enabled: Yes with 200 runs
- Constructor
- account: The initial account to grant all the tokens.
Deploy oracle proxy contract
- Source code: https://github.com/percent-finance/compound-protocol/blob/master/contracts/ChainlinkPriceOracleProxy.sol
- Flatten source code: https://etherscan.io/address/0x21A6297114853aEF193c83FC0271dEf69EA1b93d#code
- Compiler Version: v0.5.16+commit.9c3226ce
- Optimization Enabled: Yes with 200 runs
- Constructor
- ethUsdChainlinkAggregatorAddress_: The Chainlink aggregator address for ETH/USD (It can be found on https://docs.chain.link/docs/reference-contracts. For mainnet it is 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419).
Deploy Unitroller (Comptroller's storage)
- Source code: https://github.com/percent-finance/compound-protocol/blob/master/contracts/Unitroller.sol
- Flatten source code: https://etherscan.io/address/0xf47dD16553A934064509C40DC5466BBfB999528B#code
- Compiler Version: v0.5.16+commit.9c3226ce
- Optimization Enabled: Yes with 200 runs
- Constructor: Empty
Deploy Comptroller (Comptroller's implementation)
- Source code: https://github.com/percent-finance/compound-protocol/blob/master/contracts/Comptroller.sol
- Flatten source code: https://etherscan.io/address/0x395cb0c7bf2808a11200a9018c98b2839f45c6f9#code
Note: The PCT token address is hard coded in the source code (at the bottom). If you have a new PCT token address (for example when you've just deployed a new PCT token contract on testnet), you must modify the code before deploying.
- Compiler Version: v0.5.16+commit.9c3226ce
- Optimization Enabled: Yes with 200 runs
- Constructor: Empty
Config Unitroller and Comptroller
- Unitroller: Call
_setPendingImplementation(<Comptroller's address>)
- Comptroller: Call
_become(<Unitroller's address>)
Note: The following functions are proxy functions (defined in comptroller's implementation), you can call them even they are not in Unitroller's source code.
- Unitroller: Call
_setPriceOracle(<ChainlinkPriceOracleProxy's address>)
- Unitroller: Call
_setCloseFactor(500000000000000000)
(set close factor to 50%) - Unitroller: Call
_setMaxAssets(20)
(set max assets to 20) - Unitroller: Call
_setLiquidationIncentive(1080000000000000000)
(set liquidation incentive to 108%)
Deploy pTokens
- The detailed steps can be found in https://github.com/percent-finance/percent-dev/wiki/New-token-deployment-info-(relevant-to-admin-only)
- Source code
- JumpRateModelV2
- CErc20Delegate
- CErc20Delegator