Overview
APE Balance
0 APE
APE Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 4603402 | 20 hrs ago | IN | 0 APE | 0.01842166 |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
GNSChainConfig
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 800 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; import "../abstract/GNSAddressStore.sol"; import "../../interfaces/libraries/IChainConfigUtils.sol"; import "../../libraries/ChainConfigUtils.sol"; /** * @dev Facet #13: ChainConfig (Handles global and chain-specific configuration) */ contract GNSChainConfig is GNSAddressStore, IChainConfigUtils { // Initialization /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } /// @inheritdoc IChainConfigUtils function initializeChainConfig( uint16 _nativeTransferGasLimit, bool _nativeTransferEnabled ) external reinitializer(18) { ChainConfigUtils.initializeChainConfig(_nativeTransferGasLimit, _nativeTransferEnabled); } // Management Setters /// @inheritdoc IChainConfigUtils function updateNativeTransferGasLimit(uint16 _nativeTransferGasLimit) external onlyRole(Role.GOV_EMERGENCY) { ChainConfigUtils.updateNativeTransferGasLimit(_nativeTransferGasLimit); } /// @inheritdoc IChainConfigUtils function updateNativeTransferEnabled(bool _nativeTransferEnabled) external onlyRole(Role.GOV_EMERGENCY) { ChainConfigUtils.updateNativeTransferEnabled(_nativeTransferEnabled); } // Getters /// @inheritdoc IChainConfigUtils function getNativeTransferGasLimit() external view returns (uint16) { return ChainConfigUtils.getNativeTransferGasLimit(); } /// @inheritdoc IChainConfigUtils function getNativeTransferEnabled() external view returns (bool) { return ChainConfigUtils.getNativeTransferEnabled(); } /// @inheritdoc IChainConfigUtils function getReentrancyLock() external view returns (uint256) { return ChainConfigUtils.getReentrancyLock(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized != type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "../../interfaces/IGNSAddressStore.sol"; /** * @dev Proxy base for the diamond and its facet contracts to store addresses and manage access control */ abstract contract GNSAddressStore is Initializable, IGNSAddressStore { AddressStore private addressStore; /// @inheritdoc IGNSAddressStore function initialize(address _govTimelock) external initializer { if (_govTimelock == address(0)) { revert IGeneralErrors.InitError(); } _setRole(_govTimelock, Role.GOV_TIMELOCK, true); } // Addresses /// @inheritdoc IGNSAddressStore function getAddresses() external view returns (Addresses memory) { return addressStore.globalAddresses; } // Roles /// @inheritdoc IGNSAddressStore function hasRole(address _account, Role _role) public view returns (bool) { return addressStore.accessControl[_account][_role]; } /// @inheritdoc IGNSAddressStore function hasRoles(address _account, Role _roleA, Role _roleB) public view returns (bool) { return addressStore.accessControl[_account][_roleA] || addressStore.accessControl[_account][_roleB]; } /** * @dev Update role for account * @param _account account to update * @param _role role to set * @param _value true if allowed, false if not */ function _setRole(address _account, Role _role, bool _value) internal { addressStore.accessControl[_account][_role] = _value; emit AccessControlUpdated(_account, _role, _value); } /// @inheritdoc IGNSAddressStore function setRoles( address[] calldata _accounts, Role[] calldata _roles, bool[] calldata _values ) external onlyRole(Role.GOV_TIMELOCK) { if (_accounts.length != _roles.length || _accounts.length != _values.length) { revert IGeneralErrors.InvalidInputLength(); } for (uint256 i = 0; i < _accounts.length; ++i) { if (_roles[i] == Role.GOV_TIMELOCK && _accounts[i] == msg.sender) { revert NotAllowed(); } _setRole(_accounts[i], _roles[i], _values[i]); } } /** * @dev Reverts if caller does not have role * @param _role role to enforce */ function _enforceRole(Role _role) internal view { if (!hasRole(msg.sender, _role)) { revert WrongAccess(); } } /** * @dev Reverts if caller does not have at least one of the two roles * @param _roleA role to enforce * @param _roleB role to enforce */ function _enforceRoles(Role _roleA, Role _roleB) internal view { if (!hasRoles(msg.sender, _roleA, _roleB)) { revert WrongAccess(); } } /** * @dev Reverts if caller does not have role */ modifier onlyRole(Role _role) { _enforceRole(_role); _; } /** * @dev Reverts if caller does not have either of the roles */ modifier onlyRoles(Role _roleA, Role _roleB) { _enforceRoles(_roleA, _roleB); _; } /** * @dev Reverts if caller isn't this same contract (facets calling other facets) */ modifier onlySelf() { if (msg.sender != address(this)) { revert WrongAccess(); } _; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; /** * @dev Interface for errors potentially used in all libraries (general names) */ interface IGeneralErrors { error InitError(); error InvalidAddresses(); error InvalidAddress(); error InvalidInputLength(); error InvalidCollateralIndex(); error WrongParams(); error WrongLength(); error WrongOrder(); error WrongIndex(); error BlockOrder(); error Overflow(); error ZeroAddress(); error ZeroValue(); error AlreadyExists(); error DoesntExist(); error Paused(); error BelowMin(); error AboveMax(); error NotAuthorized(); error WrongTradeType(); error WrongOrderType(); error InsufficientBalance(); error UnsupportedChain(); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; import "./types/IAddressStore.sol"; import "./IGeneralErrors.sol"; /** * @dev Interface for AddressStoreUtils library */ interface IGNSAddressStore is IAddressStore, IGeneralErrors { /** * @dev Initializes address store facet * @param _rolesManager roles manager address */ function initialize(address _rolesManager) external; /** * @dev Returns addresses current values */ function getAddresses() external view returns (Addresses memory); /** * @dev Returns whether an account has been granted a particular role * @param _account account address to check * @param _role role to check */ function hasRole(address _account, Role _role) external view returns (bool); /** * @dev Returns whether an account has been granted at least one of two roles * @param _account address to check * @param _roleA first role to check * @param _roleB second role to check */ function hasRoles(address _account, Role _roleA, Role _roleB) external view returns (bool); /** * @dev Updates access control for a list of accounts * @param _accounts accounts addresses to update * @param _roles corresponding roles to update * @param _values corresponding new values to set */ function setRoles(address[] calldata _accounts, Role[] calldata _roles, bool[] calldata _values) external; /** * @dev Emitted when addresses are updated * @param addresses new addresses values */ event AddressesUpdated(Addresses addresses); /** * @dev Emitted when access control is updated for an account * @param target account address to update * @param role role to update * @param access whether role is granted or revoked */ event AccessControlUpdated(address target, Role role, bool access); error NotAllowed(); error WrongAccess(); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; import "../types/IChainConfig.sol"; /** * @dev Interface for GNSChainConfig facet (inherits types and also contains functions, events, and custom errors) */ interface IChainConfigUtils is IChainConfig { /** * @dev Initializer for ChainConfig facet * @param _nativeTransferGasLimit new native transfer gas limit * @param _nativeTransferEnabled whether native transfers should be enabled */ function initializeChainConfig(uint16 _nativeTransferGasLimit, bool _nativeTransferEnabled) external; /** * @dev Updates native transfer gas limit * @param _nativeTransferGasLimit new native transfer gas limit. Must be greater or equal to MIN_NATIVE_TRANSFER_GAS_LIMIT. */ function updateNativeTransferGasLimit(uint16 _nativeTransferGasLimit) external; /** * @dev Updates `nativeTransferEnabled`. When true, the diamond is allowed to unwrap native tokens on transfer-out. * @param _nativeTransferEnable the new value */ function updateNativeTransferEnabled(bool _nativeTransferEnable) external; /** * @dev Returns gas limit to be used for native transfers, with a minimum of `MIN_NATIVE_TRANSFER_GAS_LIMIT` (21k gas) */ function getNativeTransferGasLimit() external returns (uint16); /** * @dev Returns whether native transfers are enabled */ function getNativeTransferEnabled() external returns (bool); /** * @dev Returns the current value for reentrancy lock */ function getReentrancyLock() external returns (uint256); /** * @dev Emitted when `nativeTransferGasLimit` is updated * @param newLimit new gas limit */ event NativeTransferGasLimitUpdated(uint16 newLimit); /** * @dev Emitted when `nativeTransferEnabled` is updated * @param enabled the new value */ event NativeTransferEnabledUpdated(bool enabled); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; /** * @dev Contains the types for the GNSAddressStore facet */ interface IAddressStore { enum Role { GOV_TIMELOCK, GOV, MANAGER, GOV_EMERGENCY } struct Addresses { address gns; address gnsStaking; address treasury; } struct AddressStore { uint256 __deprecated; // previously globalAddresses (gns token only, 1 slot) mapping(address => mapping(Role => bool)) accessControl; Addresses globalAddresses; uint256[7] __gap1; // gap for global addresses // insert new storage here uint256[38] __gap2; // gap for rest of diamond storage } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; /** * @dev Contains the types for the GNSChainConfig facet */ interface IChainConfig { struct ChainConfigStorage { uint256 reentrancyLock; // HAS TO BE FIRST AND TAKE A FULL SLOT (GNSReentrancyGuard expects it) uint16 nativeTransferGasLimit; // 16 bits. 64,535 max value bool nativeTransferEnabled; // When true, the diamond is allowed to unwrap native tokens on transfer out uint232 __placeholder; uint256[48] __gap; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; import "../interfaces/IGeneralErrors.sol"; import "../interfaces/libraries/IChainConfigUtils.sol"; import "./StorageUtils.sol"; /** * @dev ChainConfig facet internal library */ library ChainConfigUtils { uint16 internal constant MIN_NATIVE_TRANSFER_GAS_LIMIT = 21_000; /** * @dev Check IChainConfig interface for documentation */ function initializeChainConfig(uint16 _nativeTransferGasLimit, bool _nativeTransferEnabled) internal { updateNativeTransferGasLimit(_nativeTransferGasLimit); updateNativeTransferEnabled(_nativeTransferEnabled); } /** * @dev Check IChainConfigUtils interface for documentation */ function updateNativeTransferGasLimit(uint16 _nativeTransferGasLimit) internal { if (_nativeTransferGasLimit < MIN_NATIVE_TRANSFER_GAS_LIMIT) revert IGeneralErrors.BelowMin(); _getStorage().nativeTransferGasLimit = _nativeTransferGasLimit; emit IChainConfigUtils.NativeTransferGasLimitUpdated(_nativeTransferGasLimit); } /** * @dev Check IChainConfigUtils interface for documentation */ function updateNativeTransferEnabled(bool _nativeTransferEnabled) internal { _getStorage().nativeTransferEnabled = _nativeTransferEnabled; emit IChainConfigUtils.NativeTransferEnabledUpdated(_nativeTransferEnabled); } /** * @dev Check IChainConfigUtils interface for documentation */ function getNativeTransferGasLimit() internal view returns (uint16) { uint16 gasLimit = _getStorage().nativeTransferGasLimit; // If `nativeTransferGasLimit` is 0 (not yet initialized) then return `MIN_NATIVE_TRANSFER_GAS_LIMIT return gasLimit == 0 ? MIN_NATIVE_TRANSFER_GAS_LIMIT : gasLimit; } /** * @dev Check IChainConfigUtils interface for documentation */ function getNativeTransferEnabled() internal view returns (bool) { return _getStorage().nativeTransferEnabled; } /** * @dev Check IChainConfigUtils interface for documentation */ function getReentrancyLock() internal view returns (uint256) { return _getStorage().reentrancyLock; } /** * @dev Returns storage slot to use when fetching storage relevant to library */ function _getSlot() internal pure returns (uint256) { return StorageUtils.GLOBAL_CHAIN_CONFIG_SLOT; } /** * @dev Returns storage pointer for storage struct in diamond contract, at defined slot */ function _getStorage() internal pure returns (IChainConfig.ChainConfigStorage storage s) { uint256 storageSlot = _getSlot(); assembly { s.slot := storageSlot } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; /** * * @dev Internal library to manage storage slots of GNSMultiCollatDiamond contract diamond storage structs. * * BE EXTREMELY CAREFUL, DO NOT EDIT THIS WITHOUT A GOOD REASON * */ library StorageUtils { uint256 internal constant GLOBAL_ADDRESSES_SLOT = 3; uint256 internal constant GLOBAL_PAIRS_STORAGE_SLOT = 51; uint256 internal constant GLOBAL_REFERRALS_SLOT = 101; uint256 internal constant GLOBAL_FEE_TIERS_SLOT = 151; uint256 internal constant GLOBAL_PRICE_IMPACT_SLOT = 201; uint256 internal constant GLOBAL_DIAMOND_SLOT = 251; uint256 internal constant GLOBAL_TRADING_STORAGE_SLOT = 301; uint256 internal constant GLOBAL_TRIGGER_REWARDS_SLOT = 351; uint256 internal constant GLOBAL_TRADING_SLOT = 401; uint256 internal constant GLOBAL_TRADING_CALLBACKS_SLOT = 451; uint256 internal constant GLOBAL_BORROWING_FEES_SLOT = 501; uint256 internal constant GLOBAL_PRICE_AGGREGATOR_SLOT = 551; uint256 internal constant GLOBAL_OTC_SLOT = 601; uint256 internal constant GLOBAL_CHAIN_CONFIG_SLOT = 651; }
{ "optimizer": { "enabled": true, "runs": 800 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AboveMax","type":"error"},{"inputs":[],"name":"AlreadyExists","type":"error"},{"inputs":[],"name":"BelowMin","type":"error"},{"inputs":[],"name":"BlockOrder","type":"error"},{"inputs":[],"name":"DoesntExist","type":"error"},{"inputs":[],"name":"InitError","type":"error"},{"inputs":[],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InvalidAddress","type":"error"},{"inputs":[],"name":"InvalidAddresses","type":"error"},{"inputs":[],"name":"InvalidCollateralIndex","type":"error"},{"inputs":[],"name":"InvalidInputLength","type":"error"},{"inputs":[],"name":"NotAllowed","type":"error"},{"inputs":[],"name":"NotAuthorized","type":"error"},{"inputs":[],"name":"Overflow","type":"error"},{"inputs":[],"name":"Paused","type":"error"},{"inputs":[],"name":"UnsupportedChain","type":"error"},{"inputs":[],"name":"WrongAccess","type":"error"},{"inputs":[],"name":"WrongIndex","type":"error"},{"inputs":[],"name":"WrongLength","type":"error"},{"inputs":[],"name":"WrongOrder","type":"error"},{"inputs":[],"name":"WrongOrderType","type":"error"},{"inputs":[],"name":"WrongParams","type":"error"},{"inputs":[],"name":"WrongTradeType","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroValue","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"enum IAddressStore.Role","name":"role","type":"uint8"},{"indexed":false,"internalType":"bool","name":"access","type":"bool"}],"name":"AccessControlUpdated","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address","name":"gns","type":"address"},{"internalType":"address","name":"gnsStaking","type":"address"},{"internalType":"address","name":"treasury","type":"address"}],"indexed":false,"internalType":"struct IAddressStore.Addresses","name":"addresses","type":"tuple"}],"name":"AddressesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"}],"name":"NativeTransferEnabledUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"newLimit","type":"uint16"}],"name":"NativeTransferGasLimitUpdated","type":"event"},{"inputs":[],"name":"getAddresses","outputs":[{"components":[{"internalType":"address","name":"gns","type":"address"},{"internalType":"address","name":"gnsStaking","type":"address"},{"internalType":"address","name":"treasury","type":"address"}],"internalType":"struct IAddressStore.Addresses","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNativeTransferEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNativeTransferGasLimit","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getReentrancyLock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"enum IAddressStore.Role","name":"_role","type":"uint8"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"},{"internalType":"enum IAddressStore.Role","name":"_roleA","type":"uint8"},{"internalType":"enum IAddressStore.Role","name":"_roleB","type":"uint8"}],"name":"hasRoles","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_govTimelock","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_nativeTransferGasLimit","type":"uint16"},{"internalType":"bool","name":"_nativeTransferEnabled","type":"bool"}],"name":"initializeChainConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_accounts","type":"address[]"},{"internalType":"enum IAddressStore.Role[]","name":"_roles","type":"uint8[]"},{"internalType":"bool[]","name":"_values","type":"bool[]"}],"name":"setRoles","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_nativeTransferEnabled","type":"bool"}],"name":"updateNativeTransferEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_nativeTransferGasLimit","type":"uint16"}],"name":"updateNativeTransferGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5061001961001e565b6100dd565b600054610100900460ff161561008a5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff908116146100db576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b610ba9806100ec6000396000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c8063885af32611610081578063b9c972291161005b578063b9c97229146101f5578063c4d66de814610208578063e085d2a71461021b57600080fd5b8063885af3261461014a57806395a8c58d1461015d578063a39fac121461017057600080fd5b806340ee2847116100b257806340ee2847146101065780637644f2421461011c5780637a5c9d1e1461012f57600080fd5b8063101e6503146100ce5780633bfab75c146100e3575b600080fd5b6100e16100dc366004610909565b61022e565b005b61028c5462010000900460ff165b60405190151581526020015b60405180910390f35b61010e610398565b6040519081526020016100fd565b6100e161012a3660046109b8565b6103a4565b6101376103bc565b60405161ffff90911681526020016100fd565b6100e16101583660046109ec565b6103c6565b6100f161016b366004610a45565b6104b5565b6101c3604080516060810182526000808252602082018190529181019190915250604080516060810182526003546001600160a01b03908116825260045481166020830152600554169181019190915290565b6040805182516001600160a01b03908116825260208085015182169083015292820151909216908201526060016100fd565b6100f1610203366004610a6f565b61050c565b6100e1610216366004610ab2565b6105bb565b6100e1610229366004610acd565b6106f8565b60006102398161070c565b85841415806102485750858214155b1561026657604051637db491eb60e01b815260040160405180910390fd5b60005b8681101561038957600086868381811061028557610285610afe565b905060200201602081019061029a9190610b14565b60038111156102ab576102ab610ae8565b1480156102e65750338888838181106102c6576102c6610afe565b90506020020160208101906102db9190610ab2565b6001600160a01b0316145b1561030457604051631eb49d6d60e11b815260040160405180910390fd5b61038188888381811061031957610319610afe565b905060200201602081019061032e9190610ab2565b87878481811061034057610340610afe565b90506020020160208101906103559190610b14565b86868581811061036757610367610afe565b905060200201602081019061037c91906109b8565b610736565b600101610269565b5050505050505050565b905090565b600061039361028b5490565b60036103af8161070c565b6103b8826107cb565b5050565b600061039361081e565b600054601290610100900460ff161580156103e8575060005460ff8083169116105b6104505760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805461ffff191660ff83161761010017905561046e838361083f565b6000805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a1505050565b6001600160a01b0382166000908152600260205260408120818360038111156104e0576104e0610ae8565b60038111156104f1576104f1610ae8565b815260208101919091526040016000205460ff169392505050565b6001600160a01b03831660009081526002602052604081208184600381111561053757610537610ae8565b600381111561054857610548610ae8565b815260208101919091526040016000205460ff16806105b357506001600160a01b03841660009081526002602052604081209083600381111561058d5761058d610ae8565b600381111561059e5761059e610ae8565b815260208101919091526040016000205460ff165b949350505050565b600054610100900460ff16158080156105db5750600054600160ff909116105b806105f55750303b1580156105f5575060005460ff166001145b6106585760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610447565b6000805460ff19166001179055801561067b576000805461ff0019166101001790555b6001600160a01b0382166106a257604051632c1c702960e21b815260040160405180910390fd5b6106af8260006001610736565b80156103b8576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b60036107038161070c565b6103b882610851565b61071633826104b5565b61073357604051631b17ff5560e21b815260040160405180910390fd5b50565b6001600160a01b0383166000908152600260205260408120829184600381111561076257610762610ae8565b600381111561077357610773610ae8565b815260200190815260200160002060006101000a81548160ff0219169083151502179055507f8d7fdec37f50c07219a6a0859420936836eb9254bf412035e3acede18b8b093d8383836040516104a893929190610b2f565b61028c805462ff0000191662010000831515908102919091179091556040519081527f2cc920a9e8bbfc19b048a3db4be815c4211e93faa33e0b1e97def344aac8aaa3906020015b60405180910390a150565b61028c5460009061ffff1680156108355780610839565b6152085b91505090565b61084882610851565b6103b8816107cb565b61520861ffff82161015610878576040516310906acb60e01b815260040160405180910390fd5b61028c805461ffff191661ffff83169081179091556040519081527ffbfcf05095de3956a64c56736502dd8e0280a6050ab0de536ce23c8725b6140890602001610813565b60008083601f8401126108cf57600080fd5b50813567ffffffffffffffff8111156108e757600080fd5b6020830191508360208260051b850101111561090257600080fd5b9250929050565b6000806000806000806060878903121561092257600080fd5b863567ffffffffffffffff8082111561093a57600080fd5b6109468a838b016108bd565b9098509650602089013591508082111561095f57600080fd5b61096b8a838b016108bd565b9096509450604089013591508082111561098457600080fd5b5061099189828a016108bd565b979a9699509497509295939492505050565b803580151581146109b357600080fd5b919050565b6000602082840312156109ca57600080fd5b6109d3826109a3565b9392505050565b803561ffff811681146109b357600080fd5b600080604083850312156109ff57600080fd5b610a08836109da565b9150610a16602084016109a3565b90509250929050565b80356001600160a01b03811681146109b357600080fd5b8035600481106109b357600080fd5b60008060408385031215610a5857600080fd5b610a6183610a1f565b9150610a1660208401610a36565b600080600060608486031215610a8457600080fd5b610a8d84610a1f565b9250610a9b60208501610a36565b9150610aa960408501610a36565b90509250925092565b600060208284031215610ac457600080fd5b6109d382610a1f565b600060208284031215610adf57600080fd5b6109d3826109da565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600060208284031215610b2657600080fd5b6109d382610a36565b6001600160a01b03841681526060810160048410610b5d57634e487b7160e01b600052602160045260246000fd5b836020830152821515604083015294935050505056fea264697066735822122028422376da8e5de17051a1afd3ef653bf34fce83ef36345ae6be98fb412052cc64736f6c63430008170033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100c95760003560e01c8063885af32611610081578063b9c972291161005b578063b9c97229146101f5578063c4d66de814610208578063e085d2a71461021b57600080fd5b8063885af3261461014a57806395a8c58d1461015d578063a39fac121461017057600080fd5b806340ee2847116100b257806340ee2847146101065780637644f2421461011c5780637a5c9d1e1461012f57600080fd5b8063101e6503146100ce5780633bfab75c146100e3575b600080fd5b6100e16100dc366004610909565b61022e565b005b61028c5462010000900460ff165b60405190151581526020015b60405180910390f35b61010e610398565b6040519081526020016100fd565b6100e161012a3660046109b8565b6103a4565b6101376103bc565b60405161ffff90911681526020016100fd565b6100e16101583660046109ec565b6103c6565b6100f161016b366004610a45565b6104b5565b6101c3604080516060810182526000808252602082018190529181019190915250604080516060810182526003546001600160a01b03908116825260045481166020830152600554169181019190915290565b6040805182516001600160a01b03908116825260208085015182169083015292820151909216908201526060016100fd565b6100f1610203366004610a6f565b61050c565b6100e1610216366004610ab2565b6105bb565b6100e1610229366004610acd565b6106f8565b60006102398161070c565b85841415806102485750858214155b1561026657604051637db491eb60e01b815260040160405180910390fd5b60005b8681101561038957600086868381811061028557610285610afe565b905060200201602081019061029a9190610b14565b60038111156102ab576102ab610ae8565b1480156102e65750338888838181106102c6576102c6610afe565b90506020020160208101906102db9190610ab2565b6001600160a01b0316145b1561030457604051631eb49d6d60e11b815260040160405180910390fd5b61038188888381811061031957610319610afe565b905060200201602081019061032e9190610ab2565b87878481811061034057610340610afe565b90506020020160208101906103559190610b14565b86868581811061036757610367610afe565b905060200201602081019061037c91906109b8565b610736565b600101610269565b5050505050505050565b905090565b600061039361028b5490565b60036103af8161070c565b6103b8826107cb565b5050565b600061039361081e565b600054601290610100900460ff161580156103e8575060005460ff8083169116105b6104505760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805461ffff191660ff83161761010017905561046e838361083f565b6000805461ff001916905560405160ff821681527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a1505050565b6001600160a01b0382166000908152600260205260408120818360038111156104e0576104e0610ae8565b60038111156104f1576104f1610ae8565b815260208101919091526040016000205460ff169392505050565b6001600160a01b03831660009081526002602052604081208184600381111561053757610537610ae8565b600381111561054857610548610ae8565b815260208101919091526040016000205460ff16806105b357506001600160a01b03841660009081526002602052604081209083600381111561058d5761058d610ae8565b600381111561059e5761059e610ae8565b815260208101919091526040016000205460ff165b949350505050565b600054610100900460ff16158080156105db5750600054600160ff909116105b806105f55750303b1580156105f5575060005460ff166001145b6106585760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610447565b6000805460ff19166001179055801561067b576000805461ff0019166101001790555b6001600160a01b0382166106a257604051632c1c702960e21b815260040160405180910390fd5b6106af8260006001610736565b80156103b8576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b60036107038161070c565b6103b882610851565b61071633826104b5565b61073357604051631b17ff5560e21b815260040160405180910390fd5b50565b6001600160a01b0383166000908152600260205260408120829184600381111561076257610762610ae8565b600381111561077357610773610ae8565b815260200190815260200160002060006101000a81548160ff0219169083151502179055507f8d7fdec37f50c07219a6a0859420936836eb9254bf412035e3acede18b8b093d8383836040516104a893929190610b2f565b61028c805462ff0000191662010000831515908102919091179091556040519081527f2cc920a9e8bbfc19b048a3db4be815c4211e93faa33e0b1e97def344aac8aaa3906020015b60405180910390a150565b61028c5460009061ffff1680156108355780610839565b6152085b91505090565b61084882610851565b6103b8816107cb565b61520861ffff82161015610878576040516310906acb60e01b815260040160405180910390fd5b61028c805461ffff191661ffff83169081179091556040519081527ffbfcf05095de3956a64c56736502dd8e0280a6050ab0de536ce23c8725b6140890602001610813565b60008083601f8401126108cf57600080fd5b50813567ffffffffffffffff8111156108e757600080fd5b6020830191508360208260051b850101111561090257600080fd5b9250929050565b6000806000806000806060878903121561092257600080fd5b863567ffffffffffffffff8082111561093a57600080fd5b6109468a838b016108bd565b9098509650602089013591508082111561095f57600080fd5b61096b8a838b016108bd565b9096509450604089013591508082111561098457600080fd5b5061099189828a016108bd565b979a9699509497509295939492505050565b803580151581146109b357600080fd5b919050565b6000602082840312156109ca57600080fd5b6109d3826109a3565b9392505050565b803561ffff811681146109b357600080fd5b600080604083850312156109ff57600080fd5b610a08836109da565b9150610a16602084016109a3565b90509250929050565b80356001600160a01b03811681146109b357600080fd5b8035600481106109b357600080fd5b60008060408385031215610a5857600080fd5b610a6183610a1f565b9150610a1660208401610a36565b600080600060608486031215610a8457600080fd5b610a8d84610a1f565b9250610a9b60208501610a36565b9150610aa960408501610a36565b90509250925092565b600060208284031215610ac457600080fd5b6109d382610a1f565b600060208284031215610adf57600080fd5b6109d3826109da565b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600060208284031215610b2657600080fd5b6109d382610a36565b6001600160a01b03841681526060810160048410610b5d57634e487b7160e01b600052602160045260246000fd5b836020830152821515604083015294935050505056fea264697066735822122028422376da8e5de17051a1afd3ef653bf34fce83ef36345ae6be98fb412052cc64736f6c63430008170033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.