2021-05-04 11:47:04 +00:00
|
|
|
pragma solidity ^0.7.0;
|
|
|
|
pragma experimental ABIEncoderV2;
|
|
|
|
|
2021-05-09 15:30:29 +00:00
|
|
|
import {AccessControl} from "./AccessControl.sol";
|
|
|
|
|
2021-05-04 11:47:04 +00:00
|
|
|
interface IndexInterface {
|
|
|
|
function master() external view returns (address);
|
|
|
|
}
|
|
|
|
|
|
|
|
contract InstaMappings is AccessControl {
|
2021-05-09 15:30:29 +00:00
|
|
|
IndexInterface public constant instaIndex =
|
|
|
|
IndexInterface(0x2971AdFa57b20E5a416aE5a708A8655A9c74f723);
|
2021-05-04 11:47:04 +00:00
|
|
|
|
|
|
|
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
_setupRole(DEFAULT_ADMIN_ROLE, instaIndex.master());
|
|
|
|
_setRoleAdmin(DEFAULT_ADMIN_ROLE, ADMIN_ROLE);
|
|
|
|
_setupRole(ADMIN_ROLE, address(this));
|
|
|
|
}
|
|
|
|
|
2021-05-09 15:30:29 +00:00
|
|
|
function getMappingContractRole(address mappingContract)
|
|
|
|
public
|
|
|
|
pure
|
|
|
|
returns (bytes32 role)
|
|
|
|
{
|
2021-05-04 11:47:04 +00:00
|
|
|
assembly {
|
|
|
|
role := mload(add(mappingContract, 32))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-09 15:30:29 +00:00
|
|
|
function hasRole(address mappingAddr, address account)
|
|
|
|
public
|
|
|
|
view
|
|
|
|
returns (bool)
|
|
|
|
{
|
2021-05-04 11:47:04 +00:00
|
|
|
return super.hasRole(getMappingContractRole(mappingAddr), account);
|
|
|
|
}
|
|
|
|
|
|
|
|
function grantRole(address mappingAddr, address account) public {
|
|
|
|
super.grantRole(getMappingContractRole(mappingAddr), account);
|
|
|
|
}
|
|
|
|
|
|
|
|
function revokeRole(address mappingAddr, address account) public {
|
|
|
|
super.revokeRole(getMappingContractRole(mappingAddr), account);
|
|
|
|
}
|
|
|
|
|
|
|
|
function renounceRole(address mappingAddr, address account) public {
|
|
|
|
super.renounceRole(getMappingContractRole(mappingAddr), account);
|
|
|
|
}
|
2021-05-09 15:30:29 +00:00
|
|
|
}
|