Address Details
contract
0x211653bE4BF4d481D3c728917BaE706B36073330
- Contract Name
- Account
- Creator
- 0x5bc1c4–68a788 at 0x7a90f8–37340d
- Balance
- 0 CELO ( )
- Tokens
-
Fetching tokens...
- Transactions
- 0 Transactions
- Transfers
- 0 Transfers
- Gas Used
- Fetching gas used...
- Last Balance Update
- 15095632
This contract has been verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- Account
- Optimization enabled
- false
- Compiler version
- v0.8.11+commit.d7f03943
- EVM Version
- istanbul
- Verified at
- 2022-09-30T08:12:54.148650Z
contracts/Account.sol
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity 0.8.11; import "@openzeppelin/contracts/utils/math/Math.sol"; import "./Managed.sol"; import "./common/UUPSOwnableUpgradeable.sol"; import "./common/UsingRegistryUpgradeable.sol"; import "./interfaces/IAccount.sol"; /** * @title A contract that facilitates voting on behalf of StakedCelo.sol. * @notice This contract depends on the Manager to decide how to distribute votes and how to * keep track of ownership of CELO voted via this contract. */ contract Account is UUPSOwnableUpgradeable, UsingRegistryUpgradeable, Managed, IAccount { /** * @notice Used to keep track of a pending withdrawal. A similar data structure * exists within LockedGold.sol, but it only keeps track of pending withdrawals * by the msg.sender to the LockedGold contract. * Because this contract facilitates withdrawals for different beneficiaries, * this contract must keep track of which beneficiaries correspond to which * pending withdrawals to prevent someone from finalizing/taking a pending * withdrawal they did not create. * @param value The withdrawal amount. * @param timestamp The timestamp at which the withdrawal amount becomes available. */ struct PendingWithdrawal { uint256 value; uint256 timestamp; } /** * @notice Used to keep track of CELO that is scheduled to be used for * voting or revoking for a validator group. * @param toVote Amount of CELO held by this contract intended to vote for a group. * @param toWithdraw Amount of CELO that's scheduled for withdrawal. * @param toWithdrawFor Amount of CELO that's scheduled for withdrawal grouped by beneficiary. */ struct ScheduledVotes { uint256 toVote; uint256 toWithdraw; mapping(address => uint256) toWithdrawFor; } /** * @notice Keyed by beneficiary address, the related array of pending withdrawals. * See `PendingWithdrawal` for more info. */ mapping(address => PendingWithdrawal[]) public pendingWithdrawals; /** * @notice Keyed by validator group address, the ScheduledVotes struct * which holds the amount of CELO that's scheduled to vote, the amount * of CELO scheduled to be withdrawn, and the amount of CELO to be * withdrawn for each beneficiary. */ mapping(address => ScheduledVotes) private scheduledVotes; /** * @notice Total amount of CELO scheduled to be withdrawn from all groups * by all beneficiaries. */ uint256 public totalScheduledWithdrawals; /** * @notice Emitted when CELO is scheduled for voting for a given group. * @param group The validator group the CELO is intended to vote for. * @param amount The amount of CELO scheduled. */ event VotesScheduled(address indexed group, uint256 amount); /** * @notice Emitted when CELO withdrawal is scheduled for a group. * @param group The validator group the CELO is withdrawn from. * @param withdrawalAmount The amount of CELO requested for withdrawal. * @param beneficiary The user for whom the withdrawal amount is intended for. */ event CeloWithdrawalScheduled( address indexed beneficiary, address indexed group, uint256 withdrawalAmount ); /** * @notice Emitted when CELO withdrawal kicked off for group. Immediate withdrawals * are not included in this event, but can be identified by a GoldToken.sol transfer * from this contract. * @param group The validator group the CELO is withdrawn from. * @param withdrawalAmount The amount of CELO requested for withdrawal. * @param beneficiary The user for whom the withdrawal amount is intended for. */ event CeloWithdrawalStarted( address indexed beneficiary, address indexed group, uint256 withdrawalAmount ); /** * @notice Emitted when a CELO withdrawal completes for `beneficiary`. * @param beneficiary The user for whom the withdrawal amount is intended. * @param amount The amount of CELO requested for withdrawal. * @param timestamp The timestamp of the pending withdrawal. */ event CeloWithdrawalFinished(address indexed beneficiary, uint256 amount, uint256 timestamp); /// @notice Used when the creation of an account with Accounts.sol fails. error AccountCreationFailed(); /// @notice Used when arrays passed for scheduling votes don't have matching lengths. error GroupsAndVotesArrayLengthsMismatch(); /** * @notice Used when the sum of votes per groups during vote scheduling * doesn't match the `msg.value` sent with the call. * @param sentValue The `msg.value` of the call. * @param expectedValue The expected sum of votes for groups. */ error TotalVotesMismatch(uint256 sentValue, uint256 expectedValue); /// @notice Used when activating of pending votes via Election has failed. error ActivatePendingVotesFailed(address group); /// @notice Used when voting via Election has failed. error VoteFailed(address group, uint256 amount); /// @notice Used when call to Election.sol's `revokePendingVotes` fails. error RevokePendingFailed(address group, uint256 amount); /// @notice Used when call to Election.sol's `revokeActiveVotes` fails. error RevokeActiveFailed(address group, uint256 amount); /** * @notice Used when active + pending votes amount is unable to fulfil a * withdrawal request amount. */ error InsufficientRevokableVotes(address group, uint256 amount); /// @notice Used when unable to transfer CELO. error CeloTransferFailed(address to, uint256 amount); /** * @notice Used when `pendingWithdrawalIndex` is too high for the * beneficiary's pending withdrawals array. */ error PendingWithdrawalIndexTooHigh( uint256 pendingWithdrawalIndex, uint256 pendingWithdrawalsLength ); /** * @notice Used when attempting to schedule more withdrawals * than CELO available to the contract. * @param group The offending group. * @param celoAvailable CELO available to the group across scheduled, pending and active votes. * @param celoToWindraw total amount of CELO that would be scheduled to be withdrawn. */ error WithdrawalAmountTooHigh(address group, uint256 celoAvailable, uint256 celoToWindraw); /** * @notice Used when any of the resolved stakedCeloGroupVoter.pendingWithdrawal * values do not match the equivalent record in lockedGold.pendingWithdrawals. */ error InconsistentPendingWithdrawalValues( uint256 localPendingWithdrawalValue, uint256 lockedGoldPendingWithdrawalValue ); /** * @notice Used when any of the resolved stakedCeloGroupVoter.pendingWithdrawal * timestamps do not match the equivalent record in lockedGold.pendingWithdrawals. */ error InconsistentPendingWithdrawalTimestamps( uint256 localPendingWithdrawalTimestamp, uint256 lockedGoldPendingWithdrawalTimestamp ); /// @notice There's no amount of scheduled withdrawal for the given beneficiary and group. error NoScheduledWithdrawal(address beneficiary, address group); /** * @notice Empty constructor for proxy implementation, `initializer` modifer ensures the * implementation gets initialized. */ // solhint-disable-next-line no-empty-blocks constructor() initializer {} /** * @param _registry The address of the Celo registry. * @param _manager The address of the Manager contract. * @param _owner The address of the contract owner. */ function initialize( address _registry, address _manager, address _owner ) external initializer { __UsingRegistry_init(_registry); __Managed_init(_manager); _transferOwnership(_owner); // Create an account so this contract can vote. if (!getAccounts().createAccount()) { revert AccountCreationFailed(); } } // solhint-disable-next-line no-empty-blocks receive() external payable {} /** * @notice Deposits CELO sent via msg.value as unlocked CELO intended as * votes for groups. * @dev Only callable by the Staked CELO contract, which must restrict which groups are valid. * @param groups The groups the deposited CELO is intended to vote for. * @param votes The amount of CELO to schedule for each respective group * from `groups`. */ function scheduleVotes(address[] calldata groups, uint256[] calldata votes) external payable onlyManager { if (groups.length != votes.length) { revert GroupsAndVotesArrayLengthsMismatch(); } uint256 totalVotes; for (uint256 i = 0; i < groups.length; i++) { scheduledVotes[groups[i]].toVote += votes[i]; totalVotes += votes[i]; emit VotesScheduled(groups[i], votes[i]); } if (totalVotes != uint256(msg.value)) { revert TotalVotesMismatch(msg.value, totalVotes); } } /** * @notice Schedule a list of withdrawals to be refunded to a beneficiary. * @param groups The groups the deposited CELO is intended to be withdrawn from. * @param withdrawals The amount of CELO to withdraw for each respective group. * @param beneficiary The account that will receive the CELO once it's withdrawn. * from `groups`. */ function scheduleWithdrawals( address beneficiary, address[] calldata groups, uint256[] calldata withdrawals ) external onlyManager { if (groups.length != withdrawals.length) { revert GroupsAndVotesArrayLengthsMismatch(); } uint256 totalWithdrawalsDelta; for (uint256 i = 0; i < withdrawals.length; i++) { uint256 celoAvailableForGroup = this.getCeloForGroup(groups[i]); if (celoAvailableForGroup < withdrawals[i]) { revert WithdrawalAmountTooHigh(groups[i], celoAvailableForGroup, withdrawals[i]); } scheduledVotes[groups[i]].toWithdraw += withdrawals[i]; scheduledVotes[groups[i]].toWithdrawFor[beneficiary] += withdrawals[i]; totalWithdrawalsDelta += withdrawals[i]; emit CeloWithdrawalScheduled(beneficiary, groups[i], withdrawals[i]); } totalScheduledWithdrawals += totalWithdrawalsDelta; } /** * @notice Starts withdrawal of CELO from `group`. If there is any unlocked CELO for the group, * that CELO is used for immediate withdrawal. Otherwise, CELO is taken from pending and active * votes, which are subject to the unlock period of LockedGold.sol. * @dev Only callable by the Staked CELO contract, which must restrict which groups are valid. * @param group The group to withdraw CELO from. * @param beneficiary The recipient of the withdrawn CELO. * @param lesserAfterPendingRevoke Used by Election's `revokePending`. This is the group that * is before `group` within the validators sorted LinkedList, or address(0) if there isn't one, * after the revoke of pending votes has occurred. * @param greaterAfterPendingRevoke Used by Election's `revokePending`. This is the group that * is after `group` within the validators sorted LinkedList, or address(0) if there isn't one, * after the revoke of pending votes has occurred. * @param lesserAfterActiveRevoke Used by Election's `revokeActive`. This is the group that * is before `group` within the validators sorted LinkedList, or address(0) if there isn't one, * after the revoke of active votes has occurred. * @param greaterAfterActiveRevoke Used by Election's `revokeActive`. This is the group that * is after `group` within the validators sorted LinkedList, or address(0) if there isn't one, * after the revoke of active votes has occurred. * @param index Used by Election's `revokePending` and `revokeActive`. This is the index of * `group` in the this contract's array of groups it is voting for. * @return The amount of immediately withdrawn CELO that is obtained from scheduledVotes * for `group`. */ function withdraw( address beneficiary, address group, address lesserAfterPendingRevoke, address greaterAfterPendingRevoke, address lesserAfterActiveRevoke, address greaterAfterActiveRevoke, uint256 index ) external returns (uint256) { uint256 withdrawalAmount = scheduledVotes[group].toWithdrawFor[beneficiary]; if (withdrawalAmount == 0) { revert NoScheduledWithdrawal(beneficiary, group); } // Emit early to return without needing to emit in multiple places. emit CeloWithdrawalStarted(beneficiary, group, withdrawalAmount); // Subtract withdrawal amount from all bookkeeping scheduledVotes[group].toWithdrawFor[beneficiary] = 0; scheduledVotes[group].toWithdraw -= withdrawalAmount; totalScheduledWithdrawals -= withdrawalAmount; uint256 immediateWithdrawalAmount = scheduledVotes[group].toVote; if (immediateWithdrawalAmount > 0) { if (immediateWithdrawalAmount > withdrawalAmount) { immediateWithdrawalAmount = withdrawalAmount; } scheduledVotes[group].toVote -= immediateWithdrawalAmount; // The benefit of using getGoldToken().transfer() rather than transferring // using a message value is that the recepient's callback is not called, thus // removing concern that a malicious beneficiary would control code at this point. bool success = getGoldToken().transfer(beneficiary, immediateWithdrawalAmount); if (!success) { revert CeloTransferFailed(beneficiary, immediateWithdrawalAmount); } // If we've withdrawn the entire amount, return. if (immediateWithdrawalAmount == withdrawalAmount) { return immediateWithdrawalAmount; } } // We know that withdrawalAmount is >= immediateWithdrawalAmount. uint256 revokeAmount = withdrawalAmount - immediateWithdrawalAmount; ILockedGold lockedGold = getLockedGold(); // Save the pending withdrawal for `beneficiary`. pendingWithdrawals[beneficiary].push( PendingWithdrawal(revokeAmount, block.timestamp + lockedGold.unlockingPeriod()) ); revokeVotes( group, revokeAmount, lesserAfterPendingRevoke, greaterAfterPendingRevoke, lesserAfterActiveRevoke, greaterAfterActiveRevoke, index ); lockedGold.unlock(revokeAmount); return immediateWithdrawalAmount; } /** * @notice Activates any activatable pending votes for group, and locks & votes any * unlocked CELO for group. * @dev Callable by anyone. In practice, this is expected to be called near the end of each * epoch by an off-chain agent. * @param group The group to activate pending votes for and lock & vote any unlocked CELO for. * @param voteLesser Used by Election's `vote`. This is the group that will recieve fewer * votes than group after the votes are cast, or address(0) if no such group exists. * @param voteGreater Used by Election's `vote`. This is the group that will recieve greater * votes than group after the votes are cast, or address(0) if no such group exists. */ function activateAndVote( address group, address voteLesser, address voteGreater ) external { IElection election = getElection(); // The amount of unlocked CELO for group that we want to lock and vote with. uint256 unlockedCeloForGroup = scheduledVotes[group].toVote; // Reset the unlocked CELO amount for group. scheduledVotes[group].toVote = 0; // If there are activatable pending votes from this contract for group, activate them. if (election.hasActivatablePendingVotes(address(this), group)) { // Revert if the activation fails. if (!election.activate(group)) { revert ActivatePendingVotesFailed(group); } } // If there is no CELO to lock up and vote with, return. if (unlockedCeloForGroup == 0) { return; } // Lock up the unlockedCeloForGroup in LockedGold, which increments the // non-voting LockedGold balance for this contract. getLockedGold().lock{value: unlockedCeloForGroup}(); // Vote for group using the newly locked CELO, reverting if it fails. if (!election.vote(group, unlockedCeloForGroup, voteLesser, voteGreater)) { revert VoteFailed(group, unlockedCeloForGroup); } } /** * @notice Finishes a pending withdrawal created as a result of a `withdrawCelo` call, * claiming CELO after the `unlockingPeriod` defined in LockedGold.sol. * @dev Callable by anyone, but ultimatly the withdrawal goes to `beneficiary`. * The pending withdrawal info found in both StakedCeloGroupVoter and LockedGold must match * to ensure that the beneficiary is claiming the appropriate pending withdrawal. * @param beneficiary The account that owns the pending withdrawal being processed. * @param localPendingWithdrawalIndex The index of the pending withdrawal to finish * in pendingWithdrawals[beneficiary] array. * @param lockedGoldPendingWithdrawalIndex The index of the pending withdrawal to finish * in LockedGold. * @return amount The amount of CELO sent to `beneficiary`. */ function finishPendingWithdrawal( address beneficiary, uint256 localPendingWithdrawalIndex, uint256 lockedGoldPendingWithdrawalIndex ) external returns (uint256 amount) { (uint256 value, uint256 timestamp) = validatePendingWithdrawalRequest( beneficiary, localPendingWithdrawalIndex, lockedGoldPendingWithdrawalIndex ); // Remove the pending withdrawal. PendingWithdrawal[] storage localPendingWithdrawals = pendingWithdrawals[beneficiary]; localPendingWithdrawals[localPendingWithdrawalIndex] = localPendingWithdrawals[ localPendingWithdrawals.length - 1 ]; localPendingWithdrawals.pop(); // Process withdrawal. getLockedGold().withdraw(lockedGoldPendingWithdrawalIndex); /** * The benefit of using getGoldToken().transfer() is that the recepients callback * is not called thus removing concern that a malicious * caller would control code at this point. */ bool success = getGoldToken().transfer(beneficiary, value); if (!success) { revert CeloTransferFailed(beneficiary, value); } emit CeloWithdrawalFinished(beneficiary, value, timestamp); return value; } /** * @notice Gets the total amount of CELO this contract controls. This is the * unlocked CELO balance of the contract plus the amount of LockedGold for this contract, * which included unvoting and voting LockedGold. * @return The total amount of CELO this contract controls, including LockedGold. */ function getTotalCelo() external view returns (uint256) { // LockedGold's getAccountTotalLockedGold returns any non-voting locked gold + // voting locked gold for each group the account is voting for, which is an // O(# of groups voted for) operation. return address(this).balance + getLockedGold().getAccountTotalLockedGold(address(this)) - totalScheduledWithdrawals; } /** * @notice Returns the pending withdrawals for a beneficiary. * @param beneficiary The address of the beneficiary who initiated the pending withdrawal. * @return values The values of pending withdrawals. * @return timestamps The timestamps of pending withdrawals. */ function getPendingWithdrawals(address beneficiary) external view returns (uint256[] memory values, uint256[] memory timestamps) { uint256 length = pendingWithdrawals[beneficiary].length; values = new uint256[](length); timestamps = new uint256[](length); for (uint256 i = 0; i < length; i++) { PendingWithdrawal memory p = pendingWithdrawals[beneficiary][i]; values[i] = p.value; timestamps[i] = p.timestamp; } return (values, timestamps); } /** * @notice Returns the number of pending withdrawals for a beneficiary. * @param beneficiary The address of the beneficiary who initiated the pending withdrawal. * @return The numbers of pending withdrawals for `beneficiary` */ function getNumberPendingWithdrawals(address beneficiary) external view returns (uint256) { return pendingWithdrawals[beneficiary].length; } /** * @notice Returns a pending withdrawals for a beneficiary. * @param beneficiary The address of the beneficiary who initiated the pending withdrawal. * @param index The index in `beneficiary`'s pendingWithdrawals array. * @return value The values of the pending withdrawal. * @return timestamp The timestamp of the pending withdrawal. */ function getPendingWithdrawal(address beneficiary, uint256 index) external view returns (uint256 value, uint256 timestamp) { PendingWithdrawal memory withdrawal = pendingWithdrawals[beneficiary][index]; return (withdrawal.value, withdrawal.timestamp); } /** * @notice Returns the total amount of CELO directed towards `group`. This is * the Unlocked CELO balance for `group` plus the combined amount in pending * and active votes made by this contract. * @param group The address of the validator group. * @return The total amount of CELO directed towards `group`. */ function getCeloForGroup(address group) external view returns (uint256) { return getElection().getTotalVotesForGroupByAccount(group, address(this)) + scheduledVotes[group].toVote - scheduledVotes[group].toWithdraw; } /** * @notice Returns the total amount of CELO that's scheduled to vote for a group. * @param group The address of the validator group. * @return The total amount of CELO directed towards `group`. */ function scheduledVotesForGroup(address group) external view returns (uint256) { return scheduledVotes[group].toVote; } /** * @notice Returns the total amount of CELO that's scheduled to be withdrawn for a group. * @param group The address of the validator group. * @return The total amount of CELO to be withdrawn for `group`. */ function scheduledWithdrawalsForGroup(address group) external view returns (uint256) { return scheduledVotes[group].toWithdraw; } /** * @notice Returns the total amount of CELO that's scheduled to be withdrawn for a group * scoped by a beneficiary. * @param group The address of the validator group. * @param beneficiary The beneficiary of the withdrawal. * @return The total amount of CELO to be withdrawn for `group` by `beneficiary`. */ function scheduledWithdrawalsForGroupAndBeneficiary(address group, address beneficiary) external view returns (uint256) { return scheduledVotes[group].toWithdrawFor[beneficiary]; } /** * @notice Revokes votes from a validator group. It first attempts to revoke pending votes, * and then active votes if necessary. * @dev Reverts if `revokeAmount` exceeds the total number of pending and active votes for * the group from this contract. * @param group The group to withdraw CELO from. * @param revokeAmount The amount of votes to revoke. * @param lesserAfterPendingRevoke Used by Election's `revokePending`. This is the group that * is before `group` within the validators sorted LinkedList, or address(0) if there isn't one, * after the revoke of pending votes has occurred. * @param greaterAfterPendingRevoke Used by Election's `revokePending`. This is the group that * is after `group` within the validators sorted LinkedList, or address(0) if there isn't one, * after the revoke of pending votes has occurred. * @param lesserAfterActiveRevoke Used by Election's `revokeActive`. This is the group that * is before `group` within the validators sorted LinkedList, or address(0) if there isn't one, * after the revoke of active votes has occurred. * @param greaterAfterActiveRevoke Used by Election's `revokeActive`. This is the group that * is after `group` within the validators sorted LinkedList, or address(0) if there isn't one, * after the revoke of active votes has occurred. * @param index Used by Election's `revokePending` and `revokeActive`. This is the index of * `group` in the this contract's array of groups it is voting for. */ function revokeVotes( address group, uint256 revokeAmount, address lesserAfterPendingRevoke, address greaterAfterPendingRevoke, address lesserAfterActiveRevoke, address greaterAfterActiveRevoke, uint256 index ) internal { IElection election = getElection(); uint256 pendingVotesAmount = election.getPendingVotesForGroupByAccount( group, address(this) ); uint256 toRevokeFromPending = Math.min(revokeAmount, pendingVotesAmount); if (toRevokeFromPending > 0) { if ( !election.revokePending( group, toRevokeFromPending, lesserAfterPendingRevoke, greaterAfterPendingRevoke, index ) ) { revert RevokePendingFailed(group, revokeAmount); } } uint256 toRevokeFromActive = revokeAmount - toRevokeFromPending; if (toRevokeFromActive == 0) { return; } uint256 activeVotesAmount = election.getActiveVotesForGroupByAccount(group, address(this)); if (activeVotesAmount < toRevokeFromActive) { revert InsufficientRevokableVotes(group, revokeAmount); } if ( !election.revokeActive( group, toRevokeFromActive, lesserAfterActiveRevoke, greaterAfterActiveRevoke, index ) ) { revert RevokeActiveFailed(group, revokeAmount); } } /** * @notice Validates a local pending withdrawal matches a given beneficiary and LockedGold * pending withdrawal. * @dev See finishPendingWithdrawal. * @param beneficiary The account that owns the pending withdrawal being processed. * @param localPendingWithdrawalIndex The index of the pending withdrawal to finish * in pendingWithdrawals[beneficiary] array. * @param lockedGoldPendingWithdrawalIndex The index of the pending withdrawal to finish * in LockedGold. * @return value The value of the pending withdrawal. * @return timestamp The timestamp of the pending withdrawal. */ function validatePendingWithdrawalRequest( address beneficiary, uint256 localPendingWithdrawalIndex, uint256 lockedGoldPendingWithdrawalIndex ) internal view returns (uint256 value, uint256 timestamp) { if (localPendingWithdrawalIndex >= pendingWithdrawals[beneficiary].length) { revert PendingWithdrawalIndexTooHigh( localPendingWithdrawalIndex, pendingWithdrawals[beneficiary].length ); } ( uint256 lockedGoldPendingWithdrawalValue, uint256 lockedGoldPendingWithdrawalTimestamp ) = getLockedGold().getPendingWithdrawal(address(this), lockedGoldPendingWithdrawalIndex); PendingWithdrawal memory pendingWithdrawal = pendingWithdrawals[beneficiary][ localPendingWithdrawalIndex ]; if (pendingWithdrawal.value != lockedGoldPendingWithdrawalValue) { revert InconsistentPendingWithdrawalValues( pendingWithdrawal.value, lockedGoldPendingWithdrawalValue ); } if (pendingWithdrawal.timestamp != lockedGoldPendingWithdrawalTimestamp) { revert InconsistentPendingWithdrawalTimestamps( pendingWithdrawal.timestamp, lockedGoldPendingWithdrawalTimestamp ); } return (pendingWithdrawal.value, pendingWithdrawal.timestamp); } }
/_openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeacon.sol"; import "../../utils/Address.sol"; import "../../utils/StorageSlot.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._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967Upgrade { // 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 Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlot.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) { Address.functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallSecure( address newImplementation, bytes memory data, bool forceCall ) internal { address oldImplementation = _getImplementation(); // Initial upgrade and setup call _setImplementation(newImplementation); if (data.length > 0 || forceCall) { Address.functionDelegateCall(newImplementation, data); } // Perform rollback test if not already in progress StorageSlot.BooleanSlot storage rollbackTesting = StorageSlot.getBooleanSlot(_ROLLBACK_SLOT); if (!rollbackTesting.value) { // Trigger rollback using upgradeTo from the new implementation rollbackTesting.value = true; Address.functionDelegateCall( newImplementation, abi.encodeWithSignature("upgradeTo(address)", oldImplementation) ); rollbackTesting.value = false; // Check rollback was effective require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades"); // Finally reset to the new implementation and log the upgrade _upgradeTo(newImplementation); } } /** * @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 Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlot.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"); StorageSlot.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 Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlot.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( Address.isContract(IBeacon(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlot.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) { Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data); } } }
/_openzeppelin/contracts/proxy/beacon/IBeacon.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 IBeacon { /** * @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/proxy/utils/UUPSUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.0; import "../ERC1967/ERC1967Upgrade.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 ERC1967Upgrade { /// @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 Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeTo(address newImplementation) external virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallSecure(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. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallSecure(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; }
/_openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @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 * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, "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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(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) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason 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 { // 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/_openzeppelin/contracts/utils/StorageSlot.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol) 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: * ``` * 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`, and `uint256`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } }
/_openzeppelin/contracts/utils/math/Math.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a >= b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a / b + (a % b == 0 ? 0 : 1); } }
/_openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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 Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing 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; }
/_openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; 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. * * 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 initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
/_openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.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 * ==== * * [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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, "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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason 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 { // 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/_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; }
/contracts/Managed.sol
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity 0.8.11; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; /** * @title Used via inheritance to grant special access control to the Manager * contract. */ abstract contract Managed is Initializable, OwnableUpgradeable { address public manager; /** * @notice Emitted when the manager is initially set or later modified. * @param manager The new managing account address. */ event ManagerSet(address indexed manager); /** * @notice Used when an `onlyManager` function is called by a non-manager. * @param caller `msg.sender` that called the function. */ error CallerNotManager(address caller); /** * @notice Used when a passed address is address(0). */ error NullAddress(); /** * @dev Initializes the contract in an upgradable context. * @param _manager The initial managing address. */ // solhint-disable-next-line func-name-mixedcase function __Managed_init(address _manager) internal onlyInitializing { _setManager(_manager); } /** * @dev Throws if called by any account other than the manager. */ modifier onlyManager() { if (manager != msg.sender) { revert CallerNotManager(msg.sender); } _; } /** * @notice Sets the manager address. * @param _manager The new manager address. */ function setManager(address _manager) external onlyOwner { _setManager(_manager); } /** * @notice Sets the manager address. * @param _manager The new manager address. */ function _setManager(address _manager) internal { if (_manager == address(0)) { revert NullAddress(); } manager = _manager; emit ManagerSet(_manager); } }
/contracts/common/UUPSOwnableUpgradeable.sol
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity 0.8.11; import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; /** * @title A contract that links UUPSUUpgradeable with OwanbleUpgradeable to gate upgrades. */ abstract contract UUPSOwnableUpgradeable is UUPSUpgradeable, OwnableUpgradeable { /** * @notice Guard method for UUPS (Universal Upgradable Proxy Standard) * See: https://docs.openzeppelin.com/contracts/4.x/api/proxy#transparent-vs-uups * @dev This methods overrides the virtual one in UUPSUpgradeable and * adds the onlyOwner modifer. */ // solhint-disable-next-line no-empty-blocks function _authorizeUpgrade(address) internal override onlyOwner {} }
/contracts/common/UsingRegistryUpgradeable.sol
//SPDX-License-Identifier: LGPL-3.0-only pragma solidity 0.8.11; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "../interfaces/IAccounts.sol"; import "../interfaces/IElection.sol"; import "../interfaces/IGoldToken.sol"; import "../interfaces/ILockedGold.sol"; import "../interfaces/IRegistry.sol"; /** * @title A helper for getting Celo core contracts from the Registry. */ abstract contract UsingRegistryUpgradeable is Initializable { /** * @notice Initializes the UsingRegistryUpgradable contract in an upgradable scenario * @param _registry The address of the Registry. For convenience, if the zero address is * provided, the registry is set to the canonical Registry address, i.e. 0x0...ce10. This * parameter should only be a non-zero address when testing. */ // solhint-disable-next-line func-name-mixedcase function __UsingRegistry_init(address _registry) internal onlyInitializing { if (_registry == address(0)) { registry = IRegistry(CANONICAL_REGISTRY); } else { registry = IRegistry(_registry); } } /// @notice The canonical address of the Registry. address internal constant CANONICAL_REGISTRY = 0x000000000000000000000000000000000000ce10; /// @notice The registry ID for the Accounts contract. bytes32 private constant ACCOUNTS_REGISTRY_ID = keccak256(abi.encodePacked("Accounts")); /// @notice The registry ID for the Election contract. bytes32 private constant ELECTION_REGISTRY_ID = keccak256(abi.encodePacked("Election")); /// @notice The registry ID for the GoldToken contract. bytes32 private constant GOLD_TOKEN_REGISTRY_ID = keccak256(abi.encodePacked("GoldToken")); /// @notice The registry ID for the LockedGold contract. bytes32 private constant LOCKED_GOLD_REGISTRY_ID = keccak256(abi.encodePacked("LockedGold")); /// @notice The Registry. IRegistry public registry; /** * @notice Gets the Accounts contract from the Registry. * @return The Accounts contract from the Registry. */ function getAccounts() internal view returns (IAccounts) { return IAccounts(registry.getAddressForOrDie(ACCOUNTS_REGISTRY_ID)); } /** * @notice Gets the Election contract from the Registry. * @return The Election contract from the Registry. */ function getElection() internal view returns (IElection) { return IElection(registry.getAddressForOrDie(ELECTION_REGISTRY_ID)); } /** * @notice Gets the GoldToken contract from the Registry. * @return The GoldToken contract from the Registry. */ function getGoldToken() internal view returns (IGoldToken) { return IGoldToken(registry.getAddressForOrDie(GOLD_TOKEN_REGISTRY_ID)); } /** * @notice Gets the LockedGold contract from the Registry. * @return The LockedGold contract from the Registry. */ function getLockedGold() internal view returns (ILockedGold) { return ILockedGold(registry.getAddressForOrDie(LOCKED_GOLD_REGISTRY_ID)); } }
/contracts/interfaces/IAccount.sol
//SPDX-License-Identifier: LGPL-3.0-only pragma solidity 0.8.11; interface IAccount { function getTotalCelo() external view returns (uint256); function getCeloForGroup(address) external view returns (uint256); function scheduleVotes(address[] calldata group, uint256[] calldata votes) external payable; function scheduledVotesForGroup(address group) external returns (uint256); function scheduleWithdrawals( address beneficiary, address[] calldata group, uint256[] calldata withdrawals ) external; }
/contracts/interfaces/IAccounts.sol
//SPDX-License-Identifier: LGPL-3.0-only pragma solidity 0.8.11; interface IAccounts { function isAccount(address) external view returns (bool); function voteSignerToAccount(address) external view returns (address); function validatorSignerToAccount(address) external view returns (address); function attestationSignerToAccount(address) external view returns (address); function signerToAccount(address) external view returns (address); function getAttestationSigner(address) external view returns (address); function getValidatorSigner(address) external view returns (address); function getVoteSigner(address) external view returns (address); function hasAuthorizedVoteSigner(address) external view returns (bool); function hasAuthorizedValidatorSigner(address) external view returns (bool); function hasAuthorizedAttestationSigner(address) external view returns (bool); function setAccountDataEncryptionKey(bytes calldata) external; function setMetadataURL(string calldata) external; function setName(string calldata) external; function setWalletAddress( address, uint8, bytes32, bytes32 ) external; function setAccount( string calldata, bytes calldata, address, uint8, bytes32, bytes32 ) external; function getDataEncryptionKey(address) external view returns (bytes memory); function getWalletAddress(address) external view returns (address); function getMetadataURL(address) external view returns (string memory); function batchGetMetadataURL(address[] calldata) external view returns (uint256[] memory, bytes memory); function getName(address) external view returns (string memory); function authorizeVoteSigner( address, uint8, bytes32, bytes32 ) external; function authorizeValidatorSigner( address, uint8, bytes32, bytes32 ) external; function authorizeValidatorSignerWithPublicKey( address, uint8, bytes32, bytes32, bytes calldata ) external; function authorizeValidatorSignerWithKeys( address, uint8, bytes32, bytes32, bytes calldata, bytes calldata, bytes calldata ) external; function authorizeAttestationSigner( address, uint8, bytes32, bytes32 ) external; function createAccount() external returns (bool); }
/contracts/interfaces/IElection.sol
//SPDX-License-Identifier: LGPL-3.0-only pragma solidity 0.8.11; interface IElection { function electValidatorSigners() external view returns (address[] memory); function electNValidatorSigners(uint256, uint256) external view returns (address[] memory); function vote( address, uint256, address, address ) external returns (bool); function activate(address) external returns (bool); function activateForAccount(address, address) external returns (bool); function revokeActive( address, uint256, address, address, uint256 ) external returns (bool); function revokeAllActive( address, address, address, uint256 ) external returns (bool); function revokePending( address, uint256, address, address, uint256 ) external returns (bool); function markGroupIneligible(address) external; function markGroupEligible( address, address, address ) external; function forceDecrementVotes( address, uint256, address[] calldata, address[] calldata, uint256[] calldata ) external returns (uint256); // view functions function getElectableValidators() external view returns (uint256, uint256); function getElectabilityThreshold() external view returns (uint256); function getNumVotesReceivable(address) external view returns (uint256); function getTotalVotes() external view returns (uint256); function getActiveVotes() external view returns (uint256); function getTotalVotesByAccount(address) external view returns (uint256); function getPendingVotesForGroupByAccount(address, address) external view returns (uint256); function getActiveVotesForGroupByAccount(address, address) external view returns (uint256); function getTotalVotesForGroupByAccount(address, address) external view returns (uint256); function getActiveVoteUnitsForGroupByAccount(address, address) external view returns (uint256); function getTotalVotesForGroup(address) external view returns (uint256); function getActiveVotesForGroup(address) external view returns (uint256); function getPendingVotesForGroup(address) external view returns (uint256); function getGroupEligibility(address) external view returns (bool); function getGroupEpochRewards( address, uint256, uint256[] calldata ) external view returns (uint256); function getGroupsVotedForByAccount(address) external view returns (address[] memory); function getEligibleValidatorGroups() external view returns (address[] memory); function getTotalVotesForEligibleValidatorGroups() external view returns (address[] memory, uint256[] memory); function getCurrentValidatorSigners() external view returns (address[] memory); function canReceiveVotes(address, uint256) external view returns (bool); function hasActivatablePendingVotes(address, address) external view returns (bool); // only owner function setElectableValidators(uint256, uint256) external returns (bool); function setMaxNumGroupsVotedFor(uint256) external returns (bool); function setElectabilityThreshold(uint256) external returns (bool); // only VM function distributeEpochRewards( address, uint256, address, address ) external; function maxNumGroupsVotedFor() external view returns (uint256); }
/contracts/interfaces/IGoldToken.sol
// SPDX-License-Identifier: LGPL-3.0-only pragma solidity 0.8.11; interface IGoldToken { function transfer(address to, uint256 value) external returns (bool); function transferWithComment( address to, uint256 value, string calldata comment ) external returns (bool); function approve(address spender, uint256 value) external returns (bool); function increaseAllowance(address spender, uint256 value) external returns (bool); function decreaseAllowance(address spender, uint256 value) external returns (bool); function transferFrom( address from, address to, uint256 value ) external returns (bool); function name() external view returns (string memory); function symbol() external view returns (string memory); function decimals() external view returns (uint8); function totalSupply() external view returns (uint256); function allowance(address owner, address spender) external view returns (uint256); function balanceOf(address owner) external view returns (uint256); }
/contracts/interfaces/ILockedGold.sol
//SPDX-License-Identifier: LGPL-3.0-only pragma solidity 0.8.11; interface ILockedGold { function unlockingPeriod() external view returns (uint256); function incrementNonvotingAccountBalance(address, uint256) external; function decrementNonvotingAccountBalance(address, uint256) external; function getAccountTotalLockedGold(address) external view returns (uint256); function getTotalLockedGold() external view returns (uint256); function getPendingWithdrawal(address, uint256) external view returns (uint256, uint256); function getPendingWithdrawals(address) external view returns (uint256[] memory, uint256[] memory); function getTotalPendingWithdrawals(address) external view returns (uint256); function lock() external payable; function unlock(uint256) external; function relock(uint256, uint256) external; function withdraw(uint256) external; function slash( address account, uint256 penalty, address reporter, uint256 reward, address[] calldata lessers, address[] calldata greaters, uint256[] calldata indices ) external; function isSlasher(address) external view returns (bool); }
/contracts/interfaces/IRegistry.sol
//SPDX-License-Identifier: LGPL-3.0-only pragma solidity 0.8.11; interface IRegistry { function setAddressFor(string calldata, address) external; function getAddressForOrDie(bytes32) external view returns (address); function getAddressFor(bytes32) external view returns (address); function getAddressForStringOrDie(string calldata identifier) external view returns (address); function getAddressForString(string calldata identifier) external view returns (address); function isOneOf(bytes32[] calldata, address) external view returns (bool); }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"error","name":"AccountCreationFailed","inputs":[]},{"type":"error","name":"ActivatePendingVotesFailed","inputs":[{"type":"address","name":"group","internalType":"address"}]},{"type":"error","name":"CallerNotManager","inputs":[{"type":"address","name":"caller","internalType":"address"}]},{"type":"error","name":"CeloTransferFailed","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"error","name":"GroupsAndVotesArrayLengthsMismatch","inputs":[]},{"type":"error","name":"InconsistentPendingWithdrawalTimestamps","inputs":[{"type":"uint256","name":"localPendingWithdrawalTimestamp","internalType":"uint256"},{"type":"uint256","name":"lockedGoldPendingWithdrawalTimestamp","internalType":"uint256"}]},{"type":"error","name":"InconsistentPendingWithdrawalValues","inputs":[{"type":"uint256","name":"localPendingWithdrawalValue","internalType":"uint256"},{"type":"uint256","name":"lockedGoldPendingWithdrawalValue","internalType":"uint256"}]},{"type":"error","name":"InsufficientRevokableVotes","inputs":[{"type":"address","name":"group","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"error","name":"NoScheduledWithdrawal","inputs":[{"type":"address","name":"beneficiary","internalType":"address"},{"type":"address","name":"group","internalType":"address"}]},{"type":"error","name":"NullAddress","inputs":[]},{"type":"error","name":"PendingWithdrawalIndexTooHigh","inputs":[{"type":"uint256","name":"pendingWithdrawalIndex","internalType":"uint256"},{"type":"uint256","name":"pendingWithdrawalsLength","internalType":"uint256"}]},{"type":"error","name":"RevokeActiveFailed","inputs":[{"type":"address","name":"group","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"error","name":"RevokePendingFailed","inputs":[{"type":"address","name":"group","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"error","name":"TotalVotesMismatch","inputs":[{"type":"uint256","name":"sentValue","internalType":"uint256"},{"type":"uint256","name":"expectedValue","internalType":"uint256"}]},{"type":"error","name":"VoteFailed","inputs":[{"type":"address","name":"group","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"error","name":"WithdrawalAmountTooHigh","inputs":[{"type":"address","name":"group","internalType":"address"},{"type":"uint256","name":"celoAvailable","internalType":"uint256"},{"type":"uint256","name":"celoToWindraw","internalType":"uint256"}]},{"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":"CeloWithdrawalFinished","inputs":[{"type":"address","name":"beneficiary","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false},{"type":"uint256","name":"timestamp","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"CeloWithdrawalScheduled","inputs":[{"type":"address","name":"beneficiary","internalType":"address","indexed":true},{"type":"address","name":"group","internalType":"address","indexed":true},{"type":"uint256","name":"withdrawalAmount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"CeloWithdrawalStarted","inputs":[{"type":"address","name":"beneficiary","internalType":"address","indexed":true},{"type":"address","name":"group","internalType":"address","indexed":true},{"type":"uint256","name":"withdrawalAmount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ManagerSet","inputs":[{"type":"address","name":"manager","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":"event","name":"VotesScheduled","inputs":[{"type":"address","name":"group","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"activateAndVote","inputs":[{"type":"address","name":"group","internalType":"address"},{"type":"address","name":"voteLesser","internalType":"address"},{"type":"address","name":"voteGreater","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"amount","internalType":"uint256"}],"name":"finishPendingWithdrawal","inputs":[{"type":"address","name":"beneficiary","internalType":"address"},{"type":"uint256","name":"localPendingWithdrawalIndex","internalType":"uint256"},{"type":"uint256","name":"lockedGoldPendingWithdrawalIndex","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getCeloForGroup","inputs":[{"type":"address","name":"group","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getNumberPendingWithdrawals","inputs":[{"type":"address","name":"beneficiary","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"value","internalType":"uint256"},{"type":"uint256","name":"timestamp","internalType":"uint256"}],"name":"getPendingWithdrawal","inputs":[{"type":"address","name":"beneficiary","internalType":"address"},{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"values","internalType":"uint256[]"},{"type":"uint256[]","name":"timestamps","internalType":"uint256[]"}],"name":"getPendingWithdrawals","inputs":[{"type":"address","name":"beneficiary","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTotalCelo","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_registry","internalType":"address"},{"type":"address","name":"_manager","internalType":"address"},{"type":"address","name":"_owner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"manager","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"value","internalType":"uint256"},{"type":"uint256","name":"timestamp","internalType":"uint256"}],"name":"pendingWithdrawals","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IRegistry"}],"name":"registry","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"payable","outputs":[],"name":"scheduleVotes","inputs":[{"type":"address[]","name":"groups","internalType":"address[]"},{"type":"uint256[]","name":"votes","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"scheduleWithdrawals","inputs":[{"type":"address","name":"beneficiary","internalType":"address"},{"type":"address[]","name":"groups","internalType":"address[]"},{"type":"uint256[]","name":"withdrawals","internalType":"uint256[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"scheduledVotesForGroup","inputs":[{"type":"address","name":"group","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"scheduledWithdrawalsForGroup","inputs":[{"type":"address","name":"group","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"scheduledWithdrawalsForGroupAndBeneficiary","inputs":[{"type":"address","name":"group","internalType":"address"},{"type":"address","name":"beneficiary","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setManager","inputs":[{"type":"address","name":"_manager","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalScheduledWithdrawals","inputs":[]},{"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"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"withdraw","inputs":[{"type":"address","name":"beneficiary","internalType":"address"},{"type":"address","name":"group","internalType":"address"},{"type":"address","name":"lesserAfterPendingRevoke","internalType":"address"},{"type":"address","name":"greaterAfterPendingRevoke","internalType":"address"},{"type":"address","name":"lesserAfterActiveRevoke","internalType":"address"},{"type":"address","name":"greaterAfterActiveRevoke","internalType":"address"},{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"receive","stateMutability":"payable"}]
Deployed ByteCode
0x60806040526004361061014f5760003560e01c806384aff2e7116100b6578063c7fb23281161006f578063c7fb2328146104a8578063c9a101f3146104e5578063d0ebdbe71461050e578063d15ca4ed14610537578063f2fde38b14610575578063f340c0d01461059e57610156565b806384aff2e7146103605780638da5cb5b1461039d578063a020c8de146103c8578063acd201d014610405578063b09bdc5e14610442578063c0c53b8b1461047f57610156565b806344dc49701161010857806344dc49701461025c578063481c6a751461029a5780634f1ef286146102c55780635fd5c95e146102e1578063715018a61461031e5780637b1039991461033557610156565b806301c21d591461015b57806301d2b6ea146101775780631449edb0146101a25780632ad9ac41146101df5780632f842a1a1461020a5780633659cfe61461023357610156565b3661015657005b600080fd5b6101756004803603810190610170919061375e565b6105dc565b005b34801561018357600080fd5b5061018c61086f565b60405161019991906137f8565b60405180910390f35b3480156101ae57600080fd5b506101c960048036038101906101c49190613871565b61090f565b6040516101d691906137f8565b60405180910390f35b3480156101eb57600080fd5b506101f461095b565b60405161020191906137f8565b60405180910390f35b34801561021657600080fd5b50610231600480360381019061022c919061389e565b610961565b005b34801561023f57600080fd5b5061025a60048036038101906102559190613871565b610dfd565b005b34801561026857600080fd5b50610283600480360381019061027e919061395f565b610f86565b60405161029192919061399f565b60405180910390f35b3480156102a657600080fd5b506102af610fc7565b6040516102bc91906139d7565b60405180910390f35b6102df60048036038101906102da9190613b33565b610fed565b005b3480156102ed57600080fd5b5061030860048036038101906103039190613871565b61112a565b60405161031591906137f8565b60405180910390f35b34801561032a57600080fd5b50610333611176565b005b34801561034157600080fd5b5061034a6111fe565b6040516103579190613bee565b60405180910390f35b34801561036c57600080fd5b5061038760048036038101906103829190613c09565b611224565b60405161039491906137f8565b60405180910390f35b3480156103a957600080fd5b506103b26114bb565b6040516103bf91906139d7565b60405180910390f35b3480156103d457600080fd5b506103ef60048036038101906103ea9190613c5c565b6114e5565b6040516103fc91906137f8565b60405180910390f35b34801561041157600080fd5b5061042c60048036038101906104279190613871565b611a5a565b60405161043991906137f8565b60405180910390f35b34801561044e57600080fd5b5061046960048036038101906104649190613871565b611b80565b60405161047691906137f8565b60405180910390f35b34801561048b57600080fd5b506104a660048036038101906104a19190613cfe565b611bcc565b005b3480156104b457600080fd5b506104cf60048036038101906104ca9190613d51565b611d7c565b6040516104dc91906137f8565b60405180910390f35b3480156104f157600080fd5b5061050c60048036038101906105079190613cfe565b611e06565b005b34801561051a57600080fd5b5061053560048036038101906105309190613871565b612125565b005b34801561054357600080fd5b5061055e6004803603810190610559919061395f565b6121ad565b60405161056c92919061399f565b60405180910390f35b34801561058157600080fd5b5061059c60048036038101906105979190613871565b612248565b005b3480156105aa57600080fd5b506105c560048036038101906105c09190613871565b612340565b6040516105d3929190613e4f565b60405180910390f35b3373ffffffffffffffffffffffffffffffffffffffff16606660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461066e57336040517f3b2495f100000000000000000000000000000000000000000000000000000000815260040161066591906139d7565b60405180910390fd5b8181905084849050146106ad576040517f8cd9cb4d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080600090505b85859050811015610821578383828181106106d3576106d2613e86565b5b90506020020135606860008888858181106106f1576106f0613e86565b5b90506020020160208101906107069190613871565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282546107529190613ee4565b9250508190555083838281811061076c5761076b613e86565b5b905060200201358261077e9190613ee4565b915085858281811061079357610792613e86565b5b90506020020160208101906107a89190613871565b73ffffffffffffffffffffffffffffffffffffffff167f3ee8e5d1cb8671d12b5b20284bb69c7fc325211a1f957cab060d8a78dcc64fba8585848181106107f2576107f1613e86565b5b9050602002013560405161080691906137f8565b60405180910390a2808061081990613f3a565b9150506106b5565b503481146108685734816040517f02760fce00000000000000000000000000000000000000000000000000000000815260040161085f92919061399f565b60405180910390fd5b5050505050565b600060695461087c612533565b73ffffffffffffffffffffffffffffffffffffffff166330ec70f5306040518263ffffffff1660e01b81526004016108b491906139d7565b602060405180830381865afa1580156108d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f59190613f98565b476109009190613ee4565b61090a9190613fc5565b905090565b6000606760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050919050565b60695481565b3373ffffffffffffffffffffffffffffffffffffffff16606660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109f357336040517f3b2495f10000000000000000000000000000000000000000000000000000000081526004016109ea91906139d7565b60405180910390fd5b818190508484905014610a32576040517f8cd9cb4d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080600090505b83839050811015610ddb5760003073ffffffffffffffffffffffffffffffffffffffff1663acd201d0888885818110610a7657610a75613e86565b5b9050602002016020810190610a8b9190613871565b6040518263ffffffff1660e01b8152600401610aa791906139d7565b602060405180830381865afa158015610ac4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae89190613f98565b9050848483818110610afd57610afc613e86565b5b90506020020135811015610b8c57868683818110610b1e57610b1d613e86565b5b9050602002016020810190610b339190613871565b81868685818110610b4757610b46613e86565b5b905060200201356040517fd5493527000000000000000000000000000000000000000000000000000000008152600401610b8393929190613ff9565b60405180910390fd5b848483818110610b9f57610b9e613e86565b5b9050602002013560686000898986818110610bbd57610bbc613e86565b5b9050602002016020810190610bd29190613871565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001016000828254610c1e9190613ee4565b92505081905550848483818110610c3857610c37613e86565b5b9050602002013560686000898986818110610c5657610c55613e86565b5b9050602002016020810190610c6b9190613871565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610cf49190613ee4565b92505081905550848483818110610d0e57610d0d613e86565b5b9050602002013583610d209190613ee4565b9250868683818110610d3557610d34613e86565b5b9050602002016020810190610d4a9190613871565b73ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f6b63acc273560d01b849e2d77c42ac2cd2b6ff5e1c775423c52a6e50be320e7b878786818110610dab57610daa613e86565b5b90506020020135604051610dbf91906137f8565b60405180910390a3508080610dd390613f3a565b915050610a3a565b508060696000828254610dee9190613ee4565b92505081905550505050505050565b7f000000000000000000000000211653be4bf4d481d3c728917bae706b3607333073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff161415610e8c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e83906140b3565b60405180910390fd5b7f000000000000000000000000211653be4bf4d481d3c728917bae706b3607333073ffffffffffffffffffffffffffffffffffffffff16610ecb6125fa565b73ffffffffffffffffffffffffffffffffffffffff1614610f21576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f1890614145565b60405180910390fd5b610f2a81612651565b610f8381600067ffffffffffffffff811115610f4957610f48613a08565b5b6040519080825280601f01601f191660200182016040528015610f7b5781602001600182028036833780820191505090505b5060006126d0565b50565b60676020528160005260406000208181548110610fa257600080fd5b9060005260206000209060020201600091509150508060000154908060010154905082565b606660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b7f000000000000000000000000211653be4bf4d481d3c728917bae706b3607333073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff16141561107c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611073906140b3565b60405180910390fd5b7f000000000000000000000000211653be4bf4d481d3c728917bae706b3607333073ffffffffffffffffffffffffffffffffffffffff166110bb6125fa565b73ffffffffffffffffffffffffffffffffffffffff1614611111576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110890614145565b60405180910390fd5b61111a82612651565b611126828260016126d0565b5050565b6000606860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050919050565b61117e6128a1565b73ffffffffffffffffffffffffffffffffffffffff1661119c6114bb565b73ffffffffffffffffffffffffffffffffffffffff16146111f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111e9906141b1565b60405180910390fd5b6111fc60006128a9565b565b606560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600061123486868661296f565b915091506000606760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050806001828054905061128d9190613fc5565b8154811061129e5761129d613e86565b5b90600052602060002090600202018187815481106112bf576112be613e86565b5b90600052602060002090600202016000820154816000015560018201548160010155905050808054806112f5576112f46141d1565b5b6001900381819060005260206000209060020201600080820160009055600182016000905550509055611326612533565b73ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d866040518263ffffffff1660e01b815260040161135e91906137f8565b600060405180830381600087803b15801561137857600080fd5b505af115801561138c573d6000803e3d6000fd5b50505050600061139a612bfc565b73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb89866040518363ffffffff1660e01b81526004016113d4929190614200565b6020604051808303816000875af11580156113f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114179190614261565b90508061145d5787846040517fbe1b5315000000000000000000000000000000000000000000000000000000008152600401611454929190614200565b60405180910390fd5b8773ffffffffffffffffffffffffffffffffffffffff167f3bb2914428a7565afeafb57ef1a5bad4a2de7be9bf7b41b7e5da505f4b974ce285856040516114a592919061399f565b60405180910390a2839450505050509392505050565b6000603360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600080606860008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008114156115b25788886040517f7a9a71fb0000000000000000000000000000000000000000000000000000000081526004016115a992919061428e565b60405180910390fd5b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167f6e250cfd645a8eac07044223b0b240549b17fe4a71aab09d925cb413b72b00ae8360405161160f91906137f8565b60405180910390a36000606860008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080606860008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160008282546116ee9190613fc5565b9250508190555080606960008282546117079190613fc5565b925050819055506000606860008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154905060008111156118a5578181111561176a578190505b80606860008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160008282546117bc9190613fc5565b9250508190555060006117cd612bfc565b73ffffffffffffffffffffffffffffffffffffffff1663a9059cbb8c846040518363ffffffff1660e01b8152600401611807929190614200565b6020604051808303816000875af1158015611826573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061184a9190614261565b905080611890578a826040517fbe1b5315000000000000000000000000000000000000000000000000000000008152600401611887929190614200565b60405180910390fd5b828214156118a357819350505050611a4f565b505b600081836118b39190613fc5565b905060006118bf612533565b9050606760008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180604001604052808481526020018373ffffffffffffffffffffffffffffffffffffffff166320637d8e6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561195c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119809190613f98565b4261198b9190613ee4565b8152509080600181540180825580915050600190039060005260206000209060020201600090919091909150600082015181600001556020820151816001015550506119dc8b838c8c8c8c8c612cc3565b8073ffffffffffffffffffffffffffffffffffffffff16636198e339836040518263ffffffff1660e01b8152600401611a1591906137f8565b600060405180830381600087803b158015611a2f57600080fd5b505af1158015611a43573d6000803e3d6000fd5b50505050829450505050505b979650505050505050565b6000606860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154606860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154611aea612fed565b73ffffffffffffffffffffffffffffffffffffffff16633861727285306040518363ffffffff1660e01b8152600401611b2492919061428e565b602060405180830381865afa158015611b41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b659190613f98565b611b6f9190613ee4565b611b799190613fc5565b9050919050565b6000606860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101549050919050565b600060019054906101000a900460ff16611bf45760008054906101000a900460ff1615611bfd565b611bfc6130b4565b5b611c3c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c3390614329565b60405180910390fd5b60008060019054906101000a900460ff161590508015611c8c576001600060016101000a81548160ff02191690831515021790555060016000806101000a81548160ff0219169083151502179055505b611c95846130c5565b611c9e836131d6565b611ca7826128a9565b611caf613231565b73ffffffffffffffffffffffffffffffffffffffff16639dca362f6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015611cfb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d1f9190614261565b611d55576040517f20188a5900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8015611d765760008060016101000a81548160ff0219169083151502179055505b50505050565b6000606860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000611e10612fed565b90506000606860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015490506000606860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055508173ffffffffffffffffffffffffffffffffffffffff1663263ecf7430876040518363ffffffff1660e01b8152600401611edc92919061428e565b602060405180830381865afa158015611ef9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1d9190614261565b15611fe0578173ffffffffffffffffffffffffffffffffffffffff16631c5a9d9c866040518263ffffffff1660e01b8152600401611f5b91906139d7565b6020604051808303816000875af1158015611f7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f9e9190614261565b611fdf57846040517fbafbcc57000000000000000000000000000000000000000000000000000000008152600401611fd691906139d7565b60405180910390fd5b5b6000811415611ff0575050612120565b611ff8612533565b73ffffffffffffffffffffffffffffffffffffffff1663f83d08ba826040518263ffffffff1660e01b81526004016000604051808303818588803b15801561203f57600080fd5b505af1158015612053573d6000803e3d6000fd5b50505050508173ffffffffffffffffffffffffffffffffffffffff1663580d747a868387876040518563ffffffff1660e01b81526004016120979493929190614349565b6020604051808303816000875af11580156120b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120da9190614261565b61211d5784816040517fcbf8d8ef000000000000000000000000000000000000000000000000000000008152600401612114929190614200565b60405180910390fd5b50505b505050565b61212d6128a1565b73ffffffffffffffffffffffffffffffffffffffff1661214b6114bb565b73ffffffffffffffffffffffffffffffffffffffff16146121a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612198906141b1565b60405180910390fd5b6121aa816132f8565b50565b6000806000606760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020848154811061220357612202613e86565b5b90600052602060002090600202016040518060400160405290816000820154815260200160018201548152505090508060000151816020015192509250509250929050565b6122506128a1565b73ffffffffffffffffffffffffffffffffffffffff1661226e6114bb565b73ffffffffffffffffffffffffffffffffffffffff16146122c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122bb906141b1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612334576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161232b90614400565b60405180910390fd5b61233d816128a9565b50565b6060806000606760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905090508067ffffffffffffffff8111156123a4576123a3613a08565b5b6040519080825280602002602001820160405280156123d25781602001602082028036833780820191505090505b5092508067ffffffffffffffff8111156123ef576123ee613a08565b5b60405190808252806020026020018201604052801561241d5781602001602082028036833780820191505090505b50915060005b81811015612509576000606760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061247e5761247d613e86565b5b906000526020600020906002020160405180604001604052908160008201548152602001600182015481525050905080600001518583815181106124c5576124c4613e86565b5b60200260200101818152505080602001518483815181106124e9576124e8613e86565b5b60200260200101818152505050808061250190613f3a565b915050612423565b5050915091565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b6000606560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200161258290614477565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004016125b491906144a5565b602060405180830381865afa1580156125d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125f591906144d5565b905090565b60006126287f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b6133e6565b60000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6126596128a1565b73ffffffffffffffffffffffffffffffffffffffff166126776114bb565b73ffffffffffffffffffffffffffffffffffffffff16146126cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126c4906141b1565b60405180910390fd5b50565b60006126da6125fa565b90506126e5846133f0565b6000835111806126f25750815b156127035761270184846134a9565b505b60006127317f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd914360001b6134d6565b90508060000160009054906101000a900460ff1661289a5760018160000160006101000a81548160ff0219169083151502179055506127fd858360405160240161277b91906139d7565b6040516020818303038152906040527f3659cfe6000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506134a9565b5060008160000160006101000a81548160ff0219169083151502179055506128236125fa565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614612890576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161288790614574565b60405180910390fd5b612899856134e0565b5b5050505050565b600033905090565b6000603360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081603360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080606760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490508410612a3c5783606760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490506040517fdee6f574000000000000000000000000000000000000000000000000000000008152600401612a3392919061399f565b60405180910390fd5b600080612a47612533565b73ffffffffffffffffffffffffffffffffffffffff1663d15ca4ed30876040518363ffffffff1660e01b8152600401612a81929190614200565b6040805180830381865afa158015612a9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ac19190614594565b915091506000606760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208781548110612b1857612b17613e86565b5b906000526020600020906002020160405180604001604052908160008201548152602001600182015481525050905082816000015114612b95578060000151836040517f753c4c22000000000000000000000000000000000000000000000000000000008152600401612b8c92919061399f565b60405180910390fd5b81816020015114612be3578060200151826040517f8acd9503000000000000000000000000000000000000000000000000000000008152600401612bda92919061399f565b60405180910390fd5b8060000151816020015194509450505050935093915050565b6000606560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed604051602001612c4b90614620565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b8152600401612c7d91906144a5565b602060405180830381865afa158015612c9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cbe91906144d5565b905090565b6000612ccd612fed565b905060008173ffffffffffffffffffffffffffffffffffffffff16639b95975f8a306040518363ffffffff1660e01b8152600401612d0c92919061428e565b602060405180830381865afa158015612d29573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d4d9190613f98565b90506000612d5b898361352f565b90506000811115612e2e578273ffffffffffffffffffffffffffffffffffffffff16639dfb60818b838b8b896040518663ffffffff1660e01b8152600401612da7959493929190614635565b6020604051808303816000875af1158015612dc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612dea9190614261565b612e2d5789896040517f88f72d99000000000000000000000000000000000000000000000000000000008152600401612e24929190614200565b60405180910390fd5b5b6000818a612e3c9190613fc5565b90506000811415612e505750505050612fe4565b60008473ffffffffffffffffffffffffffffffffffffffff1663d3e242a48d306040518363ffffffff1660e01b8152600401612e8d92919061428e565b602060405180830381865afa158015612eaa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ece9190613f98565b905081811015612f17578b8b6040517fc7b27867000000000000000000000000000000000000000000000000000000008152600401612f0e929190614200565b60405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff16636e1984758d848b8b8b6040518663ffffffff1660e01b8152600401612f58959493929190614635565b6020604051808303816000875af1158015612f77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f9b9190614261565b612fde578b8b6040517f21ffa8e9000000000000000000000000000000000000000000000000000000008152600401612fd5929190614200565b60405180910390fd5b50505050505b50505050505050565b6000606560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed60405160200161303c906146d4565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b815260040161306e91906144a5565b602060405180830381865afa15801561308b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130af91906144d5565b905090565b60006130bf30612510565b15905090565b600060019054906101000a900460ff16613114576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161310b9061475b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156131915761ce10606560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506131d3565b80606560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b600060019054906101000a900460ff16613225576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161321c9061475b565b60405180910390fd5b61322e816132f8565b50565b6000606560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dcf0aaed604051602001613280906147c7565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b81526004016132b291906144a5565b602060405180830381865afa1580156132cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132f391906144d5565b905090565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561335f576040517fe99d5ac500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80606660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167f60a0f5b9f9e81e98216071b85826681c796256fe3d1354ecb675580fba64fa6960405160405180910390a250565b6000819050919050565b6133f981613548565b613438576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161342f9061484e565b60405180910390fd5b806134657f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b6133e6565b60000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60606134ce83836040518060600160405280602781526020016149f86027913961355b565b905092915050565b6000819050919050565b6134e9816133f0565b8073ffffffffffffffffffffffffffffffffffffffff167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a250565b600081831061353e5781613540565b825b905092915050565b600080823b905060008111915050919050565b606061356684613548565b6135a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161359c906148e0565b60405180910390fd5b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516135cd919061497a565b600060405180830381855af49150503d8060008114613608576040519150601f19603f3d011682016040523d82523d6000602084013e61360d565b606091505b509150915061361d828286613628565b925050509392505050565b6060831561363857829050613688565b60008351111561364b5782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161367f91906149d5565b60405180910390fd5b9392505050565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f8401126136c8576136c76136a3565b5b8235905067ffffffffffffffff8111156136e5576136e46136a8565b5b602083019150836020820283011115613701576137006136ad565b5b9250929050565b60008083601f84011261371e5761371d6136a3565b5b8235905067ffffffffffffffff81111561373b5761373a6136a8565b5b602083019150836020820283011115613757576137566136ad565b5b9250929050565b6000806000806040858703121561377857613777613699565b5b600085013567ffffffffffffffff8111156137965761379561369e565b5b6137a2878288016136b2565b9450945050602085013567ffffffffffffffff8111156137c5576137c461369e565b5b6137d187828801613708565b925092505092959194509250565b6000819050919050565b6137f2816137df565b82525050565b600060208201905061380d60008301846137e9565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061383e82613813565b9050919050565b61384e81613833565b811461385957600080fd5b50565b60008135905061386b81613845565b92915050565b60006020828403121561388757613886613699565b5b60006138958482850161385c565b91505092915050565b6000806000806000606086880312156138ba576138b9613699565b5b60006138c88882890161385c565b955050602086013567ffffffffffffffff8111156138e9576138e861369e565b5b6138f5888289016136b2565b9450945050604086013567ffffffffffffffff8111156139185761391761369e565b5b61392488828901613708565b92509250509295509295909350565b61393c816137df565b811461394757600080fd5b50565b60008135905061395981613933565b92915050565b6000806040838503121561397657613975613699565b5b60006139848582860161385c565b92505060206139958582860161394a565b9150509250929050565b60006040820190506139b460008301856137e9565b6139c160208301846137e9565b9392505050565b6139d181613833565b82525050565b60006020820190506139ec60008301846139c8565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b613a40826139f7565b810181811067ffffffffffffffff82111715613a5f57613a5e613a08565b5b80604052505050565b6000613a7261368f565b9050613a7e8282613a37565b919050565b600067ffffffffffffffff821115613a9e57613a9d613a08565b5b613aa7826139f7565b9050602081019050919050565b82818337600083830152505050565b6000613ad6613ad184613a83565b613a68565b905082815260208101848484011115613af257613af16139f2565b5b613afd848285613ab4565b509392505050565b600082601f830112613b1a57613b196136a3565b5b8135613b2a848260208601613ac3565b91505092915050565b60008060408385031215613b4a57613b49613699565b5b6000613b588582860161385c565b925050602083013567ffffffffffffffff811115613b7957613b7861369e565b5b613b8585828601613b05565b9150509250929050565b6000819050919050565b6000613bb4613baf613baa84613813565b613b8f565b613813565b9050919050565b6000613bc682613b99565b9050919050565b6000613bd882613bbb565b9050919050565b613be881613bcd565b82525050565b6000602082019050613c036000830184613bdf565b92915050565b600080600060608486031215613c2257613c21613699565b5b6000613c308682870161385c565b9350506020613c418682870161394a565b9250506040613c528682870161394a565b9150509250925092565b600080600080600080600060e0888a031215613c7b57613c7a613699565b5b6000613c898a828b0161385c565b9750506020613c9a8a828b0161385c565b9650506040613cab8a828b0161385c565b9550506060613cbc8a828b0161385c565b9450506080613ccd8a828b0161385c565b93505060a0613cde8a828b0161385c565b92505060c0613cef8a828b0161394a565b91505092959891949750929550565b600080600060608486031215613d1757613d16613699565b5b6000613d258682870161385c565b9350506020613d368682870161385c565b9250506040613d478682870161385c565b9150509250925092565b60008060408385031215613d6857613d67613699565b5b6000613d768582860161385c565b9250506020613d878582860161385c565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613dc6816137df565b82525050565b6000613dd88383613dbd565b60208301905092915050565b6000602082019050919050565b6000613dfc82613d91565b613e068185613d9c565b9350613e1183613dad565b8060005b83811015613e42578151613e298882613dcc565b9750613e3483613de4565b925050600181019050613e15565b5085935050505092915050565b60006040820190508181036000830152613e698185613df1565b90508181036020830152613e7d8184613df1565b90509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000613eef826137df565b9150613efa836137df565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613f2f57613f2e613eb5565b5b828201905092915050565b6000613f45826137df565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613f7857613f77613eb5565b5b600182019050919050565b600081519050613f9281613933565b92915050565b600060208284031215613fae57613fad613699565b5b6000613fbc84828501613f83565b91505092915050565b6000613fd0826137df565b9150613fdb836137df565b925082821015613fee57613fed613eb5565b5b828203905092915050565b600060608201905061400e60008301866139c8565b61401b60208301856137e9565b61402860408301846137e9565b949350505050565b600082825260208201905092915050565b7f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060008201527f64656c656761746563616c6c0000000000000000000000000000000000000000602082015250565b600061409d602c83614030565b91506140a882614041565b604082019050919050565b600060208201905081810360008301526140cc81614090565b9050919050565b7f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060008201527f6163746976652070726f78790000000000000000000000000000000000000000602082015250565b600061412f602c83614030565b915061413a826140d3565b604082019050919050565b6000602082019050818103600083015261415e81614122565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061419b602083614030565b91506141a682614165565b602082019050919050565b600060208201905081810360008301526141ca8161418e565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600060408201905061421560008301856139c8565b61422260208301846137e9565b9392505050565b60008115159050919050565b61423e81614229565b811461424957600080fd5b50565b60008151905061425b81614235565b92915050565b60006020828403121561427757614276613699565b5b60006142858482850161424c565b91505092915050565b60006040820190506142a360008301856139c8565b6142b060208301846139c8565b9392505050565b7f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160008201527f647920696e697469616c697a6564000000000000000000000000000000000000602082015250565b6000614313602e83614030565b915061431e826142b7565b604082019050919050565b6000602082019050818103600083015261434281614306565b9050919050565b600060808201905061435e60008301876139c8565b61436b60208301866137e9565b61437860408301856139c8565b61438560608301846139c8565b95945050505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006143ea602683614030565b91506143f58261438e565b604082019050919050565b60006020820190508181036000830152614419816143dd565b9050919050565b600081905092915050565b7f4c6f636b6564476f6c6400000000000000000000000000000000000000000000600082015250565b6000614461600a83614420565b915061446c8261442b565b600a82019050919050565b600061448282614454565b9150819050919050565b6000819050919050565b61449f8161448c565b82525050565b60006020820190506144ba6000830184614496565b92915050565b6000815190506144cf81613845565b92915050565b6000602082840312156144eb576144ea613699565b5b60006144f9848285016144c0565b91505092915050565b7f45524331393637557067726164653a207570677261646520627265616b73206660008201527f7572746865722075706772616465730000000000000000000000000000000000602082015250565b600061455e602f83614030565b915061456982614502565b604082019050919050565b6000602082019050818103600083015261458d81614551565b9050919050565b600080604083850312156145ab576145aa613699565b5b60006145b985828601613f83565b92505060206145ca85828601613f83565b9150509250929050565b7f476f6c64546f6b656e0000000000000000000000000000000000000000000000600082015250565b600061460a600983614420565b9150614615826145d4565b600982019050919050565b600061462b826145fd565b9150819050919050565b600060a08201905061464a60008301886139c8565b61465760208301876137e9565b61466460408301866139c8565b61467160608301856139c8565b61467e60808301846137e9565b9695505050505050565b7f456c656374696f6e000000000000000000000000000000000000000000000000600082015250565b60006146be600883614420565b91506146c982614688565b600882019050919050565b60006146df826146b1565b9150819050919050565b7f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960008201527f6e697469616c697a696e67000000000000000000000000000000000000000000602082015250565b6000614745602b83614030565b9150614750826146e9565b604082019050919050565b6000602082019050818103600083015261477481614738565b9050919050565b7f4163636f756e7473000000000000000000000000000000000000000000000000600082015250565b60006147b1600883614420565b91506147bc8261477b565b600882019050919050565b60006147d2826147a4565b9150819050919050565b7f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60008201527f6f74206120636f6e747261637400000000000000000000000000000000000000602082015250565b6000614838602d83614030565b9150614843826147dc565b604082019050919050565b600060208201905081810360008301526148678161482b565b9050919050565b7f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60008201527f6e74726163740000000000000000000000000000000000000000000000000000602082015250565b60006148ca602683614030565b91506148d58261486e565b604082019050919050565b600060208201905081810360008301526148f9816148bd565b9050919050565b600081519050919050565b600081905092915050565b60005b83811015614934578082015181840152602081019050614919565b83811115614943576000848401525b50505050565b600061495482614900565b61495e818561490b565b935061496e818560208601614916565b80840191505092915050565b60006149868284614949565b915081905092915050565b600081519050919050565b60006149a782614991565b6149b18185614030565b93506149c1818560208601614916565b6149ca816139f7565b840191505092915050565b600060208201905081810360008301526149ef818461499c565b90509291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122031b56d8c992f7e9e9f7725c5583f2e29f9f8b2543660280e63fa8b947a504e2b64736f6c634300080b0033