- Contract name:
- EnergyBridge
- Optimization enabled
- true
- Compiler version
- v0.8.23+commit.f704f362
- Optimization runs
- 2000
- Verified at
- 2024-05-02T12:34:52.938550Z
contracts/EnergyBridge.sol
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; /** * @dev Bridging contract between Energy Web Chain tier 1 (T1) and Energy Web X tier 2 (T2) blockchains. * Enables POS "author" nodes to periodically publish the transactional state of T2 to T1. * Enables authors to be added and removed from participation in consensus. * Enables the "lifting" of any EWT or ERC20 tokens from T1 to the specified account on T2. * Enables the "lowering" of EWT and ERC20 tokens from T2 to the T1 account specified in the T2 proof. * Proxy upgradeable implementation utilising EIP-1822 */ import './interfaces/IEnergyBridge.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/interfaces/IERC20.sol'; import '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol'; import '@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol'; import '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol'; contract EnergyBridge is IEnergyBridge, Initializable, UUPSUpgradeable, OwnableUpgradeable { using SafeERC20 for IERC20; string private constant ESM_PREFIX = '\x19Ethereum Signed Message:\n32'; address private constant PSEUDO_EWT_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; uint256 private constant LIFT_LIMIT = type(uint128).max; uint256 private constant MINIMUM_NUMBER_OF_AUTHORS = 4; uint256 private constant LOWER_DATA_LENGTH = 20 + 32 + 20 + 4; // token address + amount + recipient address + lower ID uint256 private constant SIGNATURE_LENGTH = 65; uint256 private constant MINIMUM_PROOF_LENGTH = LOWER_DATA_LENGTH + SIGNATURE_LENGTH * 2; uint256 private constant UNLOCKED = 1; uint256 private constant LOCKED = 2; int8 private constant TX_SUCCEEDED = 1; int8 private constant TX_PENDING = 0; int8 private constant TX_FAILED = -1; /// @custom:oz-renamed-from isRegisteredCollator mapping(uint256 => bool) public isAuthor; /// @custom:oz-renamed-from isActiveCollator mapping(uint256 => bool) public authorIsActive; mapping(address => uint256) public t1AddressToId; /// @custom:oz-renamed-from t2PublicKeyToId mapping(bytes32 => uint256) public t2PubKeyToId; mapping(uint256 => address) public idToT1Address; /// @custom:oz-renamed-from idToT2PublicKey mapping(uint256 => bytes32) public idToT2PubKey; mapping(bytes2 => uint256) public numBytesToLowerData; mapping(bytes32 => bool) public isPublishedRootHash; /// @custom:oz-renamed-from isUsedT2TransactionId mapping(uint256 => bool) public isUsedT2TxId; mapping(bytes32 => bool) public hasLowered; /// @custom:oz-renamed-from quorum uint256[2] public _unused1_; /// @custom:oz-renamed-from numActiveCollators uint256 public numActiveAuthors; /// @custom:oz-renamed-from nextCollatorId uint256 public nextAuthorId; /// @custom:oz-renamed-from collatorFunctionsAreEnabled bool public authorsEnabled; /// @custom:oz-renamed-from liftingIsEnabled bool public liftingEnabled; /// @custom:oz-renamed-from loweringIsEnabled bool public loweringEnabled; address public pendingOwner; uint256 private _lock; mapping(address => uint256) public minimumLiftAmount; uint256 public defaultMinimumLiftDenominator; error AddressMismatch(); error AlreadyAdded(); error AuthorsDisabled(); error BelowMinimumLift(); error BadConfirmations(); error CannotChangeT2Key(bytes32 existingT2PubKey); error InvalidProof(); error InvalidT1Key(); error InvalidT2Key(); error InvalidTxData(); error LiftDisabled(); error LiftFailed(); error LiftLimitHit(); error Locked(); error LowerDisabled(); error LowerIsUsed(); error MissingKeys(); error NotALowerTx(); error NotAnAuthor(); error NotEnoughAuthors(); error PaymentFailed(); error PendingOwnerOnly(); error RenounceOwnershipDisabled(); error RootHashIsUsed(); error T1AddressInUse(address t1Address); error T2KeyInUse(bytes32 t2PubKey); error TxIdIsUsed(); error UnsignedTx(); error WindowExpired(); /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } function initialize( address[] calldata t1Addresses, bytes32[] calldata t1PubKeysLHS, bytes32[] calldata t1PubKeysRHS, bytes32[] calldata t2PubKeys ) public initializer { __Ownable_init(); __UUPSUpgradeable_init(); numBytesToLowerData[0x5900] = 133; // callID (2 bytes) + proof (2 prefix + 32 relayer + 32 signer + 1 prefix + 64 signature) numBytesToLowerData[0x5700] = 133; // callID (2 bytes) + proof (2 prefix + 32 relayer + 32 signer + 1 prefix + 64 signature) numBytesToLowerData[0x5702] = 2; // callID (2 bytes) authorsEnabled = true; liftingEnabled = true; loweringEnabled = true; nextAuthorId = 1; _initialiseAuthors(t1Addresses, t1PubKeysLHS, t1PubKeysRHS, t2PubKeys); } modifier onlyWhenLiftingEnabled() { if (!liftingEnabled) revert LiftDisabled(); _; } modifier onlyWhenLoweringEnabled() { if (!loweringEnabled) revert LowerDisabled(); _; } modifier onlyWhenAuthorsEnabled() { if (!authorsEnabled) revert AuthorsDisabled(); _; } modifier onlyIfLiftMinimumIsReached(address token, uint256 amount) { uint256 minimumAmount = minimumLiftAmount[token]; if (minimumAmount == 0 && token != PSEUDO_EWT_ADDRESS && defaultMinimumLiftDenominator != 0) { minimumAmount = IERC20(token).totalSupply() / defaultMinimumLiftDenominator; } if (amount == 0 || amount < minimumAmount) revert BelowMinimumLift(); _; } modifier onlyWithinCallWindow(uint256 expiry) { if (block.timestamp > expiry) revert WindowExpired(); _; } modifier lock() { if (_lock == LOCKED) revert Locked(); _lock = LOCKED; _; _lock = UNLOCKED; } /** * @dev Allows the owner to enable/disable author functionality. */ function toggleAuthors(bool state) external onlyOwner { authorsEnabled = state; emit LogAuthorsEnabled(state); } /** * @dev Allows the owner to enable/disable lifting. */ function toggleLifting(bool state) external onlyOwner { liftingEnabled = state; emit LogLiftingEnabled(state); } /** * @dev Allows the owner to enable/disable lowering. */ function toggleLowering(bool state) external onlyOwner { loweringEnabled = state; emit LogLoweringEnabled(state); } /** * @dev Allows the owner to set the minimum amount of a token the bridge will lift. */ function setMinimumLiftAmount(address token, uint256 amount) external onlyOwner { minimumLiftAmount[token] = amount; emit LogMinimumLiftAmount(token, amount); } /** * @dev Allows the owner to set the value required to calculate the default minimum lift amount for any token. */ function setDefaultMinimumLift(uint256 denominator) external onlyOwner { defaultMinimumLiftDenominator = denominator; emit LogDefaultMinimumLift(denominator); } /** * @dev Enables T2 to add a new author, permanently associating their T1 and T2 accounts and enabling * them to take part in consensus. Can also be used to reactivate an author, provided their details * have not changed. Activation of the author occurs on the first confirmation received from them. */ function addAuthor( bytes calldata t1PubKey, bytes32 t2PubKey, uint256 expiry, uint32 t2TxId, bytes calldata confirmations ) external onlyWhenAuthorsEnabled onlyWithinCallWindow(expiry) { if (t1PubKey.length != 64) revert InvalidT1Key(); address t1Address = address(uint160(uint256(keccak256(t1PubKey)))); uint256 id = t1AddressToId[t1Address]; if (isAuthor[id]) revert AlreadyAdded(); _verifyConfirmations(false, keccak256(abi.encode(t1PubKey, t2PubKey, expiry, t2TxId)), confirmations); _storeT2TxId(t2TxId); if (id == 0) { _addNewAuthor(t1Address, t2PubKey); } else { if (t2PubKey != idToT2PubKey[id]) revert CannotChangeT2Key(idToT2PubKey[id]); isAuthor[id] = true; } emit LogAuthorAdded(t1Address, t2PubKey, t2TxId); } /** * @dev Enables T2 to remove an author, immediately revoking their authority on T1. */ function removeAuthor( bytes32 t2PubKey, bytes calldata t1PubKey, uint256 expiry, uint32 t2TxId, bytes calldata confirmations ) external onlyWhenAuthorsEnabled onlyWithinCallWindow(expiry) { if (t1PubKey.length != 64) revert InvalidT1Key(); uint256 id = t2PubKeyToId[t2PubKey]; if (!isAuthor[id]) revert NotAnAuthor(); isAuthor[id] = false; if (numActiveAuthors <= MINIMUM_NUMBER_OF_AUTHORS) revert NotEnoughAuthors(); if (authorIsActive[id]) { authorIsActive[id] = false; unchecked { --numActiveAuthors; } } _verifyConfirmations(false, keccak256(abi.encode(t2PubKey, t1PubKey, expiry, t2TxId)), confirmations); _storeT2TxId(t2TxId); emit LogAuthorRemoved(idToT1Address[id], t2PubKey, t2TxId); } /** * @dev Enables T2 to publish a Merkle tree root hash representing the latest set of calls to have been made on T2. */ function publishRoot( bytes32 rootHash, uint256 expiry, uint32 t2TxId, bytes calldata confirmations ) external onlyWhenAuthorsEnabled onlyWithinCallWindow(expiry) { if (isPublishedRootHash[rootHash]) revert RootHashIsUsed(); _verifyConfirmations(false, keccak256(abi.encode(rootHash, expiry, t2TxId)), confirmations); _storeT2TxId(t2TxId); isPublishedRootHash[rootHash] = true; emit LogRootPublished(rootHash, t2TxId); } /** * @dev Enables anyone to move an amount of ERC20 tokens to the specified 32 byte public key of the recipient on T2. * Tokens must first be approved for use by this contract. * Fails if it will cause the total amount of the tokens currently lifted to exceed 340282366920938463463374607431768211455. * Fails if the amount falls below the minimum lifting threshold for the token. */ function lift( address token, bytes calldata t2PubKey, uint256 amount ) external onlyWhenLiftingEnabled onlyIfLiftMinimumIsReached(token, amount) lock { uint256 existingBalance = IERC20(token).balanceOf(address(this)); IERC20(token).safeTransferFrom(msg.sender, address(this), amount); uint256 newBalance = IERC20(token).balanceOf(address(this)); if (newBalance <= existingBalance) revert LiftFailed(); if (newBalance > LIFT_LIMIT) revert LiftLimitHit(); emit LogLifted(token, _checkT2PubKey(t2PubKey), newBalance - existingBalance); } /** * @dev Enables anyone to lift an amount of EWT to the specified 32 byte public key of the T2 recipient. */ function liftEWT( bytes calldata t2PubKey ) external payable onlyWhenLiftingEnabled onlyIfLiftMinimumIsReached(PSEUDO_EWT_ADDRESS, msg.value) lock { emit LogLifted(PSEUDO_EWT_ADDRESS, _checkT2PubKey(t2PubKey), msg.value); } /** * @dev Method deprecated - please use claimLower() instead. */ function legacyLower(bytes calldata leaf, bytes32[] calldata merklePath) external onlyWhenLoweringEnabled lock { bytes32 leafHash = keccak256(leaf); if (!confirmTransaction(leafHash, merklePath)) revert InvalidTxData(); if (hasLowered[leafHash]) revert LowerIsUsed(); hasLowered[leafHash] = true; uint256 ptr; // Determine the position of the Call ID in the leaf: unchecked { ptr += _getCompactIntegerByteSize(leaf[0]); // add number of bytes encoding the leaf length if (leaf[ptr] & 0x80 == 0x0) revert UnsignedTx(); // bitwise version check to ensure leaf is a signed tx // add version(1) + multiAddress type(1) + sender(32) + curve type(1) + signature(64) = 99 bytes to check era bytes: ptr += leaf[ptr + 99] == 0x0 ? 100 : 101; // add 99 + number of era bytes (immortal is 1, otherwise 2) ptr += _getCompactIntegerByteSize(leaf[ptr]); // add number of bytes encoding the nonce ptr += _getCompactIntegerByteSize(leaf[ptr]); // add number of bytes encoding the tip } bytes2 callId; // Retrieve the Call ID from the leaf: assembly { ptr := add(ptr, leaf.offset) callId := calldataload(ptr) } uint256 numBytesToSkip = numBytesToLowerData[callId]; // get the number of bytes between the pointer and the lower arguments if (numBytesToSkip == 0) revert NotALowerTx(); // we don't recognise this Call ID as a lower so revert bytes32 t2PubKey; address token; uint128 amount; address recipient; assembly { ptr := add(ptr, numBytesToSkip) // skip the required number of bytes to point to the start of lower transaction arguments t2PubKey := calldataload(ptr) // load next 32 bytes into 32 byte type starting at ptr token := calldataload(add(ptr, 20)) // load leftmost 20 of next 32 bytes into 20 byte type starting at ptr + 20 amount := calldataload(add(ptr, 36)) // load leftmost 16 of next 32 bytes into 16 byte type starting at ptr + 20 + 16 recipient := calldataload(add(ptr, 56)) // load leftmost 20 of next 32 bytes type starting at ptr + 20 + 16 + 20 // the amount was encoded in little endian so reverse it to big endian: amount := or( shr(8, and(amount, 0xFF00FF00FF00FF00FF00FF00FF00FF00)), shl(8, and(amount, 0x00FF00FF00FF00FF00FF00FF00FF00FF)) ) amount := or( shr(16, and(amount, 0xFFFF0000FFFF0000FFFF0000FFFF0000)), shl(16, and(amount, 0x0000FFFF0000FFFF0000FFFF0000FFFF)) ) amount := or( shr(32, and(amount, 0xFFFFFFFF00000000FFFFFFFF00000000)), shl(32, and(amount, 0x00000000FFFFFFFF00000000FFFFFFFF)) ) amount := or(shr(64, amount), shl(64, amount)) } _releaseFunds(token, amount, recipient); emit LogLegacyLowered(token, recipient, t2PubKey, amount); } /** * @dev Enables anyone to claim the amount of funds specified in the T2-supplied proof, for the intended recipient. */ function claimLower(bytes calldata proof) external onlyWhenLoweringEnabled lock { if (proof.length < MINIMUM_PROOF_LENGTH) revert InvalidProof(); address token; uint256 amount; address recipient; uint32 lowerId; assembly { token := shr(96, calldataload(proof.offset)) amount := calldataload(add(proof.offset, 20)) recipient := shr(96, calldataload(add(proof.offset, 52))) lowerId := shr(224, calldataload(add(proof.offset, 72))) } bytes32 lowerHash = keccak256(abi.encodePacked(token, amount, recipient, lowerId)); if (hasLowered[lowerHash]) revert LowerIsUsed(); hasLowered[lowerHash] = true; _verifyConfirmations(true, lowerHash, proof[LOWER_DATA_LENGTH:]); _releaseFunds(token, amount, recipient); emit LogLowerClaimed(lowerId); emit LogLowered(lowerId, token, recipient, amount); } /** @dev Check a lower proof. Returns the details, proof validity, and whether or not the lower has been claimed. * For unclaimed lowers, if the confirmations required exceed those provided then the proof must be regenerated * by T2 before claiming. */ function checkLower( bytes calldata proof ) external view returns ( address token, uint256 amount, address recipient, uint32 lowerId, uint256 confirmationsRequired, uint256 confirmationsProvided, bool proofIsValid, bool lowerIsClaimed ) { if (proof.length < MINIMUM_PROOF_LENGTH) return (address(0), 0, address(0), 0, 0, 0, false, false); token = address(bytes20(proof[0:20])); amount = uint256(bytes32(proof[20:52])); recipient = address(bytes20(proof[52:72])); lowerId = uint32(bytes4(proof[72:LOWER_DATA_LENGTH])); bytes32 lowerHash = keccak256(abi.encodePacked(token, amount, recipient, lowerId)); uint256 numConfirmations = (proof.length - LOWER_DATA_LENGTH) / SIGNATURE_LENGTH; bool[] memory confirmed = new bool[](nextAuthorId); bytes32 ethSignedPrefixMsgHash = keccak256(abi.encodePacked(ESM_PREFIX, lowerHash)); uint256 confirmationsOffset; lowerIsClaimed = hasLowered[lowerHash]; confirmationsProvided = numConfirmations; confirmationsRequired = _requiredConfirmations(); assembly { confirmationsOffset := add(proof.offset, LOWER_DATA_LENGTH) } for (uint256 i = 0; i < numConfirmations; ++i) { uint256 id = _recoverAuthorId(ethSignedPrefixMsgHash, confirmationsOffset, i); if (authorIsActive[id] && !confirmed[id]) confirmed[id] = true; else confirmationsProvided--; } proofIsValid = confirmationsProvided >= confirmationsRequired; } /** * @dev Enables anyone to check the current status of any author transaction. Helper function, intended for use by T2 authors. */ function corroborate(uint32 t2TxId, uint256 expiry) external view returns (int8) { if (isUsedT2TxId[t2TxId]) return TX_SUCCEEDED; else if (block.timestamp > expiry) return TX_FAILED; else return TX_PENDING; } /** * @dev The new owner accepts the ownership transfer. */ function acceptOwnership() external { if (msg.sender != pendingOwner) revert PendingOwnerOnly(); delete pendingOwner; _transferOwnership(msg.sender); } /** * @dev Confirm the existence of a T2 extrinsic call within a published root. */ function confirmTransaction(bytes32 leafHash, bytes32[] calldata merklePath) public view returns (bool) { bytes32 node; uint256 i; do { node = merklePath[i]; leafHash = leafHash < node ? keccak256(abi.encode(leafHash, node)) : keccak256(abi.encode(node, leafHash)); unchecked { ++i; } } while (i < merklePath.length); return isPublishedRootHash[leafHash]; } /** @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. * Can only be called by the current owner. */ function transferOwnership(address newOwner) public override onlyOwner { pendingOwner = newOwner; emit OwnershipTransferStarted(owner(), newOwner); } /** * @dev Disables the renounceOwnership function to prevent relinquishing ownership. */ function renounceOwnership() public view override onlyOwner { revert RenounceOwnershipDisabled(); } function _authorizeUpgrade(address) internal override onlyOwner {} function _initialiseAuthors( address[] calldata t1Addresses, bytes32[] calldata t1PubKeysLHS, bytes32[] calldata t1PubKeysRHS, bytes32[] calldata t2PubKeys ) private { uint256 numAuth = t1Addresses.length; if (numAuth < MINIMUM_NUMBER_OF_AUTHORS) revert NotEnoughAuthors(); if (t1PubKeysLHS.length != numAuth || t1PubKeysRHS.length != numAuth || t2PubKeys.length != numAuth) revert MissingKeys(); bytes memory t1PubKey; address t1Address; uint256 i; do { t1Address = t1Addresses[i]; t1PubKey = abi.encode(t1PubKeysLHS[i], t1PubKeysRHS[i]); if (address(uint160(uint256(keccak256(t1PubKey)))) != t1Address) revert AddressMismatch(); if (t1AddressToId[t1Address] != 0) revert T1AddressInUse(t1Address); _activateAuthor(_addNewAuthor(t1Address, t2PubKeys[i])); unchecked { ++i; } } while (i < numAuth); } function _addNewAuthor(address t1Address, bytes32 t2PubKey) private returns (uint256 id) { unchecked { id = nextAuthorId++; } if (t2PubKeyToId[t2PubKey] != 0) revert T2KeyInUse(t2PubKey); idToT1Address[id] = t1Address; idToT2PubKey[id] = t2PubKey; t1AddressToId[t1Address] = id; t2PubKeyToId[t2PubKey] = id; isAuthor[id] = true; } function _activateAuthor(uint256 id) private { authorIsActive[id] = true; unchecked { ++numActiveAuthors; } } function _releaseFunds(address token, uint256 amount, address recipient) private { if (token == PSEUDO_EWT_ADDRESS) { (bool success, ) = payable(recipient).call{ value: amount }(''); if (!success) revert PaymentFailed(); } else IERC20(token).safeTransfer(recipient, amount); } // reference: https://docs.substrate.io/reference/scale-codec/#fn-1 function _getCompactIntegerByteSize(bytes1 checkByte) private pure returns (uint8 result) { result = uint8(checkByte); assembly { switch and(result, 3) case 0 { result := 1 } // single-byte mode case 1 { result := 2 } // two-byte mode case 2 { result := 4 } // four-byte mode default { result := add(shr(2, result), 5) } // upper 6 bits + 4 = number of bytes to follow + 1 for checkbyte } } function _requiredConfirmations() private view returns (uint256 required) { required = numActiveAuthors; unchecked { required -= (required * 2) / 3; } } function _verifyConfirmations(bool isLower, bytes32 msgHash, bytes calldata confirmations) private { uint256[] memory confirmed = new uint256[](nextAuthorId); bytes32 ethSignedPrefixMsgHash = keccak256(abi.encodePacked(ESM_PREFIX, msgHash)); uint256 requiredConfirmations = _requiredConfirmations(); uint256 numConfirmations = confirmations.length / SIGNATURE_LENGTH; uint256 confirmationsOffset; uint256 confirmationsIndex; uint256 validConfirmations; uint256 authorId; assembly { confirmationsOffset := confirmations.offset } // Setup the first iteration of the do-while loop: if (isLower) { // For lowers all confirmations are explicit so the first authorId is extracted from the first confirmation authorId = _recoverAuthorId(ethSignedPrefixMsgHash, confirmationsOffset, confirmationsIndex); confirmationsIndex = 1; } else { // For non-lowers there is a high likelihood the sender is an author, so their confirmation is taken to be implicit authorId = t1AddressToId[msg.sender]; unchecked { ++numConfirmations; } } do { if (!authorIsActive[authorId]) { if (isAuthor[authorId]) { _activateAuthor(authorId); unchecked { ++validConfirmations; } requiredConfirmations = _requiredConfirmations(); if (validConfirmations == requiredConfirmations) return; // success confirmed[authorId] = 1; } } else if (confirmed[authorId] == 0) { unchecked { ++validConfirmations; } if (validConfirmations == requiredConfirmations) return; // success confirmed[authorId] = 1; } // Setup the next iteration of the loop: authorId = _recoverAuthorId(ethSignedPrefixMsgHash, confirmationsOffset, confirmationsIndex); unchecked { ++confirmationsIndex; } } while (confirmationsIndex <= numConfirmations); revert BadConfirmations(); } function _recoverAuthorId( bytes32 ethSignedPrefixMsgHash, uint256 confirmationsOffset, uint256 confirmationsIndex ) private view returns (uint256 id) { bytes32 r; bytes32 s; uint8 v; assembly { let sig := add(confirmationsOffset, mul(confirmationsIndex, SIGNATURE_LENGTH)) r := calldataload(sig) s := calldataload(add(sig, 32)) v := byte(0, calldataload(add(sig, 64))) } if (v < 27) { unchecked { v += 27; } } id = v < 29 && uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0 ? t1AddressToId[ecrecover(ethSignedPrefixMsgHash, v, r, s)] : 0; } function _storeT2TxId(uint256 t2TxId) private { if (isUsedT2TxId[t2TxId]) revert TxIdIsUsed(); isUsedT2TxId[t2TxId] = true; } function _checkT2PubKey(bytes calldata t2PubKey) private pure returns (bytes32 checkedT2PubKey) { if (t2PubKey.length != 32) revert InvalidT2Key(); checkedT2PubKey = bytes32(t2PubKey); } }
contracts/interfaces/IEnergyBridge.sol
// SPDX-License-Identifier: MIT pragma solidity 0.8.23; interface IEnergyBridge { event LogAuthorsEnabled(bool indexed state); event LogLiftingEnabled(bool indexed state); event LogLoweringEnabled(bool indexed state); event LogMinimumLiftAmount(address indexed token, uint256 amount); event LogDefaultMinimumLift(uint256 denominator); event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); event LogAuthorAdded(address indexed t1Address, bytes32 indexed t2PubKey, uint32 indexed t2TxId); event LogAuthorRemoved(address indexed t1Address, bytes32 indexed t2PubKey, uint32 indexed t2TxId); event LogRootPublished(bytes32 indexed rootHash, uint32 indexed t2TxId); event LogLifted(address indexed token, bytes32 indexed t2PubKey, uint256 amount); event LogLegacyLowered(address indexed token, address indexed t1Address, bytes32 indexed t2PubKey, uint256 amount); event LogLowerClaimed(uint32 indexed lowerId); event LogLowered(uint32 indexed lowerId, address indexed token, address indexed recipient, uint256 amount); // Owner only function toggleAuthors(bool state) external; function toggleLifting(bool state) external; function toggleLowering(bool state) external; function setMinimumLiftAmount(address token, uint256 amount) external; function setDefaultMinimumLift(uint256 denominator) external; // Authors only function addAuthor( bytes calldata t1PubKey, bytes32 t2PubKey, uint256 expiry, uint32 t2TxId, bytes calldata confirmations ) external; function removeAuthor( bytes32 t2PubKey, bytes calldata t1PubKey, uint256 expiry, uint32 t2TxId, bytes calldata confirmations ) external; function publishRoot(bytes32 rootHash, uint256 expiry, uint32 t2TxId, bytes calldata confirmations) external; // Public function lift(address token, bytes calldata t2PubKey, uint256 amount) external; function liftEWT(bytes calldata t2PubKey) external payable; function legacyLower(bytes calldata leaf, bytes32[] calldata merklePath) external; function claimLower(bytes calldata proof) external; function checkLower( bytes calldata proof ) external view returns ( address token, uint256 amount, address recipient, uint32 lowerId, uint256 confirmationsRequired, uint256 confirmationsProvided, bool proofIsValid, bool lowerIsClaimed ); function confirmTransaction(bytes32 leafHash, bytes32[] calldata merklePath) external view returns (bool); function corroborate(uint32 t2TxId, uint256 expiry) external view returns (int8); }
@openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
@openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
@openzeppelin/contracts/interfaces/IERC20.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol) pragma solidity ^0.8.0; import "../token/ERC20/IERC20.sol";
@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._ * _Available since v4.9 for `string`, `bytes`._ */ library StorageSlotUpgradeable { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../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; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.0; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../ERC1967/ERC1967UpgradeUpgradeable.sol"; import "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable { function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual override notDelegated returns (bytes32) { return _IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. * * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function upgradeTo(address newImplementation) public virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. * * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized != type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeaconUpgradeable { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeaconUpgradeable.sol"; import "../../interfaces/IERC1967Upgradeable.sol"; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/StorageSlotUpgradeable.sol"; import "../utils/Initializable.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ */ abstract contract ERC1967UpgradeUpgradeable is Initializable, IERC1967Upgradeable { function __ERC1967Upgrade_init() internal onlyInitializing { } function __ERC1967Upgrade_init_unchained() internal onlyInitializing { } // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { AddressUpgradeable.functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { AddressUpgradeable.functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); } } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
@openzeppelin/contracts-upgradeable/interfaces/draft-IERC1822Upgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822ProxiableUpgradeable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
@openzeppelin/contracts-upgradeable/interfaces/IERC1967Upgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol) pragma solidity ^0.8.0; /** * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC. * * _Available since v4.8.3._ */ interface IERC1967Upgradeable { /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Emitted when the beacon is changed. */ event BeaconUpgraded(address indexed beacon); }
@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"error","name":"AddressMismatch","inputs":[]},{"type":"error","name":"AlreadyAdded","inputs":[]},{"type":"error","name":"AuthorsDisabled","inputs":[]},{"type":"error","name":"BadConfirmations","inputs":[]},{"type":"error","name":"BelowMinimumLift","inputs":[]},{"type":"error","name":"CannotChangeT2Key","inputs":[{"type":"bytes32","name":"existingT2PubKey","internalType":"bytes32"}]},{"type":"error","name":"InvalidProof","inputs":[]},{"type":"error","name":"InvalidT1Key","inputs":[]},{"type":"error","name":"InvalidT2Key","inputs":[]},{"type":"error","name":"InvalidTxData","inputs":[]},{"type":"error","name":"LiftDisabled","inputs":[]},{"type":"error","name":"LiftFailed","inputs":[]},{"type":"error","name":"LiftLimitHit","inputs":[]},{"type":"error","name":"Locked","inputs":[]},{"type":"error","name":"LowerDisabled","inputs":[]},{"type":"error","name":"LowerIsUsed","inputs":[]},{"type":"error","name":"MissingKeys","inputs":[]},{"type":"error","name":"NotALowerTx","inputs":[]},{"type":"error","name":"NotAnAuthor","inputs":[]},{"type":"error","name":"NotEnoughAuthors","inputs":[]},{"type":"error","name":"PaymentFailed","inputs":[]},{"type":"error","name":"PendingOwnerOnly","inputs":[]},{"type":"error","name":"RenounceOwnershipDisabled","inputs":[]},{"type":"error","name":"RootHashIsUsed","inputs":[]},{"type":"error","name":"T1AddressInUse","inputs":[{"type":"address","name":"t1Address","internalType":"address"}]},{"type":"error","name":"T2KeyInUse","inputs":[{"type":"bytes32","name":"t2PubKey","internalType":"bytes32"}]},{"type":"error","name":"TxIdIsUsed","inputs":[]},{"type":"error","name":"UnsignedTx","inputs":[]},{"type":"error","name":"WindowExpired","inputs":[]},{"type":"event","name":"AdminChanged","inputs":[{"type":"address","name":"previousAdmin","internalType":"address","indexed":false},{"type":"address","name":"newAdmin","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"BeaconUpgraded","inputs":[{"type":"address","name":"beacon","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"LogAuthorAdded","inputs":[{"type":"address","name":"t1Address","internalType":"address","indexed":true},{"type":"bytes32","name":"t2PubKey","internalType":"bytes32","indexed":true},{"type":"uint32","name":"t2TxId","internalType":"uint32","indexed":true}],"anonymous":false},{"type":"event","name":"LogAuthorRemoved","inputs":[{"type":"address","name":"t1Address","internalType":"address","indexed":true},{"type":"bytes32","name":"t2PubKey","internalType":"bytes32","indexed":true},{"type":"uint32","name":"t2TxId","internalType":"uint32","indexed":true}],"anonymous":false},{"type":"event","name":"LogAuthorsEnabled","inputs":[{"type":"bool","name":"state","internalType":"bool","indexed":true}],"anonymous":false},{"type":"event","name":"LogDefaultMinimumLift","inputs":[{"type":"uint256","name":"denominator","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"LogLegacyLowered","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"address","name":"t1Address","internalType":"address","indexed":true},{"type":"bytes32","name":"t2PubKey","internalType":"bytes32","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"LogLifted","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"bytes32","name":"t2PubKey","internalType":"bytes32","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"LogLiftingEnabled","inputs":[{"type":"bool","name":"state","internalType":"bool","indexed":true}],"anonymous":false},{"type":"event","name":"LogLowerClaimed","inputs":[{"type":"uint32","name":"lowerId","internalType":"uint32","indexed":true}],"anonymous":false},{"type":"event","name":"LogLowered","inputs":[{"type":"uint32","name":"lowerId","internalType":"uint32","indexed":true},{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"address","name":"recipient","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"LogLoweringEnabled","inputs":[{"type":"bool","name":"state","internalType":"bool","indexed":true}],"anonymous":false},{"type":"event","name":"LogMinimumLiftAmount","inputs":[{"type":"address","name":"token","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"LogRootPublished","inputs":[{"type":"bytes32","name":"rootHash","internalType":"bytes32","indexed":true},{"type":"uint32","name":"t2TxId","internalType":"uint32","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferStarted","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Upgraded","inputs":[{"type":"address","name":"implementation","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"_unused1_","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"acceptOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"addAuthor","inputs":[{"type":"bytes","name":"t1PubKey","internalType":"bytes"},{"type":"bytes32","name":"t2PubKey","internalType":"bytes32"},{"type":"uint256","name":"expiry","internalType":"uint256"},{"type":"uint32","name":"t2TxId","internalType":"uint32"},{"type":"bytes","name":"confirmations","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"authorIsActive","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"authorsEnabled","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"address","name":"recipient","internalType":"address"},{"type":"uint32","name":"lowerId","internalType":"uint32"},{"type":"uint256","name":"confirmationsRequired","internalType":"uint256"},{"type":"uint256","name":"confirmationsProvided","internalType":"uint256"},{"type":"bool","name":"proofIsValid","internalType":"bool"},{"type":"bool","name":"lowerIsClaimed","internalType":"bool"}],"name":"checkLower","inputs":[{"type":"bytes","name":"proof","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimLower","inputs":[{"type":"bytes","name":"proof","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"confirmTransaction","inputs":[{"type":"bytes32","name":"leafHash","internalType":"bytes32"},{"type":"bytes32[]","name":"merklePath","internalType":"bytes32[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"int8","name":"","internalType":"int8"}],"name":"corroborate","inputs":[{"type":"uint32","name":"t2TxId","internalType":"uint32"},{"type":"uint256","name":"expiry","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"defaultMinimumLiftDenominator","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasLowered","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"idToT1Address","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"idToT2PubKey","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address[]","name":"t1Addresses","internalType":"address[]"},{"type":"bytes32[]","name":"t1PubKeysLHS","internalType":"bytes32[]"},{"type":"bytes32[]","name":"t1PubKeysRHS","internalType":"bytes32[]"},{"type":"bytes32[]","name":"t2PubKeys","internalType":"bytes32[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isAuthor","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isPublishedRootHash","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isUsedT2TxId","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"legacyLower","inputs":[{"type":"bytes","name":"leaf","internalType":"bytes"},{"type":"bytes32[]","name":"merklePath","internalType":"bytes32[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"lift","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"bytes","name":"t2PubKey","internalType":"bytes"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"liftEWT","inputs":[{"type":"bytes","name":"t2PubKey","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"liftingEnabled","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"loweringEnabled","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"minimumLiftAmount","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"nextAuthorId","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"numActiveAuthors","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"numBytesToLowerData","inputs":[{"type":"bytes2","name":"","internalType":"bytes2"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"pendingOwner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"proxiableUUID","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"publishRoot","inputs":[{"type":"bytes32","name":"rootHash","internalType":"bytes32"},{"type":"uint256","name":"expiry","internalType":"uint256"},{"type":"uint32","name":"t2TxId","internalType":"uint32"},{"type":"bytes","name":"confirmations","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"removeAuthor","inputs":[{"type":"bytes32","name":"t2PubKey","internalType":"bytes32"},{"type":"bytes","name":"t1PubKey","internalType":"bytes"},{"type":"uint256","name":"expiry","internalType":"uint256"},{"type":"uint32","name":"t2TxId","internalType":"uint32"},{"type":"bytes","name":"confirmations","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setDefaultMinimumLift","inputs":[{"type":"uint256","name":"denominator","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMinimumLiftAmount","inputs":[{"type":"address","name":"token","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"t1AddressToId","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"t2PubKeyToId","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"toggleAuthors","inputs":[{"type":"bool","name":"state","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"toggleLifting","inputs":[{"type":"bool","name":"state","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"toggleLowering","inputs":[{"type":"bool","name":"state","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"upgradeTo","inputs":[{"type":"address","name":"newImplementation","internalType":"address"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"upgradeToAndCall","inputs":[{"type":"address","name":"newImplementation","internalType":"address"},{"type":"bytes","name":"data","internalType":"bytes"}]}]
Deployed ByteCode
0x6080604052600436106102d15760003560e01c806379ba509711610179578063b9b17e7f116100d6578063e69fadb41161008a578063f2fde38b11610064578063f2fde38b146108a6578063fcd3676c146108c6578063ffef8d3b146108e657600080fd5b8063e69fadb414610819578063e6f4b53314610846578063e8fed1d61461087957600080fd5b8063e00f76f9116100bb578063e00f76f9146107a2578063e30c3978146107c2578063e51d0921146107e957600080fd5b8063b9b17e7f146106fe578063df6435121461072e57600080fd5b80638ebd72651161012d578063a8f37db411610112578063a8f37db4146106a8578063b4d034d6146106c8578063b6851152146106de57600080fd5b80638ebd72651461065b578063a05aaa071461067b57600080fd5b80638c5529781161015e5780638c552978146105f05780638cacd6e71461061d5780638da5cb5b1461063d57600080fd5b806379ba5097146105c5578063872d7d57146105da57600080fd5b8063484085741161023257806352d1902d116101e657806364bac416116101c057806364bac4161461056057806366beb4cb14610580578063715018a6146105b057600080fd5b806352d1902d146105115780635882b2a3146105265780635eaf90481461054057600080fd5b80634f1ef286116102175780634f1ef286146104b25780634fa182ea146104c55780634fc221bf146104f257600080fd5b8063484085741461047b5780634c184ff31461049f57600080fd5b80631b4097d811610289578063239c59071161026e578063239c59071461040b5780633659cfe61461043b57806342668bef1461045b57600080fd5b80631b4097d8146103cb5780631f5a970d146103eb57600080fd5b80630d238f9e116102ba5780630d238f9e14610318578063146b3b521461035d57806317a691aa1461037d57600080fd5b80630664c0ba146102d65780630caa9948146102f8575b600080fd5b3480156102e257600080fd5b506102f66102f1366004613867565b610906565b005b34801561030457600080fd5b506102f66103133660046138e6565b610a38565b34801561032457600080fd5b50610348610333366004613940565b60c96020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b34801561036957600080fd5b506102f6610378366004613959565b610db4565b34801561038957600080fd5b506103b3610398366004613940565b60cd602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610354565b3480156103d757600080fd5b506102f66103e63660046139fe565b610fb3565b3480156103f757600080fd5b506102f6610406366004613a1b565b611000565b34801561041757600080fd5b50610348610426366004613940565b60d16020526000908152604090205460ff1681565b34801561044757600080fd5b506102f6610456366004613a45565b611061565b34801561046757600080fd5b506102f6610476366004613aa5565b611203565b34801561048757600080fd5b5061049160da5481565b604051908152602001610354565b6102f66104ad366004613b11565b6115ea565b6102f66104c0366004613b69565b6117e7565b3480156104d157600080fd5b506104916104e0366004613c2b565b60cf6020526000908152604090205481565b3480156104fe57600080fd5b5060d75461034890610100900460ff1681565b34801561051d57600080fd5b50610491611975565b34801561053257600080fd5b5060d7546103489060ff1681565b34801561054c57600080fd5b5061049161055b366004613940565b611a3a565b34801561056c57600080fd5b5060d7546103489062010000900460ff1681565b34801561058c57600080fd5b5061034861059b366004613940565b60ca6020526000908152604090205460ff1681565b3480156105bc57600080fd5b506102f6611a51565b3480156105d157600080fd5b506102f6611a8b565b3480156105e657600080fd5b5061049160d65481565b3480156105fc57600080fd5b5061049161060b366004613940565b60ce6020526000908152604090205481565b34801561062957600080fd5b506102f66106383660046139fe565b611b09565b34801561064957600080fd5b506097546001600160a01b03166103b3565b34801561066757600080fd5b50610348610676366004613c6d565b611b74565b34801561068757600080fd5b50610491610696366004613a45565b60d96020526000908152604090205481565b3480156106b457600080fd5b506102f66106c3366004613b11565b611c1c565b3480156106d457600080fd5b5061049160d55481565b3480156106ea57600080fd5b506102f66106f9366004613cb9565b611e82565b34801561070a57600080fd5b50610348610719366004613940565b60d06020526000908152604090205460ff1681565b34801561073a57600080fd5b5061074e610749366004613b11565b6120a2565b604080516001600160a01b03998a1681526020810198909852979095169686019690965263ffffffff9092166060850152608084015260a083015291151560c082015290151560e082015261010001610354565b3480156107ae57600080fd5b506102f66107bd366004613d1a565b61236e565b3480156107ce57600080fd5b5060d7546103b390630100000090046001600160a01b031681565b3480156107f557600080fd5b50610348610804366004613940565b60d26020526000908152604090205460ff1681565b34801561082557600080fd5b50610491610834366004613940565b60cc6020526000908152604090205481565b34801561085257600080fd5b50610866610861366004613dde565b612575565b60405160009190910b8152602001610354565b34801561088557600080fd5b50610491610894366004613a45565b60cb6020526000908152604090205481565b3480156108b257600080fd5b506102f66108c1366004613a45565b6125b6565b3480156108d257600080fd5b506102f66108e13660046139fe565b612630565b3480156108f257600080fd5b506102f6610901366004613940565b612675565b60d75460ff1661092957604051630f68ca4760e31b815260040160405180910390fd5b838042111561094b57604051633ddfdb7f60e11b815260040160405180910390fd5b600086815260d0602052604090205460ff1615610994576040517f2c8a3b6e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516020810188905290810186905263ffffffff851660608201526109d8906000906080016040516020818303038152906040528051906020012085856126b8565b6109e78463ffffffff16612916565b600086815260d06020526040808220805460ff191660011790555163ffffffff86169188917f43c04551f5c228dcd139615dac0f9d231bcca473808592eea9a62a8504eaf9639190a3505050505050565b60d754610100900460ff16610a79576040517fb63d2c8c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038416600090815260d960205260409020548490829080158015610ac157506001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14155b8015610ace575060da5415155b15610b455760da54836001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b389190613dfa565b610b429190613e29565b90505b811580610b5157508082105b15610b88576040517f65ffd62d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600260d85403610bab576040516303cb96db60e21b815260040160405180910390fd5b600260d8556040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906001600160a01b038916906370a0823190602401602060405180830381865afa158015610c10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c349190613dfa565b9050610c4b6001600160a01b03891633308861297a565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000906001600160a01b038a16906370a0823190602401602060405180830381865afa158015610cab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ccf9190613dfa565b9050818111610d0a576040517fb19ed51900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6fffffffffffffffffffffffffffffffff811115610d54576040517fc36d283000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610d5e8888612a2b565b6001600160a01b038a167f418da8f85cfa851601f87634c6950491b6b8785a6445c8584f5658048d512cae610d938585613e4b565b60405190815260200160405180910390a35050600160d85550505050505050565b60d75460ff16610dd757604051630f68ca4760e31b815260040160405180910390fd5b8380421115610df957604051633ddfdb7f60e11b815260040160405180910390fd5b60408614610e33576040517f4b0218a800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600088815260cc602090815260408083205480845260c99092529091205460ff16610e8a576040517f157b051200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600081815260c960205260409020805460ff1916905560d554600410610edc576040517f3a6a875c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600081815260ca602052604090205460ff1615610f1457600081815260ca60205260409020805460ff1916905560d580546000190190555b610f4f60008a8a8a8a8a604051602001610f32959493929190613e89565b6040516020818303038152906040528051906020012086866126b8565b610f5e8563ffffffff16612916565b600081815260cd602052604080822054905163ffffffff8816928c926001600160a01b0316917fa8a7bc47477d28ccc711706cbda958b39da6fdb915d2746405866d89698f6de69190a4505050505050505050565b610fbb612a78565b60d7805461ff001916610100831515908102919091179091556040517f749ca68fae31d0cfb5bab03f4b6efbdc3d1309e0ab82818178082487298b7a7690600090a250565b611008612a78565b6001600160a01b038216600081815260d9602052604090819020839055517fbf549593688f88fcbeb60f46bab48e3f958a8fd45c489e2f2ea3cb8ce9bad10b906110559084815260200190565b60405180910390a25050565b6001600160a01b037f0000000000000000000000001fc6ba2f5e585c14f32af253ff910ee14726593f1630036111045760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c000000000000000000000000000000000000000060648201526084015b60405180910390fd5b7f0000000000000000000000001fc6ba2f5e585c14f32af253ff910ee14726593f6001600160a01b031661115f7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b0316146111db5760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f7879000000000000000000000000000000000000000060648201526084016110fb565b6111e481612ad2565b6040805160008082526020820190925261120091839190612ada565b50565b60d75462010000900460ff16611245576040517f499e8c3a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600260d85403611268576040516303cb96db60e21b815260040160405180910390fd5b600260d8556040516000906112809086908690613ec1565b60405180910390209050611295818484611b74565b6112cb576040517fb9bb32e800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600081815260d2602052604090205460ff1615611314576040517f24c1c1ce00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600081815260d260205260408120805460ff1916600117905561134f8686838161134057611340613ed1565b9050013560f81c60f81b612c7f565b60ff160185858281811061136557611365613ed1565b909101357f80000000000000000000000000000000000000000000000000000000000000001660000390506113c6576040517f99e50fbd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8585826063018181106113db576113db613ed1565b909101357fff000000000000000000000000000000000000000000000000000000000000001615905061140f576065611412565b60645b60ff160161142b86868381811061134057611340613ed1565b60ff160161144486868381811061134057611340613ed1565b60ff1601850180357fffff0000000000000000000000000000000000000000000000000000000000008116600090815260cf6020526040812054908190036114b8576040517fd41effec00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b91820191823560148401356eff000000ff000000ff000000ff00006024860135600881811c9283166fff000000ff000000ff000000ff0000009290911b91821617601090811c6cff000000ff000000ff000000ff9093166dff000000ff000000ff000000ff0090921691909117901b17602081811c6bffffffff00000000ffffffff166fffffffff00000000ffffffff000000009290911b9190911617604081811c91901b176038860135611580836fffffffffffffffffffffffffffffffff841683612cc9565b6040516fffffffffffffffffffffffffffffffff8316815284906001600160a01b0380841691908616907f8133d6f4be40b4be8404ddcb7ead17d8a20aa57785d1aab2f809c24cf76bd6d19060200160405180910390a45050600160d85550505050505050505050565b60d754610100900460ff1661162b576040517fb63d2c8c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee600081905260d96020527f5c1219f60ce492722326eb05199f1e7e88b3c39eee8e2bdfdaa340b16a60c5cb5434908015801561169957506001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14155b80156116a6575060da5415155b1561171d5760da54836001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156116ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117109190613dfa565b61171a9190613e29565b90505b81158061172957508082105b15611760576040517f65ffd62d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600260d85403611783576040516303cb96db60e21b815260040160405180910390fd5b600260d8556117928585612a2b565b60405134815273eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee907f418da8f85cfa851601f87634c6950491b6b8785a6445c8584f5658048d512cae9060200160405180910390a35050600160d855505050565b6001600160a01b037f0000000000000000000000001fc6ba2f5e585c14f32af253ff910ee14726593f1630036118855760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f64656c656761746563616c6c000000000000000000000000000000000000000060648201526084016110fb565b7f0000000000000000000000001fc6ba2f5e585c14f32af253ff910ee14726593f6001600160a01b03166118e07f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b6001600160a01b03161461195c5760405162461bcd60e51b815260206004820152602c60248201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060448201527f6163746976652070726f7879000000000000000000000000000000000000000060648201526084016110fb565b61196582612ad2565b61197182826001612ada565b5050565b6000306001600160a01b037f0000000000000000000000001fc6ba2f5e585c14f32af253ff910ee14726593f1614611a155760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016110fb565b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc90565b60d38160028110611a4a57600080fd5b0154905081565b611a59612a78565b6040517fffc0fd9300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60d754630100000090046001600160a01b03163314611ad6576040517f306bd3d700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60d780547fffffffffffffffffff0000000000000000000000000000000000000000ffffff169055611b0733612d9a565b565b611b11612a78565b60d780547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffff1662010000831515908102919091179091556040517f8713af94867086ff18e93beb030e44bc5542cd733709d67cd78d06db7d61b8cf90600090a250565b60008060005b848482818110611b8c57611b8c613ed1565b905060200201359150818610611bcb57604080516020810184905290810187905260600160405160208183030381529060405280519060200120611bf6565b6040805160208101889052908101839052606001604051602081830303815290604052805190602001205b9550600101838110611b7a575050506000928352505060d0602052604090205460ff1690565b60d75462010000900460ff16611c5e576040517f499e8c3a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600260d85403611c81576040516303cb96db60e21b815260040160405180910390fd5b600260d8819055611c9490604190613ee7565b611c9f90604c613efe565b811015611cd8576040517f09bde33900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040516bffffffffffffffffffffffff19833581811660208401526014850135603480850182905286013592831660548501527fffffffff0000000000000000000000000000000000000000000000000000000060488701359081166068860152606092831c94919390921c9160e01c90600090606c0160408051601f198184030181529181528151602092830120600081815260d290935291205490915060ff1615611db1576040517f24c1c1ce00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600081815260d260205260409020805460ff19166001908117909155611de49082611ddf89604c818d613f11565b6126b8565b611def858585612cc9565b60405163ffffffff8316907f9853e4c075911a10a89a0f7a46bac6f8a246c4e9152480d16d86aa6a2391a4f190600090a2826001600160a01b0316856001600160a01b03168363ffffffff167f35785504aaf3ebdff5a444e169347a35e8f1b7bf982515c2e7d120b64fb6fb2a87604051611e6c91815260200190565b60405180910390a45050600160d8555050505050565b60d75460ff16611ea557604051630f68ca4760e31b815260040160405180910390fd5b8380421115611ec757604051633ddfdb7f60e11b815260040160405180910390fd5b60408714611f01576040517f4b0218a800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008888604051611f13929190613ec1565b60408051918290039091206001600160a01b038116600090815260cb60209081528382205480835260c99091529290205490925060ff1615611f81576040517ff411c32700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611fbc60008b8b8b8b8b604051602001611f9f959493929190613f3b565b6040516020818303038152906040528051906020012087876126b8565b611fcb8663ffffffff16612916565b80600003611fe357611fdd8289612df9565b50612058565b600081815260ce6020526040902054881461203e57600081815260ce6020526040908190205490517f140c681500000000000000000000000000000000000000000000000000000000815260048101919091526024016110fb565b600081815260c960205260409020805460ff191660011790555b8563ffffffff1688836001600160a01b03167f697a463b143a01bd93749c518e1e69d9b29fbba6408f1789236a2e4b24dab84c60405160405180910390a450505050505050505050565b6000808080808080806120b760416002613ee7565b6120c290604c613efe565b8910156120e657506000965086955085945084935083925082915081905080612361565b6120f4601460008b8d613f11565b6120fd91613f72565b60601c9750612110603460148b8d613f11565b61211991613fa7565b9650612129604860348b8d613f11565b61213291613f72565b60601c9550612145604c60488b8d613f11565b61214e91613fc5565b6040516bffffffffffffffffffffffff1960608b811b82166020840152603483018b905289901b1660548201527fffffffff000000000000000000000000000000000000000000000000000000008216606882015260e09190911c9550600090606c0160408051601f1981840301815291905280516020909101209050600060416121da604c8d613e4b565b6121e49190613e29565b9050600060d65467ffffffffffffffff81111561220357612203613b53565b60405190808252806020026020018201604052801561222c578160200160208202803683370190505b50905060006040518060400160405280601c81526020017f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152508460405160200161227992919061402f565b60408051808303601f190181529181528151602092830120600087815260d29093529082205460d55495995060ff1696508894909250600360028202049003985050604c8e0160005b848110156123545760006122d7848484612ec5565b600081815260ca602052604090205490915060ff16801561230f575084818151811061230557612305613ed1565b6020026020010151155b1561233d57600185828151811061232857612328613ed1565b9115156020928302919091019091015261234b565b8961234781614051565b9a50505b506001016122c2565b5088881015965050505050505b9295985092959890939650565b600054610100900460ff161580801561238e5750600054600160ff909116105b806123a85750303b1580156123a8575060005460ff166001145b61241a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016110fb565b6000805460ff19166001179055801561243d576000805461ff0019166101001790555b612445612fb6565b61244d61303b565b60cf60205260857f474cf5cd8a156a285bdb013cd5ad88639478d8c2df5dd0da103de5e0c93be11f8190557f260a2a8177dfbdaed58acd0b3df5d4289c584f88be17037c5ed3bb018cde8169557f570200000000000000000000000000000000000000000000000000000000000060005260027f475ac2ade161108313ceef0815ca8140b4df68a82031c72f4e2f1441479510655560d780547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000001662010101179055600160d65561252489898989898989896130b8565b801561256a576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050565b63ffffffff8216600090815260d1602052604081205460ff161561259b575060016125b0565b814211156125ac57506000196125b0565b5060005b92915050565b6125be612a78565b60d780547fffffffffffffffffff0000000000000000000000000000000000000000ffffff1663010000006001600160a01b03848116918202929092179092556097546040519116907f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270090600090a350565b612638612a78565b60d7805460ff19168215159081179091556040517f21696bd848bea290ccde93edff157cd334ca5c968ae5264d86727fac0d5f36d190600090a250565b61267d612a78565b60da8190556040518181527f1283ff170111200f5977c3665f4280de6c49dc7427ad88340015e7e0a22458be9060200160405180910390a150565b600060d65467ffffffffffffffff8111156126d5576126d5613b53565b6040519080825280602002602001820160405280156126fe578160200160208202803683370190505b50905060006040518060400160405280601c81526020017f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152508560405160200161274b92919061402f565b604051602081830303815290604052805190602001209050600061277760d55460036002820204900390565b90506000612786604186613e29565b905085600080808b156127a95761279e878585612ec5565b9050600192506127c1565b5033600090815260cb60205260409020546001909401935b600081815260ca602052604090205460ff1661286757600081815260c9602052604090205460ff16156128625761281981600090815260ca60205260409020805460ff1916600190811790915560d580549091019055565b60d5546001909201916003600282020490039550858203612841575050505050505050612910565b600188828151811061285557612855613ed1565b6020026020010181815250505b6128c3565b87818151811061287957612879613ed1565b60200260200101516000036128c3578160010191508582036128a2575050505050505050612910565b60018882815181106128b6576128b6613ed1565b6020026020010181815250505b6128ce878585612ec5565b9050826001019250848311156127c1576040517f409c8aac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b600081815260d1602052604090205460ff161561295f576040517f7edd16f000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600090815260d160205260409020805460ff19166001179055565b6040516001600160a01b03808516602483015283166044820152606481018290526129109085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526132e5565b600060208214612a67576040517ff4fc87a400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612a718284613fa7565b9392505050565b6097546001600160a01b03163314611b075760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016110fb565b611200612a78565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615612b1257612b0d836133cd565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612b6c575060408051601f3d908101601f19168201909252612b6991810190613dfa565b60015b612bde5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201527f6f6e206973206e6f74205555505300000000000000000000000000000000000060648201526084016110fb565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc8114612c735760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f7860448201527f6961626c6555554944000000000000000000000000000000000000000000000060648201526084016110fb565b50612b0d838383613498565b60f881901c600381168015612cac5760018114612cb55760028114612cbe5760058260021c019150612cc3565b60019150612cc3565b60029150612cc3565b600491505b50919050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b03841601612d86576000816001600160a01b03168360405160006040518083038185875af1925050503d8060008114612d46576040519150601f19603f3d011682016040523d82523d6000602084013e612d4b565b606091505b5050905080612910576040517ff499da2000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612b0d6001600160a01b03841682846134bd565b609780546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60d6805460018101909155600082815260cc602052604090205415612e4d576040517f02f3935c000000000000000000000000000000000000000000000000000000008152600481018390526024016110fb565b600081815260cd6020908152604080832080546001600160a01b0390971673ffffffffffffffffffffffffffffffffffffffff199097168717905560ce825280832085905594825260cb815284822083905592815260cc835283812082905581815260c9909252919020805460ff1916600117905590565b600060418202830180359060208101359060400135831a601b811015612ee957601b015b601d8160ff16108015612f1c57507f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08211155b612f27576000612fab565b604080516000808252602082018084528a905260ff841692820192909252606081018590526080810184905260cb919060019060a0016020604051602081039080840390855afa158015612f7f573d6000803e3d6000fd5b505050602060405103516001600160a01b03166001600160a01b03168152602001908152602001600020545b979650505050505050565b600054610100900460ff166130335760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016110fb565b611b07613506565b600054610100900460ff16611b075760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016110fb565b8660048110156130f4576040517f3a6a875c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b85811415806131035750838114155b8061310e5750818114155b15613145576040517f097ec09e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60606000805b8b8b8281811061315d5761315d613ed1565b90506020020160208101906131729190613a45565b915089898281811061318657613186613ed1565b9050602002013588888381811061319f5761319f613ed1565b905060200201356040516020016131c0929190918252602082015260400190565b6040516020818303038152906040529250816001600160a01b0316838051906020012060001c6001600160a01b031614613226576040517f4cd87fb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038216600090815260cb602052604090205415613281576040517f78f22dd10000000000000000000000000000000000000000000000000000000081526001600160a01b03831660048201526024016110fb565b6132cd6132a68388888581811061329a5761329a613ed1565b90506020020135612df9565b600090815260ca60205260409020805460ff1916600190811790915560d580549091019055565b60010183811061314b57505050505050505050505050565b600061333a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661358c9092919063ffffffff16565b905080516000148061335b57508080602001905181019061335b9190614068565b612b0d5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016110fb565b6001600160a01b0381163b61344a5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016110fb565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b6134a1836135a3565b6000825111806134ae5750805b15612b0d5761291083836135e3565b6040516001600160a01b038316602482015260448101829052612b0d9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064016129c7565b600054610100900460ff166135835760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e6700000000000000000000000000000000000000000060648201526084016110fb565b611b0733612d9a565b606061359b8484600085613608565b949350505050565b6135ac816133cd565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060612a7183836040518060600160405280602781526020016140d5602791396136ef565b6060824710156136805760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016110fb565b600080866001600160a01b0316858760405161369c9190614085565b60006040518083038185875af1925050503d80600081146136d9576040519150601f19603f3d011682016040523d82523d6000602084013e6136de565b606091505b5091509150612fab87838387613767565b6060600080856001600160a01b03168560405161370c9190614085565b600060405180830381855af49150503d8060008114613747576040519150601f19603f3d011682016040523d82523d6000602084013e61374c565b606091505b509150915061375d86838387613767565b9695505050505050565b606083156137d65782516000036137cf576001600160a01b0385163b6137cf5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016110fb565b508161359b565b61359b83838151156137eb5781518083602001fd5b8060405162461bcd60e51b81526004016110fb91906140a1565b803563ffffffff8116811461381957600080fd5b919050565b60008083601f84011261383057600080fd5b50813567ffffffffffffffff81111561384857600080fd5b60208301915083602082850101111561386057600080fd5b9250929050565b60008060008060006080868803121561387f57600080fd5b853594506020860135935061389660408701613805565b9250606086013567ffffffffffffffff8111156138b257600080fd5b6138be8882890161381e565b969995985093965092949392505050565b80356001600160a01b038116811461381957600080fd5b600080600080606085870312156138fc57600080fd5b613905856138cf565b9350602085013567ffffffffffffffff81111561392157600080fd5b61392d8782880161381e565b9598909750949560400135949350505050565b60006020828403121561395257600080fd5b5035919050565b600080600080600080600060a0888a03121561397457600080fd5b87359650602088013567ffffffffffffffff8082111561399357600080fd5b61399f8b838c0161381e565b909850965060408a013595508691506139ba60608b01613805565b945060808a01359150808211156139d057600080fd5b506139dd8a828b0161381e565b989b979a50959850939692959293505050565b801515811461120057600080fd5b600060208284031215613a1057600080fd5b8135612a71816139f0565b60008060408385031215613a2e57600080fd5b613a37836138cf565b946020939093013593505050565b600060208284031215613a5757600080fd5b612a71826138cf565b60008083601f840112613a7257600080fd5b50813567ffffffffffffffff811115613a8a57600080fd5b6020830191508360208260051b850101111561386057600080fd5b60008060008060408587031215613abb57600080fd5b843567ffffffffffffffff80821115613ad357600080fd5b613adf8883890161381e565b90965094506020870135915080821115613af857600080fd5b50613b0587828801613a60565b95989497509550505050565b60008060208385031215613b2457600080fd5b823567ffffffffffffffff811115613b3b57600080fd5b613b478582860161381e565b90969095509350505050565b634e487b7160e01b600052604160045260246000fd5b60008060408385031215613b7c57600080fd5b613b85836138cf565b9150602083013567ffffffffffffffff80821115613ba257600080fd5b818501915085601f830112613bb657600080fd5b813581811115613bc857613bc8613b53565b604051601f8201601f19908116603f01168101908382118183101715613bf057613bf0613b53565b81604052828152886020848701011115613c0957600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b600060208284031215613c3d57600080fd5b81357fffff00000000000000000000000000000000000000000000000000000000000081168114612a7157600080fd5b600080600060408486031215613c8257600080fd5b83359250602084013567ffffffffffffffff811115613ca057600080fd5b613cac86828701613a60565b9497909650939450505050565b600080600080600080600060a0888a031215613cd457600080fd5b873567ffffffffffffffff80821115613cec57600080fd5b613cf88b838c0161381e565b909950975060208a0135965060408a013595508791506139ba60608b01613805565b6000806000806000806000806080898b031215613d3657600080fd5b883567ffffffffffffffff80821115613d4e57600080fd5b613d5a8c838d01613a60565b909a50985060208b0135915080821115613d7357600080fd5b613d7f8c838d01613a60565b909850965060408b0135915080821115613d9857600080fd5b613da48c838d01613a60565b909650945060608b0135915080821115613dbd57600080fd5b50613dca8b828c01613a60565b999c989b5096995094979396929594505050565b60008060408385031215613df157600080fd5b613a3783613805565b600060208284031215613e0c57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600082613e4657634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156125b0576125b0613e13565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b858152608060208201526000613ea3608083018688613e5e565b905083604083015263ffffffff831660608301529695505050505050565b8183823760009101908152919050565b634e487b7160e01b600052603260045260246000fd5b80820281158282048414176125b0576125b0613e13565b808201808211156125b0576125b0613e13565b60008085851115613f2157600080fd5b83861115613f2e57600080fd5b5050820193919092039150565b608081526000613f4f608083018789613e5e565b602083019590955250604081019290925263ffffffff1660609091015292915050565b6bffffffffffffffffffffffff198135818116916014851015613f9f5780818660140360031b1b83161692505b505092915050565b803560208310156125b057600019602084900360031b1b1692915050565b7fffffffff000000000000000000000000000000000000000000000000000000008135818116916004851015613f9f5760049490940360031b84901b1690921692915050565b60005b8381101561402657818101518382015260200161400e565b50506000910152565b6000835161404181846020880161400b565b9190910191825250602001919050565b60008161406057614060613e13565b506000190190565b60006020828403121561407a57600080fd5b8151612a71816139f0565b6000825161409781846020870161400b565b9190910192915050565b60208152600082518060208401526140c081604085016020870161400b565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208beb977d161b06b2a29ec54e873ee7e6c4f97dec94b2cb15afb0375f21c1e3d564736f6c63430008170033