Deployed InstaMappingController contract

This commit is contained in:
Thrilok Kumar 2021-08-03 21:32:27 +05:30
parent dedd38239a
commit cf8cc26090
4 changed files with 121 additions and 35 deletions

View File

@ -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"
);
_;
}

View File

@ -1,4 +1,6 @@
{
"connectors":
{
"1" : {
"AUTHORITY-A": "0x351Bb32e90C35647Df7a584f3c1a3A0c38F31c68",
"BASIC-A": "0x9926955e0Dd681Dc303370C52f4Ad0a4dd061687",
@ -32,4 +34,8 @@
"AAVE-CLAIM-A": "0xC7Cb1dE2721BFC0E0DA1b9D526bCdC54eF1C0eFC",
"PARASWAP-A": "0xFb3a1D56eD56F046721B9aCa749895100754578b"
}
},
"mappings": {
"InstaMappingController": "0xDdd075D5e1024901E4038461e1e4BbC3A48a08d4"
}
}

View File

@ -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)
})

View File

@ -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)
})