|
{
|
|
"language": "Solidity",
|
|
"sources": {
|
|
"src/Registry.sol": {
|
|
"content": "// SPDX-License-Identifier: Apache-2.0\npragma solidity 0.8.16;\n\nimport { Ownable } from \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract Registry is Ownable {\n // ============================================= ADDRESS CONFIG =============================================\n\n /**\n * @notice Emitted when the address of a contract is changed.\n * @param id value representing the unique ID tied to the changed contract\n * @param oldAddress address of the contract before the change\n * @param newAddress address of the contract after the contract\n */\n event AddressChanged(uint256 indexed id, address oldAddress, address newAddress);\n\n /**\n * @notice Attempted to set the address of a contract that is not registered.\n * @param id id of the contract that is not registered\n */\n error Registry__ContractNotRegistered(uint256 id);\n\n /**\n * @notice The unique ID that the next registered contract will have.\n */\n uint256 public nextId;\n\n /**\n * @notice Get the address associated with an id.\n */\n mapping(uint256 => address) public getAddress;\n\n /**\n * @notice Set the address of the contract at a given id.\n */\n function setAddress(uint256 id, address newAddress) external onlyOwner {\n if (id >= nextId) revert Registry__ContractNotRegistered(id);\n\n emit AddressChanged(id, getAddress[id], newAddress);\n\n getAddress[id] = newAddress;\n }\n\n // ============================================= INITIALIZATION =============================================\n\n /**\n * @param gravityBridge address of GravityBridge contract\n * @param swapRouter address of SwapRouter contract\n * @param priceRouter address of PriceRouter contract\n */\n constructor(\n address gravityBridge,\n address swapRouter,\n address priceRouter\n ) Ownable() {\n _register(gravityBridge);\n _register(swapRouter);\n _register(priceRouter);\n }\n\n // ============================================ REGISTER CONFIG ============================================\n\n /**\n * @notice Emitted when a new contract is registered.\n * @param id value representing the unique ID tied to the new contract\n * @param newContract address of the new contract\n */\n event Registered(uint256 indexed id, address indexed newContract);\n\n /**\n * @notice Register the address of a new contract.\n * @param newContract address of the new contract to register\n */\n function register(address newContract) external onlyOwner {\n _register(newContract);\n }\n\n function _register(address newContract) internal {\n getAddress[nextId] = newContract;\n\n emit Registered(nextId, newContract);\n\n nextId++;\n }\n}\n"
|
|
},
|
|
"lib/openzeppelin-contracts/contracts/access/Ownable.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n"
|
|
},
|
|
"lib/openzeppelin-contracts/contracts/utils/Context.sol": {
|
|
"content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n"
|
|
}
|
|
},
|
|
"settings": {
|
|
"remappings": [
|
|
"@chainlink/=lib/chainlink/",
|
|
"@ds-test/=lib/forge-std/lib/ds-test/src/",
|
|
"@ensdomains/=node_modules/@ensdomains/",
|
|
"@forge-std/=lib/forge-std/src/",
|
|
"@openzeppelin/=lib/openzeppelin-contracts/",
|
|
"@solmate/=lib/solmate/src/",
|
|
"@uniswap/v3-core/=lib/v3-core/",
|
|
"@uniswap/v3-periphery/=lib/v3-periphery/",
|
|
"chainlink/=lib/chainlink/",
|
|
"ds-test/=lib/forge-std/lib/ds-test/src/",
|
|
"eth-gas-reporter/=node_modules/eth-gas-reporter/",
|
|
"forge-std/=lib/forge-std/src/",
|
|
"hardhat/=node_modules/hardhat/",
|
|
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
|
|
"solmate/=lib/solmate/src/",
|
|
"src/=src/",
|
|
"test/=test/",
|
|
"src/=src/",
|
|
"test/=test/"
|
|
],
|
|
"optimizer": {
|
|
"enabled": true,
|
|
"runs": 200
|
|
},
|
|
"metadata": {
|
|
"bytecodeHash": "ipfs"
|
|
},
|
|
"outputSelection": {
|
|
"*": {
|
|
"*": [
|
|
"evm.bytecode",
|
|
"evm.deployedBytecode",
|
|
"devdoc",
|
|
"userdoc",
|
|
"metadata",
|
|
"abi"
|
|
]
|
|
}
|
|
},
|
|
"evmVersion": "london",
|
|
"libraries": {}
|
|
}
|
|
} |