Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xA886F0Ba...586835bc6 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
AvsGovernance
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.8.20; /*______ __ __ __ __ / \ / | / | / | / | /$$$$$$ | _$$ |_ $$ |____ ______ _______ _$$ |_ $$/ _______ $$ | $$ |/ $$ | $$ \ / \ / \ / $$ | / | / | $$ | $$ |$$$$$$/ $$$$$$$ |/$$$$$$ |$$$$$$$ |$$$$$$/ $$ |/$$$$$$$/ $$ | $$ | $$ | __ $$ | $$ |$$ $$ |$$ | $$ | $$ | __ $$ |$$ | $$ \__$$ | $$ |/ |$$ | $$ |$$$$$$$$/ $$ | $$ | $$ |/ |$$ |$$ \_____ $$ $$/ $$ $$/ $$ | $$ |$$ |$$ | $$ | $$ $$/ $$ |$$ | $$$$$$/ $$$$/ $$/ $$/ $$$$$$$/ $$/ $$/ $$$$/ $$/ $$$$$$$/ */ import { AccessControlUpgradeable } from "openzeppelin-contracts-upgradeable/contracts/access/AccessControlUpgradeable.sol"; import { ReentrancyGuardUpgradeable } from "openzeppelin-contracts-upgradeable/contracts/utils/ReentrancyGuardUpgradeable.sol"; import { IMessageHandler } from "@othentic/NetworkManagement/Common/interfaces/IMessageHandler.sol"; import { IAvsGovernance } from "@othentic/NetworkManagement/L1/interfaces/IAvsGovernance.sol"; import { IOthenticRegistry } from "@othentic/NetworkManagement/L1/interfaces/IOthenticRegistry.sol"; import { IVault } from "@othentic/NetworkManagement/Common/interfaces/IVault.sol"; import { AvsGovernancePausable } from "@othentic/NetworkManagement/L1/AvsGovernancePausable.sol"; import { ISignatureUtils } from "@eigenlayer/contracts/interfaces/ISignatureUtils.sol"; import { AvsGovernanceStorage, AvsGovernanceStorageData } from "@othentic/NetworkManagement/L1/AvsGovernanceStorage.sol"; import { IAvsGovernanceLogic } from "@othentic/NetworkManagement/L1/interfaces/IAvsGovernanceLogic.sol"; import { MessagesLibrary } from "@othentic/NetworkManagement/Common/MessagesLibrary.sol"; import { RolesLibrary } from "@othentic/NetworkManagement/Common/RolesLibrary.sol"; import { PauserRolesLibrary } from "@othentic/NetworkManagement/Common/PauserRolesLibrary.sol"; import { SignedAuthTokenLibrary } from "@othentic/NetworkManagement/Common/SignedAuthTokenLibrary.sol"; import { BLSAuthLibrary } from "@othentic/NetworkManagement/Common/BLSAuthLibrary.sol"; import { IBLSAuthSingleton } from "@othentic/NetworkManagement/Common/interfaces/IBLSAuthSingleton.sol"; import { IAVSDirectory } from "@eigenlayer/contracts/interfaces/IAVSDirectory.sol"; /** * @author Othentic Labs LTD. * @notice Terms of Service: https://www.othentic.xyz/terms-of-service */ contract AvsGovernance is IAvsGovernance, AvsGovernancePausable, ReentrancyGuardUpgradeable { using SignedAuthTokenLibrary for bytes; // MODIFIERS modifier onlyRegisteredOperator() { if (_getStorage().isOperatorRegistered[msg.sender] == 0) revert OperatorNotRegistered(); _; } modifier onlyUnregisteredOperator() { if (_getStorage().isOperatorRegistered[msg.sender] != 0) revert OperatorAlreadyRegistered(); _; } // EXTERNAL FUNCTIONS function initialize( InitializationParams calldata _initializationParams ) public virtual initializer { _initialize( _initializationParams ); } function _initialize( InitializationParams calldata _initializationParams ) internal onlyInitializing { require( _initializationParams.avsGovernanceMultisigOwner != address(0) && _initializationParams.operationsMultisig != address(0) && _initializationParams.communityMultisig != address(0) && _initializationParams.othenticRegistry != address(0) && _initializationParams.messageHandler != address(0) && _initializationParams.vault != address(0) && _initializationParams.avsDirectoryContract != address(0) && _initializationParams.allowlistSigner != address(0), "AvsGovernance: Invalid input" ); address _avsGovernanceMultisigOwner = _initializationParams.avsGovernanceMultisigOwner; address _operationsMultisig = _initializationParams.operationsMultisig; address _communityMultisig = _initializationParams.communityMultisig; address _messageHandler = _initializationParams.messageHandler; string calldata _avsName = _initializationParams.avsName; IOthenticRegistry _othenticRegistry = IOthenticRegistry(_initializationParams.othenticRegistry); // [REMOVE_OTHENTIC_ACCESS_CONTROL] - replace with grant roles by permission rather than entity __OthenticAccessControl_init(_avsGovernanceMultisigOwner, _operationsMultisig, _communityMultisig); __AvsGovernancePausable_init(_avsGovernanceMultisigOwner, _operationsMultisig, _communityMultisig); AvsGovernanceStorageData storage _sd = _getStorage(); _sd.othenticRegistry = _othenticRegistry; _sd.messageHandler = IMessageHandler(_messageHandler); _grantRole(RolesLibrary.MESSAGE_HANDLER, _messageHandler); _sd.vault = IVault(_initializationParams.vault); _sd.allowlistSigner = _initializationParams.allowlistSigner; _sd.rewardsReceiverModificationDelay = 7 days; _sd.avsDirectoryContract = IAVSDirectory(_initializationParams.avsDirectoryContract); _sd.numOfOperatorsLimit = 100; _sd.blsAuthSingleton = _initializationParams.blsAuthSingleton; _setAvsName(_sd, _avsName); _othenticRegistry.registerAvs(_avsName); _setSupportedStrategies(_sd, _getDefaultStrategies(_sd)); } // -------------------- Operators Interface -------------------- // function registerAsAllowedOperator( uint256[4] calldata _blsKey, bytes calldata _authToken, address _rewardsReceiver, ISignatureUtils.SignatureWithSaltAndExpiry memory _operatorSignature, BLSAuthLibrary.Signature calldata _blsRegistrationSignature ) external onlyUnregisteredOperator whenFlowNotPaused(PauserRolesLibrary.REGISTRATION_FLOW) nonReentrant { AvsGovernanceStorageData storage _sd = _getStorage(); if (!_sd.isAllowlisted) revert AllowlistDisabled(); if (!_authToken.verifyAuthTokenForAddress(address(this), msg.sender, _sd.allowlistSigner)) revert InvalidAllowlistAuthToken(); if (_rewardsReceiver == address(0)) revert InvalidRewardsReceiver(); _setRewardsReceiver(_sd, _rewardsReceiver); _registerAsOperator(_sd, msg.sender, _blsKey, _blsRegistrationSignature, _rewardsReceiver); _sd.avsDirectoryContract.registerOperatorToAVS(msg.sender, _operatorSignature); } function registerAsOperator( uint256[4] calldata _blsKey, address _rewardsReceiver, ISignatureUtils.SignatureWithSaltAndExpiry memory _operatorSignature, BLSAuthLibrary.Signature calldata _blsRegistrationSignature ) external onlyUnregisteredOperator whenFlowNotPaused(PauserRolesLibrary.REGISTRATION_FLOW) nonReentrant { AvsGovernanceStorageData storage _sd = _getStorage(); if (_sd.isAllowlisted) revert AllowlistEnabled(); if (_rewardsReceiver == address(0)) revert InvalidRewardsReceiver(); _setRewardsReceiver(_sd, _rewardsReceiver); _registerAsOperator(_sd, msg.sender, _blsKey, _blsRegistrationSignature, _rewardsReceiver); _sd.avsDirectoryContract.registerOperatorToAVS(msg.sender, _operatorSignature); } function unregisterAsOperator() external onlyRegisteredOperator whenFlowNotPaused(PauserRolesLibrary.REGISTRATION_FLOW) nonReentrant { AvsGovernanceStorageData storage _sd = _getStorage(); _unregisterAsOperator(msg.sender); _sd.avsDirectoryContract.deregisterOperatorFromAVS(msg.sender); } // only supported on L1 function queueRewardsReceiverModification(address _newRewardsReceiver) external onlyRegisteredOperator whenFlowNotPaused(PauserRolesLibrary.OPERATOR_SET_REWARDS_RECEIVER_FLOW) { if (_newRewardsReceiver == address(0)) revert InvalidRewardsReceiver(); AvsGovernanceStorageData storage _sd = _getStorage(); _sd.isReqestPaymentPaused[msg.sender] = true; uint256 _modificationDelay = block.timestamp + _sd.rewardsReceiverModificationDelay; _sd.rewardsReceiverModificationDetails[msg.sender] = RewardsReceiverModificationDetails(_newRewardsReceiver, _modificationDelay); emit QueuedRewardsReceiverModification(msg.sender, _newRewardsReceiver, _modificationDelay); } function completeRewardsReceiverModification() external onlyRegisteredOperator { AvsGovernanceStorageData storage _sd = _getStorage(); if (block.timestamp < _sd.rewardsReceiverModificationDetails[msg.sender].modificationDelay) revert ModificationDelayNotPassed(); _setRewardsReceiver(_sd, _sd.rewardsReceiverModificationDetails[msg.sender].newRewardsReceiver); _sd.isReqestPaymentPaused[msg.sender] = false; _sd.rewardsReceiverModificationDetails[msg.sender] = RewardsReceiverModificationDetails(address(0), 0); } function getIsAllowlisted() external view returns (bool) { return _getStorage().isAllowlisted; } function getRewardsReceiver(address _operator) external view returns (address) { return _getStorage().rewardsReceiver[_operator]; } function avsName() external view returns (string memory) { return _getStorage().avsName; } function vault() external view returns (address) { return address(_getStorage().vault); } function minSharesForStrategy(address _strategy) external view returns (uint256) { return _getStorage().minSharesPerStrategy[_strategy]; } function minVotingPower() external view returns (uint256) { return _getStorage().minVotingPower; } function maxEffectiveBalance() external view returns (uint256) { return _getStorage().maxEffectiveBalance; } function strategies() external view returns (address[] memory) { return _getStorage().strategies; } function strategyMultiplier(address _strategy) external view returns (uint256) { return _getStorage().multipliers[_strategy]; } function votingPower(address _operator) external view returns (uint256) { AvsGovernanceStorageData storage _sd = _getStorage(); (/*IAvsGovernance.StrategyShares[] memory _minSharesPerStrategyList*/, IAvsGovernance.StrategyMultiplier[] memory _strategyMultipliers) = _getListOfMinSharesPerStrategyAndMultipliers(_sd); return _getVotingPower(_sd, _operator, _strategyMultipliers); } // -------------------- Layer 2 Interface -------------------- // /// @dev Can only be called by AttestationCenter::requestPayment using MessageHandler, pauseFlow protection is enforced on AttestationCenter. function withdrawRewards(address _operator, uint256 _lastPayedTask, uint256 _feeToClaim) external onlyRole(RolesLibrary.MESSAGE_HANDLER) { AvsGovernanceStorageData storage _sd = _getStorage(); if(_sd.isReqestPaymentPaused[_operator]) { _triggerL2Clearance(_sd, _operator, _lastPayedTask, 0); } else { IVault _vault = _sd.vault; address _rewardsReceiver = _sd.rewardsReceiver[_operator]; bool _success = _withdrawRewards(_operator, _rewardsReceiver, _lastPayedTask, _feeToClaim, _vault); if(!_success) _feeToClaim = 0; _triggerL2Clearance(_sd, _operator, _lastPayedTask, _feeToClaim); } } /// @dev Can only be called by AttestationCenter::requestPayment using MessageHandler, pauseFlow protection is enforced on AttestationCenter. function withdrawBatchRewards(PaymentRequestMessage[] memory _operators, uint256 _lastPayedTask) external onlyRole(RolesLibrary.MESSAGE_HANDLER) { AvsGovernanceStorageData storage _sd = _getStorage(); IVault _vault = _sd.vault; PaymentRequestMessage memory _paymentRequestMessage; for(uint256 i = 0; i<_operators.length; i++) { _paymentRequestMessage = _operators[i]; address _operator = _paymentRequestMessage.operator; if(_operator == address(0)) break; address _rewardsReceiver = _sd.rewardsReceiver[_operator]; bool _success = _withdrawRewards(_operator, _rewardsReceiver, _lastPayedTask, _paymentRequestMessage.feeToClaim, _vault); if(!_success) _operators[i].feeToClaim = 0; } _triggerL2BatchClearance(_sd, _operators, _lastPayedTask); } function isOperatorRegistered(address operator) external view returns (bool) { return _getStorage().isOperatorRegistered[operator] != 0; } function numOfActiveOperators() external view returns (uint256) { return _getStorage().numOfActiveOperators; } //@obsolete - need to use numOfActiveOperators function numOfOperators() external view returns (uint256){ return _getStorage().numOfActiveOperators; } // -------------------- AvsGovernance Multisig Interface -------------------- // /// @inheritdoc IAvsGovernance function setNumOfOperatorsLimit(uint256 _newLimitOfNumOfOperators) external onlyRole(RolesLibrary.AVS_GOVERNANCE_MULTISIG) { AvsGovernanceStorageData storage _sd = _getStorage(); uint256 _numOfActiveOperators = _sd.numOfActiveOperators; if (_numOfActiveOperators > _newLimitOfNumOfOperators) revert NumOfActiveOperatorsIsGreaterThanNumOfOperatorLimit(_numOfActiveOperators, _newLimitOfNumOfOperators); _sd.numOfOperatorsLimit = _newLimitOfNumOfOperators; emit SetNumOfOperatorsLimit(_newLimitOfNumOfOperators); } function depositERC20(uint256 _amount) external { _getStorage().vault.depositERC20(msg.sender, _amount); } function setAvsName(string calldata _avsName) external onlyRole(RolesLibrary.AVS_GOVERNANCE_MULTISIG) { _setAvsName(_getStorage(), _avsName); } function setRewardsReceiverModificationDelay(uint256 _rewardsReceiverModificationDelay) external onlyRole(RolesLibrary.AVS_GOVERNANCE_MULTISIG) { _getStorage().rewardsReceiverModificationDelay = _rewardsReceiverModificationDelay; emit SetRewardsReceiverModificationDelay(_rewardsReceiverModificationDelay); } function transferAvsGovernanceMultisig(address _newAvsGovernanceMultisig) external onlyRole(RolesLibrary.AVS_GOVERNANCE_MULTISIG) { _revokeRole(RolesLibrary.AVS_GOVERNANCE_MULTISIG, msg.sender); _grantRole(RolesLibrary.AVS_GOVERNANCE_MULTISIG, _newAvsGovernanceMultisig); emit SetAvsGovernanceMultisig(_newAvsGovernanceMultisig); } function setIsAllowlisted(bool _isAllowlisted) external onlyRole(RolesLibrary.AVS_GOVERNANCE_MULTISIG) { _getStorage().isAllowlisted = _isAllowlisted; emit SetIsAllowlisted(_isAllowlisted); } function setAvsGovernanceLogic(IAvsGovernanceLogic _avsGovernanceLogic) external onlyRole(RolesLibrary.AVS_GOVERNANCE_MULTISIG) whenFlowNotPaused(PauserRolesLibrary.SET_AVS_LOGIC_FLOW) { _getStorage().avsGovernanceLogic = _avsGovernanceLogic; emit SetAvsGovernanceLogic(address(_avsGovernanceLogic)); } function setAvsGovernanceMultiplierSyncer(address _newAvsGovernanceMultiplierSyncer) external onlyRole(RolesLibrary.AVS_GOVERNANCE_MULTISIG) { AvsGovernanceStorageData storage _sd = _getStorage(); _revokeRole(RolesLibrary.MULTIPLIER_SYNCER, _sd.avsGovernanceMultiplierSyncer); _grantRole(RolesLibrary.MULTIPLIER_SYNCER, _newAvsGovernanceMultiplierSyncer); _sd.avsGovernanceMultiplierSyncer = _newAvsGovernanceMultiplierSyncer; emit SetAvsGovernanceMultiplierSyncer(_newAvsGovernanceMultiplierSyncer); } function setSupportedStrategies(address[] calldata _strategies) external onlyRole(RolesLibrary.AVS_GOVERNANCE_MULTISIG) whenFlowNotPaused(PauserRolesLibrary.SET_SUPPORTED_STRATEGIES_FLOW){ _setSupportedStrategies(_getStorage(), _strategies); } function setMinVotingPower(uint256 _minVotingPower) external onlyRole(RolesLibrary.AVS_GOVERNANCE_MULTISIG) { _getStorage().minVotingPower = _minVotingPower; emit MinVotingPowerSet(_minVotingPower); } function setMaxEffectiveBalance(uint256 _maxBalance) external onlyRole(RolesLibrary.AVS_GOVERNANCE_MULTISIG) { _getStorage().maxEffectiveBalance = _maxBalance; emit MaxEffectiveBalanceSet(_maxBalance); } function setMinSharesForStrategy(address _strategy, uint256 _minShares) external onlyRole(RolesLibrary.AVS_GOVERNANCE_MULTISIG) { AvsGovernanceStorageData storage _sd = AvsGovernanceStorage.load(); bool _strategyFound = false; for (uint256 i = 0; i < _sd.strategies.length; i++) { if (_sd.strategies[i] == _strategy) { _strategyFound = true; break; } } if (!_strategyFound) revert InvalidStrategy(); _sd.minSharesPerStrategy[_strategy] = _minShares; emit MinSharesPerStrategySet(_strategy, _minShares); } // -------------------- Operations Multisig Interface -------------------- // function transferMessageHandler(address _newMessageHandler) external onlyRole(RolesLibrary.OPERATIONS_MULTISIG) { AvsGovernanceStorageData storage _sd = _getStorage(); _revokeRole(RolesLibrary.MESSAGE_HANDLER, address(_sd.messageHandler)); _grantRole(RolesLibrary.MESSAGE_HANDLER, _newMessageHandler); _sd.messageHandler = IMessageHandler(_newMessageHandler); emit SetMessageHandler(_newMessageHandler); } function setOthenticRegistry(IOthenticRegistry _othenticRegistry) external onlyRole(RolesLibrary.OPERATIONS_MULTISIG) { _getStorage().othenticRegistry = _othenticRegistry; emit SetOthenticRegistry(address(_othenticRegistry)); } function setAllowlistSigner(address _allowlistSigner) external onlyRole(RolesLibrary.OPERATIONS_MULTISIG) { _getStorage().allowlistSigner = _allowlistSigner; emit SetAllowlistSigner(_allowlistSigner); } function setBLSAuthSingleton(address _blsAuthSingleton) external onlyRole(RolesLibrary.OPERATIONS_MULTISIG) { _getStorage().blsAuthSingleton = _blsAuthSingleton; emit BLSAuthSingletonSet(_blsAuthSingleton); } // -------------------- Avs Governance Multiplier Syncer Interface -------------------- /// function setStrategyMultiplier(StrategyMultiplier calldata _strategyMultiplier) external onlyRole(RolesLibrary.MULTIPLIER_SYNCER) { _setStrategyMultiplier(_getStorage(), _strategyMultiplier); } function setStrategyMultiplierBatch(StrategyMultiplier[] calldata _strategyMultipliers) external onlyRole(RolesLibrary.MULTIPLIER_SYNCER) { AvsGovernanceStorageData storage _sd = _getStorage(); for(uint i = 0; i < _strategyMultipliers.length; i++) { _setStrategyMultiplier(_sd, _strategyMultipliers[i]); } } // -------------------- IServiceManager Interface -------------------- // function updateAVSMetadataURI(string calldata metadataURI) external onlyRole(RolesLibrary.AVS_GOVERNANCE_MULTISIG) { _getStorage().avsDirectoryContract.updateAVSMetadataURI(metadataURI); } function getDefaultStrategies() external view returns (address[] memory) { return _getDefaultStrategies(_getStorage()); } function getOperatorRestakedStrategies(address _operator) external view returns (address[] memory) { AvsGovernanceStorageData storage _sd = _getStorage(); return _sd.othenticRegistry.getOperatorRestakedStrategies(_operator, _sd.strategies); } function getNumOfOperatorsLimit() external view returns (uint256 numOfOperatorsLimitView) { return _getStorage().numOfOperatorsLimit; } // @obsolete - use votingPower instead function numOfShares(address _operator) external view returns (uint256) { AvsGovernanceStorageData storage _sd = _getStorage(); return _sd.othenticRegistry.getOperatorShares(_operator, _sd.strategies); } function getRestakeableStrategies() external view returns (address[] memory) { return _getStorage().strategies; } function avsDirectory() external view returns (address) { return address(_getStorage().avsDirectoryContract); } // =============================================================== // // INTERNAL FUNCTIONS function _getStorage() internal pure returns (AvsGovernanceStorageData storage _sd) { return AvsGovernanceStorage.load(); } function _getListOfMinSharesPerStrategyAndMultipliers(AvsGovernanceStorageData storage _sd) internal view returns (IAvsGovernance.StrategyShares[] memory, IAvsGovernance.StrategyMultiplier[] memory) { address[] memory _strategies = _sd.strategies; IAvsGovernance.StrategyShares[] memory _minSharesPerStrategyList = new IAvsGovernance.StrategyShares[](_strategies.length); IAvsGovernance.StrategyMultiplier[] memory _strategyMultipliers = new IAvsGovernance.StrategyMultiplier[](_strategies.length); for (uint256 i = 0; i < _strategies.length;) { address _strategy = _strategies[i]; _minSharesPerStrategyList[i] = IAvsGovernance.StrategyShares(_strategy, _sd.minSharesPerStrategy[_strategy]); uint256 _multiplier = _sd.multipliers[_strategy]; if (_multiplier == 0) { _multiplier = 1; } _strategyMultipliers[i] = IAvsGovernance.StrategyMultiplier(_strategy, _multiplier); unchecked {++i;} } return (_minSharesPerStrategyList, _strategyMultipliers); } function _registerAsOperator(AvsGovernanceStorageData storage _sd, address _operator, uint256[4] calldata _blsKey, BLSAuthLibrary.Signature memory _blsRegistrationSignature, address _rewardsReceiver) internal { uint256 _numOfOperatorsLimit = _sd.numOfOperatorsLimit; if (_sd.numOfActiveOperators >= _numOfOperatorsLimit) revert NumOfOperatorsLimitReached(_numOfOperatorsLimit); if (!IBLSAuthSingleton(_sd.blsAuthSingleton).isValidSignature(_blsRegistrationSignature, _operator, address(this), _blsKey)) revert InvalidBlsRegistrationSignature(); IAvsGovernanceLogic _avsGovernanceLogic = _sd.avsGovernanceLogic; bool _isAvsGovernanceLogicSet = address(_avsGovernanceLogic) != address(0); (IAvsGovernance.StrategyShares[] memory _minSharesPerStrategyList, IAvsGovernance.StrategyMultiplier[] memory _strategyMultipliers) = _getListOfMinSharesPerStrategyAndMultipliers(_sd); uint256 _votingPower = _getVotingPower(_sd, _operator, _strategyMultipliers); { bool _isActive = (_votingPower >= _sd.minVotingPower) && _sd.othenticRegistry.isValidNumOfShares(_operator, _minSharesPerStrategyList); if (!_isActive) revert NotEnoughVotingPower(); if (_isAvsGovernanceLogicSet) { _avsGovernanceLogic.beforeOperatorRegistered(_operator, _votingPower, _blsKey, _rewardsReceiver); } _triggerL2OperatorRegistration(_sd, _operator, _votingPower, _blsKey, _rewardsReceiver); ++_sd.numOfActiveOperators; _sd.isOperatorRegistered[_operator] = 1; } if (_isAvsGovernanceLogicSet) { _avsGovernanceLogic.afterOperatorRegistered(_operator, _votingPower, _blsKey, _rewardsReceiver); } emit OperatorRegistered(_operator, _blsKey); } function _unregisterAsOperator(address _operator) internal { AvsGovernanceStorageData storage _sd = _getStorage(); IAvsGovernanceLogic _avsGovernanceLogic = _sd.avsGovernanceLogic; bool _isAvsGovernanceLogicSet = address(_avsGovernanceLogic) != address(0); if (_isAvsGovernanceLogicSet) { _avsGovernanceLogic.beforeOperatorUnregistered(_operator); } _triggerL2Unregister(_sd, _operator); --_sd.numOfActiveOperators; _sd.isOperatorRegistered[_operator] = 0; if (_isAvsGovernanceLogicSet) { _avsGovernanceLogic.afterOperatorUnregistered(_operator); } emit OperatorUnregistered(_operator); } function _triggerL2OperatorRegistration(AvsGovernanceStorageData storage _sd, address _operator, uint256 _votingPower, uint256[4] calldata _blsKey, address _rewardsReceiver) internal { bytes memory _registerOperatorMessage = MessagesLibrary.BuildRegisterOperatorMessage(_operator, _votingPower, _blsKey, _rewardsReceiver); _sd.messageHandler.sendMessage(_registerOperatorMessage); } function _triggerL2Unregister(AvsGovernanceStorageData storage _sd, address _operator) internal { bytes memory _unRegisterMessage = MessagesLibrary.BuildUnregisterRequestMessage(_operator); _sd.messageHandler.sendMessage(_unRegisterMessage); } function _triggerL2Clearance(AvsGovernanceStorageData storage _sd, address _operator, uint256 _lastPayedTask, uint256 _feeToClaim) internal { bytes memory _clearMessage = MessagesLibrary.BuildClearRequestMessage(_operator, _lastPayedTask, _feeToClaim); _sd.messageHandler.sendMessage(_clearMessage); } function _triggerL2BatchClearance(AvsGovernanceStorageData storage _sd, PaymentRequestMessage[] memory _operators, uint256 _lastPayedTask) internal { bytes memory _clearMessage = MessagesLibrary.BuildBatchClearRequestMessage(abi.encode(_operators), _lastPayedTask); _sd.messageHandler.sendMessage(_clearMessage); } function _setSupportedStrategies(AvsGovernanceStorageData storage _sd, address[] memory _strategies) internal { delete _sd.strategies; for (uint256 i = 0; i < _strategies.length;) { address _strategy = _strategies[i]; if (_strategy == address(0)) revert InvalidStrategy(); _sd.strategies.push(_strategy); unchecked { ++i; } } emit SetSupportedStrategies(_strategies); } // PRIVATE FUNCTIONS function _getVotingPower(AvsGovernanceStorageData storage _sd, address _operator, IAvsGovernance.StrategyMultiplier[] memory _strategyMultipliers) private view returns (uint256) { uint256 _maxEffBalance = _sd.maxEffectiveBalance; uint256 _votingPower = _sd.othenticRegistry.getVotingPower(_operator, _strategyMultipliers); if (_votingPower > _maxEffBalance && _maxEffBalance > 0) { _votingPower = _maxEffBalance; } return _votingPower; } function _getDefaultStrategies(AvsGovernanceStorageData storage _sd) private view returns (address[] memory) { return _sd.othenticRegistry.getDefaultStrategies(block.chainid); } function _withdrawRewards(address _operator, address _rewardsReceiver, uint256 _lastPayedTask, uint256 _feeToClaim, IVault _vault) private returns (bool _success) { if(_rewardsReceiver != address(0)) { _success = _vault.withdrawRewards(_rewardsReceiver, _lastPayedTask, _feeToClaim); } else { ///TODO: This is temporary and all existing operator must set a rewards receiver address. _success = _vault.withdrawRewards(_operator, _lastPayedTask, _feeToClaim); } } function _setStrategyMultiplier(AvsGovernanceStorageData storage _sd, StrategyMultiplier calldata _strategyMultiplier) private { _sd.multipliers[_strategyMultiplier.strategy] = _strategyMultiplier.multiplier; emit SetStrategyMultiplier(_strategyMultiplier.strategy, _strategyMultiplier.multiplier); } function _setRewardsReceiver(AvsGovernanceStorageData storage _sd, address _rewardsReceiver) private { _sd.rewardsReceiver[msg.sender] = _rewardsReceiver; emit SetRewardsReceiver(msg.sender, _rewardsReceiver); } function _setAvsName(AvsGovernanceStorageData storage _sd, string calldata _avsName) private { _sd.avsName = _avsName; emit SetAvsName(_avsName); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol"; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {ERC165Upgradeable} from "../utils/introspection/ERC165Upgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControl, ERC165Upgradeable { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /// @custom:storage-location erc7201:openzeppelin.storage.AccessControl struct AccessControlStorage { mapping(bytes32 role => RoleData) _roles; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControl")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800; function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) { assembly { $.slot := AccessControlStorageLocation } } /** * @dev Modifier that checks that an account has a specific role. Reverts * with an {AccessControlUnauthorizedAccount} error including the required role. */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); return $._roles[role].hasRole[account]; } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()` * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier. */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account` * is missing `role`. */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert AccessControlUnauthorizedAccount(account, role); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) { AccessControlStorage storage $ = _getAccessControlStorage(); return $._roles[role].adminRole; } /** * @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. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @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 revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address callerConfirmation) public virtual { if (callerConfirmation != _msgSender()) { revert AccessControlBadConfirmation(); } _revokeRole(role, callerConfirmation); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { AccessControlStorage storage $ = _getAccessControlStorage(); bytes32 previousAdminRole = getRoleAdmin(role); $._roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); if (!hasRole(role, account)) { $._roles[role].hasRole[account] = true; emit RoleGranted(role, account, _msgSender()); return true; } else { return false; } } /** * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { AccessControlStorage storage $ = _getAccessControlStorage(); if (hasRole(role, account)) { $._roles[role].hasRole[account] = false; emit RoleRevoked(role, account, _msgSender()); return true; } else { return false; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; /// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard struct ReentrancyGuardStorage { uint256 _status; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00; function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) { assembly { $.slot := ReentrancyGuardStorageLocation } } /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); $._status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // On the first call to nonReentrant, _status will be NOT_ENTERED if ($._status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail $._status = ENTERED; } function _nonReentrantAfter() private { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) $._status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage(); return $._status == ENTERED; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.8.20; /*______ __ __ __ __ / \ / | / | / | / | /$$$$$$ | _$$ |_ $$ |____ ______ _______ _$$ |_ $$/ _______ $$ | $$ |/ $$ | $$ \ / \ / \ / $$ | / | / | $$ | $$ |$$$$$$/ $$$$$$$ |/$$$$$$ |$$$$$$$ |$$$$$$/ $$ |/$$$$$$$/ $$ | $$ | $$ | __ $$ | $$ |$$ $$ |$$ | $$ | $$ | __ $$ |$$ | $$ \__$$ | $$ |/ |$$ | $$ |$$$$$$$$/ $$ | $$ | $$ |/ |$$ |$$ \_____ $$ $$/ $$ $$/ $$ | $$ |$$ |$$ | $$ | $$ $$/ $$ |$$ | $$$$$$/ $$$$/ $$/ $$/ $$$$$$$/ $$/ $$/ $$$$/ $$/ $$$$$$$/ */ /** * @author Othentic Labs LTD. */ interface IMessageHandler { function sendMessage(bytes memory _payload) external; function deposit() external payable; function nilify(uint64 _nonce) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.8.20; /*______ __ __ __ __ / \ / | / | / | / | /$$$$$$ | _$$ |_ $$ |____ ______ _______ _$$ |_ $$/ _______ $$ | $$ |/ $$ | $$ \ / \ / \ / $$ | / | / | $$ | $$ |$$$$$$/ $$$$$$$ |/$$$$$$ |$$$$$$$ |$$$$$$/ $$ |/$$$$$$$/ $$ | $$ | $$ | __ $$ | $$ |$$ $$ |$$ | $$ | $$ | __ $$ |$$ | $$ \__$$ | $$ |/ |$$ | $$ |$$$$$$$$/ $$ | $$ | $$ |/ |$$ |$$ \_____ $$ $$/ $$ $$/ $$ | $$ |$$ |$$ | $$ | $$ $$/ $$ |$$ | $$$$$$/ $$$$/ $$/ $$/ $$$$$$$/ $$/ $$/ $$$$/ $$/ $$$$$$$/ */ import { ISignatureUtils } from "@eigenlayer/contracts/interfaces/ISignatureUtils.sol"; import { BLSAuthLibrary } from "@othentic/NetworkManagement/Common/BLSAuthLibrary.sol"; import { IAccessControl } from "openzeppelin-contracts/contracts/access/IAccessControl.sol"; /** * @author Othentic Labs LTD. * @notice Terms of Service: https://www.othentic.xyz/terms-of-service */ interface IAvsGovernance is IAccessControl { struct StrategyMultiplier { address strategy; uint256 multiplier; } struct StrategyShares { address strategy; uint256 shares; } struct Operator { uint256[4] blsKey; uint256 numOfShares; bool isAllowlisted; bool isActive; } struct PaymentRequestMessage { address operator; uint256 feeToClaim; } struct RewardsReceiverModificationDetails { address newRewardsReceiver; uint256 modificationDelay; } struct InitializationParams { address avsGovernanceMultisigOwner; address operationsMultisig; address communityMultisig; address othenticRegistry; address messageHandler; address vault; address avsDirectoryContract; address allowlistSigner; string avsName; address blsAuthSingleton; } event SetToken(address token); event SetRewardsReceiverModificationDelay(uint256 modificationDelay); event SetAvsGovernanceLogic(address avsGovernanceLogic); event SetAvsGovernanceMultisig(address newAvsGovernanceMultisig); event SetIsAllowlisted(bool isAllowlisted); event SetMessageHandler(address newMessageHandler); event SetOthenticRegistry(address othenticRegistry); event SetAllowlistSigner(address allowlistSigner); event SetSupportedStrategies(address[] strategies); event SetAvsName(string avsName); event QueuedRewardsReceiverModification(address operator, address receiver, uint256 delay); event SetRewardsReceiver(address operator, address receiver); event OperatorRegistered(address indexed operator, uint256[4] blsKey); event OperatorUnregistered(address operator); event SetAvsGovernanceMultiplierSyncer(address avsGovernanceMultiplierSyncer); event SetStrategyMultiplier(address strategy, uint256 multiplier); event MinVotingPowerSet(uint256 minVotingPower); event MinSharesPerStrategySet(address strategy, uint256 minShares); event MaxEffectiveBalanceSet(uint256 maxEffectiveBalance); event BLSAuthSingletonSet(address blsAuthSingleton); /** * @dev Emitted when numOfOperatorsLimit is updated. * @notice Number of operators limit can not be set below the number of active operators. * @param newLimitOfNumOfOperators The updated number of oprators limit. */ event SetNumOfOperatorsLimit(uint256 newLimitOfNumOfOperators); error Unauthorized(string message); /** @notice Number of operators limit can not be set below the number of active operators. * @dev Restricted use to AVS_GOVERNANCE_MULTISIG role. * @param numOfOperatorsLimit Current number of operators limit. * @param numOfActiveOperators (Can not be set below the number of active operators). */ error NumOfActiveOperatorsIsGreaterThanNumOfOperatorLimit(uint256 numOfOperatorsLimit, uint256 numOfActiveOperators); /** Operator Number is has reached the defined limit. Consider contacting the AVS admin to increase the limit. * @param numOfOperatorsLimit Number of operators limit (AvsGovernanceStorageData.numOfOperatorsLimit). */ error NumOfOperatorsLimitReached(uint256 numOfOperatorsLimit); error OperatorNotRegistered(); error OperatorAlreadyRegistered(); error InvalidBlsRegistrationSignature(); error InvalidRewardsReceiver(); error AllowlistDisabled(); error AllowlistEnabled(); error InvalidAllowlistAuthToken(); error ModificationDelayNotPassed(); error InvalidSlashingRate(); error InvalidStrategy(); error AccessControlInvalidMultiplierSyncer(); error InvalidMultiplierNotSet(); error NotEnoughVotingPower(); function isOperatorRegistered(address operator) external view returns (bool); function numOfActiveOperators() external view returns (uint256); //@obsolete - need to use numOfActiveOperators function numOfOperators() external view returns (uint256); /** * @dev Increases the limit of number of operators of the AVS. * @dev Restricted use to AVS_GOVERNANCE_MULTISIG role. * @notice Number of operators limit can not be set below the number of active operators. * @param newLimitOfNumOfOperators Updated number of operators limit. */ function setNumOfOperatorsLimit(uint256 newLimitOfNumOfOperators) external; function avsName() external view returns (string memory); function vault() external view returns (address); function getIsAllowlisted() external view returns (bool); function getRewardsReceiver(address operator) external view returns (address); function strategies() external view returns (address[] memory); function strategyMultiplier(address _strategy) external view returns (uint256); function registerAsOperator(uint256[4] calldata _blsKey, address _rewardsReceiver, ISignatureUtils.SignatureWithSaltAndExpiry memory _operatorSignature, BLSAuthLibrary.Signature calldata _blsRegistrationSignature) external; function registerAsAllowedOperator(uint256[4] calldata _blsKey, bytes calldata _authToken, address _rewardsReceiver, ISignatureUtils.SignatureWithSaltAndExpiry memory _operatorSignature, BLSAuthLibrary.Signature calldata _blsRegistrationSignature) external; function queueRewardsReceiverModification(address _rewardsReceiver) external; function completeRewardsReceiverModification() external; function withdrawRewards(address _operator, uint256 _lastPayedTask, uint256 _feeToClaim) external; function withdrawBatchRewards(PaymentRequestMessage[] memory _operators, uint256 _lastPayedTask) external; function transferAvsGovernanceMultisig(address _newAvsGovernanceMultisig) external; // @obsolete - use votingPower function numOfShares(address _operator) external view returns (uint256); function votingPower(address _operator) external view returns (uint256); function getDefaultStrategies() external view returns (address[] memory); function getNumOfOperatorsLimit() external view returns (uint256 numOfOperatorsLimitView); function setMinSharesForStrategy(address _strategy, uint256 _minNumOfShares) external; // IServiceManager interface function updateAVSMetadataURI(string memory _metadataURI) external; function getOperatorRestakedStrategies(address operator) external view returns (address[] memory); function getRestakeableStrategies() external view returns (address[] memory); function avsDirectory() external view returns (address); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.8.20; import "@othentic/NetworkManagement/L1/interfaces/IAvsGovernance.sol"; /*______ __ __ __ __ / \ / | / | / | / | /$$$$$$ | _$$ |_ $$ |____ ______ _______ _$$ |_ $$/ _______ $$ | $$ |/ $$ | $$ \ / \ / \ / $$ | / | / | $$ | $$ |$$$$$$/ $$$$$$$ |/$$$$$$ |$$$$$$$ |$$$$$$/ $$ |/$$$$$$$/ $$ | $$ | $$ | __ $$ | $$ |$$ $$ |$$ | $$ | $$ | __ $$ |$$ | $$ \__$$ | $$ |/ |$$ | $$ |$$$$$$$$/ $$ | $$ | $$ |/ |$$ |$$ \_____ $$ $$/ $$ $$/ $$ | $$ |$$ |$$ | $$ | $$ $$/ $$ |$$ | $$$$$$/ $$$$/ $$/ $$/ $$$$$$$/ $$/ $$/ $$$$/ $$/ $$$$$$$/ */ /** * @author Othentic Labs LTD. * @notice Terms of Service: https://www.othentic.xyz/terms-of-service */ interface IOthenticRegistry { event OperatorOptIn(address operator, uint256 shares, uint32 serveUntilBlock); event OperatorFreezed(uint256 avsId, address operator); event AvsRegistered(uint256 id, address avsGovernance); event AvsOptIn(address avsGovernance, string avsName); error InvalidBlockId(); function getOperatorRestakedStrategies(address _operator, address[] memory _allStrategies) external view returns (address[] memory); function numOfShares(address _operator, address _strategy) external view returns (uint256 amount); function getOperatorShares(address _operator, address[] memory _strategies) external view returns (uint256); function getAvsGovernance(uint256 _id) external view returns (address avsGovernance); function getAvsGovernanceId(address _avsGovernance) external view returns (uint256 id); function freezeOperator(address _operator) external; function approveAvs(address _avsGovernance) external returns (uint256 id); function registerAvs(string memory _avsName) external; function isValidNumOfShares(address _operator, IAvsGovernance.StrategyShares[] calldata _minSharesPerStrategyList) external view returns (bool); function getVotingPower(address _operator, IAvsGovernance.StrategyMultiplier[] calldata _strategyMultipliers) external view returns (uint256); function getDefaultStrategies(uint _chainid) external pure returns (address[] memory); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.8.20; /*______ __ __ __ __ / \ / | / | / | / | /$$$$$$ | _$$ |_ $$ |____ ______ _______ _$$ |_ $$/ _______ $$ | $$ |/ $$ | $$ \ / \ / \ / $$ | / | / | $$ | $$ |$$$$$$/ $$$$$$$ |/$$$$$$ |$$$$$$$ |$$$$$$/ $$ |/$$$$$$$/ $$ | $$ | $$ | __ $$ | $$ |$$ $$ |$$ | $$ | $$ | __ $$ |$$ | $$ \__$$ | $$ |/ |$$ | $$ |$$$$$$$$/ $$ | $$ | $$ |/ |$$ |$$ \_____ $$ $$/ $$ $$/ $$ | $$ |$$ |$$ | $$ | $$ $$/ $$ |$$ | $$$$$$/ $$$$/ $$/ $$/ $$$$$$$/ $$/ $$/ $$$$/ $$/ $$$$$$$/ */ /** * @author Othentic Labs LTD. * @notice Terms of Service: https://www.othentic.xyz/terms-of-service */ interface IVault { event RewardsDeposited(address ownerVault, uint256 amount); event RewardWithdrawn(address operator, uint256 lastPayedTask, uint256 feeToClaim); event RewardWithdrawalFailed(address operator, uint256 lastPayedTask, uint256 feeToClaim); error NativeETHNotSupported(); error ERC20NotSupported(); error ZeroValueNotAllowed(); error InvalidAmount(); error TransferToOtTreasuryFailed(); error InvalidProtocolFee(); error TransferFailed(); function depositNative() external payable; function depositERC20(address _from, uint256 _amount) external; function depositERC20WithCallback(address _from, uint256 _amount, bytes calldata _data) external; function withdrawRewards(address _operator, uint256 _lastPayedTask, uint256 _feeToClaim) external returns (bool success); function getToken() external view returns (address rewardsToken); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.8.20; /*______ __ __ __ __ / \ / | / | / | / | /$$$$$$ | _$$ |_ $$ |____ ______ _______ _$$ |_ $$/ _______ $$ | $$ |/ $$ | $$ \ / \ / \ / $$ | / | / | $$ | $$ |$$$$$$/ $$$$$$$ |/$$$$$$ |$$$$$$$ |$$$$$$/ $$ |/$$$$$$$/ $$ | $$ | $$ | __ $$ | $$ |$$ $$ |$$ | $$ | $$ | __ $$ |$$ | $$ \__$$ | $$ |/ |$$ | $$ |$$$$$$$$/ $$ | $$ | $$ |/ |$$ |$$ \_____ $$ $$/ $$ $$/ $$ | $$ |$$ |$$ | $$ | $$ $$/ $$ |$$ | $$$$$$/ $$$$/ $$/ $$/ $$$$$$$/ $$/ $$/ $$$$/ $$/ $$$$$$$/ */ /** * @author Othentic Labs LTD. */ import "@othentic/NetworkManagement/Common/PauserRolesLibrary.sol"; import "@othentic/NetworkManagement/Common/RolesLibrary.sol"; import "@othentic/NetworkManagement/Common/PausableFlows.sol"; contract AvsGovernancePausable is PausableFlows { // INITIALIZER function __AvsGovernancePausable_init(address _avsGovernanceMultisigOwner, address _operationsMultisig, address _communityMultisig) internal onlyInitializing { __AccessControl_init(); _grantAvsGovernanceRoles(_avsGovernanceMultisigOwner, _operationsMultisig, _communityMultisig); renounceRole(DEFAULT_ADMIN_ROLE, address(msg.sender)); } function _grantAvsGovernanceRoles(address _avsGovernanceMultisigOwner, address _operationsMultisig, address _communityMultisig) private { _grantRole(PauserRolesLibrary.REGISTRATION_FLOW, _avsGovernanceMultisigOwner); _grantRole(PauserRolesLibrary.REGISTRATION_FLOW, _operationsMultisig); _grantRole(PauserRolesLibrary.REGISTRATION_FLOW, _communityMultisig); _grantRole(PauserRolesLibrary.OPERATOR_SET_REWARDS_RECEIVER_FLOW, _avsGovernanceMultisigOwner); _grantRole(PauserRolesLibrary.OPERATOR_SET_REWARDS_RECEIVER_FLOW, _operationsMultisig); _grantRole(PauserRolesLibrary.SET_SUPPORTED_STRATEGIES_FLOW, _avsGovernanceMultisigOwner); _grantRole(PauserRolesLibrary.SET_SUPPORTED_STRATEGIES_FLOW, _operationsMultisig); _grantRole(PauserRolesLibrary.SET_SUPPORTED_STRATEGIES_FLOW, _communityMultisig); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; /** * @title The interface for common signature utilities. * @author Layr Labs, Inc. * @notice Terms of Service: https://docs.eigenlayer.xyz/overview/terms-of-service */ interface ISignatureUtils { // @notice Struct that bundles together a signature and an expiration time for the signature. Used primarily for stack management. struct SignatureWithExpiry { // the signature itself, formatted as a single bytes object bytes signature; // the expiration timestamp (UTC) of the signature uint256 expiry; } // @notice Struct that bundles together a signature, a salt for uniqueness, and an expiration time for the signature. Used primarily for stack management. struct SignatureWithSaltAndExpiry { // the signature itself, formatted as a single bytes object bytes signature; // the salt used to generate the signature bytes32 salt; // the expiration timestamp (UTC) of the signature uint256 expiry; } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.8.20; /*______ __ __ __ __ / \ / | / | / | / | /$$$$$$ | _$$ |_ $$ |____ ______ _______ _$$ |_ $$/ _______ $$ | $$ |/ $$ | $$ \ / \ / \ / $$ | / | / | $$ | $$ |$$$$$$/ $$$$$$$ |/$$$$$$ |$$$$$$$ |$$$$$$/ $$ |/$$$$$$$/ $$ | $$ | $$ | __ $$ | $$ |$$ $$ |$$ | $$ | $$ | __ $$ |$$ | $$ \__$$ | $$ |/ |$$ | $$ |$$$$$$$$/ $$ | $$ | $$ |/ |$$ |$$ \_____ $$ $$/ $$ $$/ $$ | $$ |$$ |$$ | $$ | $$ $$/ $$ |$$ | $$$$$$/ $$$$/ $$/ $$/ $$$$$$$/ $$/ $$/ $$$$/ $$/ $$$$$$$/ */ import { IMessageHandler } from "@othentic/NetworkManagement/Common/interfaces/IMessageHandler.sol"; import { IVault } from "@othentic/NetworkManagement/Common/interfaces/IVault.sol"; import { IOthenticRegistry } from "@othentic/NetworkManagement/L1/interfaces/IOthenticRegistry.sol"; import { IAvsGovernanceLogic } from "@othentic/NetworkManagement/L1/interfaces/IAvsGovernanceLogic.sol"; import { IAVSDirectory } from "@eigenlayer/contracts/interfaces/IAVSDirectory.sol"; import { IAvsGovernance } from "@othentic/NetworkManagement/L1/interfaces/IAvsGovernance.sol"; struct AvsGovernanceStorageData { uint24 slashingRate; uint256 numOfActiveOperators; IMessageHandler messageHandler; IOthenticRegistry othenticRegistry; IVault vault; IAVSDirectory avsDirectoryContract; bool isAllowlisted; address allowlistSigner; mapping(address => uint256) isOperatorRegistered; // We are using uint256 for backwards compatibility IAvsGovernanceLogic avsGovernanceLogic; address[] strategies; string avsName; uint256 rewardsReceiverModificationDelay; mapping(address => bool) isReqestPaymentPaused; mapping(address => address) rewardsReceiver; mapping(address => IAvsGovernance.RewardsReceiverModificationDetails) rewardsReceiverModificationDetails; uint256 numOfOperatorsLimit; uint256 minVotingPower; uint256 maxEffectiveBalance; mapping(address => uint256) minSharesPerStrategy; mapping(address => uint256) multipliers; address avsGovernanceMultiplierSyncer; address blsAuthSingleton; } library AvsGovernanceStorage { uint256 constant private STORAGE_POSITION = uint256(keccak256("storage.avs.governance")) - 1; function load() internal pure returns (AvsGovernanceStorageData storage sd) { uint256 position = STORAGE_POSITION; assembly { sd.slot := position } } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.8.20; /** * @author Othentic Labs LTD. * @notice Terms of Service: https://www.othentic.xyz/terms-of-service * @notice Depending on the application, it may be necessary to add reentrancy gaurds to hooks */ interface IAvsGovernanceLogic { function beforeOperatorRegistered(address _operator, uint256 _votingPower, uint256[4] calldata _blsKey, address _rewardsReceiver) external; function afterOperatorRegistered(address _operator, uint256 _votingPower, uint256[4] calldata _blsKey, address _rewardsReceiver) external; function beforeOperatorUnregistered(address _operator) external; function afterOperatorUnregistered(address _operator) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.8.20; /*______ __ __ __ __ / \ / | / | / | / | /$$$$$$ | _$$ |_ $$ |____ ______ _______ _$$ |_ $$/ _______ $$ | $$ |/ $$ | $$ \ / \ / \ / $$ | / | / | $$ | $$ |$$$$$$/ $$$$$$$ |/$$$$$$ |$$$$$$$ |$$$$$$/ $$ |/$$$$$$$/ $$ | $$ | $$ | __ $$ | $$ |$$ $$ |$$ | $$ | $$ | __ $$ |$$ | $$ \__$$ | $$ |/ |$$ | $$ |$$$$$$$$/ $$ | $$ | $$ |/ |$$ |$$ \_____ $$ $$/ $$ $$/ $$ | $$ |$$ |$$ | $$ | $$ $$/ $$ |$$ | $$$$$$/ $$$$/ $$/ $$/ $$$$$$$/ $$/ $$/ $$$$/ $$/ $$$$$$$/ */ library MessagesLibrary { bytes4 internal constant CLEAR_SIG = bytes4(keccak256("CLEAR")); bytes4 internal constant BATCH_CLEAR_SIG = bytes4(keccak256("BATCH_CLEAR")); bytes4 internal constant PAYMENT_SIG = bytes4(keccak256("PAYMENT")); bytes4 internal constant BATCH_PAYMENT_SIG = bytes4(keccak256("BATCH_PAYMENT")); bytes4 internal constant REGISTER_SIG = bytes4(keccak256("REGISTER")); bytes4 internal constant UNREGISTER_SIG = bytes4(keccak256("UNREGISTER")); bytes4 internal constant UNSTAKE_SIG = bytes4(keccak256("UNSTAKE")); ////////////////////////////////////////////////////////////////// // Message Builders ////////////////////////////////////////////////////////////////// // // Tasks Manager to Network Manager messages // ///////////////////////////////////////////////////////////////// function BuildPaymentRequestMessage(address _operator, uint32 _taskNumber, uint _feeToClaim) internal pure returns (bytes memory) { return abi.encodeWithSelector(MessagesLibrary.PAYMENT_SIG, _operator, _taskNumber, _feeToClaim); } function BuildBatchPaymentRequestMessage(bytes memory _operators, uint256 _taskNumber) internal pure returns (bytes memory) { return abi.encodeWithSelector(MessagesLibrary.BATCH_PAYMENT_SIG, _operators, _taskNumber); } ////////////////////////////////////////////////////////////////// // // AvsGovernance to AttestationCenter messages // ///////////////////////////////////////////////////////////////// function BuildRegisterOperatorMessage(address _operator, uint256 _votingPower, uint[4] calldata _blsKey, address _rewardsReceiver) internal pure returns (bytes memory) { return abi.encodeWithSelector(MessagesLibrary.REGISTER_SIG, _operator, _votingPower, _blsKey, _rewardsReceiver); } function BuildUnregisterRequestMessage(address _operator) internal pure returns (bytes memory) { return abi.encodeWithSelector(MessagesLibrary.UNREGISTER_SIG, _operator); } function BuildClearRequestMessage(address _operator, uint256 _lastPaidTaskNumber, uint256 _amountClaimed) internal pure returns (bytes memory) { return abi.encodeWithSelector(MessagesLibrary.CLEAR_SIG, _operator, _lastPaidTaskNumber, _amountClaimed); } function BuildBatchClearRequestMessage(bytes memory _operators, uint256 _lastPaidTaskNumber) internal pure returns (bytes memory) { return abi.encodeWithSelector(MessagesLibrary.BATCH_CLEAR_SIG, _operators, _lastPaidTaskNumber); } ////////////////////////////////////////////////////////////////// // // L1MessageHandler // ///////////////////////////////////////////////////////////////// function ParsePaymentRequestMessage(bytes memory _message) internal pure returns (address _operator, uint256 _lastPayedTask, uint256 _feeToClaim) { return abi.decode(_message, (address, uint256, uint256)); } function ParseBatchPaymentRequestMessage(bytes memory _message) internal pure returns (bytes memory _operators, uint256 _lastPayedTask) { return abi.decode(_message, (bytes, uint256)); } ////////////////////////////////////////////////////////////////// // // L2MessageHandler // ///////////////////////////////////////////////////////////////// function ParseRegisterToAvsMessage(bytes memory _message) internal pure returns (address _operator, uint256 _votingPower, uint256[4] memory _blsKey, address _rewardsReceiver) { return abi.decode(_message, (address, uint256, uint256[4], address)); } function ParsePaymentSuccessMessage(bytes memory _message) internal pure returns (address _operator, uint256 _lastPaidTaskNumber, uint256 _amountClaimed) { return abi.decode(_message, (address, uint256, uint256)); } function ParseBatchPaymentSuccessMessage(bytes memory _message) internal pure returns (bytes memory _operators, uint256 _lastPaidTaskNumber) { return abi.decode(_message, (bytes, uint256)); } function ParseUnregisterOperatorMessage(bytes memory _message) internal pure returns (address operator) { return abi.decode(_message, (address)); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.8.20; /*______ __ __ __ __ / \ / | / | / | / | /$$$$$$ | _$$ |_ $$ |____ ______ _______ _$$ |_ $$/ _______ $$ | $$ |/ $$ | $$ \ / \ / \ / $$ | / | / | $$ | $$ |$$$$$$/ $$$$$$$ |/$$$$$$ |$$$$$$$ |$$$$$$/ $$ |/$$$$$$$/ $$ | $$ | $$ | __ $$ | $$ |$$ $$ |$$ | $$ | $$ | __ $$ |$$ | $$ \__$$ | $$ |/ |$$ | $$ |$$$$$$$$/ $$ | $$ | $$ |/ |$$ |$$ \_____ $$ $$/ $$ $$/ $$ | $$ |$$ |$$ | $$ | $$ $$/ $$ |$$ | $$$$$$/ $$$$/ $$/ $$/ $$$$$$$/ $$/ $$/ $$$$/ $$/ $$$$$$$/ */ library RolesLibrary { bytes4 internal constant AVS_GOVERNANCE_MULTISIG = bytes4(keccak256("AVS_GOVERNANCE_MULTISIG")); bytes4 internal constant AVS_GOVERNANCE = bytes4(keccak256("AVS_GOVERNANCE")); bytes4 internal constant OPERATIONS_MULTISIG = bytes4(keccak256("OPERATIONS_MULTISIG")); bytes4 internal constant COMMUNITY_MULTISIG = bytes4(keccak256("COMMUNITY_MULTISIG")); bytes4 internal constant MESSAGE_HANDLER = bytes4(keccak256("MESSAGE_HANDLER")); bytes4 internal constant ATTESTATION_CENTER = bytes4(keccak256("ATTESTATION_CENTER")); bytes4 internal constant LZ_RETRY_ROLE = bytes4(keccak256("LZ_RETRY")); bytes4 internal constant AVS_FACTORY_ROLE = bytes4(keccak256("AVS_FACTORY_ROLE")); bytes4 internal constant MULTIPLIER_SYNCER = bytes4(keccak256("MULTIPLIER_SYNCER")); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.8.20; /*______ __ __ __ __ / \ / | / | / | / | /$$$$$$ | _$$ |_ $$ |____ ______ _______ _$$ |_ $$/ _______ $$ | $$ |/ $$ | $$ \ / \ / \ / $$ | / | / | $$ | $$ |$$$$$$/ $$$$$$$ |/$$$$$$ |$$$$$$$ |$$$$$$/ $$ |/$$$$$$$/ $$ | $$ | $$ | __ $$ | $$ |$$ $$ |$$ | $$ | $$ | __ $$ |$$ | $$ \__$$ | $$ |/ |$$ | $$ |$$$$$$$$/ $$ | $$ | $$ |/ |$$ |$$ \_____ $$ $$/ $$ $$/ $$ | $$ |$$ |$$ | $$ | $$ $$/ $$ |$$ | $$$$$$/ $$$$/ $$/ $$/ $$$$$$$/ $$/ $$/ $$$$/ $$/ $$$$$$$/ */ library PauserRolesLibrary { // PAUSABLE FLOWS-FEATURES bytes4 internal constant REGISTRATION_FLOW = bytes4(keccak256("REGISTRATION_FLOW")); bytes4 internal constant PAYMENT_REQUEST_FLOW = bytes4(keccak256("PAYMENT_REQUST_FLOW")); bytes4 internal constant BATCH_PAYMENT_REQUEST_FLOW = bytes4(keccak256("BATCH_PAYMENT_REQUEST_FLOW")); bytes4 internal constant OPERATOR_SET_REWARDS_RECEIVER_FLOW = bytes4(keccak256("AVS_PAUSE_REWARD_MODIFICATION")); bytes4 internal constant SET_AVS_LOGIC_FLOW = bytes4(keccak256("SET_AVS_LOGIC_FLOW")); bytes4 internal constant SET_SUPPORTED_STRATEGIES_FLOW = bytes4(keccak256("SET_SUPPORTED_STRATEGIES_FLOW")); bytes4 internal constant TASKS_SUBMISSION_FLOW = bytes4(keccak256("TASKS_SUBMISSION_FLOW")); bytes4 internal constant CREATE_NEW_TASK_DEFINITION_FLOW = bytes4(keccak256("CREATE_NEW_TASK_DEFINITION_FLOW")); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.8.20; /*______ __ __ __ __ / \ / | / | / | / | /$$$$$$ | _$$ |_ $$ |____ ______ _______ _$$ |_ $$/ _______ $$ | $$ |/ $$ | $$ \ / \ / \ / $$ | / | / | $$ | $$ |$$$$$$/ $$$$$$$ |/$$$$$$ |$$$$$$$ |$$$$$$/ $$ |/$$$$$$$/ $$ | $$ | $$ | __ $$ | $$ |$$ $$ |$$ | $$ | $$ | __ $$ |$$ | $$ \__$$ | $$ |/ |$$ | $$ |$$$$$$$$/ $$ | $$ | $$ |/ |$$ |$$ \_____ $$ $$/ $$ $$/ $$ | $$ |$$ |$$ | $$ | $$ $$/ $$ |$$ | $$$$$$/ $$$$/ $$/ $$/ $$$$$$$/ $$/ $$/ $$$$/ $$/ $$$$$$$/ */ import { ECDSA } from "openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol"; import { MessageHashUtils } from "openzeppelin-contracts/contracts/utils/cryptography/MessageHashUtils.sol"; library SignedAuthTokenLibrary { using ECDSA for bytes32; using MessageHashUtils for bytes32; function verifyAuthTokenForAddress(bytes memory _authToken, address _avsGovernanceAddress, address _address, address _signer) internal pure returns (bool) { return getAddress(_avsGovernanceAddress, _address, _authToken) == _signer; } function _hash(address _avsGovernanceAddress,address _address) internal pure returns (bytes32) { return keccak256(abi.encode(_avsGovernanceAddress, _address)); } function _recover(bytes32 hash, bytes memory token) internal pure returns (address) { return hash.toEthSignedMessageHash().recover(token); } function getAddress(address _avsGovernanceAddress, address _address, bytes memory _authToken) internal pure returns (address) { return _recover(_hash(_avsGovernanceAddress, _address), _authToken); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.8.20; /*______ __ __ __ __ / \ / | / | / | / | /$$$$$$ | _$$ |_ $$ |____ ______ _______ _$$ |_ $$/ _______ $$ | $$ |/ $$ | $$ \ / \ / \ / $$ | / | / | $$ | $$ |$$$$$$/ $$$$$$$ |/$$$$$$ |$$$$$$$ |$$$$$$/ $$ |/$$$$$$$/ $$ | $$ | $$ | __ $$ | $$ |$$ $$ |$$ | $$ | $$ | __ $$ |$$ | $$ \__$$ | $$ |/ |$$ | $$ |$$$$$$$$/ $$ | $$ | $$ |/ |$$ |$$ \_____ $$ $$/ $$ $$/ $$ | $$ |$$ |$$ | $$ | $$ $$/ $$ |$$ | $$$$$$/ $$$$/ $$/ $$/ $$$$$$$/ $$/ $$/ $$$$/ $$/ $$$$$$$/ */ import { BLS } from "@othentic/NetworkManagement/Common/BLS.sol"; library BLSAuthLibrary { using BLS for uint256[2]; bytes32 internal constant DOMAIN = keccak256("OthenticBLSAuth"); struct Signature { uint256[2] signature; } /// @dev because of backwards compatibility issues, _signature is memory /// even though it should be calldata. Once old registration is removed, adjust accordingly function isValidSignature( Signature memory _signature, address _signer, address _contract, uint256[4] calldata _blsKey ) internal view returns (bool) { /// @dev signature verification succeeds if signature and pubkey are empty if (!_signature.signature.isValidSignature()) return false; uint256[2] memory _messageHash = _message(_signer, _contract); (bool _callSuccess, bool _result) = _signature.signature.verifySingle(_blsKey, _messageHash); return _callSuccess && _result; } /// @dev uses abi.encode twice because of the way the bls signatures are implemented in the CLI /// if we want to reduce more gas we should look into how polygon implemented it function _message(address _signer, address _contract) internal view returns (uint256[2] memory) { // slither-disable-next-line calls-loop bytes32 _hash = keccak256(abi.encode(_signer, _contract, block.chainid)); return BLS.hashToPoint(DOMAIN, abi.encode(_hash)); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.8.20; /*______ __ __ __ __ / \ / | / | / | / | /$$$$$$ | _$$ |_ $$ |____ ______ _______ _$$ |_ $$/ _______ $$ | $$ |/ $$ | $$ \ / \ / \ / $$ | / | / | $$ | $$ |$$$$$$/ $$$$$$$ |/$$$$$$ |$$$$$$$ |$$$$$$/ $$ |/$$$$$$$/ $$ | $$ | $$ | __ $$ | $$ |$$ $$ |$$ | $$ | $$ | __ $$ |$$ | $$ \__$$ | $$ |/ |$$ | $$ |$$$$$$$$/ $$ | $$ | $$ |/ |$$ |$$ \_____ $$ $$/ $$ $$/ $$ | $$ |$$ |$$ | $$ | $$ $$/ $$ |$$ | $$$$$$/ $$$$/ $$/ $$/ $$$$$$$/ $$/ $$/ $$$$/ $$/ $$$$$$$/ */ import { BLSAuthLibrary } from "@othentic/NetworkManagement/Common/BLSAuthLibrary.sol"; interface IBLSAuthSingleton { function isValidSignature( BLSAuthLibrary.Signature calldata _signature, address _signer, address _contract, uint256[4] calldata _blsKey ) external view returns (bool); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; import "./ISignatureUtils.sol"; interface IAVSDirectory is ISignatureUtils { /// @notice Enum representing the status of an operator's registration with an AVS enum OperatorAVSRegistrationStatus { UNREGISTERED, // Operator not registered to AVS REGISTERED // Operator registered to AVS } /** * @notice Emitted when @param avs indicates that they are updating their MetadataURI string * @dev Note that these strings are *never stored in storage* and are instead purely emitted in events for off-chain indexing */ event AVSMetadataURIUpdated(address indexed avs, string metadataURI); /// @notice Emitted when an operator's registration status for an AVS is updated event OperatorAVSRegistrationStatusUpdated( address indexed operator, address indexed avs, OperatorAVSRegistrationStatus status ); /** * @notice Called by an avs to register an operator with the avs. * @param operator The address of the operator to register. * @param operatorSignature The signature, salt, and expiry of the operator's signature. */ function registerOperatorToAVS( address operator, ISignatureUtils.SignatureWithSaltAndExpiry memory operatorSignature ) external; /** * @notice Called by an avs to deregister an operator with the avs. * @param operator The address of the operator to deregister. */ function deregisterOperatorFromAVS(address operator) external; /** * @notice Called by an AVS to emit an `AVSMetadataURIUpdated` event indicating the information has updated. * @param metadataURI The URI for metadata associated with an AVS * @dev Note that the `metadataURI` is *never stored * and is only emitted in the `AVSMetadataURIUpdated` event */ function updateAVSMetadataURI(string calldata metadataURI) external; /** * @notice Returns whether or not the salt has already been used by the operator. * @dev Salts is used in the `registerOperatorToAVS` function. */ function operatorSaltIsSpent(address operator, bytes32 salt) external view returns (bool); /** * @notice Calculates the digest hash to be signed by an operator to register with an AVS * @param operator The account registering as an operator * @param avs The AVS the operator is registering to * @param salt A unique and single use value associated with the approver signature. * @param expiry Time after which the approver's signature becomes invalid */ function calculateOperatorAVSRegistrationDigestHash( address operator, address avs, bytes32 salt, uint256 expiry ) external view returns (bytes32); /// @notice The EIP-712 typehash for the Registration struct used by the contract function OPERATOR_AVS_REGISTRATION_TYPEHASH() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol) pragma solidity ^0.8.20; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev The `account` is missing a role. */ error AccessControlUnauthorizedAccount(address account, bytes32 neededRole); /** * @dev The caller of a function is not the expected one. * * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}. */ error AccessControlBadConfirmation(); /** * @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. */ 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 `callerConfirmation`. */ function renounceRole(bytes32 role, address callerConfirmation) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import {Initializable} from "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC-165 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); * } * ``` */ abstract contract ERC165Upgradeable is Initializable, IERC165 { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @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 Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 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 in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._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 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._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() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @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 { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.8.20; /*______ __ __ __ __ / \ / | / | / | / | /$$$$$$ | _$$ |_ $$ |____ ______ _______ _$$ |_ $$/ _______ $$ | $$ |/ $$ | $$ \ / \ / \ / $$ | / | / | $$ | $$ |$$$$$$/ $$$$$$$ |/$$$$$$ |$$$$$$$ |$$$$$$/ $$ |/$$$$$$$/ $$ | $$ | $$ | __ $$ | $$ |$$ $$ |$$ | $$ | $$ | __ $$ |$$ | $$ \__$$ | $$ |/ |$$ | $$ |$$$$$$$$/ $$ | $$ | $$ |/ |$$ |$$ \_____ $$ $$/ $$ $$/ $$ | $$ |$$ |$$ | $$ | $$ $$/ $$ |$$ | $$$$$$/ $$$$/ $$/ $$/ $$$$$$$/ $$/ $$/ $$$$/ $$/ $$$$$$$/ */ /** * @author Othentic Labs LTD. */ import "openzeppelin-contracts-upgradeable/contracts/access/AccessControlUpgradeable.sol"; import "@othentic/NetworkManagement/Common/PauserRolesLibrary.sol"; import "@othentic/NetworkManagement/Common/RolesLibrary.sol"; import "@othentic/NetworkManagement/Common/interfaces/IPausableFlows.sol"; import "@othentic/NetworkManagement/Common/PausableFlowsStorage.sol"; abstract contract PausableFlows is IPausableFlows, AccessControlUpgradeable { // MODIFIERS modifier whenFlowNotPaused(bytes4 _pausableFlow) { _revertIfFlowPaused(_pausableFlow); _; } modifier whenFlowPaused(bytes4 _pausableFlow) { _revertIfFlowUnpaused(_pausableFlow); _; } function __OthenticAccessControl_init(address _avsGovernanceMultisigOwner, address _operationsMultisig, address _communityMultisig) internal onlyInitializing { _grantRole(RolesLibrary.OPERATIONS_MULTISIG, _operationsMultisig); _grantRole(RolesLibrary.AVS_GOVERNANCE_MULTISIG, _avsGovernanceMultisigOwner); _grantRole(RolesLibrary.COMMUNITY_MULTISIG, _communityMultisig); } // EXTERNAL FUNCTIONS function isFlowPaused(bytes4 _pausableFlow) external view returns (bool _isPaused) { return _getPausableFlowsStorage().flowsPauseStates[_pausableFlow]; } function pause(bytes4 _pausableFlow) external whenFlowNotPaused(_pausableFlow) onlyRole(_pausableFlow){ _pause(_pausableFlow); } function unpause(bytes4 _pausableFlow) external whenFlowPaused(_pausableFlow) onlyRole(_pausableFlow) { _unpause(_pausableFlow); } // INTERNAL FUNCTIONS function _pause(bytes4 _pausableFlow) internal { PausableFlowsStorageData storage _sd = _getPausableFlowsStorage(); if (_sd.flowsPauseStates[_pausableFlow]) revert PauseFlowIsAlreadyPaused(); _sd.flowsPauseStates[_pausableFlow] = true; emit FlowPaused(_pausableFlow, msg.sender); } function _unpause(bytes4 _pausableFlow) internal { PausableFlowsStorageData storage _sd = _getPausableFlowsStorage(); if (!_sd.flowsPauseStates[_pausableFlow]) revert UnpausingFlowIsAlreadyUnpaused(); _sd.flowsPauseStates[_pausableFlow] = false; emit FlowUnpaused(_pausableFlow, msg.sender); } function _revertIfFlowPaused(bytes4 _pausableFlow) internal view { if (_getPausableFlowsStorage().flowsPauseStates[_pausableFlow]) revert FlowIsCurrentlyPaused(); } function _revertIfFlowUnpaused(bytes4 _pausableFlow) internal view { if (!_getPausableFlowsStorage().flowsPauseStates[_pausableFlow]) revert FlowIsCurrentlyUnpaused(); } function _getPausableFlowsStorage() internal pure returns (PausableFlowsStorageData storage _sd) { return PausableFlowsStorage.load(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.20; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS } /** * @dev The signature derives the `address(0)`. */ error ECDSAInvalidSignature(); /** * @dev The signature has an invalid length. */ error ECDSAInvalidSignatureLength(uint256 length); /** * @dev The signature has an S value that is in the upper half order. */ error ECDSAInvalidSignatureS(bytes32 s); /** * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not * return address(0) without also returning an error description. Errors are documented using an enum (error type) * and a bytes32 providing additional information about the error. * * If no error is returned, then the address can be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length)); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) { unchecked { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); // We do not check for an overflow here since the shift operation results in 0 or 1. uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs); _throwError(error, errorArg); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError, bytes32) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS, s); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature, bytes32(0)); } return (signer, RecoverError.NoError, bytes32(0)); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s); _throwError(error, errorArg); return recovered; } /** * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided. */ function _throwError(RecoverError error, bytes32 errorArg) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert ECDSAInvalidSignature(); } else if (error == RecoverError.InvalidSignatureLength) { revert ECDSAInvalidSignatureLength(uint256(errorArg)); } else if (error == RecoverError.InvalidSignatureS) { revert ECDSAInvalidSignatureS(errorArg); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol) pragma solidity ^0.8.20; import {Strings} from "../Strings.sol"; /** * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing. * * The library provides methods for generating a hash of a message that conforms to the * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712] * specifications. */ library MessageHashUtils { /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing a bytes32 `messageHash` with * `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with * keccak256, although any bytes32 value can be safely used because the final digest will * be re-hashed. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20) } } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x45` (`personal_sign` messages). * * The digest is calculated by prefixing an arbitrary `message` with * `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method. * * See {ECDSA-recover}. */ function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) { return keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message)); } /** * @dev Returns the keccak256 digest of an EIP-191 signed data with version * `0x00` (data with intended validator). * * The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended * `validator` address. Then hashing the result. * * See {ECDSA-recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked(hex"19_00", validator, data)); } /** * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`). * * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with * `\x19\x01` and hashing the result. It corresponds to the hash signed by the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712. * * See {ECDSA-recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, hex"19_01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) digest := keccak256(ptr, 0x42) } } }
// SPDX-License-Identifier: MIT /* MIT License Copyright (c) 2021 Hubble-Project (natspec added by Polygon Technology) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ pragma solidity >=0.8.19; import {ModexpInverse, ModexpSqrt} from "./ModExp.sol"; /** @title Boneh–Lynn–Shacham (BLS) signature scheme on Barreto-Naehrig 254 bit curve (BN-254) @notice BLS signature aggregation reduces the size of signature data to store on-chain @dev points on G1 are used for signatures and messages, and on G2 for public keys @dev Adapted to be an internal library instead of an abstract contract */ library BLS { error InvalidPublicKeyCount(); error InvalidPublicKeyMessageCount(); error BNAddCallFailed(); error InvalidFieldElement(); error BadFTMappingImplementation(); // Field order // prettier-ignore uint256 private constant N = 21888242871839275222246405745257275088696311157297823662689037894645226208583; // Negated generator of G2 // prettier-ignore uint256 private constant N_G2_X1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634; // prettier-ignore uint256 private constant N_G2_X0 = 10857046999023057135944570762232829481370756359578518086990519993285655852781; // prettier-ignore uint256 private constant N_G2_Y1 = 17805874995975841540914202342111839520379459829704422454583296818431106115052; // prettier-ignore uint256 private constant N_G2_Y0 = 13392588948715843804641432497768002650278120570034223513918757245338268106653; // sqrt(-3) // prettier-ignore uint256 private constant Z0 = 0x0000000000000000b3c4d79d41a91759a9e4c7e359b6b89eaec68e62effffffd; // (sqrt(-3) - 1) / 2 // prettier-ignore uint256 private constant Z1 = 0x000000000000000059e26bcea0d48bacd4f263f1acdb5c4f5763473177fffffe; // prettier-ignore uint256 private constant T24 = 0x1000000000000000000000000000000000000000000000000; // prettier-ignore uint256 private constant MASK24 = 0xffffffffffffffffffffffffffffffffffffffffffffffff; function verifySingle( uint256[2] memory signature, uint256[4] memory pubkey, uint256[2] memory message ) internal view returns (bool, bool) { uint256[12] memory input = [ signature[0], signature[1], N_G2_X1, N_G2_X0, N_G2_Y1, N_G2_Y0, message[0], message[1], pubkey[1], pubkey[0], pubkey[3], pubkey[2] ]; uint256[1] memory out; bool callSuccess; // solhint-disable-next-line no-inline-assembly assembly { callSuccess := staticcall(gas(), 8, input, 384, out, 0x20) } if (!callSuccess) { return (false, false); } return (out[0] != 0, true); } function verifyMultiple( uint256[2] calldata signature, uint256[4][] calldata pubkeys, uint256[2][] calldata messages ) internal view returns (bool checkResult, bool callSuccess) { uint256 size = pubkeys.length; if (size == 0) revert InvalidPublicKeyCount(); if (size != messages.length) revert InvalidPublicKeyMessageCount(); uint256 inputSize = (size + 1) * 6; uint256[] memory input = new uint256[](inputSize); input[0] = signature[0]; input[1] = signature[1]; input[2] = N_G2_X1; input[3] = N_G2_X0; input[4] = N_G2_Y1; input[5] = N_G2_Y0; for (uint256 i = 0; i < size; i++) { input[i * 6 + 6] = messages[i][0]; input[i * 6 + 7] = messages[i][1]; input[i * 6 + 8] = pubkeys[i][1]; input[i * 6 + 9] = pubkeys[i][0]; input[i * 6 + 10] = pubkeys[i][3]; input[i * 6 + 11] = pubkeys[i][2]; } uint256[1] memory out; // solhint-disable-next-line no-inline-assembly assembly { callSuccess := staticcall(gas(), 8, add(input, 0x20), mul(inputSize, 0x20), out, 0x20) } if (!callSuccess) { return (false, false); } return (out[0] != 0, true); } function verifyMultipleSameMsg( uint256[2] calldata signature, uint256[4][] calldata pubkeys, uint256[2] calldata message ) internal view returns (bool checkResult, bool callSuccess) { uint256 size = pubkeys.length; if (size == 0) revert InvalidPublicKeyCount(); uint256 inputSize = (size + 1) * 6; uint256[] memory input = new uint256[](inputSize); input[0] = signature[0]; input[1] = signature[1]; input[2] = N_G2_X1; input[3] = N_G2_X0; input[4] = N_G2_Y1; input[5] = N_G2_Y0; for (uint256 i = 0; i < size; i++) { input[i * 6 + 6] = message[0]; input[i * 6 + 7] = message[1]; input[i * 6 + 8] = pubkeys[i][1]; input[i * 6 + 9] = pubkeys[i][0]; input[i * 6 + 10] = pubkeys[i][3]; input[i * 6 + 11] = pubkeys[i][2]; } uint256[1] memory out; // solhint-disable-next-line no-inline-assembly assembly { callSuccess := staticcall(gas(), 8, add(input, 0x20), mul(inputSize, 0x20), out, 0x20) } if (!callSuccess) { return (false, false); } return (out[0] != 0, true); } function hashToPoint(bytes32 domain, bytes memory message) internal view returns (uint256[2] memory) { uint256[2] memory u = hashToField(domain, message); uint256[2] memory p0 = mapToPoint(u[0]); uint256[2] memory p1 = mapToPoint(u[1]); uint256[4] memory bnAddInput; bnAddInput[0] = p0[0]; bnAddInput[1] = p0[1]; bnAddInput[2] = p1[0]; bnAddInput[3] = p1[1]; bool success; // solhint-disable-next-line no-inline-assembly assembly { success := staticcall(sub(gas(), 2000), 6, bnAddInput, 128, p0, 64) switch success case 0 { invalid() } } if (!success) revert BNAddCallFailed(); return p0; } function mapToPoint(uint256 _x) internal pure returns (uint256[2] memory p) { if (_x >= N) revert InvalidFieldElement(); uint256 x = _x; (, bool decision) = sqrt(x); uint256 a0 = mulmod(x, x, N); a0 = addmod(a0, 4, N); uint256 a1 = mulmod(x, Z0, N); uint256 a2 = mulmod(a1, a0, N); a2 = inverse(a2); a1 = mulmod(a1, a1, N); a1 = mulmod(a1, a2, N); // x1 a1 = mulmod(x, a1, N); x = addmod(Z1, N - a1, N); // check curve a1 = mulmod(x, x, N); a1 = mulmod(a1, x, N); a1 = addmod(a1, 3, N); bool found; (a1, found) = sqrt(a1); if (found) { if (!decision) { a1 = N - a1; } return [x, a1]; } // x2 x = N - addmod(x, 1, N); // check curve a1 = mulmod(x, x, N); a1 = mulmod(a1, x, N); a1 = addmod(a1, 3, N); (a1, found) = sqrt(a1); if (found) { if (!decision) { a1 = N - a1; } return [x, a1]; } // x3 x = mulmod(a0, a0, N); x = mulmod(x, x, N); x = mulmod(x, a2, N); x = mulmod(x, a2, N); x = addmod(x, 1, N); // must be on curve a1 = mulmod(x, x, N); a1 = mulmod(a1, x, N); a1 = addmod(a1, 3, N); (a1, found) = sqrt(a1); // solhint-disable-next-line reason-string if (!found) revert BadFTMappingImplementation(); if (!decision) { a1 = N - a1; } return [x, a1]; } function isValidSignature(uint256[2] memory signature) internal pure returns (bool) { if ((signature[0] >= N) || (signature[1] >= N)) { return false; } else { return isOnCurveG1(signature); } } function isOnCurveG1(uint256[2] memory point) internal pure returns (bool _isOnCurve) { // solhint-disable-next-line no-inline-assembly assembly { let t0 := mload(point) let t1 := mload(add(point, 32)) let t2 := mulmod(t0, t0, N) t2 := mulmod(t2, t0, N) t2 := addmod(t2, 3, N) t1 := mulmod(t1, t1, N) _isOnCurve := eq(t1, t2) } } function isOnCurveG2(uint256[4] memory point) internal pure returns (bool _isOnCurve) { // solhint-disable-next-line no-inline-assembly assembly { // x0, x1 let t0 := mload(point) let t1 := mload(add(point, 32)) // x0 ^ 2 let t2 := mulmod(t0, t0, N) // x1 ^ 2 let t3 := mulmod(t1, t1, N) // 3 * x0 ^ 2 let t4 := add(add(t2, t2), t2) // 3 * x1 ^ 2 let t5 := addmod(add(t3, t3), t3, N) // x0 * (x0 ^ 2 - 3 * x1 ^ 2) t2 := mulmod(add(t2, sub(N, t5)), t0, N) // x1 * (3 * x0 ^ 2 - x1 ^ 2) t3 := mulmod(add(t4, sub(N, t3)), t1, N) // x ^ 3 + b t0 := addmod(t2, 0x2b149d40ceb8aaae81be18991be06ac3b5b4c5e559dbefa33267e6dc24a138e5, N) t1 := addmod(t3, 0x009713b03af0fed4cd2cafadeed8fdf4a74fa084e52d1852e4a2bd0685c315d2, N) // y0, y1 t2 := mload(add(point, 64)) t3 := mload(add(point, 96)) // y ^ 2 t4 := mulmod(addmod(t2, t3, N), addmod(t2, sub(N, t3), N), N) t3 := mulmod(shl(1, t2), t3, N) // y ^ 2 == x ^ 3 + b _isOnCurve := and(eq(t0, t4), eq(t1, t3)) } } /** * @notice returns square root of a uint256 value * @param xx the value to take the square root of * @return x the uint256 value of the root * @return hasRoot a bool indicating if there is a square root */ function sqrt(uint256 xx) internal pure returns (uint256 x, bool hasRoot) { x = ModexpSqrt.run(xx); hasRoot = mulmod(x, x, N) == xx; } /** * @notice inverts a uint256 value * @param a uint256 value to invert * @return uint256 of the value of the inverse */ function inverse(uint256 a) internal pure returns (uint256) { return ModexpInverse.run(a); } function hashToField(bytes32 domain, bytes memory messages) internal pure returns (uint256[2] memory) { bytes memory _msg = expandMsgTo96(domain, messages); uint256 u0; uint256 u1; uint256 a0; uint256 a1; // solhint-disable-next-line no-inline-assembly assembly { let p := add(_msg, 24) u1 := and(mload(p), MASK24) p := add(_msg, 48) u0 := and(mload(p), MASK24) a0 := addmod(mulmod(u1, T24, N), u0, N) p := add(_msg, 72) u1 := and(mload(p), MASK24) p := add(_msg, 96) u0 := and(mload(p), MASK24) a1 := addmod(mulmod(u1, T24, N), u0, N) } return [a0, a1]; } function expandMsgTo96(bytes32 domain, bytes memory message) internal pure returns (bytes memory) { // zero<64>|msg<var>|lib_str<2>|I2OSP(0, 1)<1>|dst<var>|dst_len<1> uint256 t0 = message.length; bytes memory msg0 = new bytes(32 + t0 + 64 + 4); bytes memory out = new bytes(96); // b0 // solhint-disable-next-line no-inline-assembly assembly { let p := add(msg0, 96) for { let z := 0 } lt(z, t0) { z := add(z, 32) } { mstore(add(p, z), mload(add(message, add(z, 32)))) } p := add(p, t0) mstore8(p, 0) p := add(p, 1) mstore8(p, 96) p := add(p, 1) mstore8(p, 0) p := add(p, 1) mstore(p, domain) p := add(p, 32) mstore8(p, 32) } bytes32 b0 = sha256(msg0); bytes32 bi; t0 = 32 + 34; // resize intermediate message // solhint-disable-next-line no-inline-assembly assembly { mstore(msg0, t0) } // b1 // solhint-disable-next-line no-inline-assembly assembly { mstore(add(msg0, 32), b0) mstore8(add(msg0, 64), 1) mstore(add(msg0, 65), domain) mstore8(add(msg0, add(32, 65)), 32) } bi = sha256(msg0); // solhint-disable-next-line no-inline-assembly assembly { mstore(add(out, 32), bi) } // b2 // solhint-disable-next-line no-inline-assembly assembly { let t := xor(b0, bi) mstore(add(msg0, 32), t) mstore8(add(msg0, 64), 2) mstore(add(msg0, 65), domain) mstore8(add(msg0, add(32, 65)), 32) } bi = sha256(msg0); // solhint-disable-next-line no-inline-assembly assembly { mstore(add(out, 64), bi) } // b3 // solhint-disable-next-line no-inline-assembly assembly { let t := xor(b0, bi) mstore(add(msg0, 32), t) mstore8(add(msg0, 64), 3) mstore(add(msg0, 65), domain) mstore8(add(msg0, add(32, 65)), 32) } bi = sha256(msg0); // solhint-disable-next-line no-inline-assembly assembly { mstore(add(out, 96), bi) } return out; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @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: BUSL-1.1 pragma solidity >=0.8.20; /*______ __ __ __ __ / \ / | / | / | / | /$$$$$$ | _$$ |_ $$ |____ ______ _______ _$$ |_ $$/ _______ $$ | $$ |/ $$ | $$ \ / \ / \ / $$ | / | / | $$ | $$ |$$$$$$/ $$$$$$$ |/$$$$$$ |$$$$$$$ |$$$$$$/ $$ |/$$$$$$$/ $$ | $$ | $$ | __ $$ | $$ |$$ $$ |$$ | $$ | $$ | __ $$ |$$ | $$ \__$$ | $$ |/ |$$ | $$ |$$$$$$$$/ $$ | $$ | $$ |/ |$$ |$$ \_____ $$ $$/ $$ $$/ $$ | $$ |$$ |$$ | $$ | $$ $$/ $$ |$$ | $$$$$$/ $$$$/ $$/ $$/ $$$$$$$/ $$/ $$/ $$$$/ $$/ $$$$$$$/ */ /** * @author Othentic Labs LTD. */ interface IPausableFlows { // EVENTS event FlowPaused(bytes4 _pausableFlow, address _pauser); event FlowUnpaused(bytes4 _pausableFlowFlag, address _unpauser); // ERRORS error FlowIsCurrentlyPaused(); error FlowIsCurrentlyUnpaused(); error PauseFlowIsAlreadyPaused(); error UnpausingFlowIsAlreadyUnpaused(); // EXTERNAL FUNCTIONS function pause(bytes4 _pausableFlow) external; function unpause(bytes4 _pausableFlow) external; function isFlowPaused(bytes4 _pausableFlow) external view returns (bool); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.8.20; /*______ __ __ __ __ / \ / | / | / | / | /$$$$$$ | _$$ |_ $$ |____ ______ _______ _$$ |_ $$/ _______ $$ | $$ |/ $$ | $$ \ / \ / \ / $$ | / | / | $$ | $$ |$$$$$$/ $$$$$$$ |/$$$$$$ |$$$$$$$ |$$$$$$/ $$ |/$$$$$$$/ $$ | $$ | $$ | __ $$ | $$ |$$ $$ |$$ | $$ | $$ | __ $$ |$$ | $$ \__$$ | $$ |/ |$$ | $$ |$$$$$$$$/ $$ | $$ | $$ |/ |$$ |$$ \_____ $$ $$/ $$ $$/ $$ | $$ |$$ |$$ | $$ | $$ $$/ $$ |$$ | $$$$$$/ $$$$/ $$/ $$/ $$$$$$$/ $$/ $$/ $$$$/ $$/ $$$$$$$/ */ /// @custom:storage-location erc7201:othentic.storage.PauseableFlowControl struct PausableFlowsStorageData { mapping(bytes4 _pausableFlow => bool isPaused) flowsPauseStates; } library PausableFlowsStorage { // keccak256(abi.encode(uint256(keccak256("othentic.storage.PauseableFlowControl")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant STORAGE_LOCATION = 0xfe6065fb4e9872e2ad4479001655335380d83f70e163706cd65857449b845100; function load() internal pure returns (PausableFlowsStorageData storage sd) { bytes32 position = STORAGE_LOCATION; assembly { sd.slot := position } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal * representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT /* MIT License Copyright (c) 2021 Hubble-Project Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ pragma solidity >=0.8.19; /** @title Compute Inverse by Modular Exponentiation @notice Compute $input^(N - 2) mod N$ using Addition Chain method. Where N = 0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47 and N - 2 = 0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd45 @dev the function body is generated with the modified addchain script see https://github.com/kobigurk/addchain/commit/2c37a2ace567a9bdc680b4e929c94aaaa3ec700f */ library ModexpInverse { /** * @notice computes inverse * @dev computes $input^(N - 2) mod N$ using Addition Chain method. * @param t2 the number to get the inverse of (uint256) * @return t0 the inverse (uint256) */ function run(uint256 t2) internal pure returns (uint256 t0) { // solhint-disable-next-line no-inline-assembly assembly { let n := 0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47 t0 := mulmod(t2, t2, n) let t5 := mulmod(t0, t2, n) let t1 := mulmod(t5, t0, n) let t3 := mulmod(t5, t5, n) let t8 := mulmod(t1, t0, n) let t4 := mulmod(t3, t5, n) let t6 := mulmod(t3, t1, n) t0 := mulmod(t3, t3, n) let t7 := mulmod(t8, t3, n) t3 := mulmod(t4, t3, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t5, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t2, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t2, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t8, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t8, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t2, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t8, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t2, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t5, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t7, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t1, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t5, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t8, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t1, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t2, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t6, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t7, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t1, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t5, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t1, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t5, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t6, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t6, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t1, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t8, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t6, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t1, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t4, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t6, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t2, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t8, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t8, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t1, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t2, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t7, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t3, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t2, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t2, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t5, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t6, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t5, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t5, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t3, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t4, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t3, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t1, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t2, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t1, n) } } } /** @title Compute Square Root by Modular Exponentiation @notice Compute $input^{(N + 1) / 4} mod N$ using Addition Chain method. Where N = 0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47 and (N + 1) / 4 = 0xc19139cb84c680a6e14116da060561765e05aa45a1c72a34f082305b61f3f52 */ library ModexpSqrt { /** * @notice computes square root by modular exponentation * @dev Compute $input^{(N + 1) / 4} mod N$ using Addition Chain method * @param t6 the number to derive the square root of * @return t0 the square root */ function run(uint256 t6) internal pure returns (uint256 t0) { // solhint-disable-next-line no-inline-assembly assembly { let n := 0x30644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd47 t0 := mulmod(t6, t6, n) let t4 := mulmod(t0, t6, n) let t2 := mulmod(t4, t0, n) let t3 := mulmod(t4, t4, n) let t8 := mulmod(t2, t0, n) let t1 := mulmod(t3, t4, n) let t5 := mulmod(t3, t2, n) t0 := mulmod(t3, t3, n) let t7 := mulmod(t8, t3, n) t3 := mulmod(t1, t3, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t4, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t6, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t6, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t8, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t8, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t6, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t8, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t6, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t4, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t7, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t2, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t4, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t8, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t2, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t6, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t5, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t7, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t2, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t4, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t2, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t4, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t5, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t5, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t2, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t8, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t5, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t2, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t1, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t5, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t6, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t8, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t8, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t2, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t6, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t7, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t3, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t6, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t6, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t4, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t5, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t4, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t4, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t3, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t1, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t3, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t2, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t0, n) t0 := mulmod(t0, t1, n) t0 := mulmod(t0, t0, n) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
{ "remappings": [ "ds-test/=lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "@openzeppelin-upgrades/=lib/openzeppelin-contracts-upgradeable/", "@openzeppelin/=lib/openzeppelin-contracts/", "othentic-contracts-script/=lib/contracts/script/", "@othentic-contracts/=lib/contracts/src/", "@forge-safe/=lib/forge-safe/src/", "@othentic-governance/script/=script/", "@othentic-governance/src/=src/", "@eigenlayer-middleware/=lib/contracts/lib/eigenlayer-middleware/src/", "@eigenlayer/=lib/contracts/lib/eigenlayer-contracts/src/", "@layerzerolabs/lz-evm-messagelib-v2/=lib/contracts/lib/LayerZero-v2/messagelib/", "@layerzerolabs/lz-evm-oapp-v2/=lib/contracts/lib/LayerZero-v2/oapp/", "@layerzerolabs/lz-evm-protocol-v2/=lib/contracts/lib/LayerZero-v2/protocol/", "@openzeppelin-upgradeable/=lib/contracts/lib/openzeppelin-contracts-upgradeable/", "@openzeppelin-upgrades-v4.9.0/=lib/contracts/lib/eigenlayer-contracts/lib/openzeppelin-contracts-upgradeable-v4.9.0/", "@openzeppelin-v4.9.0/=lib/contracts/lib/eigenlayer-contracts/lib/openzeppelin-contracts-v4.9.0/", "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@othentic-script/=lib/contracts/script/", "@othentic-test/=lib/contracts/test/", "@othentic/=lib/contracts/src/", "LayerZero-v2/=lib/contracts/lib/LayerZero-v2/", "contracts/=lib/contracts/contracts/", "eigenlayer-contracts/=lib/contracts/lib/eigenlayer-contracts/", "eigenlayer-middleware/=lib/contracts/lib/eigenlayer-middleware/", "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/", "forge-safe/=lib/forge-safe/", "openzeppelin-contracts-upgradeable-v4.9.0/=lib/contracts/lib/eigenlayer-contracts/lib/openzeppelin-contracts-upgradeable-v4.9.0/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "openzeppelin-contracts-v4.9.0/=lib/contracts/lib/eigenlayer-contracts/lib/openzeppelin-contracts-v4.9.0/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "openzeppelin-upgrades/=lib/openzeppelin-upgrades/", "openzeppelin/=lib/contracts/lib/eigenlayer-contracts/lib/openzeppelin-contracts-upgradeable-v4.9.0/contracts/", "solidity-bytes-utils/contracts/=lib/contracts/src/lz/util/", "solidity-stringutils/=lib/forge-safe/lib/surl/lib/solidity-stringutils/", "solmate/=lib/forge-safe/lib/solmate/src/", "surl/=lib/forge-safe/lib/surl/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": false, "libraries": {} }
Contract ABI
API[{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[],"name":"AccessControlInvalidMultiplierSyncer","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[],"name":"AllowlistDisabled","type":"error"},{"inputs":[],"name":"AllowlistEnabled","type":"error"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[],"name":"FlowIsCurrentlyPaused","type":"error"},{"inputs":[],"name":"FlowIsCurrentlyUnpaused","type":"error"},{"inputs":[],"name":"InvalidAllowlistAuthToken","type":"error"},{"inputs":[],"name":"InvalidBlsRegistrationSignature","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"InvalidMultiplierNotSet","type":"error"},{"inputs":[],"name":"InvalidRewardsReceiver","type":"error"},{"inputs":[],"name":"InvalidSlashingRate","type":"error"},{"inputs":[],"name":"InvalidStrategy","type":"error"},{"inputs":[],"name":"ModificationDelayNotPassed","type":"error"},{"inputs":[],"name":"NotEnoughVotingPower","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"uint256","name":"numOfOperatorsLimit","type":"uint256"},{"internalType":"uint256","name":"numOfActiveOperators","type":"uint256"}],"name":"NumOfActiveOperatorsIsGreaterThanNumOfOperatorLimit","type":"error"},{"inputs":[{"internalType":"uint256","name":"numOfOperatorsLimit","type":"uint256"}],"name":"NumOfOperatorsLimitReached","type":"error"},{"inputs":[],"name":"OperatorAlreadyRegistered","type":"error"},{"inputs":[],"name":"OperatorNotRegistered","type":"error"},{"inputs":[],"name":"PauseFlowIsAlreadyPaused","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"string","name":"message","type":"string"}],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"UnpausingFlowIsAlreadyUnpaused","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"blsAuthSingleton","type":"address"}],"name":"BLSAuthSingletonSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes4","name":"_pausableFlow","type":"bytes4"},{"indexed":false,"internalType":"address","name":"_pauser","type":"address"}],"name":"FlowPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes4","name":"_pausableFlowFlag","type":"bytes4"},{"indexed":false,"internalType":"address","name":"_unpauser","type":"address"}],"name":"FlowUnpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"maxEffectiveBalance","type":"uint256"}],"name":"MaxEffectiveBalanceSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"strategy","type":"address"},{"indexed":false,"internalType":"uint256","name":"minShares","type":"uint256"}],"name":"MinSharesPerStrategySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"minVotingPower","type":"uint256"}],"name":"MinVotingPowerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"uint256[4]","name":"blsKey","type":"uint256[4]"}],"name":"OperatorRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"operator","type":"address"}],"name":"OperatorUnregistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"delay","type":"uint256"}],"name":"QueuedRewardsReceiverModification","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"allowlistSigner","type":"address"}],"name":"SetAllowlistSigner","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"avsGovernanceLogic","type":"address"}],"name":"SetAvsGovernanceLogic","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"avsGovernanceMultiplierSyncer","type":"address"}],"name":"SetAvsGovernanceMultiplierSyncer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAvsGovernanceMultisig","type":"address"}],"name":"SetAvsGovernanceMultisig","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"avsName","type":"string"}],"name":"SetAvsName","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"isAllowlisted","type":"bool"}],"name":"SetIsAllowlisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newMessageHandler","type":"address"}],"name":"SetMessageHandler","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newLimitOfNumOfOperators","type":"uint256"}],"name":"SetNumOfOperatorsLimit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"othenticRegistry","type":"address"}],"name":"SetOthenticRegistry","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"}],"name":"SetRewardsReceiver","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"modificationDelay","type":"uint256"}],"name":"SetRewardsReceiverModificationDelay","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"strategy","type":"address"},{"indexed":false,"internalType":"uint256","name":"multiplier","type":"uint256"}],"name":"SetStrategyMultiplier","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"strategies","type":"address[]"}],"name":"SetSupportedStrategies","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"SetToken","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"avsDirectory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"avsName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"completeRewardsReceiverModification","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getDefaultStrategies","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getIsAllowlisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNumOfOperatorsLimit","outputs":[{"internalType":"uint256","name":"numOfOperatorsLimitView","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"}],"name":"getOperatorRestakedStrategies","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRestakeableStrategies","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"}],"name":"getRewardsReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"avsGovernanceMultisigOwner","type":"address"},{"internalType":"address","name":"operationsMultisig","type":"address"},{"internalType":"address","name":"communityMultisig","type":"address"},{"internalType":"address","name":"othenticRegistry","type":"address"},{"internalType":"address","name":"messageHandler","type":"address"},{"internalType":"address","name":"vault","type":"address"},{"internalType":"address","name":"avsDirectoryContract","type":"address"},{"internalType":"address","name":"allowlistSigner","type":"address"},{"internalType":"string","name":"avsName","type":"string"},{"internalType":"address","name":"blsAuthSingleton","type":"address"}],"internalType":"struct IAvsGovernance.InitializationParams","name":"_initializationParams","type":"tuple"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_pausableFlow","type":"bytes4"}],"name":"isFlowPaused","outputs":[{"internalType":"bool","name":"_isPaused","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"isOperatorRegistered","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxEffectiveBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_strategy","type":"address"}],"name":"minSharesForStrategy","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minVotingPower","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numOfActiveOperators","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numOfOperators","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"}],"name":"numOfShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_pausableFlow","type":"bytes4"}],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newRewardsReceiver","type":"address"}],"name":"queueRewardsReceiverModification","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[4]","name":"_blsKey","type":"uint256[4]"},{"internalType":"bytes","name":"_authToken","type":"bytes"},{"internalType":"address","name":"_rewardsReceiver","type":"address"},{"components":[{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256","name":"expiry","type":"uint256"}],"internalType":"struct ISignatureUtils.SignatureWithSaltAndExpiry","name":"_operatorSignature","type":"tuple"},{"components":[{"internalType":"uint256[2]","name":"signature","type":"uint256[2]"}],"internalType":"struct BLSAuthLibrary.Signature","name":"_blsRegistrationSignature","type":"tuple"}],"name":"registerAsAllowedOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[4]","name":"_blsKey","type":"uint256[4]"},{"internalType":"address","name":"_rewardsReceiver","type":"address"},{"components":[{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256","name":"expiry","type":"uint256"}],"internalType":"struct ISignatureUtils.SignatureWithSaltAndExpiry","name":"_operatorSignature","type":"tuple"},{"components":[{"internalType":"uint256[2]","name":"signature","type":"uint256[2]"}],"internalType":"struct BLSAuthLibrary.Signature","name":"_blsRegistrationSignature","type":"tuple"}],"name":"registerAsOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_allowlistSigner","type":"address"}],"name":"setAllowlistSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IAvsGovernanceLogic","name":"_avsGovernanceLogic","type":"address"}],"name":"setAvsGovernanceLogic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newAvsGovernanceMultiplierSyncer","type":"address"}],"name":"setAvsGovernanceMultiplierSyncer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_avsName","type":"string"}],"name":"setAvsName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_blsAuthSingleton","type":"address"}],"name":"setBLSAuthSingleton","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isAllowlisted","type":"bool"}],"name":"setIsAllowlisted","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxBalance","type":"uint256"}],"name":"setMaxEffectiveBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_strategy","type":"address"},{"internalType":"uint256","name":"_minShares","type":"uint256"}],"name":"setMinSharesForStrategy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minVotingPower","type":"uint256"}],"name":"setMinVotingPower","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newLimitOfNumOfOperators","type":"uint256"}],"name":"setNumOfOperatorsLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IOthenticRegistry","name":"_othenticRegistry","type":"address"}],"name":"setOthenticRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardsReceiverModificationDelay","type":"uint256"}],"name":"setRewardsReceiverModificationDelay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"strategy","type":"address"},{"internalType":"uint256","name":"multiplier","type":"uint256"}],"internalType":"struct IAvsGovernance.StrategyMultiplier","name":"_strategyMultiplier","type":"tuple"}],"name":"setStrategyMultiplier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"strategy","type":"address"},{"internalType":"uint256","name":"multiplier","type":"uint256"}],"internalType":"struct IAvsGovernance.StrategyMultiplier[]","name":"_strategyMultipliers","type":"tuple[]"}],"name":"setStrategyMultiplierBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_strategies","type":"address[]"}],"name":"setSupportedStrategies","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"strategies","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_strategy","type":"address"}],"name":"strategyMultiplier","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":"_newAvsGovernanceMultisig","type":"address"}],"name":"transferAvsGovernanceMultisig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newMessageHandler","type":"address"}],"name":"transferMessageHandler","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_pausableFlow","type":"bytes4"}],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unregisterAsOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"metadataURI","type":"string"}],"name":"updateAVSMetadataURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vault","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"}],"name":"votingPower","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"feeToClaim","type":"uint256"}],"internalType":"struct IAvsGovernance.PaymentRequestMessage[]","name":"_operators","type":"tuple[]"},{"internalType":"uint256","name":"_lastPayedTask","type":"uint256"}],"name":"withdrawBatchRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"uint256","name":"_lastPayedTask","type":"uint256"},{"internalType":"uint256","name":"_feeToClaim","type":"uint256"}],"name":"withdrawRewards","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106103785760003560e01c80637d38e926116101d3578063bc8be0c811610104578063e481af9d116100a2578063efd969781161007c578063efd9697814610711578063f251c9a61461074b578063fab57b8f14610753578063fbfa77cf1461076657600080fd5b8063e481af9d146106e6578063e6474b0f14610701578063e86685d91461070957600080fd5b8063d547741f116100de578063d547741f146106c0578063d94a2e1d146106d3578063d9f9027f146106e6578063e474def4146106ee57600080fd5b8063bc8be0c814610687578063c07473f61461069a578063c3814e5b146106ad57600080fd5b80639e965cc111610171578063a98fb3551161014b578063a98fb35514610646578063b525fa8814610659578063b79092fd14610661578063bac1e94b1461067457600080fd5b80639e965cc114610623578063a217fddf14610636578063a88171ee1461063e57600080fd5b80638f53bc50116101ad5780638f53bc50146105d757806391d14854146105ea57806393304a9d146105fd5780639d79e4a71461061057600080fd5b80637d38e9261461059e5780638987c767146105b15780638a70469a146105c457600080fd5b80633aa83ec7116102ad5780635e95cee21161024b5780636b1906f8116102255780636b1906f8146105705780636b3aa72e1461058357806376086c701461058b5780637897dec31461056857600080fd5b80635e95cee21461052a5780636a907803146105555780636ade02da1461056857600080fd5b80634d07f651116102875780634d07f651146104de5780634ef1476e146104f1578063513c52ba1461050457806355e489181461051757600080fd5b80633aa83ec7146104a357806341b92a29146104b657806345a022fa146104cb57600080fd5b8063305df58a1161031a57806333cfb7b7116102f457806333cfb7b7146104555780633425e8d81461047557806336568abe1461048857806336fffde01461049b57600080fd5b8063305df58a1461041c578063312c150b1461042f5780633256b4d11461044257600080fd5b80631b21ba72116103565780631b21ba72146103c257806322609a4d146103d5578063248a9ca3146103e85780632f2ff15d1461040957600080fd5b806301ffc9a71461037d578063076400d5146103a557806309869442146103ba575b600080fd5b61039061038b366004613785565b61076e565b60405190151581526020015b60405180910390f35b6103b86103b33660046137c7565b6107a5565b005b6103b86107cb565b6103b86103d03660046137f8565b6108c7565b6103b86103e3366004613968565b610a22565b6103fb6103f63660046139db565b610b98565b60405190815260200161039c565b6103b86104173660046139f4565b610bba565b6103b861042a366004613a24565b610bdc565b6103b861043d366004613a50565b610cd9565b6103b8610450366004613ac4565b610d58565b6104686104633660046137f8565b610e03565b60405161039c9190613af9565b6103b86104833660046137f8565b610e93565b6103b86104963660046139f4565b610f3d565b6103fb610f75565b6103b86104b1366004613785565b610f88565b6104be610faf565b60405161039c9190613b8c565b6103b86104d93660046137f8565b61104a565b6103b86104ec3660046137f8565b6110bb565b6103b86104ff3660046137f8565b61115c565b6103b86105123660046137f8565b6111c5565b6103b86105253660046139db565b611233565b61053d6105383660046137f8565b611281565b6040516001600160a01b03909116815260200161039c565b6103fb6105633660046137f8565b6112b1565b6103fb611335565b61039061057e3660046137f8565b611348565b61053d611376565b6103b86105993660046139db565b611392565b6103b86105ac366004613be7565b6113df565b6103b86105bf3660046137f8565b611402565b6103b86105d23660046139db565b611495565b6103fb6105e53660046137f8565b6114e3565b6103906105f83660046139f4565b61150f565b6103b861060b366004613c28565b611547565b6103b861061e3660046139db565b611733565b6103b8610631366004613cd6565b6117bd565b6103fb600081565b6103fb611826565b6103b8610654366004613be7565b611839565b6103906118b3565b6103b861066f3660046139db565b6118d0565b6103b8610682366004613785565b61193b565b6103b8610695366004613d16565b611962565b6103fb6106a83660046137f8565b611a70565b6103fb6106bb3660046137f8565b611a9e565b6103b86106ce3660046139f4565b611aca565b6103b86106e1366004613dde565b611ae6565b610468611b41565b6103b86106fc3660046137f8565b611bab565b6103b8611c14565b610468611d16565b61039061071f366004613785565b6001600160e01b03191660009081526000805160206144c5833981519152602052604090205460ff1690565b6103fb611d2d565b6103b8610761366004613e40565b611d40565b61053d611e4d565b60006001600160e01b03198216637965db0b60e01b148061079f57506301ffc9a760e01b6001600160e01b03198316145b92915050565b63ef0892d160e01b6107b681611e69565b6107c76107c1611e73565b83611e7d565b5050565b6107d3611e73565b33600090815260079190910160205260408120549003610806576040516325ec6c1f60e01b815260040160405180910390fd5b7f92c9d1c07198b9465c1d2907806f1150774e0758b4edc0d272f5df87a5a7492c61083081611f03565b610838611f4b565b6000610842611e73565b905061084d33611f83565b60058101546040516351b27a6d60e11b81523360048201526001600160a01b039091169063a364f4da90602401600060405180830381600087803b15801561089457600080fd5b505af11580156108a8573d6000803e3d6000fd5b50505050506108c4600160008051602061450583398151915255565b50565b6108cf611e73565b33600090815260079190910160205260408120549003610902576040516325ec6c1f60e01b815260040160405180910390fd5b7fd93c394bc0520b0dc9db435f0321020356363275d7d80fbdc9f5296937698fc661092c81611f03565b6001600160a01b0382166109525760405162cc6ac760e01b815260040160405180910390fd5b600061095c611e73565b336000908152600c820160205260408120805460ff19166001179055600b8201549192509061098b9042613e91565b6040805180820182526001600160a01b038781168083526020808401868152336000818152600e8b018452879020955186546001600160a01b0319169516949094178555516001909401939093558351918252918101919091529081018290529091507f0d8cfa10a3087b28d3c226ad9a37314860e7c3c0505a25a39e3cdefb3118a98a906060015b60405180910390a150505050565b610a2a611e73565b336000908152600791909101602052604090205415610a5c576040516342ee68b560e01b815260040160405180910390fd5b7f92c9d1c07198b9465c1d2907806f1150774e0758b4edc0d272f5df87a5a7492c610a8681611f03565b610a8e611f4b565b6000610a98611e73565b6005810154909150600160a01b900460ff1615610ac857604051638a943acd60e01b815260040160405180910390fd5b6001600160a01b038516610aee5760405162cc6ac760e01b815260040160405180910390fd5b610af881866120d8565b610b13813388610b0d36889003880188613ea4565b8961213a565b6005810154604051639926ee7d60e01b81526001600160a01b0390911690639926ee7d90610b479033908890600401613f2c565b600060405180830381600087803b158015610b6157600080fd5b505af1158015610b75573d6000803e3d6000fd5b5050505050610b91600160008051602061450583398151915255565b5050505050565b60009081526000805160206144e5833981519152602052604090206001015490565b610bc382610b98565b610bcc81611e69565b610bd68383612437565b50505050565b6378b4401360e11b610bed81611e69565b6000610bf76124dc565b90506000805b6009830154811015610c5d57856001600160a01b0316836009018281548110610c2857610c28613f77565b6000918252602090912001546001600160a01b031603610c4b5760019150610c5d565b80610c5581613f8d565b915050610bfd565b5080610c7c57604051632711b74d60e11b815260040160405180910390fd5b6001600160a01b0385166000818152601284016020908152604091829020879055815192835282018690527f3a6c52328a7b3b726d0ec757d68f416b26ec2991ac4d4f95d450c504f5a0e521910160405180910390a15050505050565b6378b4401360e11b610cea81611e69565b7f37b1f16af49fd5d40e5dc679bf35afa8bb06df10cb8308e0aa633882d2a81201610d1481611f03565b610bd6610d1f611e73565b85858080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061250a92505050565b638a70a0eb60e01b610d6981611e69565b6000610d73611e73565b6001600160a01b0386166000908152600c8201602052604090205490915060ff1615610dab57610da681868660006125e2565b610b91565b60048101546001600160a01b038681166000908152600d840160205260408120549282169290911690610de18883898987612692565b905080610ded57600095505b610df9848989896125e2565b5050505050505050565b60606000610e0f611e73565b6003810154604051630776843760e31b81529192506001600160a01b031690633bb421b890610e479086906009860190600401613fa6565b600060405180830381865afa158015610e64573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e8c9190810190614005565b9392505050565b6378b4401360e11b610ea481611e69565b6000610eae611e73565b6014810154909150610ed19063ef0892d160e01b906001600160a01b03166127aa565b50610ee363ef0892d160e01b84612437565b506014810180546001600160a01b0319166001600160a01b0385169081179091556040519081527fb73a70f24733a9265231de5807eae76d1740a9974b31a142ef9e243508987bbe906020015b60405180910390a1505050565b6001600160a01b0381163314610f665760405163334bd91960e11b815260040160405180910390fd5b610f7082826127aa565b505050565b6000610f7f611e73565b60100154905090565b80610f9281611f03565b6001600160e01b03198216610fa681611e69565b610f7083612826565b6060610fb9611e73565b600a018054610fc79061409e565b80601f0160208091040260200160405190810160405280929190818152602001828054610ff39061409e565b80156110405780601f1061101557610100808354040283529160200191611040565b820191906000526020600020905b81548152906001019060200180831161102357829003601f168201915b5050505050905090565b63d8a8b5c760e01b61105b81611e69565b81611064611e73565b60030180546001600160a01b0319166001600160a01b0392831617905560405190831681527ff9855cc914fefc396bdeb5a4dcb97a2f6c75f4d6f00a8e71d6f9a40e474afe8d906020015b60405180910390a15050565b63d8a8b5c760e01b6110cc81611e69565b60006110d6611e73565b60028101549091506110f990638a70a0eb60e01b906001600160a01b03166127aa565b5061110b638a70a0eb60e01b84612437565b506002810180546001600160a01b0319166001600160a01b0385169081179091556040519081527f997f84b541d7b68e210e6f50e3402b51d8411dbbc4d44ed81e508383126e4e9490602001610f30565b63d8a8b5c760e01b61116d81611e69565b81611176611e73565b60150180546001600160a01b0319166001600160a01b0392831617905560405190831681527f4cbffdecf3b5e4b22bfb2bdec99a66f8fcf81e19b060682afd9645c729da1472906020016110af565b6378b4401360e11b6111d681611e69565b6111e76378b4401360e11b336127aa565b506111f96378b4401360e11b83612437565b506040516001600160a01b03831681527f024e98b7d808a3ddb028252dc95dfdcb165a0ca59fcff8984b4fecf9a7222649906020016110af565b6378b4401360e11b61124481611e69565b8161124d611e73565b601001556040518281527f10203ddc048c86cf14172a6ea2565c805ce7320b22d6941b2eb396d0ee077983906020016110af565b600061128b611e73565b6001600160a01b039283166000908152600d919091016020526040902054909116919050565b6000806112bc611e73565b6003810154604051639004134760e01b81529192506001600160a01b0316906390041347906112f49086906009860190600401613fa6565b602060405180830381865afa158015611311573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8c91906140d2565b600061133f611e73565b60010154905090565b6000611352611e73565b6001600160a01b039092166000908152600792909201602052506040902054151590565b6000611380611e73565b600501546001600160a01b0316919050565b6378b4401360e11b6113a381611e69565b816113ac611e73565b601101556040518281527ec6fb6db9c52d89a1eaf84e0470a3304db2086d0ac44d64ebf4ea35a905a7d0906020016110af565b6378b4401360e11b6113f081611e69565b610f706113fb611e73565b84846128c7565b6378b4401360e11b61141381611e69565b7fc44a152afe05976f48b094dd378bad59da43eb5e1eb74842319c4e72992d238361143d81611f03565b82611446611e73565b60080180546001600160a01b0319166001600160a01b0392831617905560405190841681527f7c36ee80df183e227956a9f387a48d26bbf4d2f1526410493d11126de5a8942c90602001610f30565b6378b4401360e11b6114a681611e69565b816114af611e73565b600b01556040518281527f47c8c3268759fc47868c5e319217a2e85d47bd3935a4108debe246f6025fb88b906020016110af565b60006114ed611e73565b6001600160a01b03909216600090815260139290920160205250604090205490565b60009182526000805160206144e5833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b61154f611e73565b336000908152600791909101602052604090205415611581576040516342ee68b560e01b815260040160405180910390fd5b7f92c9d1c07198b9465c1d2907806f1150774e0758b4edc0d272f5df87a5a7492c6115ab81611f03565b6115b3611f4b565b60006115bd611e73565b6005810154909150600160a01b900460ff166115ec57604051632d35c8d360e01b815260040160405180910390fd5b61164a30338360060160009054906101000a90046001600160a01b03168a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929594939250506129089050565b6116675760405163d2342ec760e01b815260040160405180910390fd5b6001600160a01b03851661168d5760405162cc6ac760e01b815260040160405180910390fd5b61169781866120d8565b6116ac81338a610b0d36889003880188613ea4565b6005810154604051639926ee7d60e01b81526001600160a01b0390911690639926ee7d906116e09033908890600401613f2c565b600060405180830381600087803b1580156116fa57600080fd5b505af115801561170e573d6000803e3d6000fd5b505050505061172a600160008051602061450583398151915255565b50505050505050565b6378b4401360e11b61174481611e69565b600061174e611e73565b6001810154909150838111156117865760405163d2930ec560e01b815260048101829052602481018590526044015b60405180910390fd5b600f82018490556040518481527fc0dd1d82df4ae12576f7a7912395305cf73deae26c764dd74a945cd6ba81591b90602001610a14565b6378b4401360e11b6117ce81611e69565b816117d7611e73565b6005018054911515600160a01b0260ff60a01b1990921691909117905560405182151581527f2dcb3282f9b7aa18e1bf7fa254c45f3e270e8f26d9a37ae590d5d8125b58d1b1906020016110af565b6000611830611e73565b60110154905090565b6378b4401360e11b61184a81611e69565b611852611e73565b6005015460405163a98fb35560e01b81526001600160a01b039091169063a98fb3559061188590869086906004016140eb565b600060405180830381600087803b15801561189f57600080fd5b505af115801561172a573d6000803e3d6000fd5b60006118bd611e73565b60050154600160a01b900460ff16919050565b6118d8611e73565b600490810154604051634bff5c9360e11b81523392810192909252602482018390526001600160a01b0316906397feb92690604401600060405180830381600087803b15801561192757600080fd5b505af1158015610b91573d6000803e3d6000fd5b8061194581612932565b6001600160e01b0319821661195981611e69565b610f7083612979565b638a70a0eb60e01b61197381611e69565b600061197d611e73565b600481015460408051808201909152600080825260208201529192506001600160a01b03169060005b8651811015611a5c578681815181106119c1576119c1613f77565b602090810291909101015180519092506001600160a01b0381166119e55750611a5c565b6001600160a01b038082166000908152600d87016020908152604082205490860151921691611a1a90849084908c908a612692565b905080611a465760008a8581518110611a3557611a35613f77565b602002602001015160200181815250505b5050508080611a5490613f8d565b9150506119a6565b50611a68838787612a16565b505050505050565b600080611a7b611e73565b90506000611a8882612aa2565b915050611a96828583612cd4565b949350505050565b6000611aa8611e73565b6001600160a01b03909216600090815260129290920160205250604090205490565b611ad382610b98565b611adc81611e69565b610bd683836127aa565b63ef0892d160e01b611af781611e69565b6000611b01611e73565b905060005b83811015610b9157611b2f82868684818110611b2457611b24613f77565b905060400201611e7d565b80611b3981613f8d565b915050611b06565b6060611b4b611e73565b60090180548060200260200160405190810160405280929190818152602001828054801561104057602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311611b84575050505050905090565b63d8a8b5c760e01b611bbc81611e69565b81611bc5611e73565b60060180546001600160a01b0319166001600160a01b0392831617905560405190831681527ffa4acc0aaeb2714e420e9c8339167ddef7bc66c0f94a0c5a7722de21dcb7508c906020016110af565b611c1c611e73565b33600090815260079190910160205260408120549003611c4f576040516325ec6c1f60e01b815260040160405180910390fd5b6000611c59611e73565b336000908152600e82016020526040902060010154909150421015611c9157604051638ce7a3f160e01b815260040160405180910390fd5b336000908152600e82016020526040902054611cb79082906001600160a01b03166120d8565b336000818152600c830160209081526040808320805460ff1916905580518082018252838152808301848152948452600e9095019091529020915182546001600160a01b0319166001600160a01b039091161782555160019190910155565b6060611d28611d23611e73565b612d73565b905090565b6000611d37611e73565b600f0154905090565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b0316600081158015611d855750825b90506000826001600160401b03166001148015611da15750303b155b905081158015611daf575080155b15611dcd5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315611df757845460ff60401b1916600160401b1785555b611e0086612de6565b8315611a6857845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a1505050505050565b6000611e57611e73565b600401546001600160a01b0316919050565b6108c4813361318e565b6000611d286124dc565b602081018035906013840190600090611e9690856137f8565b6001600160a01b03168152602080820192909252604001600020919091557f8ae53ffd0ebc018acb19342fba690554d49ae9a467a9606a38b49cb5ad775c8190611ee2908301836137f8565b604080516001600160a01b03909216825260208085013590830152016110af565b6001600160e01b0319811660009081526000805160206144c5833981519152602052604090205460ff16156108c45760405163722fdba960e01b815260040160405180910390fd5b600080516020614505833981519152805460011901611f7d57604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b6000611f8d611e73565b60088101549091506001600160a01b03168015801590612003576040516311c7e79960e21b81526001600160a01b03858116600483015283169063471f9e6490602401600060405180830381600087803b158015611fea57600080fd5b505af1158015611ffe573d6000803e3d6000fd5b505050505b61200d83856131c7565b826001016000815461201e9061411a565b909155506001600160a01b0384166000908152600784016020526040812055801561209f5760405163e9ecc1cb60e01b81526001600160a01b03858116600483015283169063e9ecc1cb90602401600060405180830381600087803b15801561208657600080fd5b505af115801561209a573d6000803e3d6000fd5b505050505b6040516001600160a01b03851681527f6f42117a557500c705ddf040a619d86f39101e6b74ac20d7b3e5943ba473fc7f90602001610a14565b336000818152600d8401602090815260409182902080546001600160a01b0319166001600160a01b0386169081179091558251938452908301527fe906feea2ef60b474e22b4169bdd4de6906a84cd448cbcee99593526fe87082d91016110af565b600f850154600186015481116121665760405163c77b407760e01b81526004810182905260240161177d565b6015860154604051633cf65e3b60e01b81526001600160a01b0390911690633cf65e3b9061219e908690899030908a90600401614131565b602060405180830381865afa1580156121bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121df9190614186565b6121fc576040516314532dfd60e11b815260040160405180910390fd5b60088601546001600160a01b03168015156000806122198a612aa2565b91509150600061222a8b8b84612cd4565b905060008b6010015482101580156122b2575060038c01546040516330959fcb60e11b81526001600160a01b039091169063612b3f9690612271908e9088906004016141a3565b602060405180830381865afa15801561228e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b29190614186565b9050806122d257604051631c33ce8d60e11b815260040160405180910390fd5b841561233d5760405163094e7a3f60e41b81526001600160a01b038716906394e7a3f09061230a908e9086908f908e90600401614206565b600060405180830381600087803b15801561232457600080fd5b505af1158015612338573d6000803e3d6000fd5b505050505b61234a8c8c848d8c613233565b8b6001016000815461235b90613f8d565b90915550506001600160a01b038a16600090815260078c01602052604090206001905583156123e9576040516376c56c1b60e11b81526001600160a01b0386169063ed8ad836906123b6908d9085908e908d90600401614206565b600060405180830381600087803b1580156123d057600080fd5b505af11580156123e4573d6000803e3d6000fd5b505050505b896001600160a01b03167f54bc9cf83c2eb0f2ad1abf6e4fab882964404622ba2df6b5a9356a18d3aac0558a6040516124229190614239565b60405180910390a25050505050505050505050565b60006000805160206144e5833981519152612452848461150f565b6124d2576000848152602082815260408083206001600160a01b03871684529091529020805460ff191660011790556124883390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a4600191505061079f565b600091505061079f565b60008061079f60017f3e2bfe19d7b287e1320a5adb4ca1cb62f90c30e328e073ba40443179d690e11a614248565b612518600983016000613753565b60005b81518110156125b257600082828151811061253857612538613f77565b6020026020010151905060006001600160a01b0316816001600160a01b03160361257557604051632711b74d60e11b815260040160405180910390fd5b60098401805460018082018355600092835260209092200180546001600160a01b0319166001600160a01b0393909316929092179091550161251b565b507ff009a6ffded424f714e8904d643a1ea4479453188faf08a3996121996b76684f816040516110af9190613af9565b604080516001600160a01b03858116602483015260448201859052606480830185905283518084039091018152608490920183526020820180516001600160e01b0316630356129d60e11b1790526002870154925163104c8d4b60e31b8152919216906382646a5890612659908490600401613b8c565b600060405180830381600087803b15801561267357600080fd5b505af1158015612687573d6000803e3d6000fd5b505050505050505050565b60006001600160a01b0385161561272457604051633256b4d160e01b81526001600160a01b0386811660048301526024820186905260448201859052831690633256b4d1906064016020604051808303816000875af11580156126f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061271d9190614186565b90506127a1565b604051633256b4d160e01b81526001600160a01b0387811660048301526024820186905260448201859052831690633256b4d1906064016020604051808303816000875af115801561277a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061279e9190614186565b90505b95945050505050565b60006000805160206144e58339815191526127c5848461150f565b156124d2576000848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a4600191505061079f565b6001600160e01b0319811660009081526000805160206144c5833981519152602081905260409091205460ff16156128715760405163dfe10d7d60e01b815260040160405180910390fd5b6001600160e01b0319821660009081526020829052604090819020805460ff19166001179055517f95c3658c5e0c74e20cf12db371b9b67d26e97a1937f6d2284f88cc44d036b4f6906110af908490339061425b565b600a83016128d68284836142c4565b507f7f63aacad63bc1693280450d5c3612ccd4efc53e46d69f3a537db102cd66290c8282604051610f309291906140eb565b6000816001600160a01b031661291f8585886132ae565b6001600160a01b03161495945050505050565b6001600160e01b0319811660009081526000805160206144c5833981519152602052604090205460ff166108c4576040516368c87f3360e11b815260040160405180910390fd5b6001600160e01b0319811660009081526000805160206144c5833981519152602081905260409091205460ff166129c357604051635bfd2da760e11b815260040160405180910390fd5b6001600160e01b0319821660009081526020829052604090819020805460ff19169055517fc7e56e17b0a6c4b467df6495e1eda1baecd7ba20604e80c1058ac06f4578d85e906110af908490339061425b565b6000612a4183604051602001612a2c9190614383565b604051602081830303815290604052836132f0565b600285015460405163104c8d4b60e31b81529192506001600160a01b0316906382646a5890612a74908490600401613b8c565b600060405180830381600087803b158015612a8e57600080fd5b505af1158015610df9573d6000803e3d6000fd5b606080600083600901805480602002602001604051908101604052809291908181526020018280548015612aff57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612ae1575b50505050509050600081516001600160401b03811115612b2157612b21613826565b604051908082528060200260200182016040528015612b6657816020015b6040805180820190915260008082526020820152815260200190600190039081612b3f5790505b509050600082516001600160401b03811115612b8457612b84613826565b604051908082528060200260200182016040528015612bc957816020015b6040805180820190915260008082526020820152815260200190600190039081612ba25790505b50905060005b8351811015612cc8576000848281518110612bec57612bec613f77565b602002602001015190506040518060400160405280826001600160a01b03168152602001896012016000846001600160a01b03166001600160a01b0316815260200190815260200160002054815250848381518110612c4d57612c4d613f77565b6020908102919091018101919091526001600160a01b038216600090815260138a01909152604081205490819003612c83575060015b6040518060400160405280836001600160a01b0316815260200182815250848481518110612cb357612cb3613f77565b60209081029190910101525050600101612bcf565b50909590945092505050565b6011830154600384015460405163f679e15f60e01b81526000929183916001600160a01b039091169063f679e15f90612d1390889088906004016143e3565b602060405180830381865afa158015612d30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d5491906140d2565b90508181118015612d655750600082115b156127a15750949350505050565b60038101546040516301753ab960e31b81524660048201526060916001600160a01b031690630ba9d5c890602401600060405180830381865afa158015612dbe573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261079f9190810190614005565b612dee613360565b6000612dfd60208301836137f8565b6001600160a01b031614158015612e2d57506000612e2160408301602084016137f8565b6001600160a01b031614155b8015612e5257506000612e4660608301604084016137f8565b6001600160a01b031614155b8015612e7757506000612e6b60808301606084016137f8565b6001600160a01b031614155b8015612e9c57506000612e9060a08301608084016137f8565b6001600160a01b031614155b8015612ec157506000612eb560c0830160a084016137f8565b6001600160a01b031614155b8015612ee657506000612eda60e0830160c084016137f8565b6001600160a01b031614155b8015612f0c57506000612f00610100830160e084016137f8565b6001600160a01b031614155b612f585760405162461bcd60e51b815260206004820152601c60248201527f417673476f7665726e616e63653a20496e76616c696420696e70757400000000604482015260640161177d565b6000612f6760208301836137f8565b90506000612f7b60408401602085016137f8565b90506000612f8f60608501604086016137f8565b90506000612fa360a08601608087016137f8565b9050366000612fb6610100880188614446565b90925090506000612fcd6080890160608a016137f8565b9050612fda8787876133ab565b612fe58787876133e8565b6000612fef611e73565b6003810180546001600160a01b038086166001600160a01b031992831617909255600283018054928916929091169190911790559050613036638a70a0eb60e01b86612437565b5061304760c08a0160a08b016137f8565b6004820180546001600160a01b0319166001600160a01b039290921691909117905561307a6101008a0160e08b016137f8565b6006820180546001600160a01b0319166001600160a01b039290921691909117905562093a80600b8201556130b560e08a0160c08b016137f8565b6005820180546001600160a01b0319166001600160a01b03929092169190911790556064600f8201556130f06101408a016101208b016137f8565b6015820180546001600160a01b0319166001600160a01b039290921691909117905561311d8185856128c7565b60405162ee0ec160e61b81526001600160a01b03831690633b83b0409061314a90879087906004016140eb565b600060405180830381600087803b15801561316457600080fd5b505af1158015613178573d6000803e3d6000fd5b505050506126878161318983612d73565b61250a565b613198828261150f565b6107c75760405163e2517d3f60e01b81526001600160a01b03821660048201526024810183905260440161177d565b604080516001600160a01b0383811660248084019190915283518084039091018152604490920183526020820180516001600160e01b031663edad0a1360e01b1790526002850154925163104c8d4b60e31b8152919216906382646a5890611885908490600401613b8c565b60006132418585858561340e565b600287015460405163104c8d4b60e31b81529192506001600160a01b0316906382646a5890613274908490600401613b8c565b600060405180830381600087803b15801561328e57600080fd5b505af11580156132a2573d6000803e3d6000fd5b50505050505050505050565b604080516001600160a01b038086166020808401919091529085168284015282518083038401815260609092019092528051910120600090611a969083613484565b60607f7ac0d49c0df8eaba20287b89637474262377d7fcc1bf84c337d672a9ed663c75838360405160240161332692919061448c565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152905092915050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff166133a957604051631afcd79f60e31b815260040160405180910390fd5b565b6133b3613360565b6133c463d8a8b5c760e01b83612437565b506133d66378b4401360e11b84612437565b50610bd663d3e319af60e01b82612437565b6133f0613360565b6133f86134bd565b6134038383836134c5565b610f70600033610f3d565b60607f58cc5acb742fd5eb9df21407aed105abca7d37584645d014636aa13c7b7bc387858585856040516024016134489493929190614206565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091529050949350505050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000006000908152601c839052603c8120610e8c9083613554565b6133a9613360565b6134d663024b274760e61b84612437565b506134e863024b274760e61b83612437565b506134fa63024b274760e61b82612437565b5061350c63d93c394b60e01b84612437565b5061351e63d93c394b60e01b83612437565b50613530631bd8f8b560e11b84612437565b50613542631bd8f8b560e11b83612437565b50610bd6631bd8f8b560e11b82612437565b600080600080613564868661357e565b92509250925061357482826135cb565b5090949350505050565b600080600083516041036135b85760208401516040850151606086015160001a6135aa88828585613684565b9550955095505050506135c4565b50508151600091506002905b9250925092565b60008260038111156135df576135df6144ae565b036135e8575050565b60018260038111156135fc576135fc6144ae565b0361361a5760405163f645eedf60e01b815260040160405180910390fd5b600282600381111561362e5761362e6144ae565b0361364f5760405163fce698f760e01b81526004810182905260240161177d565b6003826003811115613663576136636144ae565b036107c7576040516335e2f38360e21b81526004810182905260240161177d565b600080807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08411156136bf5750600091506003905082613749565b604080516000808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa158015613713573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661373f57506000925060019150829050613749565b9250600091508190505b9450945094915050565b50805460008255906000526020600020908101906108c491905b80821115613781576000815560010161376d565b5090565b60006020828403121561379757600080fd5b81356001600160e01b031981168114610e8c57600080fd5b6000604082840312156137c157600080fd5b50919050565b6000604082840312156137d957600080fd5b610e8c83836137af565b6001600160a01b03811681146108c457600080fd5b60006020828403121561380a57600080fd5b8135610e8c816137e3565b806080810183101561079f57600080fd5b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b038111828210171561385e5761385e613826565b60405290565b604080519081016001600160401b038111828210171561385e5761385e613826565b604051601f8201601f191681016001600160401b03811182821017156138ae576138ae613826565b604052919050565b6000606082840312156138c857600080fd5b6138d061383c565b905081356001600160401b03808211156138e957600080fd5b818401915084601f8301126138fd57600080fd5b813560208282111561391157613911613826565b613923601f8301601f19168201613886565b9250818352868183860101111561393957600080fd5b818185018285013760008183850101528285528086013581860152505050506040820135604082015292915050565b600080600080610100858703121561397f57600080fd5b6139898686613815565b93506080850135613999816137e3565b925060a08501356001600160401b038111156139b457600080fd5b6139c0878288016138b6565b9250506139d08660c087016137af565b905092959194509250565b6000602082840312156139ed57600080fd5b5035919050565b60008060408385031215613a0757600080fd5b823591506020830135613a19816137e3565b809150509250929050565b60008060408385031215613a3757600080fd5b8235613a42816137e3565b946020939093013593505050565b60008060208385031215613a6357600080fd5b82356001600160401b0380821115613a7a57600080fd5b818501915085601f830112613a8e57600080fd5b813581811115613a9d57600080fd5b8660208260051b8501011115613ab257600080fd5b60209290920196919550909350505050565b600080600060608486031215613ad957600080fd5b8335613ae4816137e3565b95602085013595506040909401359392505050565b6020808252825182820181905260009190848201906040850190845b81811015613b3a5783516001600160a01b031683529284019291840191600101613b15565b50909695505050505050565b6000815180845260005b81811015613b6c57602081850181015186830182015201613b50565b506000602082860101526020601f19601f83011685010191505092915050565b602081526000610e8c6020830184613b46565b60008083601f840112613bb157600080fd5b5081356001600160401b03811115613bc857600080fd5b602083019150836020828501011115613be057600080fd5b9250929050565b60008060208385031215613bfa57600080fd5b82356001600160401b03811115613c1057600080fd5b613c1c85828601613b9f565b90969095509350505050565b6000806000806000806101208789031215613c4257600080fd5b613c4c8888613815565b955060808701356001600160401b0380821115613c6857600080fd5b613c748a838b01613b9f565b909750955060a08901359150613c89826137e3565b90935060c08801359080821115613c9f57600080fd5b50613cac89828a016138b6565b925050613cbc8860e089016137af565b90509295509295509295565b80151581146108c457600080fd5b600060208284031215613ce857600080fd5b8135610e8c81613cc8565b60006001600160401b03821115613d0c57613d0c613826565b5060051b60200190565b6000806040808486031215613d2a57600080fd5b83356001600160401b03811115613d4057600080fd5b8401601f81018613613d5157600080fd5b80356020613d66613d6183613cf3565b613886565b82815260069290921b83018101918181019089841115613d8557600080fd5b938201935b83851015613dce5785858b031215613da25760008081fd5b613daa613864565b8535613db5816137e3565b8152858401358482015282529385019390820190613d8a565b9997909101359750505050505050565b60008060208385031215613df157600080fd5b82356001600160401b0380821115613e0857600080fd5b818501915085601f830112613e1c57600080fd5b813581811115613e2b57600080fd5b8660208260061b8501011115613ab257600080fd5b600060208284031215613e5257600080fd5b81356001600160401b03811115613e6857600080fd5b82016101408185031215610e8c57600080fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561079f5761079f613e7b565b600060408284031215613eb657600080fd5b60405160208082018281106001600160401b0382111715613ed957613ed9613826565b604052601f84018513613eeb57600080fd5b613ef3613864565b806040860187811115613f0557600080fd5b865b81811015613f1e5780358452928401928401613f07565b505083525090949350505050565b60018060a01b0383168152604060208201526000825160606040840152613f5660a0840182613b46565b90506020840151606084015260408401516080840152809150509392505050565b634e487b7160e01b600052603260045260246000fd5b600060018201613f9f57613f9f613e7b565b5060010190565b60006040820160018060a01b03808616845260206040818601528286548085526060870191508760005282600020945060005b81811015613ff7578554851683526001958601959284019201613fd9565b509098975050505050505050565b6000602080838503121561401857600080fd5b82516001600160401b0381111561402e57600080fd5b8301601f8101851361403f57600080fd5b805161404d613d6182613cf3565b81815260059190911b8201830190838101908783111561406c57600080fd5b928401925b82841015614093578351614084816137e3565b82529284019290840190614071565b979650505050505050565b600181811c908216806140b257607f821691505b6020821081036137c157634e487b7160e01b600052602260045260246000fd5b6000602082840312156140e457600080fd5b5051919050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b60008161412957614129613e7b565b506000190190565b84516101008201908260005b600281101561415c57825182526020928301929091019060010161413d565b5050506001600160a01b038581166040840152841660608301526080838184013795945050505050565b60006020828403121561419857600080fd5b8151610e8c81613cc8565b6001600160a01b038316815260406020808301829052835183830181905260009291858101916060860190855b81811015613ff7576141f683865180516001600160a01b03168252602090810151910152565b93830193918501916001016141d0565b6001600160a01b0385811682526020820185905260e0820190608085604085013780841660c08401525095945050505050565b60808181019083833792915050565b8181038181111561079f5761079f613e7b565b6001600160e01b03199290921682526001600160a01b0316602082015260400190565b601f821115610f7057600081815260208120601f850160051c810160208610156142a55750805b601f850160051c820191505b81811015611a68578281556001016142b1565b6001600160401b038311156142db576142db613826565b6142ef836142e9835461409e565b8361427e565b6000601f841160018114614323576000851561430b5750838201355b600019600387901b1c1916600186901b178355610b91565b600083815260209020601f19861690835b828110156143545786850135825560209485019460019092019101614334565b50868210156143715760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b602080825282518282018190526000919060409081850190868401855b828110156143d6576143c684835180516001600160a01b03168252602090810151910152565b92840192908501906001016143a0565b5091979650505050505050565b6001600160a01b038316815260406020808301829052835183830181905260009291858101916060860190855b81811015613ff75761443683865180516001600160a01b03168252602090810151910152565b9383019391850191600101614410565b6000808335601e1984360301811261445d57600080fd5b8301803591506001600160401b0382111561447757600080fd5b602001915036819003821315613be057600080fd5b60408152600061449f6040830185613b46565b90508260208301529392505050565b634e487b7160e01b600052602160045260246000fdfefe6065fb4e9872e2ad4479001655335380d83f70e163706cd65857449b84510002dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b6268009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a264697066735822122025c987c4eb642fad3fb1ca9f7ae1d0442d56ceae4a999d8900b0ae4efae36b9a64736f6c63430008140033
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.