Contract Overview
Balance:
0 MATIC
MATIC Value:
$0.00
My Name Tag:
Not Available, login to update
Txn Hash |
Method
|
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0x5072c4dcb2a1d6d7d7076fe12370018cd608398f43cf1354acd2e3ac4b2c093d | 0x60806040 | 31243731 | 245 days 5 hrs ago | 0x07883ebd6f178420f24969279bd425ab0b99f10b | IN | Contract Creation | 0 MATIC | 0.042397655805 |
[ Download CSV Export ]
Similar Match Source Code
Note: This contract matches the deployed ByteCode of the Source Code for Contract 0xB267697adD4E9b5ED47208f92B0057c14cbB0e34
Contract Name:
ERC20Validator
Compiler Version
v0.8.9+commit.e5eed63a
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "./utils/IDefaultAccessControl.sol"; import "./IUnitPricesGovernance.sol"; interface IProtocolGovernance is IDefaultAccessControl, IUnitPricesGovernance { /// @notice CommonLibrary protocol params. /// @param maxTokensPerVault Max different token addresses that could be managed by the vault /// @param governanceDelay The delay (in secs) that must pass before setting new pending params to commiting them /// @param protocolTreasury The address that collects protocolFees, if protocolFee is not zero /// @param forceAllowMask If a permission bit is set in this mask it forces all addresses to have this permission as true /// @param withdrawLimit Withdraw limit (in unit prices, i.e. usd) struct Params { uint256 maxTokensPerVault; uint256 governanceDelay; address protocolTreasury; uint256 forceAllowMask; uint256 withdrawLimit; } // ------------------- EXTERNAL, VIEW ------------------- /// @notice Timestamp after which staged granted permissions for the given address can be committed. /// @param target The given address /// @return Zero if there are no staged permission grants, timestamp otherwise function stagedPermissionGrantsTimestamps(address target) external view returns (uint256); /// @notice Staged granted permission bitmask for the given address. /// @param target The given address /// @return Bitmask function stagedPermissionGrantsMasks(address target) external view returns (uint256); /// @notice Permission bitmask for the given address. /// @param target The given address /// @return Bitmask function permissionMasks(address target) external view returns (uint256); /// @notice Timestamp after which staged pending protocol parameters can be committed /// @return Zero if there are no staged parameters, timestamp otherwise. function stagedParamsTimestamp() external view returns (uint256); /// @notice Staged pending protocol parameters. function stagedParams() external view returns (Params memory); /// @notice Current protocol parameters. function params() external view returns (Params memory); /// @notice Addresses for which non-zero permissions are set. function permissionAddresses() external view returns (address[] memory); /// @notice Permission addresses staged for commit. function stagedPermissionGrantsAddresses() external view returns (address[] memory); /// @notice Return all addresses where rawPermissionMask bit for permissionId is set to 1. /// @param permissionId Id of the permission to check. /// @return A list of dirty addresses. function addressesByPermission(uint8 permissionId) external view returns (address[] memory); /// @notice Checks if address has permission or given permission is force allowed for any address. /// @param addr Address to check /// @param permissionId Permission to check function hasPermission(address addr, uint8 permissionId) external view returns (bool); /// @notice Checks if address has all permissions. /// @param target Address to check /// @param permissionIds A list of permissions to check function hasAllPermissions(address target, uint8[] calldata permissionIds) external view returns (bool); /// @notice Max different ERC20 token addresses that could be managed by the protocol. function maxTokensPerVault() external view returns (uint256); /// @notice The delay for committing any governance params. function governanceDelay() external view returns (uint256); /// @notice The address of the protocol treasury. function protocolTreasury() external view returns (address); /// @notice Permissions mask which defines if ordinary permission should be reverted. /// This bitmask is xored with ordinary mask. function forceAllowMask() external view returns (uint256); /// @notice Withdraw limit per token per block. /// @param token Address of the token /// @return Withdraw limit per token per block function withdrawLimit(address token) external view returns (uint256); /// @notice Addresses that has staged validators. function stagedValidatorsAddresses() external view returns (address[] memory); /// @notice Timestamp after which staged granted permissions for the given address can be committed. /// @param target The given address /// @return Zero if there are no staged permission grants, timestamp otherwise function stagedValidatorsTimestamps(address target) external view returns (uint256); /// @notice Staged validator for the given address. /// @param target The given address /// @return Validator function stagedValidators(address target) external view returns (address); /// @notice Addresses that has validators. function validatorsAddresses() external view returns (address[] memory); /// @notice Address that has validators. /// @param i The number of address /// @return Validator address function validatorsAddress(uint256 i) external view returns (address); /// @notice Validator for the given address. /// @param target The given address /// @return Validator function validators(address target) external view returns (address); // ------------------- EXTERNAL, MUTATING, GOVERNANCE, IMMEDIATE ------------------- /// @notice Rollback all staged validators. function rollbackStagedValidators() external; /// @notice Revoke validator instantly from the given address. /// @param target The given address function revokeValidator(address target) external; /// @notice Stages a new validator for the given address /// @param target The given address /// @param validator The validator for the given address function stageValidator(address target, address validator) external; /// @notice Commits validator for the given address. /// @dev Reverts if governance delay has not passed yet. /// @param target The given address. function commitValidator(address target) external; /// @notice Commites all staged validators for which governance delay passed /// @return Addresses for which validators were committed function commitAllValidatorsSurpassedDelay() external returns (address[] memory); /// @notice Rollback all staged granted permission grant. function rollbackStagedPermissionGrants() external; /// @notice Commits permission grants for the given address. /// @dev Reverts if governance delay has not passed yet. /// @param target The given address. function commitPermissionGrants(address target) external; /// @notice Commites all staged permission grants for which governance delay passed. /// @return An array of addresses for which permission grants were committed. function commitAllPermissionGrantsSurpassedDelay() external returns (address[] memory); /// @notice Revoke permission instantly from the given address. /// @param target The given address. /// @param permissionIds A list of permission ids to revoke. function revokePermissions(address target, uint8[] memory permissionIds) external; /// @notice Commits staged protocol params. /// Reverts if governance delay has not passed yet. function commitParams() external; // ------------------- EXTERNAL, MUTATING, GOVERNANCE, DELAY ------------------- /// @notice Sets new pending params that could have been committed after governance delay expires. /// @param newParams New protocol parameters to set. function stageParams(Params memory newParams) external; /// @notice Stage granted permissions that could have been committed after governance delay expires. /// Resets commit delay and permissions if there are already staged permissions for this address. /// @param target Target address /// @param permissionIds A list of permission ids to grant function stagePermissionGrants(address target, uint8[] memory permissionIds) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import "./utils/IDefaultAccessControl.sol"; interface IUnitPricesGovernance is IDefaultAccessControl, IERC165 { // ------------------- EXTERNAL, VIEW ------------------- /// @notice Estimated amount of token worth 1 USD staged for commit. /// @param token Address of the token /// @return The amount of token function stagedUnitPrices(address token) external view returns (uint256); /// @notice Timestamp after which staged unit prices for the given token can be committed. /// @param token Address of the token /// @return Timestamp function stagedUnitPricesTimestamps(address token) external view returns (uint256); /// @notice Estimated amount of token worth 1 USD. /// @param token Address of the token /// @return The amount of token function unitPrices(address token) external view returns (uint256); // ------------------- EXTERNAL, MUTATING ------------------- /// @notice Stage estimated amount of token worth 1 USD staged for commit. /// @param token Address of the token /// @param value The amount of token function stageUnitPrice(address token, uint256 value) external; /// @notice Reset staged value /// @param token Address of the token function rollbackUnitPrice(address token) external; /// @notice Commit staged unit price /// @param token Address of the token function commitUnitPrice(address token) external; }
// SPDX-License-Identifier: BSL-1.1 pragma solidity 0.8.9; interface IContractMeta { function contractName() external view returns (string memory); function contractNameBytes() external view returns (bytes32); function contractVersion() external view returns (string memory); function contractVersionBytes() external view returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/access/IAccessControlEnumerable.sol"; interface IDefaultAccessControl is IAccessControlEnumerable { /// @notice Checks that the address is contract admin. /// @param who Address to check /// @return `true` if who is admin, `false` otherwise function isAdmin(address who) external view returns (bool); /// @notice Checks that the address is contract admin. /// @param who Address to check /// @return `true` if who is operator, `false` otherwise function isOperator(address who) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "../IProtocolGovernance.sol"; interface IBaseValidator { /// @notice Validator parameters /// @param protocolGovernance Reference to Protocol Governance struct ValidatorParams { IProtocolGovernance protocolGovernance; } /// @notice Validator params staged to commit. function stagedValidatorParams() external view returns (ValidatorParams memory); /// @notice Timestamp after which validator params can be committed. function stagedValidatorParamsTimestamp() external view returns (uint256); /// @notice Current validator params. function validatorParams() external view returns (ValidatorParams memory); /// @notice Stage new validator params for commit. /// @param newParams New params for commit function stageValidatorParams(ValidatorParams calldata newParams) external; /// @notice Commit new validator params. function commitValidatorParams() external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import "./IBaseValidator.sol"; interface IValidator is IBaseValidator, IERC165 { // @notice Validate if call can be made to external contract. // @dev Reverts if validation failed. Returns nothing if validation is ok // @param sender Sender of the externalCall method // @param addr Address of the called contract // @param value Ether value for the call // @param selector Selector of the called method // @param data Call data after selector function validate( address sender, address addr, uint256 value, bytes4 selector, bytes calldata data ) external view; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; /// @notice Exceptions stores project`s smart-contracts exceptions library ExceptionsLibrary { string constant ADDRESS_ZERO = "AZ"; string constant VALUE_ZERO = "VZ"; string constant EMPTY_LIST = "EMPL"; string constant NOT_FOUND = "NF"; string constant INIT = "INIT"; string constant DUPLICATE = "DUP"; string constant NULL = "NULL"; string constant TIMESTAMP = "TS"; string constant FORBIDDEN = "FRB"; string constant ALLOWLIST = "ALL"; string constant LIMIT_OVERFLOW = "LIMO"; string constant LIMIT_UNDERFLOW = "LIMU"; string constant INVALID_VALUE = "INV"; string constant INVARIANT = "INVA"; string constant INVALID_TARGET = "INVTR"; string constant INVALID_TOKEN = "INVTO"; string constant INVALID_INTERFACE = "INVI"; string constant INVALID_SELECTOR = "INVS"; string constant INVALID_STATE = "INVST"; string constant INVALID_LENGTH = "INVL"; string constant LOCK = "LCKD"; string constant DISABLED = "DIS"; }
//SPDX-License-Identifier: MIT pragma solidity 0.8.9; /// @notice Stores permission ids for addresses library PermissionIdsLibrary { // The msg.sender is allowed to register vault uint8 constant REGISTER_VAULT = 0; // The msg.sender is allowed to create vaults uint8 constant CREATE_VAULT = 1; // The token is allowed to be transfered by vault uint8 constant ERC20_TRANSFER = 2; // The token is allowed to be added to vault uint8 constant ERC20_VAULT_TOKEN = 3; // Trusted protocols that are allowed to be approved of vault ERC20 tokens by any strategy uint8 constant ERC20_APPROVE = 4; // Trusted protocols that are allowed to be approved of vault ERC20 tokens by trusted strategy uint8 constant ERC20_APPROVE_RESTRICTED = 5; // Strategy allowed using restricted API uint8 constant TRUSTED_STRATEGY = 6; }
// SPDX-License-Identifier: BSL-1.1 pragma solidity 0.8.9; import "../interfaces/utils/IContractMeta.sol"; abstract contract ContractMeta is IContractMeta { // ------------------- EXTERNAL, VIEW ------------------- function contractName() external pure returns (string memory) { return _bytes32ToString(_contractName()); } function contractNameBytes() external pure returns (bytes32) { return _contractName(); } function contractVersion() external pure returns (string memory) { return _bytes32ToString(_contractVersion()); } function contractVersionBytes() external pure returns (bytes32) { return _contractVersion(); } // ------------------- INTERNAL, VIEW ------------------- function _contractName() internal pure virtual returns (bytes32); function _contractVersion() internal pure virtual returns (bytes32); function _bytes32ToString(bytes32 b) internal pure returns (string memory s) { s = new string(32); uint256 len = 32; for (uint256 i = 0; i < 32; ++i) { if (uint8(b[i]) == 0) { len = i; break; } } assembly { mstore(s, len) mstore(add(s, 0x20), b) } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "../interfaces/validators/IBaseValidator.sol"; import "../interfaces/IProtocolGovernance.sol"; import "../libraries/ExceptionsLibrary.sol"; contract BaseValidator is IBaseValidator { IBaseValidator.ValidatorParams internal _validatorParams; IBaseValidator.ValidatorParams internal _stagedValidatorParams; uint256 internal _stagedValidatorParamsTimestamp; constructor(IProtocolGovernance protocolGovernance) { _validatorParams = IBaseValidator.ValidatorParams({protocolGovernance: protocolGovernance}); } // ------------------- EXTERNAL, VIEW ------------------- /// @inheritdoc IBaseValidator function stagedValidatorParams() external view returns (ValidatorParams memory) { return _stagedValidatorParams; } /// @inheritdoc IBaseValidator function stagedValidatorParamsTimestamp() external view returns (uint256) { return _stagedValidatorParamsTimestamp; } /// @inheritdoc IBaseValidator function validatorParams() external view returns (ValidatorParams memory) { return _validatorParams; } // ------------------- EXTERNAL, MUTATING ------------------- /// @notice Stages params that could have been committed after governance delay expires. /// @param newParams Params to stage function stageValidatorParams(IBaseValidator.ValidatorParams calldata newParams) external { IProtocolGovernance governance = _validatorParams.protocolGovernance; require(governance.isAdmin(msg.sender), ExceptionsLibrary.FORBIDDEN); _stagedValidatorParams = newParams; _stagedValidatorParamsTimestamp = block.timestamp + governance.governanceDelay(); emit StagedValidatorParams(tx.origin, msg.sender, newParams, _stagedValidatorParamsTimestamp); } /// @notice Commits staged params function commitValidatorParams() external { require(_stagedValidatorParamsTimestamp != 0, ExceptionsLibrary.INVALID_STATE); IProtocolGovernance governance = _validatorParams.protocolGovernance; require(governance.isAdmin(msg.sender), ExceptionsLibrary.FORBIDDEN); require(block.timestamp >= _stagedValidatorParamsTimestamp, ExceptionsLibrary.TIMESTAMP); _validatorParams = _stagedValidatorParams; delete _stagedValidatorParams; delete _stagedValidatorParamsTimestamp; emit CommittedValidatorParams(tx.origin, msg.sender, _validatorParams); } /// @notice Emitted when new params are staged for commit /// @param origin Origin of the transaction (tx.origin) /// @param sender Sender of the call (msg.sender) /// @param newParams New params that were staged for commit /// @param when When the params could be committed event StagedValidatorParams( address indexed origin, address indexed sender, IBaseValidator.ValidatorParams newParams, uint256 when ); /// @notice Emitted when new params are staged for commit /// @param origin Origin of the transaction (tx.origin) /// @param sender Sender of the call (msg.sender) /// @param params New params that were staged for commit event CommittedValidatorParams( address indexed origin, address indexed sender, IBaseValidator.ValidatorParams params ); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "../interfaces/validators/IValidator.sol"; import "../interfaces/IProtocolGovernance.sol"; import "../libraries/PermissionIdsLibrary.sol"; import "../utils/ContractMeta.sol"; import "./Validator.sol"; contract ERC20Validator is ContractMeta, Validator { bytes4 public constant APPROVE_SELECTOR = IERC20.approve.selector; constructor(IProtocolGovernance protocolGovernance_) BaseValidator(protocolGovernance_) {} // ------------------- EXTERNAL, VIEW ------------------- // @inhericdoc IValidator function validate( address sender, address addr, uint256 value, bytes4 selector, bytes calldata data ) external view { require(value == 0, ExceptionsLibrary.INVALID_VALUE); if (selector == APPROVE_SELECTOR) { address spender; assembly { spender := calldataload(data.offset) } _verifyApprove(sender, addr, spender); } else { revert(ExceptionsLibrary.INVALID_SELECTOR); } } // ------------------- INTERNAL, VIEW ------------------- function _contractName() internal pure override returns (bytes32) { return bytes32("ERC20Validator"); } function _contractVersion() internal pure override returns (bytes32) { return bytes32("1.0.0"); } function _verifyApprove( address sender, address token, address spender ) private view { IProtocolGovernance protocolGovernance = _validatorParams.protocolGovernance; if (!protocolGovernance.hasPermission(token, PermissionIdsLibrary.ERC20_TRANSFER)) { revert(ExceptionsLibrary.FORBIDDEN); } if (protocolGovernance.hasPermission(spender, PermissionIdsLibrary.ERC20_APPROVE)) { return; } if ( protocolGovernance.hasPermission(spender, PermissionIdsLibrary.ERC20_APPROVE_RESTRICTED) && protocolGovernance.hasPermission(sender, PermissionIdsLibrary.TRUSTED_STRATEGY) ) { return; } revert(ExceptionsLibrary.FORBIDDEN); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "../interfaces/validators/IValidator.sol"; import "./BaseValidator.sol"; abstract contract Validator is IValidator, ERC165, BaseValidator { /// @inheritdoc IERC165 function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return (interfaceId == type(IValidator).interfaceId) || super.supportsInterface(interfaceId); } }
{ "evmVersion": "istanbul", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IProtocolGovernance","name":"protocolGovernance_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"origin","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"components":[{"internalType":"contract IProtocolGovernance","name":"protocolGovernance","type":"address"}],"indexed":false,"internalType":"struct IBaseValidator.ValidatorParams","name":"params","type":"tuple"}],"name":"CommittedValidatorParams","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"origin","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"components":[{"internalType":"contract IProtocolGovernance","name":"protocolGovernance","type":"address"}],"indexed":false,"internalType":"struct IBaseValidator.ValidatorParams","name":"newParams","type":"tuple"},{"indexed":false,"internalType":"uint256","name":"when","type":"uint256"}],"name":"StagedValidatorParams","type":"event"},{"inputs":[],"name":"APPROVE_SELECTOR","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"commitValidatorParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"contractNameBytes","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"contractVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"contractVersionBytes","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"components":[{"internalType":"contract IProtocolGovernance","name":"protocolGovernance","type":"address"}],"internalType":"struct IBaseValidator.ValidatorParams","name":"newParams","type":"tuple"}],"name":"stageValidatorParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stagedValidatorParams","outputs":[{"components":[{"internalType":"contract IProtocolGovernance","name":"protocolGovernance","type":"address"}],"internalType":"struct IBaseValidator.ValidatorParams","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stagedValidatorParamsTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes4","name":"selector","type":"bytes4"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"validate","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[],"name":"validatorParams","outputs":[{"components":[{"internalType":"contract IProtocolGovernance","name":"protocolGovernance","type":"address"}],"internalType":"struct IBaseValidator.ValidatorParams","name":"","type":"tuple"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50604051610c5a380380610c5a83398101604081905261002f91610061565b60408051602081019091526001600160a01b0390911690819052600080546001600160a01b0319169091179055610091565b60006020828403121561007357600080fd5b81516001600160a01b038116811461008a57600080fd5b9392505050565b610bba806100a06000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c806357acc3021161007157806357acc3021461016c5780635e585c341461019657806375d0c0dc146101a9578063a0865839146101be578063a0a8e460146101e5578063e6ab042c146101ed57600080fd5b806301ffc9a7146100b957806306a46239146100e15780630768b496146100f95780630e3e80ac1461010157806347c0a4ed146101185780634c39da1b1461012d575b600080fd5b6100cc6100c7366004610941565b6101f5565b60405190151581526020015b60405180910390f35b640312e302e360dc1b5b6040519081526020016100d8565b6002546100eb565b6d22a92199182b30b634b230ba37b960911b6100eb565b61012b610126366004610963565b610231565b005b6040805160208082018352600090915281519081019091526001546001600160a01b031681525b60405190516001600160a01b031681526020016100d8565b60408051602080820183526000918290528251908101909252546001600160a01b03168152610154565b61012b6101a4366004610993565b6103c3565b6101b1610461565b6040516100d89190610a44565b6101cc63095ea7b360e01b81565b6040516001600160e01b031990911681526020016100d8565b6101b161047d565b61012b610490565b60006001600160e01b03198216631796170d60e21b148061022657506301ffc9a760e01b6001600160e01b03198316145b92915050565b905090565b600054604051630935e01b60e21b81523360048201526001600160a01b039091169081906324d7806c9060240160206040518083038186803b15801561027657600080fd5b505afa15801561028a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ae9190610a99565b6040518060400160405280600381526020016223292160e91b815250906102f15760405162461bcd60e51b81526004016102e89190610a44565b60405180910390fd5b508160016102ff8282610abb565b905050806001600160a01b031663bba329396040518163ffffffff1660e01b815260040160206040518083038186803b15801561033b57600080fd5b505afa15801561034f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103739190610ae4565b61037d9042610b13565b6002819055604051339132917f660ad6a797f71286627569396d4046567822701c6afd27f47d280dee5e2ce181916103b791879190610b2b565b60405180910390a35050565b60408051808201909152600381526224a72b60e91b602082015284156103fc5760405162461bcd60e51b81526004016102e89190610a44565b506001600160e01b0319831663095ea7b360e01b141561042957813561042387878361062d565b50610459565b604080518082018252600480825263494e565360e01b6020830152915162461bcd60e51b81526102e89201610a44565b505050505050565b606061022c6d22a92199182b30b634b230ba37b960911b6108b8565b606061022c640312e302e360dc1b6108b8565b60025460408051808201909152600581526412539594d560da1b6020820152906104cd5760405162461bcd60e51b81526004016102e89190610a44565b50600054604051630935e01b60e21b81523360048201526001600160a01b039091169081906324d7806c9060240160206040518083038186803b15801561051357600080fd5b505afa158015610527573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061054b9190610a99565b6040518060400160405280600381526020016223292160e91b815250906105855760405162461bcd60e51b81526004016102e89190610a44565b5060025442101560405180604001604052806002815260200161545360f01b815250906105c55760405162461bcd60e51b81526004016102e89190610a44565b5060018054600080546001600160a01b0383166001600160a01b0319918216811783559216909255600291909155604051908152339032907f15f858bb04b5aa79f0fafddd94b014ab8bf8ceae94724b7074c7b4940be688b49060200160405180910390a350565b6000546040516363e85d2d60e01b81526001600160a01b038481166004830152600260248301529091169081906363e85d2d9060440160206040518083038186803b15801561067b57600080fd5b505afa15801561068f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b39190610a99565b6106e857604080518082018252600381526223292160e91b6020820152905162461bcd60e51b81526102e89190600401610a44565b6040516363e85d2d60e01b81526001600160a01b0383811660048084019190915260248301528216906363e85d2d9060440160206040518083038186803b15801561073257600080fd5b505afa158015610746573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076a9190610a99565b156107755750505050565b6040516363e85d2d60e01b81526001600160a01b038381166004830152600560248301528216906363e85d2d9060440160206040518083038186803b1580156107bd57600080fd5b505afa1580156107d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f59190610a99565b801561087c57506040516363e85d2d60e01b81526001600160a01b038581166004830152600660248301528216906363e85d2d9060440160206040518083038186803b15801561084457600080fd5b505afa158015610858573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087c9190610a99565b156108875750505050565b604080518082018252600381526223292160e91b6020820152905162461bcd60e51b81526102e89190600401610a44565b604080516020808252818301909252606091602082018180368337019050509050602060005b6020811015610916578381602081106108f9576108f9610b53565b1a61090657809150610916565b61090f81610b69565b90506108de565b508152602081019190915290565b80356001600160e01b03198116811461093c57600080fd5b919050565b60006020828403121561095357600080fd5b61095c82610924565b9392505050565b60006020828403121561097557600080fd5b50919050565b6001600160a01b038116811461099057600080fd5b50565b60008060008060008060a087890312156109ac57600080fd5b86356109b78161097b565b955060208701356109c78161097b565b9450604087013593506109dc60608801610924565b9250608087013567ffffffffffffffff808211156109f957600080fd5b818901915089601f830112610a0d57600080fd5b813581811115610a1c57600080fd5b8a6020828501011115610a2e57600080fd5b6020830194508093505050509295509295509295565b600060208083528351808285015260005b81811015610a7157858101830151858201604001528201610a55565b81811115610a83576000604083870101525b50601f01601f1916929092016040019392505050565b600060208284031215610aab57600080fd5b8151801515811461095c57600080fd5b8135610ac68161097b565b81546001600160a01b0319166001600160a01b039190911617905550565b600060208284031215610af657600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115610b2657610b26610afd565b500190565b604081018335610b3a8161097b565b6001600160a01b03168252602090910191909152919050565b634e487b7160e01b600052603260045260246000fd5b6000600019821415610b7d57610b7d610afd565b506001019056fea2646970667358221220fd84bd4e9b1d08aa81879cbd70d39f356350a0367dd8ad5c4a9c46815209256264736f6c63430008090033000000000000000000000000170a97ebfa6bd6557db514cf458487c07c94e4a4
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.