diff --git a/contracts/mapping/InstaMappingController.sol b/contracts/mapping/InstaMappingController.sol index c7287aaf..274990e8 100644 --- a/contracts/mapping/InstaMappingController.sol +++ b/contracts/mapping/InstaMappingController.sol @@ -1,6 +1,5 @@ // SPDX-License-Identifier: MIT - -pragma solidity >=0.6.0 <0.8.0; +pragma solidity ^0.7.0; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "@openzeppelin/contracts/utils/Address.sol"; @@ -10,6 +9,10 @@ interface IndexInterface { function master() external view returns (address); } +interface ConnectorsInterface { + function chief(address) external view returns (bool); +} + contract InstaMappingController is Context { using EnumerableSet for EnumerableSet.AddressSet; using Address for address; @@ -18,6 +21,9 @@ contract InstaMappingController is Context { IndexInterface public constant instaIndex = IndexInterface(0x2971AdFa57b20E5a416aE5a708A8655A9c74f723); + ConnectorsInterface public constant connectors = + ConnectorsInterface(0x97b0B3A8bDeFE8cB9563a3c610019Ad10DB8aD11); // InstaConnectorsV2 + /** * @dev Emitted when `account` is granted `role`. @@ -39,8 +45,8 @@ contract InstaMappingController is Context { modifier onlyMaster { require( - instaIndex.master() == _msgSender(), - "MappingController: sender must be master" + instaIndex.master() == _msgSender() || connectors.chief(_msgSender()), + "MappingController: sender must be master or chief" ); _; } diff --git a/docs/connectors.json b/docs/connectors.json index 98e66de9..52b4877d 100644 --- a/docs/connectors.json +++ b/docs/connectors.json @@ -1,35 +1,41 @@ { - "1" : { - "AUTHORITY-A": "0x351Bb32e90C35647Df7a584f3c1a3A0c38F31c68", - "BASIC-A": "0x9926955e0Dd681Dc303370C52f4Ad0a4dd061687", - "1INCH-A": "0x235fca310ac7be45c7ad45f111203468743e4b7c", - "1INCH-B": "0xaBac3dCf164eD827EAfda8e05eCc8208D6bc5E04", - "COMPOUND-A": "0xbb153cf09a123746e0eb3b3a436c544a7eeb24b6", - "AAVE-V1-A": "0x612c5CA43230D9F97a0ac87E4420F66b8DF97e9D", - "AAVE-V2-A": "0x68b27A84101ac5120bBAb7Ce8d6b096C961df52C", - "MAKERDAO-A": "0x4049db23c605b197f764072569b8db2464653ef6", - "UNISWAP-V2-A": "0x1E5CE41BdB653734445FeC3553b61FebDdaFC43c", - "COMP-A": "0xB446e325D44C52b93eC122Bf76301f235f90B9c9", - "UNISWAP-A": "0xA4BF319968986D2352FA1c550D781bBFCCE3FcaB", - "POLYGON-BRIDGE-A": "0x1b79B302132370B434fb7807b36CB72FB0510aD5", - "AAVE-CLAIM-A": "0x611C1FA59Aa1d6352c4C8bD44882063c6aEE85E0", - "AAVE-STAKE-A": "0xf73c94402bc24148b744083ed02654eec2c37d5b", - "G-UNISWAP-A": "0x2fca923c7535083f25f761dcf289d7d81f024dda", - "INST-STAKING-A": "0x37a63939e128d284e0eae5d3e517aad44f5204d4", - "AAVE-V2-IMPORT-B": "0x6fe05374924830B6aC98849f75A3D5766E51Ef10", - "COMPOUND-IMPORT-B": "0xdA101870ca6136539628F28041E1B55baf4EB6C0", - "INSTAPOOL-A": "0x5806Af7AB22E2916fA582Ff05731Bf7C682387B2", - "MAKERDAO-CLAIM-A": "0x2f8cBE650af98602a215b6482F2aD60893C5A4E8", - "WETH-A": "0x22075fa719eFb02Ca3cF298AFa9C974B7465E5D3", - "REFINANCE-A": "0x9eA34bE6dA51aa9F6408FeA79c946FDCFA424442", - "INST-A": "0x52C2C4a0db049255fF345EB9D3Fb1f555b7a924A" + "connectors": + { + "1" : { + "AUTHORITY-A": "0x351Bb32e90C35647Df7a584f3c1a3A0c38F31c68", + "BASIC-A": "0x9926955e0Dd681Dc303370C52f4Ad0a4dd061687", + "1INCH-A": "0x235fca310ac7be45c7ad45f111203468743e4b7c", + "1INCH-B": "0xaBac3dCf164eD827EAfda8e05eCc8208D6bc5E04", + "COMPOUND-A": "0xbb153cf09a123746e0eb3b3a436c544a7eeb24b6", + "AAVE-V1-A": "0x612c5CA43230D9F97a0ac87E4420F66b8DF97e9D", + "AAVE-V2-A": "0x68b27A84101ac5120bBAb7Ce8d6b096C961df52C", + "MAKERDAO-A": "0x4049db23c605b197f764072569b8db2464653ef6", + "UNISWAP-V2-A": "0x1E5CE41BdB653734445FeC3553b61FebDdaFC43c", + "COMP-A": "0xB446e325D44C52b93eC122Bf76301f235f90B9c9", + "UNISWAP-A": "0xA4BF319968986D2352FA1c550D781bBFCCE3FcaB", + "POLYGON-BRIDGE-A": "0x1b79B302132370B434fb7807b36CB72FB0510aD5", + "AAVE-CLAIM-A": "0x611C1FA59Aa1d6352c4C8bD44882063c6aEE85E0", + "AAVE-STAKE-A": "0xf73c94402bc24148b744083ed02654eec2c37d5b", + "G-UNISWAP-A": "0x2fca923c7535083f25f761dcf289d7d81f024dda", + "INST-STAKING-A": "0x37a63939e128d284e0eae5d3e517aad44f5204d4", + "AAVE-V2-IMPORT-B": "0x6fe05374924830B6aC98849f75A3D5766E51Ef10", + "COMPOUND-IMPORT-B": "0xdA101870ca6136539628F28041E1B55baf4EB6C0", + "INSTAPOOL-A": "0x5806Af7AB22E2916fA582Ff05731Bf7C682387B2", + "MAKERDAO-CLAIM-A": "0x2f8cBE650af98602a215b6482F2aD60893C5A4E8", + "WETH-A": "0x22075fa719eFb02Ca3cF298AFa9C974B7465E5D3", + "REFINANCE-A": "0x9eA34bE6dA51aa9F6408FeA79c946FDCFA424442", + "INST-A": "0x52C2C4a0db049255fF345EB9D3Fb1f555b7a924A" + }, + "137" : { + "1INCH-A": "0xC0d9210496afE9763F5d8cEb8deFfBa817232A9e", + "AAVE-V2-A": "0xE84d8010Afc3663919F44685cB53ED88866da3eE", + "AUTHORITY-A": "0xf73C94402BC24148b744083eD02654EEc2C37D5B", + "BASIC-A": "0x1cAF5EC802ca602E98139AD96A8f2B7BC524264E", + "AAVE-CLAIM-A": "0xC7Cb1dE2721BFC0E0DA1b9D526bCdC54eF1C0eFC", + "PARASWAP-A": "0xFb3a1D56eD56F046721B9aCa749895100754578b" + } }, - "137" : { - "1INCH-A": "0xC0d9210496afE9763F5d8cEb8deFfBa817232A9e", - "AAVE-V2-A": "0xE84d8010Afc3663919F44685cB53ED88866da3eE", - "AUTHORITY-A": "0xf73C94402BC24148b744083eD02654EEc2C37D5B", - "BASIC-A": "0x1cAF5EC802ca602E98139AD96A8f2B7BC524264E", - "AAVE-CLAIM-A": "0xC7Cb1dE2721BFC0E0DA1b9D526bCdC54eF1C0eFC", - "PARASWAP-A": "0xFb3a1D56eD56F046721B9aCa749895100754578b" + "mappings": { + "InstaMappingController": "0xDdd075D5e1024901E4038461e1e4BbC3A48a08d4" } } diff --git a/scripts/deployInstaMappingController.js b/scripts/deployInstaMappingController.js new file mode 100644 index 00000000..f6919bb2 --- /dev/null +++ b/scripts/deployInstaMappingController.js @@ -0,0 +1,36 @@ +const hre = require('hardhat') +const { ethers } = hre + +async function main () { + if (hre.network.name === 'mainnet') { + console.log( + '\n\n Deploying Contracts to mainnet. Hit ctrl + c to abort' + ) + } else if (hre.network.name === 'hardhat') { + console.log( + '\n\n Deploying Contracts to hardhat.' + ) + } + + const InstaMappingController = await ethers.getContractFactory('InstaMappingController') + const instaMappingController = await InstaMappingController.deploy() + await instaMappingController.deployed() + + console.log('InstaMappingController deployed: ', instaMappingController.address) + + if (hre.network.name === 'mainnet') { + await hre.run('verify:verify', { + address: instaMappingController.address, + constructorArguments: [] + }) + } else if (hre.network.name === 'hardhat') { + console.log("Contracts deployed.") + } +} + +main() + .then(() => process.exit(0)) + .catch(error => { + console.error(error) + process.exit(1) + }) diff --git a/scripts/deployMappingContract.js b/scripts/deployMappingContract.js new file mode 100644 index 00000000..7fce2acd --- /dev/null +++ b/scripts/deployMappingContract.js @@ -0,0 +1,38 @@ +const hre = require('hardhat') +const { ethers } = hre + +async function main () { + if (hre.network.name === 'mainnet') { + console.log( + '\n\n Deploying Contracts to mainnet. Hit ctrl + c to abort' + ) + } else if (hre.network.name === 'hardhat') { + console.log( + '\n\n Deploying Contracts to hardhat.' + ) + } + + const mappingContract = "CONTRACT_NAME" + + const InstaProtocolMapping = await ethers.getContractFactory(mappingContract) + const instaProtocolMapping = await InstaProtocolMapping.deploy() + await instaProtocolMapping.deployed() + + console.log(`${mappingContract} deployed: `, instaProtocolMapping.address) + + if (hre.network.name === 'mainnet') { + await hre.run('verify:verify', { + address: instaProtocolMapping.address, + constructorArguments: [] + }) + } else if (hre.network.name === 'hardhat') { + console.log("Contracts deployed.") + } +} + +main() + .then(() => process.exit(0)) + .catch(error => { + console.error(error) + process.exit(1) + })