diff --git a/packages/dai-plugin-mcd/contracts/abiMap.js b/packages/dai-plugin-mcd/contracts/abiMap.js new file mode 100644 index 000000000..005ff3b43 --- /dev/null +++ b/packages/dai-plugin-mcd/contracts/abiMap.js @@ -0,0 +1,44 @@ +// not run through babel, so we must use an ES5-safe export +module.exports = { + REP: require('./abis/REP.json'), + ZRX: require('./abis/ZRX.json'), + OMG: require('./abis/OMG.json'), + BAT: require('./abis/BAT.json'), + DGD: require('./abis/DGD.json'), + GNT: require('./abis/GNT.json'), + SAI: require('./abis/DSToken.json'), + CDP_MANAGER: require('./abis/DssCdpManager.json'), + ETH: require('./abis/WETH9_.json'), + GET_CDPS: require('./abis/GetCdps.json'), + MCD_ADM: require('./abis/DSRoles.json'), + MCD_CAT: require('./abis/Cat.json'), + MCD_DAI: require('./abis/DSToken.json'), + MCD_DAI_GUARD: require('./abis/DSGuard.json'), + MCD_DEPLOY: require('./abis/DssDeploy.json'), + MCD_FLAP: require('./abis/Flapper.json'), + 'MCD_FLIP_*': require('./abis/Flipper.json'), + MCD_FLOP: require('./abis/Flopper.json'), + MCD_GOV: require('./abis/DSToken.json'), + 'MCD_JOIN_*': require('./abis/GemJoin.json'), + MCD_JOIN_OMG_A: require('./abis/GemJoin2.json'), + MCD_JOIN_DGD_A: require('./abis/GemJoin2.json'), + MCD_JOIN_GNT_A: require('./abis/GemJoin4.json'), + MCD_JOIN_DAI: require('./abis/DaiJoin.json'), + MCD_JUG: require('./abis/Jug.json'), + MCD_END: require('./abis/End.json'), + MCD_ESM: require('./abis/ESM.json'), + MCD_PAUSE: require('./abis/DSPause.json'), + MCD_PAUSE_PROXY: require('./abis/Plan.json'), + MCD_POT: require('./abis/Pot.json'), + MCD_SPOT: require('./abis/Spotter.json'), + MCD_VAT: require('./abis/Vat.json'), + MCD_VOW: require('./abis/Vow.json'), + MULTICALL: require('./abis/MultiCall.json'), + 'PIP_*': require('./abis/DSValue.json'), + PROXY_ACTIONS: require('./abis/DssProxyActions.json'), + PROXY_ACTIONS_DSR: require('./abis/DssProxyActionsDsr.json'), + MIGRATION: require('./abis/ScdMcdMigration.json'), + MIGRATION_PROXY_ACTIONS: require('./abis/MigrationProxyActions.json'), + USDC: require('./abis/USDC.json'), + WBTC: require('./abis/WBTC.json') +}; diff --git a/packages/dai-plugin-mcd/contracts/abiMap.json b/packages/dai-plugin-mcd/contracts/abiMap.json deleted file mode 100644 index 746c922ee..000000000 --- a/packages/dai-plugin-mcd/contracts/abiMap.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "REP": "REP", - "ZRX": "ZRX", - "OMG": "OMG", - "BAT": "BAT", - "DGD": "DGD", - "GNT": "GNT", - "SAI": "DSToken", - "CDP_MANAGER": "DssCdpManager", - "ETH": "WETH9_", - "GET_CDPS": "GetCdps", - "MCD_ADM": "DSRoles", - "MCD_CAT": "Cat", - "MCD_DAI": "DSToken", - "MCD_DAI_GUARD": "DSGuard", - "MCD_DEPLOY": "DssDeploy", - "MCD_FLAP": "Flapper", - "MCD_FLIP_*": "Flipper", - "MCD_FLOP": "Flopper", - "MCD_GOV": "DSToken", - "MCD_JOIN_*": "GemJoin", - "MCD_JOIN_OMG_A": "GemJoin2", - "MCD_JOIN_DGD_A": "GemJoin2", - "MCD_JOIN_GNT_A": "GemJoin4", - "MCD_JOIN_DAI": "DaiJoin", - "MCD_JUG": "Jug", - "MCD_END": "End", - "MCD_ESM": "ESM", - "MCD_MOVE_*": "GemMove", - "MCD_MOVE_DAI": "DaiMove", - "MCD_PAUSE": "DSPause", - "MCD_PAUSE_PROXY": "Plan", - "MCD_POT": "Pot", - "MCD_SPOT": "Spotter", - "MCD_VAT": "Vat", - "MCD_VOW": "Vow", - "MULTICALL": "MultiCall", - "PIP_*": "DSValue", - "PROXY_ACTIONS": "DssProxyActions", - "PROXY_ACTIONS_DSR": "DssProxyActionsDsr", - "MIGRATION": "ScdMcdMigration", - "MIGRATION_PROXY_ACTIONS": "MigrationProxyActions", - "USDC": "USDC", - "WBTC": "WBTC" -} diff --git a/packages/dai-plugin-mcd/src/index.js b/packages/dai-plugin-mcd/src/index.js index 8f6851dde..8bd19e32e 100644 --- a/packages/dai-plugin-mcd/src/index.js +++ b/packages/dai-plugin-mcd/src/index.js @@ -6,7 +6,7 @@ import { createCurrency, createCurrencyRatio } from '@makerdao/currency'; import testnetAddresses from '../contracts/addresses/testnet.json'; import kovanAddresses from '../contracts/addresses/kovan.json'; import mainnetAddresses from '../contracts/addresses/mainnet.json'; -import abiMap from '../contracts/abiMap.json'; +import abiMap from '../contracts/abiMap'; import CdpManager from './CdpManager'; import SavingsService from './SavingsService'; import CdpTypeService from './CdpTypeService'; @@ -26,18 +26,18 @@ const { CDP_MANAGER, CDP_TYPE, SYSTEM_DATA, AUCTION, SAVINGS } = ServiceRoles; let addContracts = reduce( testnetAddresses, (result, testnetAddress, name) => { - let abiName = abiMap[name]; - if (!abiName) { + let abi = abiMap[name]; + if (!abi) { const prefix = Object.keys(abiMap).find( k => k.substring(k.length - 1) == '*' && k.substring(0, k.length - 1) == name.substring(0, k.length - 1) ); - if (prefix) abiName = abiMap[prefix]; + if (prefix) abi = abiMap[prefix]; } - if (abiName) { + if (abi) { result[name] = { - abi: require(`../contracts/abis/${abiName}.json`), + abi, address: { testnet: testnetAddress, kovan: kovanAddresses[name], diff --git a/packages/dai-plugin-migrations/contracts/abiMap.js b/packages/dai-plugin-migrations/contracts/abiMap.js new file mode 100644 index 000000000..77deb90f8 --- /dev/null +++ b/packages/dai-plugin-migrations/contracts/abiMap.js @@ -0,0 +1,26 @@ +// not run through babel, so we must use an ES5-safe export +module.exports = { + TUB: require('./abis/SaiTub.json'), + MCD_END_1: require('./abis/End.json'), + MCD_VAT_1: require('./abis/Vat.json'), + GET_CDPS_1: require('./abis/GetCdps.json'), + CDP_MANAGER_1: require('./abis/DssCdpManager.json'), + MCD_DAI_1: require('./abis/Dai.json'), + MCD_POT_1: require('./abis/Pot.json'), + MCD_END: require('./abis/End.json'), + MCD_VAT: require('./abis/Vat.json'), + GET_CDPS: require('./abis/GetCdps.json'), + CDP_MANAGER: require('./abis/DssCdpManager.json'), + MCD_DAI: require('./abis/Dai.json'), + MCD_POT: require('./abis/Pot.json'), + REDEEMER: require('./abis/Redeemer.json'), + MIGRATION: require('./abis/ScdMcdMigration.json'), + MIGRATION_PROXY_ACTIONS: require('./abis/MigrationProxyActions.json'), + OLD_CHIEF: require('./abis/DSChief.json'), + OLD_VOTE_PROXY_FACTORY: require('./abis/VoteProxyFactory.json'), + OLD_MKR: require('./abis/DSToken.json'), + 'MCD_JOIN_*': require('./abis/GemJoin.json'), + PROXY_ACTIONS_END: require('./abis/DssProxyActionsEnd.json'), + SAI_CAGEFREE: require('./abis/CageFree.json'), + MCD_ESM: require('./abis/ESM.json') +}; diff --git a/packages/dai-plugin-migrations/contracts/abiMap.json b/packages/dai-plugin-migrations/contracts/abiMap.json deleted file mode 100644 index 9719c3979..000000000 --- a/packages/dai-plugin-migrations/contracts/abiMap.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "TUB": "SaiTub", - "MCD_END_1": "End", - "MCD_VAT_1": "Vat", - "GET_CDPS_1": "GetCdps", - "CDP_MANAGER_1": "DssCdpManager", - "MCD_DAI_1": "Dai", - "MCD_POT_1": "Pot", - "MCD_END": "End", - "MCD_VAT": "Vat", - "GET_CDPS": "GetCdps", - "CDP_MANAGER": "DssCdpManager", - "MCD_DAI": "Dai", - "MCD_POT": "Pot", - "REDEEMER": "Redeemer", - "MIGRATION": "ScdMcdMigration", - "MIGRATION_PROXY_ACTIONS": "MigrationProxyActions", - "OLD_CHIEF": "DSChief", - "OLD_VOTE_PROXY_FACTORY": "VoteProxyFactory", - "OLD_MKR": "DSToken", - "MCD_JOIN_*": "GemJoin", - "PROXY_ACTIONS_END": "DssProxyActionsEnd", - "SAI_CAGEFREE": "CageFree", - "MCD_ESM": "ESM" -} \ No newline at end of file diff --git a/packages/dai-plugin-migrations/src/index.js b/packages/dai-plugin-migrations/src/index.js index 83f144963..72bd46094 100644 --- a/packages/dai-plugin-migrations/src/index.js +++ b/packages/dai-plugin-migrations/src/index.js @@ -2,7 +2,7 @@ import { createCurrency } from '@makerdao/currency'; import testnetAddresses from '../contracts/addresses/testnet.json'; import kovanAddresses from '../contracts/addresses/kovan.json'; import mainnetAddresses from '../contracts/addresses/mainnet.json'; -import abiMap from '../contracts/abiMap.json'; +import abiMap from '../contracts/abiMap'; import MigrationService from './MigrationService'; import { ServiceRoles as ServiceRoles_ } from './constants'; export const ServiceRoles = ServiceRoles_; @@ -11,11 +11,11 @@ const { MIGRATION } = ServiceRoles; // this implementation assumes that all contracts in kovan.json, mainnet.json are also in testnet.json const allContracts = Object.entries(testnetAddresses).reduce( (contracts, [name, testnetAddress]) => { - const abiName = abiMap[name]; + const abi = abiMap[name]; - if (abiName) { + if (abi) { contracts[name] = { - abi: require(`../contracts/abis/${abiName}.json`), + abi, address: { testnet: testnetAddress, kovan: kovanAddresses[name], diff --git a/packages/dai-plugin-scd/contracts/abiMap.js b/packages/dai-plugin-scd/contracts/abiMap.js new file mode 100644 index 000000000..6352b9e47 --- /dev/null +++ b/packages/dai-plugin-scd/contracts/abiMap.js @@ -0,0 +1,21 @@ +// might not be run through babel in the future, so we must use an ES5-safe export +module.exports = { + SAI_PIP: require('./abis/DSValue'), + SAI_PEP: require('./abis/DSValue'), + SAI_PIT: require('./abis/GemPit'), + SAI_SIN: require('./abis/ERC20'), + SAI_MOM: require('./abis/SaiMom'), + SAI_VOX: require('./abis/SaiVox'), + SAI_TUB: require('./abis/SaiTub'), + SAI_TAP: require('./abis/SaiTap'), + SAI_TOP: require('./abis/SaiTop'), + SAI_SKR: require('./abis/ERC20'), + SAI_GEM: require('./abis/WETH9'), + SAI_GOV: require('./abis/ERC20'), + SAI: require('./abis/ERC20'), + SAI_PROXY: require('./abis/SaiProxyCreateAndExecute'), + PROXY_REGISTRY: require('./abis/ProxyRegistry'), + DS_PROXY_FACTORY: require('./abis/DSProxyFactory'), + DS_PROXY: require('./abis/DSProxy'), + MULTICALL: require('./abis/Multicall') +}; diff --git a/packages/dai-plugin-scd/contracts/abiMap.json b/packages/dai-plugin-scd/contracts/abiMap.json deleted file mode 100644 index a2c7185bc..000000000 --- a/packages/dai-plugin-scd/contracts/abiMap.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "SAI_PIP": "DSValue", - "SAI_PEP": "DSValue", - "SAI_PIT": "GemPit", - "SAI_SIN": "ERC20", - "SAI_MOM": "SaiMom", - "SAI_VOX": "SaiVox", - "SAI_TUB": "SaiTub", - "SAI_TAP": "SaiTap", - "SAI_TOP": "SaiTop", - "SAI_SKR": "ERC20", - "SAI_GEM": "WETH9", - "SAI_GOV": "ERC20", - "SAI": "ERC20", - "SAI_PROXY": "SaiProxyCreateAndExecute", - "PROXY_REGISTRY": "ProxyRegistry", - "DS_PROXY_FACTORY": "DSProxyFactory", - "DS_PROXY": "DSProxy", - "MULTICALL": "Multicall" -} diff --git a/packages/dai-plugin-scd/src/index.js b/packages/dai-plugin-scd/src/index.js index 1ac5f11ad..7b5c44515 100644 --- a/packages/dai-plugin-scd/src/index.js +++ b/packages/dai-plugin-scd/src/index.js @@ -4,7 +4,7 @@ import { createCurrency, createCurrencyRatio } from '@makerdao/currency'; import testnetAddresses from '../contracts/addresses/testnet.json'; import kovanAddresses from '../contracts/addresses/kovan.json'; import mainnetAddresses from '../contracts/addresses/mainnet.json'; -import abiMap from '../contracts/abiMap.json'; +import abiMap from '../contracts/abiMap'; import EthereumCdpService from './EthereumCdpService'; import PriceService from './PriceService'; import TokenConversionService from './TokenConversionService'; @@ -21,18 +21,18 @@ const { CDP, PRICE, CONVERSION } = ServiceRoles; let addContracts = reduce( testnetAddresses, (result, testnetAddress, name) => { - let abiName = abiMap[name]; - if (!abiName) { + let abi = abiMap[name]; + if (!abi) { const prefix = Object.keys(abiMap).find( k => k.substring(k.length - 1) == '*' && k.substring(0, k.length - 1) == name.substring(0, k.length - 1) ); - if (prefix) abiName = abiMap[prefix]; + if (prefix) abi = abiMap[prefix]; } - if (abiName) { + if (abi) { result[name] = { - abi: require(`../contracts/abis/${abiName}.json`), + abi, address: { testnet: testnetAddress, kovan: kovanAddresses[name],