dapp- ethereum smart contract development framework to assist with building and testing smart contracts
seth- command-line interface to interact with ethereum networks
hevm- Haskell EVM implementation optimized to run solidity tests
ilk) to the Maker Protocol requires the addition of the following contracts, if they don’t already exist.
GemJoinadapter is the interface between the collateral token contract and the core accounting contract (
Vat). Its purpose is to abstract away all the particular features of a specific token, hence standardizing the token behavior before being debited in the Maker Protocol. It's similar to WETH, but rather than conforming ETH to an ERC20 standard, a
GemJoinadapter conforms XYZ token to Maker's internal balance standard (
gem). Each collateral has its own
Flippercontract is where collateral is sent when it is out for auction. Collateral is sourced from Vaults that are liquidated after they become undercollateralized. The same
Flipperimplementation is used for all collateral types.
Mediancontract maintains a whitelist of oracle price feeds authorized to post USD price updates for collateral supported in the Maker Protocol. The
OSMcontract ensures that new collateral price values are delayed by a specific amount of time. The Oracle Team will handle the deployment of the
OSM, and, once configured, will share its addresses with the Smart Contract team to be called in the
ilk) to the Maker Protocol requires an upgrade to different repositories in the
dssecosystem, which are responsible for recreating Maker Protocol instances to be rigorously tested before mainnet inclusion. The two repos that are of most interest to you:
dss-deploy-scripts—This repository contains a set of scripts that deploy
dssto an Ethereum chain of your choosing. It reads the
GemJoinAdapters, and the token contracts from
dss-gem-joins. This contract is used to deploy fresh instances of the Maker Protocol on local testchains and public testnets. For pre-deployed systems, such as the latest version on Kovan and Mainnet, system upgrades are commissioned through Spells and will be described in the Deploy Contracts in section three.
dss-deploy-scriptsshould be made after the Greenlight Governance Poll. Additionally, a confirmation of a successful Executive vote (i.e.
cast) should be appended as a comment before it is accepted as a new addition and merged into
ETH-B): Then there is no need to develop a new adapter. It only requires adding the new
dss-deploy-scripts; therefore, go directly to step 10d.
BATis reccommended. Take care to capture the target token’s defining features.
dss-deploy-scripts. This is the moment that you want to deploy this token to kovan. You do this now so that if there are any changes you need to make to the token, you don’t have to go through the hassle of updating the dependency tree again. Since you deploy everything to kovan, you will need to acquire some kETH (kovan ETH) to deploy contracts and send transaction on kovan. You can ask for some kETH in the #dev channel on the makerdao rocket.chat server: https://chat.makerdao.com/channel/dev. To deploy this new token, try:
GemJointhat addresses the needs of the new collateral token
dapp upgrade dss-gem-joins && git push
ETH-A): < name >
nix run -f https://github.com/icetan/dapp2nix/tarball/master -c dapp2nix up dss-gem-joins
nix run -f https://github.com/icetan/dapp2nix/tarball/master -c dapp2nix up dss-proxy-actions
nix run -f https://github.com/icetan/dapp2nix/tarball/master -c dapp2nix up testchain-medians
nix run -f https://github.com/icetan/dapp2nix/tarball/master -c dapp2nix dup
ETH-B), you will not need to make a new deploy ilk script, and you can go straight to the last sub-step, which is to update the environment config files.
dss-deploy-scriptswill pull the token contract and
dss-gem-joins, use the latest auction contract (
Flipper), use an OSM, configure all authorizations, deploy all contracts, and enable the collateral type in a fresh instance of the Maker Protocol.
GemJoin. Remember, your new collateral is going to use a previous adapter or the one you made
chmod +x deploy-ilk-token
gem, you can use the token address we got from the kovan deploy earlier.
pipthat’s needed from the Oracle team. This contract usually undergoes extensive testing before we get it. For now, we can make a PR, but put it in draft form until we get that
hat, which is then trusted to execute these functions and make changes to the live protocol.
planand then the actual execution after the delay by
castingthe spell, which introduces the desired changes to the live Protocol.
SpellActioncontract is defined which contains the main execute function and a
DssSpellcontract contains a description of the spell and orchestrates the execution of one or more spell actions through the GSM.
seth send 0x630D82Cbf82089B09F71f8d3aAaff2EBA6f47B15 'transfer(address,uint256)' 0x57aAeAE905376a4B1899bA81364b4cE2519CBfB3 50000000000000000000000000000
gulpamount should be.
gem, and any other constructor values are set correctly.
dapp --use solc:0.5.12 build && dapp create GemJoin 0xbA987bDB501d131f766fEe8180Da5d81b34b69d9 $(seth --to-bytes32 "$(seth --from-ascii "BAL-A")") 0x630D82Cbf82089B09F71f8d3aAaff2EBA6f47B15
ilkvalues are set correctly.
FlipFabcontract to deploy a generic Flipper contract. You can find the
MCD_FLIP_FABaddress in the changelog along with the arguments
Cat. You can get the bytes32 of the ilk from the command below, but replace
BAL-Awith your token.
TX=$(seth send 0x7c890e1e492FDDA9096353D155eE1B26C1656a62 'newFlip(address,address,bytes32)(address)' 0xbA987bDB501d131f766fEe8180Da5d81b34b69d9 0xdDb5F7A3A5558b9a6a1f3382BD75E2268d1c6958 $(seth --to-bytes32 "$(seth --from-ascii "BAL-A")") --async) && seth receipt $TX logs | jq -r '..address'
seth senddoesn’t return the new Flipper address. You can find this address by chasing it down in the transaction hash that was returned. Simply go to https://ethtx.info/kovan/<tx hash>.
OSMand will share its address with the Smart Contract team to be called in the
Momcontracts allow governance to execute certain time-sensitive actions without having to pass through a delay.
OSMMomcontract allows governance to stop an erroneous oracle price update instantly, and the
FlipperMomcontract allows governance to instantly stop vaults of a collateral type from being liquidated under unfavorable conditions.
Flippercontracts, the deployer address (
ETH_FROM) is given authorization, which needs to be revoked with a follow-up
./templatedirectory to add the new collateral type with values from https://github.com/makerdao/dss-deploy-scripts/tree/master/config, and then replace the contents of the
src/Kovan-DssSpell.solcontract with it. It is important that the template is exactly followed and no changes are made since it was created after many iterations. Reviews would be conducted against it line by line and they would fail if any changes are introduced to the template.
poke()the OSM yourself by using the TOKEN_PIP address:
seth send $TOKEN_PIP 'poke()'. Feel free to do this twice, but you must wait an hour between each
poke(). Once you’ve poked, you can run this script to see if there is a price in the OSM: https://gist.github.com/godsflaw/3dd9171237a88caa948fc5879431d0ce
nextPricepopulated. If you don’t, you should reach out to the Oracles team to ensure they are indeed providing a price.
gulp()on the faucet. This section tells the faucet how many tokens should be handed out for a
gulp()is called it cannot be called from the same address again, so be generous. For testing later, this MUST be more than the DAI dust value with collateralization ratio applied. Target 5x the dust value.
.sethrcfile with the correct network, gas limit, and signing keys. You can also add the Etherscan API key to the file to .sethrc for automatic etherescan contract verification, ETHERSCAN_API_KEY=XXXXXYYYYYZZZZ.