Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request #152 from makerdao/mcd-v0.2.11
Browse files Browse the repository at this point in the history
SDK-711: MCD v0.2.11
  • Loading branch information
ethanbennett authored Aug 20, 2019
2 parents 1868890 + 6453f34 commit b112f91
Show file tree
Hide file tree
Showing 18 changed files with 170 additions and 203 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ code on commit.
```
yarn
yarn lerna bootstrap // Installs dependencies & links all local dependencies together
yarn build // builds each plugin for local use
```

### Running the testchain
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@babel/plugin-proposal-throw-expressions": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.3.4",
"@babel/preset-env": "^7.4.5",
"@makerdao/testchain": "^0.2.10-4",
"@makerdao/testchain": "^0.2.11",
"babel-eslint": "^10.0.1",
"babel-jest": "^24.8.0",
"babel-loader": "^8.0.5",
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/dai-plugin-mcd/contracts/abis/Flippy.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"constant":false,"inputs":[{"name":"id","type":"uint256"}],"name":"yank","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"bids","outputs":[{"components":[{"name":"bid","type":"uint256"},{"name":"lot","type":"uint256"},{"name":"guy","type":"address"},{"name":"tic","type":"uint48"},{"name":"end","type":"uint48"},{"name":"urn","type":"address"},{"name":"gal","type":"address"},{"name":"tab","type":"uint256"}],"name":"","type":"tuple"}],"payable":false,"stateMutability":"view","type":"function"}]
[{"constant":false,"inputs":[{"name":"id","type":"uint256"}],"name":"yank","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"bids","outputs":[{"components":[{"name":"bid","type":"uint256"},{"name":"lot","type":"uint256"},{"name":"guy","type":"address"},{"name":"tic","type":"uint48"},{"name":"end","type":"uint48"},{"name":"usr","type":"address"},{"name":"gal","type":"address"},{"name":"tab","type":"uint256"}],"name":"","type":"tuple"}],"payable":false,"stateMutability":"view","type":"function"}]
98 changes: 49 additions & 49 deletions packages/dai-plugin-mcd/contracts/addresses/kovan.json
Original file line number Diff line number Diff line change
@@ -1,76 +1,76 @@
{
"DEPLOYER": "0x61de44946D6b809a30D8e6A236157966659f9640",
"MULTICALL": "0x36b468a9cf4a7a00188731257582dfe5c2141896",
"MULTICALL": "0x34b5bd422b27a8c8eaf3f80b940367d975c8f6e1",
"FAUCET": "0x94598157fcf0715c3bc9b4a35450cce82ac57b20",
"MCD_DEPLOY": "0x8600f5b33aebc97202ccec04eb36a5a233dabe18",
"MCD_DEPLOY": "0x6146433a8ec1ac6cf100acf2ab09a81912393ed2",
"MCD_GOV": "0xaaf64bfcc32d0f15873a02163e7e500671a4ffcd",
"MCD_GOV_GUARD": "0x1d2f30363fb30c6ba3a26f5c0ab9f3e77197aefc",
"MCD_IOU": "0x52d54e192d1d2eff3319427bbfede0b79855e2aa",
"MCD_ADM": "0x03358a3959247ae8de50a52c7919b88ab5989b85",
"VOTE_PROXY_FACTORY": "0xe743525d0653bdf291f835a19e493bb3d1026ab9",
"MCD_VAT": "0x5ce1e3c8ba1363c7a87f5e9118aac0db4b0f0691",
"MCD_JUG": "0x1ff7cb4126d7690daaa1c0f1ba58bab06d53d4b8",
"MCD_CAT": "0xfd5db7bd95c6a53f805dc2c631e62803e17de609",
"MCD_VOW": "0x43d3fa1c52933c4ff13628e43279f17d97cbbe9a",
"MCD_JOIN_DAI": "0xe70a5307f5132ee3a6a056c5efb7d5a53f3cdbd7",
"MCD_FLAP": "0xec9f745bfd0835dbea3c0c61a0cc6a15f68c5a31",
"MCD_FLOP": "0xeedcbe2ecec652617f5757688a73745a3905cc14",
"MCD_PAUSE": "0x8fe4f004ed32c0d11d00de9f7aa65a37815211ae",
"MCD_PAUSE_PROXY": "0xd8439f40a308964666800c03fb746e32901eb0e8",
"MCD_GOV_ACTIONS": "0x7e6c691559395329149aefd4bfaed2689130bb3b",
"MCD_DAI": "0x5944413037920674d39049ec4844117a031eaa74",
"MCD_SPOT": "0xcf68a9dc1e17a0d56ffedfb7e96ed6bf7e84458a",
"MCD_POT": "0x570d432df425937d0b83077dafe16a728c1c3438",
"MCD_END": "0xc6cd35939523d258d5c28febf6017635a4ea858d",
"MCD_ESM": "0xb4a9e253cb9b13109ac89fea50f2b33f6eafe825",
"PROXY_ACTIONS": "0xc8c1351cadc005390fd1afa1eaf25c679d8b599c",
"CDP_MANAGER": "0x772ff99b5aae3d51512d73c04f763c73adc7a86a",
"GET_CDPS": "0xda50a754d77e5a4432acc01b55625d58a3821fb9",
"PROXY_FACTORY": "0xff8f45417d818dc4e070389ad2b876f132605a2f",
"PROXY_REGISTRY": "0x1935399ecbeefbfe23b58213c5acddfbcb2ed4d9",
"MCD_GUARD": "0x0de879766490e497025738ae29bb8cc533eb355d",
"MCD_ADM": "0x3d434d7625721aa31ddbf9f98825aca6ba4b685f",
"MCD_IOU": "0xc52362382417f56e85e7e030b786972a1a2edd0b",
"VOTE_PROXY_FACTORY": "0x984c18e3f8a8582cedaa5b96e2c7399f0a2b022b",
"MCD_VAT": "0x04c67ea772ebb467383772cb1b64c7a9b1e02bca",
"MCD_JUG": "0xeffb135cf2e4911de9e478679d358c9df246424a",
"MCD_CAT": "0x505795bd482f24da52bba25c072a833696d8c6ee",
"MCD_VOW": "0x5fd6598a1f6a3b5fe78627fa72107d4a9fadf348",
"MCD_JOIN_DAI": "0xcf20652c7e9ff777fcb3772b594e852d1154174d",
"MCD_FLAP": "0x43920251323f05139c76bd75771fd3ab8e5a6dad",
"MCD_FLOP": "0xd5f64f76ce8047e8978707a00fa4c143405e9e37",
"MCD_PAUSE": "0xb5bb144eb951a8060d6ac186aee694187e2d037d",
"MCD_PAUSE_PROXY": "0xd16ba625e0b981c73fba249db64b523eade884a4",
"MCD_GOV_ACTIONS": "0xed0150fc2eb6f280af552fbdf3cbd5f66d3c7d1f",
"MCD_DAI": "0xdb6a55a94e0dd324292f3d05cf504c751b31cee2",
"MCD_SPOT": "0x2403ddca8715427fdb04f9e70d8989cddab06b67",
"MCD_POT": "0xe019a058adcd42e34a456f3b86466ddd103027e4",
"MCD_END": "0xdf72153215205ae87b4cf388866064ce234b35a5",
"MCD_ESM": "0xce1db78a9d5ff7520430421f8fa5f7744021dd3e",
"PROXY_ACTIONS": "0x4e8fa882ce2127b50e508d3abfa6be12911b0c05",
"CDP_MANAGER": "0x7a4991c6bd1053c31f1678955ce839999d9841b1",
"GET_CDPS": "0xcc1ba3ee9cd1e06765ae41a195723bbe97de4ed1",
"PROXY_FACTORY": "0xe11e3b391f7e8bc47247866af32af67dd58dc800",
"PROXY_REGISTRY": "0x64a436ae831c1672ae81f674cab8b6775df3475c",
"ETH": "0xd0a1e359811322d97991e03f863a0c30c2cf029c",
"VAL_ETH": "0x75dd74e8afe8110c8320ed397cccff3b8134d981",
"PIP_ETH": "0x75dd74e8afe8110c8320ed397cccff3b8134d981",
"MCD_JOIN_ETH_A": "0xca512f193650db9a55aba9e61a7ec0b0b5aea0b7",
"MCD_FLIP_ETH_A": "0x9d18e462b23ffc45ce6136a76dff82c4c55702be",
"MCD_JOIN_ETH_B": "0x9f5611179d416f977fe85896ce15816fd3d152ee",
"MCD_FLIP_ETH_B": "0xdcdf9f7504727aa2b7299c3f0d9fb661a2febfcd",
"MCD_JOIN_ETH_C": "0xc7a0aa2565a2081636697e4e40f300e74e77c3a0",
"MCD_FLIP_ETH_C": "0xc387636fe80a031f48839be73727d52985bf3f41",
"MCD_JOIN_ETH_A": "0x004ddbf22b90cc5ce715be6096ac2fd89b514bf6",
"MCD_FLIP_ETH_A": "0xe8b1439bbcc5a4da4a8e938257aea3a8d18f78ad",
"MCD_JOIN_ETH_B": "0xb3acc117e70e9f2cb8afa66c80ed5ffc09df9c70",
"MCD_FLIP_ETH_B": "0xd4b18bbc581fa6f7a019c7c8f2245430f865c14e",
"MCD_JOIN_ETH_C": "0xade09cccddbacfdd69741c97a45d742460e9ec23",
"MCD_FLIP_ETH_C": "0x965875bddaa6011a8af54cb952798473bc0f086b",
"REP": "0xc7aa227823789e363f29679f23f7e8f6d9904a9b",
"VAL_REP": "0x5debc8c4124db0c1d3bad99e69287a576c7b2ccc",
"PIP_REP": "0x5debc8c4124db0c1d3bad99e69287a576c7b2ccc",
"MCD_JOIN_REP_A": "0x7d9d701e87920a1a7396438769b571fb55b6ffdc",
"MCD_FLIP_REP_A": "0x7558ae09e94e27424f2a02d1fa46ea8284d0c8eb",
"MCD_JOIN_REP_A": "0x91f4e07be74445a3897b6d4e70393b5ad7b8e4b0",
"MCD_FLIP_REP_A": "0x01d7735e4a4cadadb1f1ec5e7fe08f676ec17ed2",
"ZRX": "0x18392097549390502069c17700d21403ea3c721a",
"VAL_ZRX": "0xc010f1bbde279a5bb05c93f5fc902293d5a9f7a9",
"PIP_ZRX": "0xc010f1bbde279a5bb05c93f5fc902293d5a9f7a9",
"MCD_JOIN_ZRX_A": "0x6d10ff4eb87484c55d9fc2907a11ae26fa6c859f",
"MCD_FLIP_ZRX_A": "0x976b340267b77f02b443d9a5ea34681f31796ed6",
"MCD_JOIN_ZRX_A": "0x4a48d3e3ee832575f70efb980c9a62ddce5c263a",
"MCD_FLIP_ZRX_A": "0x5ce206c55d6c13fe9293a947b43a0dcd3e6ef137",
"OMG": "0x441b1a74c69ee6e631834b626b29801d42076d38",
"VAL_OMG": "0x1e9740f61e80650a60ba70f2d0b477fb85db2b03",
"PIP_OMG": "0x1e9740f61e80650a60ba70f2d0b477fb85db2b03",
"MCD_JOIN_OMG_A": "0x46024f1bace6b2e93b622cffc12a4cd43a23aa76",
"MCD_FLIP_OMG_A": "0xcd03d1147d14e06fa31ed5b85eca1e95ccdc6de6",
"MCD_JOIN_OMG_A": "0x606fcf8eb5bbe1dd17d52d853c7d346c594109fe",
"MCD_FLIP_OMG_A": "0xc967ff09e407ec029cb98f42f8e628116407085b",
"BAT": "0x9f8cfb61d3b2af62864408dd703f9c3beb55dff7",
"VAL_BAT": "0x5c40c9eb35c76069fa4c3a00ea59fac6ffa9c113",
"PIP_BAT": "0x5c40c9eb35c76069fa4c3a00ea59fac6ffa9c113",
"MCD_JOIN_BAT_A": "0x277cd249711a5895353d48ae5254271c1004cb0d",
"MCD_FLIP_BAT_A": "0x6a8f77412029523a21cfb35960ebe062418b91b8",
"MCD_JOIN_BAT_A": "0x635716849a7f6ae57211bb2f9564b10551a8f166",
"MCD_FLIP_BAT_A": "0x5bc5be4775eb6c61bff9717e1f35d887fb54142c",
"DGD": "0x62aeec5fb140bb233b1c5612a8747ca1dc56dc1b",
"VAL_DGD": "0x112bf99e873317643fbfcc22d197e3e01b825cb0",
"PIP_DGD": "0x112bf99e873317643fbfcc22d197e3e01b825cb0",
"MCD_JOIN_DGD_A": "0x3689d9885a998ea4615f82000f8491bf773b2642",
"MCD_FLIP_DGD_A": "0xc39447dda044cd02d1a8c2f935e14376ff6276ea",
"MCD_JOIN_DGD_A": "0xf07b0cbe6fad45bb3576de92e063639ad951987f",
"MCD_FLIP_DGD_A": "0x034f2c3e4e8db8f8469493bb38d8885e06f8ab54",
"GNT": "0xc81ba844f451d4452a01bbb2104c1c4f89252907",
"VAL_GNT": "0xf46e96a6f23fdcb5870f0ac0dbe9d2c605485ddc",
"PIP_GNT": "0xf46e96a6f23fdcb5870f0ac0dbe9d2c605485ddc",
"MCD_JOIN_GNT_A": "0x64d1f7e7702f914b0fc13ce56d7a022b2a8449b0",
"MCD_FLIP_GNT_A": "0x3d8b0106e5f28e6611cdfd3940a973e7b7fc6ff7",
"PROXY_PAUSE_ACTIONS": "0xcd958d3cb7d6b394dbdc38259952d79dc2b55cf8",
"PROXY_DEPLOYER": "0x7c3b871d79d3de3c7e80c5e8393bb6477bec3004",
"GOV_POLL_GEN": "0x08acfcb03118b31fd945f9d5bd8cb61581c06b42",
"MCD_JOIN_GNT_A": "0x4e22282bb7304c6c07aa4404b3a9a2f7afe1958a",
"MCD_FLIP_GNT_A": "0xa1a4cc927091a3c9f10e55a161869b3cad58ef1b",
"PROXY_PAUSE_ACTIONS": "0x640457c680d75dae73450a642c41cd178d34ac65",
"PROXY_DEPLOYER": "0x818a81dd914e89a4698869ee54c8e2c056bfda03",
"GOV_POLL_GEN": "0xd247195403963d7b81ff0028d1036d7ed0ed61a3",
"POLL_ID": "0",
"VOTE_YES": "0x4a04b03901feccec8f4d795e2387e54d1a6b6d8d",
"VOTE_NO": "0x0d0a1ddc1103c4c891917a7a6320bc7632cf7724"
"VOTE_YES": "0x6e1c3b0334ef4231dd739d1e0e2f9cf2ec0fdb4a",
"VOTE_NO": "0x80ba5974a57033ccb1a4e6982ae32a255cd24f5f"
}
54 changes: 27 additions & 27 deletions packages/dai-plugin-mcd/contracts/addresses/testnet.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"BAT": "0x927f29f213c691ace67cbc9fdb6ebbfd04d07ec4",
"CDP_MANAGER": "0x6b09a5b5dc17eaa7d0b65ba898f58005a70736b5",
"BAT": "0x666866f71a978f119acec358543c1e72fc27637d",
"CDP_MANAGER": "0xdb8848ea69cce3f7f41949d274899641e558cdf4",
"DEPLOYER": "0x16fb96a5fa0427af0c8f7cf1eb4870231c8154b6",
"DGD": "0xeb9d9336b4a89260bc4b94ee6a34e2faf46b0ca5",
"ETH": "0xc7c5e44358a77f7a8508fe35d5cb21c4a365a3bf",
"DGD": "0x8752bde45da8b2665cd36754a39fd5cc82f0ad05",
"ETH": "0x73bf2607f04822b6859e71457f5d8817aec7f0c3",
"FAUCET": "0x2d3adfca1e6ad360a138cbcf2f286f70a5ff614a",
"GET_CDPS": "0xdb8848ea69cce3f7f41949d274899641e558cdf4",
"GNT": "0x4af6e9fa188161fd283dc8d51619615d00ef3f01",
"GOV_POLL_GEN": "0xe8f0f6067fa52572d6631517e9050c46769bebf3",
"MCD_ADM": "0x0e69131732c7700d5d598350504ba885d677cca8",
"GET_CDPS": "0x2a3a2f87403d675748eb11b6fce92a16a0084eb6",
"GNT": "0xb782cee543f1a9a0724f32731f53dcdd198c2695",
"GOV_POLL_GEN": "0x7861fef0437924c0c5e52d617312b058477db810",
"MCD_ADM": "0x5e6085775cd0b41fc70d1a6b48a0451bf7aca801",
"MCD_CAT": "0x38d4aa5a17d3d15f0a6baa754b11cd3b6e97b8ed",
"MCD_DAI": "0x11c8d156e1b5fd883e31e9091874f2af80b02775",
"MCD_DEPLOY": "0x629ca18b145a870efb230cf89aa626a4b2d3b228",
Expand All @@ -26,19 +26,19 @@
"MCD_FLIP_ZRX_A": "0xd97c629021ee39c94ea89230d4005629a253ca3f",
"MCD_FLOP": "0xf2cba62837a52b0c1847f225438c82d050b4ac19",
"MCD_GOV": "0x174666d4101f6294eba19d0846ec85176d28f2e6",
"MCD_GOV_ACTIONS": "0x7581e647b7b5d522b198ef44f51e1121b3d837b0",
"MCD_GOV_GUARD": "0xe0d81d47ac1e791dd2559013cf1ff005e619d733",
"MCD_IOU": "0xa805669da5d6c3851f383acc03a9a5fc45671c25",
"MCD_JOIN_BAT_A": "0x666866f71a978f119acec358543c1e72fc27637d",
"MCD_GOV_ACTIONS": "0x689e9dc3214ac88f312fdd148684bf199ccf596c",
"MCD_GUARD": "0xe0d81d47ac1e791dd2559013cf1ff005e619d733",
"MCD_IOU": "0xdf3b1a36ff07cccf5e61a60690fc0170e238f499",
"MCD_JOIN_BAT_A": "0xa8119bfc8565ce4640d0512d8656e54369e4cd79",
"MCD_JOIN_DAI": "0x0e88266e5d517d6358ad6adabc15475ea2d277d1",
"MCD_JOIN_DGD_A": "0x8752bde45da8b2665cd36754a39fd5cc82f0ad05",
"MCD_JOIN_ETH_A": "0x73bf2607f04822b6859e71457f5d8817aec7f0c3",
"MCD_JOIN_ETH_B": "0x3ef50e4fe8d6668b701b5f7aaff95e442fd4dd78",
"MCD_JOIN_ETH_C": "0x71ce2f5a1ee392425b749956f9b58481a7c6b707",
"MCD_JOIN_GNT_A": "0xb782cee543f1a9a0724f32731f53dcdd198c2695",
"MCD_JOIN_OMG_A": "0x2a5f3e35aba017435b3c8a66f64da3509a6a71ec",
"MCD_JOIN_REP_A": "0xf2ea44b10d559c7bcbf156861effd3425fb5e5fb",
"MCD_JOIN_ZRX_A": "0xec93d8ea996da9ffe359778f3dae6134df0de016",
"MCD_JOIN_DGD_A": "0x1fd87e7ddf2a2f22ac5fb8f617a44214f17b883c",
"MCD_JOIN_ETH_A": "0x95ca251198d0d56e4acf6b22adc7e7a1f835fcdd",
"MCD_JOIN_ETH_B": "0xf7cbc73fe7d30c68ad7b64d293d4f52f76027261",
"MCD_JOIN_ETH_C": "0x6741a0fecce6ecbf7c1f338de624f63d970497ea",
"MCD_JOIN_GNT_A": "0xa87faa7500099368ba57a3a2f584f5197c05e37f",
"MCD_JOIN_OMG_A": "0x089af8e5dc55271a2ee4ca5d5bd1d8b37482ea19",
"MCD_JOIN_REP_A": "0xe9658d1356890e06987c2d769b7d76caedbcff4b",
"MCD_JOIN_ZRX_A": "0x5ab87e4729bfffe884c40a65c5bef55af105a99e",
"MCD_JUG": "0x6a30d8cfaae0a79472e7e1e038f4a40ac2caff60",
"MCD_PAUSE": "0x55320248dc50ef6dabc88ecbc294fd5e2e1f4ec6",
"MCD_PAUSE_PROXY": "0x439d8e0ad339fdddfa79186b2f3697886d3faa7c",
Expand All @@ -47,7 +47,7 @@
"MCD_VAT": "0xc94d704539002c68ff130efb177d201552bbfa90",
"MCD_VOW": "0x6190cc9b0eff21ed385ac0c43dbb649cebb88b9a",
"MULTICALL": "0x2b2fbfca02f8c29c750ed193828b40887e8bbb32",
"OMG": "0xc677d837a437c24db14e1225416d52bcc9b86e94",
"OMG": "0x2a5f3e35aba017435b3c8a66f64da3509a6a71ec",
"PIP_BAT": "0x26ea0dd33aa37e15d95a9ae166092a139ad62013",
"PIP_DGD": "0xb0ae8c0856259c6fe000f8e2c14507e5fc167d48",
"PIP_ETH": "0x1d24598fa8b77811e68243a2746cc553e68ca03b",
Expand All @@ -56,21 +56,21 @@
"PIP_REP": "0x7e430f637f3b844d09fc7f81e7fbbce520162092",
"PIP_ZRX": "0x9a2810a12197cb844af4ba74a4b81bc1ca727130",
"POLL_ID": "0",
"PROXY_ACTIONS": "0x689e9dc3214ac88f312fdd148684bf199ccf596c",
"PROXY_ACTIONS": "0x6b09a5b5dc17eaa7d0b65ba898f58005a70736b5",
"PROXY_DEPLOYER": "0x0388cb1bd399d61e0516cb15d275c9f324e4b25d",
"PROXY_FACTORY": "0xdd35201726c511474e7e1ee426b5c78b014addcc",
"PROXY_PAUSE_ACTIONS": "0x2a3a2f87403d675748eb11b6fce92a16a0084eb6",
"PROXY_PAUSE_ACTIONS": "0x6c0604d4b3ebb76dba48cc0b5a54bd0f260d962c",
"PROXY_REGISTRY": "0xb564f1dc7d220f8e20de45547de71620543c0053",
"REP": "0x61afcbaddfeefe7155416248cb51511d73b94e42",
"REP": "0xf2ea44b10d559c7bcbf156861effd3425fb5e5fb",
"VAL_BAT": "0x26ea0dd33aa37e15d95a9ae166092a139ad62013",
"VAL_DGD": "0xb0ae8c0856259c6fe000f8e2c14507e5fc167d48",
"VAL_ETH": "0x1d24598fa8b77811e68243a2746cc553e68ca03b",
"VAL_GNT": "0xa7f1b1b3f05f8d5fceb8dacc893570b9e5d82bff",
"VAL_OMG": "0xa9d33ce18803b0742460ffb1b33b6c40f95178bc",
"VAL_REP": "0x7e430f637f3b844d09fc7f81e7fbbce520162092",
"VAL_ZRX": "0x9a2810a12197cb844af4ba74a4b81bc1ca727130",
"VOTE_NO": "0xf1158bdefdceaf29413c4c0c81c8f450f273b976",
"VOTE_NO": "0x68f4649700dc5435d9a55d72612fee55bc0a0869",
"VOTE_PROXY_FACTORY": "0x883c76966ea1d1afec54a1c20f84a57a287bb021",
"VOTE_YES": "0x22acb4ed65bc2617437c54b8d976592c2990ab2d",
"ZRX": "0xdc901a38a2ec3283556f039b115423049517b50c"
"VOTE_YES": "0x78e7a21580d12ade6aaea24ee8991e55c286f366",
"ZRX": "0xec93d8ea996da9ffe359778f3dae6134df0de016"
}
64 changes: 27 additions & 37 deletions packages/dai-plugin-mcd/src/CdpManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,13 @@ export default class CdpManager extends LocalService {
);
drawAmount = castAsCurrency(drawAmount, MDAI);
const proxyAddress = await this.get('proxy').ensureProxy({ promise });
await setupGnt(lockAmount, proxyAddress, this);
const jugAddress = this.get('smartContract').getContractAddress('MCD_JUG');
const isEth = ETH.isInstance(lockAmount);
const method = setMethod(isEth, id);
const isGnt = GNT.isInstance(lockAmount);
const method = setMethod(isEth, isGnt, id);
const args = [
this._managerAddress,
jugAddress,
this._adapterAddress(ilk),
this._adapterAddress('DAI'),
id || stringToBytes(ilk),
Expand All @@ -140,18 +142,27 @@ export default class CdpManager extends LocalService {
}
].filter(x => x);

// If opening a new GNT CDP, GNT must first be transferred
// to the proxy (so it can be transferred to the new bag)
if (method === 'openLockGNTAndDraw')
await this.get('token')
.getToken('GNT')
.transfer(proxyAddress, lockAmount);
// Transfers to bag if locking GNT in existing CDP
if (id && isGnt) await transferToBag(lockAmount, proxyAddress, this);
// Indicates if gem supports transferFrom
if (!isEth) args.splice(-1, 0, !GNT.isInstance(lockAmount));
if (!isEth && method !== 'openLockGNTAndDraw')
args.splice(-1, 0, !GNT.isInstance(lockAmount));

return await this.proxyActions[method](...args);
}

