diff --git a/package.json b/package.json index 68320e597..c861c24ae 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,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.16", + "@makerdao/testchain": "^0.2.16-1", "babel-eslint": "^10.0.1", "babel-jest": "^24.8.0", "babel-loader": "^8.0.5", diff --git a/packages/dai-plugin-mcd/contracts/addresses/testnet.json b/packages/dai-plugin-mcd/contracts/addresses/testnet.json index 10d6ca05d..bcd2662a5 100644 --- a/packages/dai-plugin-mcd/contracts/addresses/testnet.json +++ b/packages/dai-plugin-mcd/contracts/addresses/testnet.json @@ -2,13 +2,11 @@ "BAT": "0x666866f71a978f119acec358543c1e72fc27637d", "CDP_MANAGER": "0x77d6250c22ecba016a4f6d1a917bf5b2ed0704c5", "DEPLOYER": "0x16fb96a5fa0427af0c8f7cf1eb4870231c8154b6", - "DGD": "0x8752bde45da8b2665cd36754a39fd5cc82f0ad05", "ETH": "0x7ba25f791fa76c3ef40ac98ed42634a8bc24c238", "FAUCET": "0x2d3adfca1e6ad360a138cbcf2f286f70a5ff614a", "GET_CDPS": "0x8a339ada3b96d6139bbdce3bd0375725fc411133", - "GNT": "0xb782cee543f1a9a0724f32731f53dcdd198c2695", "GOV_GUARD": "0xf584b166fba89c72c8f23d49224d304f6705f879", - "MCD_ADM": "0x28dd44319c5a159f06ab5c5ee781760ee3200848", + "MCD_ADM": "0x1ed553ff89645fcdd55409ae02462f1239f92511", "MCD_CAT": "0x6190cc9b0eff21ed385ac0c43dbb649cebb88b9a", "MCD_DAI": "0x38d4aa5a17d3d15f0a6baa754b11cd3b6e97b8ed", "MCD_DEPLOY": "0x629ca18b145a870efb230cf89aa626a4b2d3b228", @@ -16,30 +14,16 @@ "MCD_ESM": "0x88015f50fb5b2bb1abf8a9c3e1db231e267b5c4f", "MCD_FLAP": "0x0e88266e5d517d6358ad6adabc15475ea2d277d1", "MCD_FLIP_BAT_A": "0x5ca712b68e99af30839fd002043e9fd482407162", - "MCD_FLIP_DGD_A": "0x2f7510ce3b12f8bdd7079e333ed9868727de1640", "MCD_FLIP_ETH_A": "0xf2cba62837a52b0c1847f225438c82d050b4ac19", - "MCD_FLIP_ETH_B": "0x5f11a0150a8941fa3aa64a91f734e1b0b249e7bf", - "MCD_FLIP_ETH_C": "0xaddcb0327b22c13fd36ebf4d289a22a8d82beb9d", - "MCD_FLIP_GNT_A": "0xa61db4400f514004b32920b7dc5586b4e5fa7725", - "MCD_FLIP_OMG_A": "0xf52320d012889828f3b62d8d235aebd5f9109766", - "MCD_FLIP_REP_A": "0x48d6c0b14edc177360afbbb360436a3b9d83a866", "MCD_FLIP_SAI": "0x7138ae30a42de812be5f394c899d8bbe55f0ffab", - "MCD_FLIP_ZRX_A": "0x829feff316aabafdf9280d635b516c448cba736e", "MCD_FLOP": "0xedf775290396cb081b6b3a6d1e4edbb8e2ce3109", "MCD_GOV": "0x174666d4101f6294eba19d0846ec85176d28f2e6", - "MCD_GOV_ACTIONS": "0xe1131fbff225ffc0ebdc4233852fdc415e4d2b6b", - "MCD_IOU": "0x392e4ff172e6d88c3375de218f6e7e2fa75d3c82", + "MCD_GOV_ACTIONS": "0x493226477349795d74e106eed6a2b6a5d437edab", + "MCD_IOU": "0x2cc9a419cec33e7906c6a37988e861ea1bddd1c2", "MCD_JOIN_BAT_A": "0xa8119bfc8565ce4640d0512d8656e54369e4cd79", "MCD_JOIN_DAI": "0x11c8d156e1b5fd883e31e9091874f2af80b02775", - "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_SAI": "0xcf4a441593fbf1bf56960674c5a3a18049c7bbe2", - "MCD_JOIN_ZRX_A": "0x5ab87e4729bfffe884c40a65c5bef55af105a99e", + "MCD_JOIN_SAI": "0x2bb387c549c61e7fce9ddcc9ca19980d696643a4", "MCD_JUG": "0xc94d704539002c68ff130efb177d201552bbfa90", "MCD_PAUSE": "0x55320248dc50ef6dabc88ecbc294fd5e2e1f4ec6", "MCD_PAUSE_PROXY": "0x439d8e0ad339fdddfa79186b2f3697886d3faa7c", @@ -47,26 +31,19 @@ "MCD_SPOT": "0x8d68d36d45a34a6ff368069bd0baa32ad49a6092", "MCD_VAT": "0x1b71b5a6e59840fa1a11f1cb92cdadfcf70fa5c8", "MCD_VOW": "0x6a30d8cfaae0a79472e7e1e038f4a40ac2caff60", - "MIGRATION": "0x689e9dc3214ac88f312fdd148684bf199ccf596c", - "MIGRATION_PROXY_ACTIONS": "0xd324bc539b85e6dfe08005c4d261d0ff22b0a34c", + "MIGRATION": "0x23c9aafe0d1968eac6d9f1edb9fa831641783fed", + "MIGRATION_PROXY_ACTIONS": "0xdb8848ea69cce3f7f41949d274899641e558cdf4", "MULTICALL": "0x2b2fbfca02f8c29c750ed193828b40887e8bbb32", - "OMG": "0x2a5f3e35aba017435b3c8a66f64da3509a6a71ec", "PIP_BAT": "0x26ea0dd33aa37e15d95a9ae166092a139ad62013", - "PIP_DGD": "0xb0ae8c0856259c6fe000f8e2c14507e5fc167d48", "PIP_ETH": "0x1d24598fa8b77811e68243a2746cc553e68ca03b", - "PIP_GNT": "0xa7f1b1b3f05f8d5fceb8dacc893570b9e5d82bff", - "PIP_OMG": "0xa9d33ce18803b0742460ffb1b33b6c40f95178bc", - "PIP_REP": "0x7e430f637f3b844d09fc7f81e7fbbce520162092", - "PIP_SAI": "0x2bb387c549c61e7fce9ddcc9ca19980d696643a4", - "PIP_ZRX": "0x9a2810a12197cb844af4ba74a4b81bc1ca727130", + "PIP_SAI": "0x0000000000000000000000000000000000000000", "PROXY_ACTIONS": "0xa5dd0e5906fac83862581c5dca85cf926abfa09b", "PROXY_ACTIONS_DSR": "0xda4ebe73ff9e11fc6f97cef200199ddb385d7982", "PROXY_ACTIONS_END": "0x0e8d43bd507798476c1053165f9c061f1e000a09", "PROXY_DEPLOYER": "0x06dcc6fa0b1173fe95e6b94412ea3d2ba9b2c849", "PROXY_FACTORY": "0xe0d81d47ac1e791dd2559013cf1ff005e619d733", - "PROXY_PAUSE_ACTIONS": "0x2cc9a419cec33e7906c6a37988e861ea1bddd1c2", + "PROXY_PAUSE_ACTIONS": "0x4165855523c21df91814040f8f01f2f33905139d", "PROXY_REGISTRY": "0xdd35201726c511474e7e1ee426b5c78b014addcc", - "REP": "0xf2ea44b10d559c7bcbf156861effd3425fb5e5fb", "SAI": "0xc226f3cd13d508bc319f4f4290172748199d6612", "SAI_TUB": "0xe82ce3d6bf40f2f9414c8d01a35e3d9eb16a1761", "VAL_BAT": "0x26ea0dd33aa37e15d95a9ae166092a139ad62013", @@ -76,6 +53,5 @@ "VAL_OMG": "0xa9d33ce18803b0742460ffb1b33b6c40f95178bc", "VAL_REP": "0x7e430f637f3b844d09fc7f81e7fbbce520162092", "VAL_ZRX": "0x9a2810a12197cb844af4ba74a4b81bc1ca727130", - "VOTE_PROXY_FACTORY": "0xf95a6b6740f8fcbb25eb49bc0176c2b4581fdb73", - "ZRX": "0xec93d8ea996da9ffe359778f3dae6134df0de016" + "VOTE_PROXY_FACTORY": "0x392e4ff172e6d88c3375de218f6e7e2fa75d3c82" } diff --git a/packages/dai-plugin-mcd/src/index.js b/packages/dai-plugin-mcd/src/index.js index 10d4d5134..e7a5bb501 100644 --- a/packages/dai-plugin-mcd/src/index.js +++ b/packages/dai-plugin-mcd/src/index.js @@ -75,8 +75,6 @@ export const GNT = createCurrency('GNT'); const defaultCdpTypes = [ { currency: ETH, ilk: 'ETH-A' }, - { currency: ETH, ilk: 'ETH-B' }, - { currency: ZRX, ilk: 'ZRX-A' }, { currency: BAT, ilk: 'BAT-A' } ]; diff --git a/packages/dai-plugin-mcd/test/CdpManager.spec.js b/packages/dai-plugin-mcd/test/CdpManager.spec.js index 8ca514cd5..3e01454e2 100644 --- a/packages/dai-plugin-mcd/test/CdpManager.spec.js +++ b/packages/dai-plugin-mcd/test/CdpManager.spec.js @@ -2,7 +2,7 @@ import findIndex from 'lodash/findIndex'; import { mcdMaker, setupCollateral } from './helpers'; import { setMethod, transferToBag } from '../src/CdpManager'; import { ServiceRoles } from '../src/constants'; -import { ETH, MDAI, GNT, DGD } from '../src'; +import { ETH, MDAI, GNT, DGD, BAT } from '../src'; import { dummyEventData, formattedDummyEventData } from './fixtures'; import { takeSnapshot, restoreSnapshot } from '@makerdao/test-helpers'; @@ -14,9 +14,10 @@ beforeAll(async () => { maker = await mcdMaker({ cdpTypes: [ { currency: ETH, ilk: 'ETH-A' }, - { currency: ETH, ilk: 'ETH-B' }, - { currency: DGD, ilk: 'DGD-A', decimals: 9 }, - { currency: GNT, ilk: 'GNT-A' } + { currency: BAT, ilk: 'BAT-A' } + // { currency: ETH, ilk: 'ETH-B' }, + // { currency: DGD, ilk: 'DGD-A', decimals: 9 }, + // { currency: GNT, ilk: 'GNT-A' } ] }); cdpMgr = maker.service(ServiceRoles.CDP_MANAGER); @@ -37,7 +38,7 @@ test('getCdpIds gets empty CDP data from a proxy', async () => { test('getCdpIds gets all CDP data from the proxy', async () => { const cdp1 = await cdpMgr.open('ETH-A'); - const cdp2 = await cdpMgr.open('ETH-B'); + const cdp2 = await cdpMgr.open('BAT-A'); cdpMgr.reset(); const currentProxy = await maker.currentProxy(); const cdps = await cdpMgr.getCdpIds(currentProxy); @@ -110,7 +111,7 @@ test('transaction tracking for openLockAndDraw', async () => { expect(handlers.mined).toBeCalled(); }); -test('set precision arguments according to decimals', () => { +xtest('set precision arguments according to decimals', () => { expect(cdpMgr._precision(ETH(1))).toBe('wei'); expect(cdpMgr._precision(GNT(1))).toBe(18); expect(cdpMgr._precision(DGD(1))).toBe(9); @@ -124,7 +125,7 @@ test('set method correctly', () => { expect(setMethod(false, true)).toBe('openLockGNTAndDraw'); }); -test('transferToBag for GNT CDPs', async () => { +xtest('transferToBag for GNT CDPs', async () => { const gntToken = maker.service('token').getToken(GNT); const proxyAddress = await maker.service('proxy').currentProxy(); const bagAddress = await maker diff --git a/packages/dai-plugin-mcd/test/CdpType.spec.js b/packages/dai-plugin-mcd/test/CdpType.spec.js index ce8582775..7d0a9a595 100644 --- a/packages/dai-plugin-mcd/test/CdpType.spec.js +++ b/packages/dai-plugin-mcd/test/CdpType.spec.js @@ -14,7 +14,7 @@ beforeAll(async () => { // these CDP types should be available to the Maker instance because // of the configuration passed into it (see test/helpers.js) -const scenarios = [['ETH-A', ETH], ['ETH-B', ETH], ['BAT-A', BAT]]; +const scenarios = [['ETH-A', ETH], ['BAT-A', BAT]]; /* The following arrays are expected values for each tested @@ -24,7 +24,7 @@ const scenarios = [['ETH-A', ETH], ['ETH-B', ETH], ['BAT-A', BAT]]; */ const systemValues = { 'ETH-A': [2, 4, 100000, 1.5, 0.05, '5.0'], - 'ETH-B': [2, 4, 100000, 2, 0.05, '4.0'], + // 'ETH-B': [2, 4, 100000, 2, 0.05, '4.0'], 'BAT-A': [2, 4, 5000, 2, 0.08, '10.5'] }; @@ -106,11 +106,11 @@ describe.each(scenarios)('%s', (ilk, GEM) => { }); test('get system-wide debt', () => { - expect(service.totalDebtAllCdpTypes.toNumber()).toBeCloseTo(12); + expect(service.totalDebtAllCdpTypes.toNumber()).toBeCloseTo(8); }); test('get system-wide collateral value', () => { - expect(service.totalCollateralValueAllCdpTypes.toNumber()).toBeCloseTo(60); + expect(service.totalCollateralValueAllCdpTypes.toNumber()).toBeCloseTo(40); }); test('get system-wide collateralization ratio', async () => { diff --git a/packages/dai-plugin-mcd/test/CdpTypeService.spec.js b/packages/dai-plugin-mcd/test/CdpTypeService.spec.js index d675fae95..1d86ec8ee 100644 --- a/packages/dai-plugin-mcd/test/CdpTypeService.spec.js +++ b/packages/dai-plugin-mcd/test/CdpTypeService.spec.js @@ -15,7 +15,7 @@ test('getCdpType with no matches throws an error', () => { }).toThrowError(/matches no cdp type/); }); -test('getCdpType with too many matches throws an error', () => { +xtest('getCdpType with too many matches throws an error', () => { expect(() => { service.getCdpType(ETH); }).toThrowError(/matches more than one cdp type/); diff --git a/packages/dai-plugin-mcd/test/ManagedCdp.spec.js b/packages/dai-plugin-mcd/test/ManagedCdp.spec.js index 4b14e4d13..69c77519b 100644 --- a/packages/dai-plugin-mcd/test/ManagedCdp.spec.js +++ b/packages/dai-plugin-mcd/test/ManagedCdp.spec.js @@ -1,6 +1,6 @@ import { takeSnapshot, restoreSnapshot } from '@makerdao/test-helpers'; import { mcdMaker, setupCollateral } from './helpers'; -import { ETH, REP, MDAI, USD, GNT, OMG, DGD } from '../src'; +import { ETH, REP, MDAI, USD, GNT, OMG, DGD, BAT } from '../src'; import { ServiceRoles } from '../src/constants'; import { dummyEventData, formattedDummyEventData } from './fixtures'; import { createCurrencyRatio } from '@makerdao/currency'; @@ -13,10 +13,11 @@ beforeAll(async () => { maker = await mcdMaker({ cdpTypes: [ { currency: ETH, ilk: 'ETH-A' }, - { currency: REP, ilk: 'REP-A' }, - { currency: OMG, ilk: 'OMG-A' }, - { currency: DGD, ilk: 'DGD-A', decimals: 9 }, - { currency: GNT, ilk: 'GNT-A' } + { currency: BAT, ilk: 'BAT-A' } + // { currency: REP, ilk: 'REP-A' }, + // { currency: OMG, ilk: 'OMG-A' }, + // { currency: DGD, ilk: 'DGD-A', decimals: 9 }, + // { currency: GNT, ilk: 'GNT-A' } ] }); dai = maker.getToken(MDAI); @@ -32,29 +33,29 @@ afterAll(async () => { }); test('prevent locking the wrong collateral type', async () => { - const cdp = await maker.service(CDP_MANAGER).open('REP-A'); + const cdp = await maker.service(CDP_MANAGER).open('BAT-A'); expect.assertions(1); try { await cdp.lockCollateral(ETH(1)); } catch (err) { - expect(err.message).toMatch(/Can't cast 1.00 ETH as REP/); + expect(err.message).toMatch(/Can't cast 1.00 ETH as BAT/); } }); test('prevent freeing the wrong collateral type', async () => { - const cdp = await maker.service(CDP_MANAGER).open('REP-A'); + const cdp = await maker.service(CDP_MANAGER).open('BAT-A'); expect.assertions(1); try { await cdp.freeCollateral(ETH(1)); } catch (err) { - expect(err.message).toMatch(/Can't cast 1.00 ETH as REP/); + expect(err.message).toMatch(/Can't cast 1.00 ETH as BAT/); } }); test('liquidationPrice and collateralizationRatio are infinite with 0 collateral and 0 debt', async () => { - const cdp = await maker.service(CDP_MANAGER).open('REP-A'); + const cdp = await maker.service(CDP_MANAGER).open('BAT-A'); await cdp.prefetch(); - const ratio = createCurrencyRatio(USD, REP); + const ratio = createCurrencyRatio(USD, BAT); const ratio2 = createCurrencyRatio(USD, MDAI); expect(cdp.liquidationPrice).toEqual(ratio(Infinity)); expect(cdp.collateralizationRatio).toEqual(ratio2(Infinity)); @@ -127,27 +128,27 @@ describe.each([ 'ETH-A', ETH, async () => setupCollateral(maker, 'ETH-A', { price: 150, debtCeiling: 50 }) - ], - [ - 'REP-A', - REP, - async () => setupCollateral(maker, 'REP-A', { price: 100, debtCeiling: 50 }) - ], - [ - 'GNT-A', - GNT, - async () => setupCollateral(maker, 'GNT-A', { price: 100, debtCeiling: 50 }) - ], - [ - 'OMG-A', - OMG, - async () => setupCollateral(maker, 'OMG-A', { price: 100, debtCeiling: 50 }) - ], - [ - 'DGD-A', - DGD, - async () => setupCollateral(maker, 'DGD-A', { price: 100, debtCeiling: 50 }) ] + // [ + // 'REP-A', + // REP, + // async () => setupCollateral(maker, 'REP-A', { price: 100, debtCeiling: 50 }) + // ], + // [ + // 'GNT-A', + // GNT, + // async () => setupCollateral(maker, 'GNT-A', { price: 100, debtCeiling: 50 }) + // ], + // [ + // 'OMG-A', + // OMG, + // async () => setupCollateral(maker, 'OMG-A', { price: 100, debtCeiling: 50 }) + // ], + // [ + // 'DGD-A', + // DGD, + // async () => setupCollateral(maker, 'DGD-A', { price: 100, debtCeiling: 50 }) + // ] ])('%s', (ilk, GEM, setup) => { let startingGemBalance, startingDaiBalance; diff --git a/packages/dai-plugin-migrations/contracts/addresses/testnet.json b/packages/dai-plugin-migrations/contracts/addresses/testnet.json index 0fefa0726..a2d465fa0 100644 --- a/packages/dai-plugin-migrations/contracts/addresses/testnet.json +++ b/packages/dai-plugin-migrations/contracts/addresses/testnet.json @@ -8,6 +8,6 @@ "MCD_POT_1": "0x8c4be23de45f82a4fec7a93f69929bd2a13a4777", "REDEEMER": "0x2daf1c09275b0b72277909377eb20ccf10efa02e", "OLD_MKR": "0xa3bfc24194007416fa73fc6e3a7d3b245f647d6e", - "MIGRATION": "0x689e9dc3214ac88f312fdd148684bf199ccf596c", - "MIGRATION_PROXY_ACTIONS": "0xd324bc539b85e6dfe08005c4d261d0ff22b0a34c" + "MIGRATION": "0x23c9aafe0d1968eac6d9f1edb9fa831641783fed", + "MIGRATION_PROXY_ACTIONS": "0xdb8848ea69cce3f7f41949d274899641e558cdf4" } diff --git a/packages/dai-plugin-migrations/src/migrations/SaiToDai.js b/packages/dai-plugin-migrations/src/migrations/SaiToDai.js index 9f7880a60..614c06789 100644 --- a/packages/dai-plugin-migrations/src/migrations/SaiToDai.js +++ b/packages/dai-plugin-migrations/src/migrations/SaiToDai.js @@ -23,9 +23,6 @@ export default class SaiToDai { address, migrationContract.address ); - console.log(allowance.toNumber()); - console.log(formattedAmount * 1.5); - console.log(migrationContract.address); if (allowance.toNumber() < amount) { await this._sai.approve(migrationContract.address, formattedAmount, { promise diff --git a/packages/dai-plugin-migrations/test/kovan/kovan.test.js b/packages/dai-plugin-migrations/test/kovan/kovan.test.js index 945f8ae5a..500a4a0ba 100644 --- a/packages/dai-plugin-migrations/test/kovan/kovan.test.js +++ b/packages/dai-plugin-migrations/test/kovan/kovan.test.js @@ -41,7 +41,7 @@ async function openLockAndDrawScdCdp(drawAmount, maker) { return cdp; } -test('kovan', async () => { +xtest('kovan', async () => { const maker = await mcdMaker(); const sai = maker.getToken(SAI); const mkr = maker.getToken(MKR); diff --git a/packages/dai-plugin-migrations/test/migrations/SaiToDai.spec.js b/packages/dai-plugin-migrations/test/migrations/SaiToDai.spec.js index 367dfd1d8..fd6efaef0 100644 --- a/packages/dai-plugin-migrations/test/migrations/SaiToDai.spec.js +++ b/packages/dai-plugin-migrations/test/migrations/SaiToDai.spec.js @@ -48,7 +48,6 @@ describe('SDai to MDai Migration', () => { .service('token') .getToken('MDAI') .balanceOf(address); - console.log(saiBalanceBeforeMigration); await migration.execute(1); diff --git a/yarn.lock b/yarn.lock index c80e54c26..8a430c3c0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1701,10 +1701,10 @@ js-sha3 "^0.8.0" lodash "^4.17.11" -"@makerdao/testchain@^0.2.16": - version "0.2.16" - resolved "https://registry.yarnpkg.com/@makerdao/testchain/-/testchain-0.2.16.tgz#7b93c3170c542035751f184bebe091a370af266b" - integrity sha512-PyYcjphbN4Cy2qSJ1MAyFAG3LUH/pKiIwFHgaoJ5jYv/1uQo+dt83hWwjdhU/f5op/QgSQcKEgb5KZ7LjNw1oA== +"@makerdao/testchain@^0.2.16-1": + version "0.2.16-1" + resolved "https://registry.yarnpkg.com/@makerdao/testchain/-/testchain-0.2.16-1.tgz#35fe04591cf40691f5dacdca96d455bab9b3f637" + integrity sha512-sPWvIeasOauPHqB1DnpQ2/P8ZR6GVvIYZcutQiDcVXQj3iIwEpZZH47eBeqsMze2MnbGFFWFjHOwO8sCiGqt2Q== dependencies: ganache-cli makerdao/ganache-cli#fix/gas-est-crash