@tracksTransactions
async lock(id, ilk, lockAmount, { promise }) {
const proxyAddress = await this.get('proxy').ensureProxy({ promise });
await setupGnt(lockAmount, proxyAddress, this);
const isEth = ETH.isInstance(lockAmount);
const method = `lock${isEth ? 'ETH' : 'Gem'}`;
const isGnt = GNT.isInstance(lockAmount);
const method = `safeLock${isEth ? 'ETH' : 'Gem'}`;
const args = [
this._managerAddress,
this._adapterAddress(ilk),
Expand All @@ -164,6 +175,8 @@ export default class CdpManager extends LocalService {
}
].filter(x => x);

// Transfers to bag if locking GNT in existing CDP
if (id && isGnt) await transferToBag(lockAmount, proxyAddress, this);
// Indicates if gem supports transferFrom
if (!isEth) args.splice(-1, 0, !GNT.isInstance(lockAmount));

Expand All @@ -189,7 +202,7 @@ export default class CdpManager extends LocalService {

@tracksTransactions
async wipe(id, wipeAmount, { promise }) {
return this.proxyActions.wipe(
return this.proxyActions.safeWipe(
...[
this._managerAddress,
this._adapterAddress('DAI'),
Expand Down Expand Up @@ -297,48 +310,25 @@ export default class CdpManager extends LocalService {
}
}

export function setMethod(isEth, id) {
export function setMethod(isEth, isGnt, id) {
if (id && isEth) {
return 'lockETHAndDraw';
} else if (isEth) {
return 'openLockETHAndDraw';
} else if (!id && isGnt) {
return 'openLockGNTAndDraw';
} else if (id) {
return 'lockGemAndDraw(address,address,address,uint256,uint256,uint256,bool)';
return 'lockGemAndDraw';
}
return 'openLockGemAndDraw';
}

// The following functions are only required for GNT
export async function setupGnt(lockAmount, proxyAddress, cdpMgr) {
if (GNT.isInstance(lockAmount)) {
await transferToBag(lockAmount, proxyAddress, cdpMgr);
}
}

export async function transferToBag(lockAmount, proxyAddress, cdpMgr) {
const gntToken = cdpMgr.get('token').getToken(GNT);
const bagAddress = await ensureBag(proxyAddress, cdpMgr);
const gntAdapter = cdpMgr
.get('smartContract')
.getContractByName('MCD_JOIN_GNT_A');
const bagAddress = await gntAdapter.bags(proxyAddress);

return gntToken.transfer(bagAddress, lockAmount);
}

export async function ensureBag(proxyAddress, cdpMgr) {
const gntAdapter = cdpMgr.get('smartContract').getContract('MCD_JOIN_GNT_A');

let bagAddress = await getBagAddress(proxyAddress, gntAdapter);
if (!bagAddress) {
await gntAdapter.make(proxyAddress);
bagAddress = await getBagAddress(proxyAddress, gntAdapter);
}

return bagAddress;
}

export async function getBagAddress(proxyAddress, gntAdapter) {
let bagAddress = await gntAdapter.bags(proxyAddress);
if (bagAddress === '0x0000000000000000000000000000000000000000') {
bagAddress = null;
}

return bagAddress;
}
Loading

0 comments on commit b112f91

Please sign in to comment.