Source Code
Latest 9 from a total of 9 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Transfer Ownersh... | 24552317 | 10 days ago | IN | 0 ETH | 0 | ||||
| Withdraw Unclaim... | 23089848 | 44 days ago | IN | 0 ETH | 0 | ||||
| Claim | 23089825 | 44 days ago | IN | 0 ETH | 0 | ||||
| Fund Campaign | 22989366 | 46 days ago | IN | 0 ETH | 0 | ||||
| Fund Campaign | 22955183 | 47 days ago | IN | 0 ETH | 0.00000001 | ||||
| Fund Campaign | 22954074 | 47 days ago | IN | 0 ETH | 0.00000001 | ||||
| Create Campaign | 22953936 | 47 days ago | IN | 0 ETH | 0.00000003 | ||||
| Create Campaign | 22953855 | 47 days ago | IN | 0 ETH | 0.00000003 | ||||
| Create Campaign | 22781435 | 51 days ago | IN | 0 ETH | 0.00000002 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
WorldCampaignManager
Compiler Version
v0.8.29+commit.ab55807c
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import {Ownable} from "solady/auth/Ownable.sol";
import {IERC20} from "./interfaces/IERC20.sol";
import {IAddressBook} from "./interfaces/IAddressBook.sol";
import {SafeTransferLib} from "solady/utils/SafeTransferLib.sol";
import {EfficientHashLib} from "solady/utils/EfficientHashLib.sol";
/// @title World Campaign Manager
/// @author Miguel Piedrafita
/// @notice Allows World to run global campaigns
contract WorldCampaignManager is Ownable {
///////////////////////////////////////////////////////////////////////////////
/// ERRORS ///
//////////////////////////////////////////////////////////////////////////////
/// @notice Thrown when trying to create a campaign with invalid configuration
error InvalidConfiguration();
/// @notice Thrown when a campaign is not found
error CampaignNotFound();
/// @notice Thrown when a campaign has ended
error CampaignEnded();
/// @notice Thrown when trying to withdraw from a campaign that is still active
error CampaignActive();
/// @notice Thrown when a participant has already participated in a campaign
error AlreadyParticipated();
/// @notice Thrown when a user tries to sponsor themselves
error CannotSponsorSelf();
/// @notice Thrown when a user tries to sponsor the user they were sponsored by
error CannotSponsorSponsor();
/// @notice Thrown when an address is not verified
error NotVerified();
/// @notice Thrown when a recipient has not been sponsored
error NotSponsored();
/// @notice Thrown when there are insufficient funds to process a claim
error InsufficientFunds();
/// @notice Thrown when a recipient tries to claim without sponsoring someone first.
error HasNotSponsoredYet();
///////////////////////////////////////////////////////////////////////////////
/// EVENTS ///
//////////////////////////////////////////////////////////////////////////////
/// @notice Emitted when the WorldCampaignManager is initialized
event WorldCampaignManagerInitialized(address addressBook);
/// @notice Emitted when a new campaign is created
/// @param campaignId The ID of the created campaign
event CampaignCreated(uint256 indexed campaignId);
/// @notice Emitted when a campaign is funded
/// @param campaignId The ID of the campaign
/// @param amount The amount of funds added to the campaign
event CampaignFunded(uint256 indexed campaignId, uint256 amount);
/// @notice Emitted when a campaign ends early
/// @param campaignId The ID of the campaign
event CampaignEndedEarly(uint256 indexed campaignId);
/// @notice Emitted when excess funds are withdrawn from a campaign
/// @param campaignId The ID of the campaign
/// @param amount The amount of funds withdrawn
event ExcessFundsWithdrawn(uint256 indexed campaignId, uint256 amount);
/// @notice Emitted when a sponsorship is made
/// @param campaignId The ID of the campaign
/// @param sponsor The address of the sponsor
/// @param recipient The address of the recipient being sponsored
event Sponsored(uint256 indexed campaignId, address indexed sponsor, address indexed recipient);
/// @notice Emitted when a sponsorship reward is claimed
/// @param campaignId The ID of the campaign
/// @param recipient The address of the recipient claiming the reward
/// @param rewardAmount The amount of the reward claimed
event Claimed(uint256 indexed campaignId, address indexed recipient, uint256 rewardAmount);
///////////////////////////////////////////////////////////////////////////////
/// TYPE DECLARATIONS ///
//////////////////////////////////////////////////////////////////////////////
/// @notice Represents a sponsorship campaign
/// @param token The ERC20 token used for rewards
/// @param funds The amount of funds allocated for the campaign
/// @param endsAt The timestamp when the campaign ends
/// @param wasEndedEarly Whether the campaign was ended early
/// @param lowerBound The minimum reward amount
/// @param upperBound The maximum reward amount
/// @param bonusRewardThreshold The threshold for bonus rewards
/// @param bonusRewardAmount The amount for bonus rewards
/// @param randomnessSeed A seed used for randomness in reward calculation
struct Campaign {
address token;
uint256 funds;
uint256 endsAt;
bool wasEndedEarly;
uint256 lowerBound;
uint256 upperBound;
uint256 bonusRewardThreshold;
uint256 bonusRewardAmount;
uint256 randomnessSeed;
}
enum ClaimStatus {
NotSponsored,
CanClaim,
AlreadyClaimed
}
///////////////////////////////////////////////////////////////////////////////
/// CONFIG STORAGE ///
//////////////////////////////////////////////////////////////////////////////
/// @notice The address book contract that will be used to check verification status
IAddressBook public immutable addressBook;
/// @notice The next campaign ID to be assigned
uint256 private nextCampaignId = 1;
/// @notice A mapping of campaign ID to Campaign details
mapping(uint256 => Campaign) public getCampaign;
/// @notice Stores the sponsored recipient for a given campaign and sponsor
mapping(uint256 => mapping(address => address)) public getSponsoredRecipient;
/// @notice Stores the reverse mapping of recipient to sponsor for a given campaign
mapping(uint256 => mapping(address => address)) public getSponsor;
/// @notice Tracks whether a recipient has been sponsored in a given campaign
mapping(uint256 => mapping(address => ClaimStatus)) public getClaimStatus;
///////////////////////////////////////////////////////////////////////////////
/// CONSTRUCTOR ///
//////////////////////////////////////////////////////////////////////////////
/// @notice Create a new WorldCampaignManager contract
/// @param _addressBook The address book contract that will be used to check verification status
/// @custom:throws InvalidConfiguration Thrown when the address book address is zero
constructor(IAddressBook _addressBook) {
require(address(_addressBook) != address(0), InvalidConfiguration());
addressBook = _addressBook;
_initializeOwner(msg.sender);
emit WorldCampaignManagerInitialized(address(addressBook));
}
///////////////////////////////////////////////////////////////////////////////
/// MAIN LOGIC ///
//////////////////////////////////////////////////////////////////////////////
/// @notice Sponsor a recipient in a campaign
/// @param campaignId The ID of the campaign
/// @param recipient The address of the recipient to be sponsored
/// @custom:throws CannotSponsorSelf Thrown when a user tries to sponsor themselves
/// @custom:throws InvalidConfiguration Thrown when the recipient address is zero
/// @custom:throws CampaignNotFound Thrown when the campaign does not exist
/// @custom:throws CampaignEnded Thrown when the campaign has already ended
/// @custom:throws AlreadyParticipated Thrown when the recipient has already been sponsored
/// @custom:throws NotVerified Thrown when either the sponsor or recipient is not verified
function sponsor(uint256 campaignId, address recipient) external {
Campaign memory campaign = getCampaign[campaignId];
require(recipient != msg.sender, CannotSponsorSelf());
require(recipient != address(0), InvalidConfiguration());
require(campaign.token != address(0), CampaignNotFound());
require(getSponsor[campaignId][msg.sender] != recipient, CannotSponsorSponsor());
require(addressBook.addressVerifiedUntil(recipient) >= block.timestamp, NotVerified());
require(block.timestamp < campaign.endsAt && !campaign.wasEndedEarly, CampaignEnded());
require(addressBook.addressVerifiedUntil(msg.sender) >= block.timestamp, NotVerified());
require(getSponsoredRecipient[campaignId][msg.sender] == address(0), AlreadyParticipated());
require(getClaimStatus[campaignId][recipient] == ClaimStatus.NotSponsored, AlreadyParticipated());
getSponsor[campaignId][recipient] = msg.sender;
getSponsoredRecipient[campaignId][msg.sender] = recipient;
getClaimStatus[campaignId][recipient] = ClaimStatus.CanClaim;
emit Sponsored(campaignId, msg.sender, recipient);
}
/// @notice Claim a sponsorship reward in a campaign
/// @param campaignId The ID of the campaign
/// @return rewardAmount The amount of the reward claimed
/// @custom:throws CampaignNotFound Thrown when the campaign does not exist
/// @custom:throws CampaignEnded Thrown when the campaign has already ended
/// @custom:throws HasNotSponsoredYet Thrown when the recipient has not sponsored anyone yet
/// @custom:throws NotSponsored Thrown when the recipient has not been sponsored or has already claimed their reward
function claim(uint256 campaignId) external returns (uint256 rewardAmount) {
Campaign storage campaign = getCampaign[campaignId];
address sponsor = getSponsor[campaignId][msg.sender];
require(campaign.token != address(0), CampaignNotFound());
require(block.timestamp < campaign.endsAt, CampaignEnded());
require(getClaimStatus[campaignId][msg.sender] == ClaimStatus.CanClaim, NotSponsored());
require(getSponsoredRecipient[campaignId][msg.sender] != address(0), HasNotSponsoredYet());
getClaimStatus[campaignId][msg.sender] = ClaimStatus.AlreadyClaimed;
if (campaign.lowerBound == campaign.upperBound) {
rewardAmount = campaign.lowerBound;
} else {
uint256 range = campaign.upperBound - campaign.lowerBound;
uint256 randomness = uint256(EfficientHashLib.hash(abi.encodePacked(campaign.randomnessSeed, msg.sender)));
rewardAmount = campaign.lowerBound + (randomness % (range + 1));
}
if (rewardAmount >= campaign.bonusRewardThreshold) {
rewardAmount = campaign.bonusRewardAmount;
}
require(campaign.funds >= rewardAmount, InsufficientFunds());
unchecked {
campaign.funds -= rewardAmount;
}
emit Claimed(campaignId, msg.sender, rewardAmount);
SafeTransferLib.safeTransfer(campaign.token, msg.sender, rewardAmount);
}
/// @notice Check if a sponsor can sponsor a recipient in a campaign
/// @param campaignId The ID of the campaign
/// @param sponsor The address of the sponsor
/// @param recipient The address of the recipient to be sponsored
/// @return True if the sponsor can sponsor the recipient, false otherwise
function canSponsor(uint256 campaignId, address sponsor, address recipient) external view returns (bool) {
Campaign memory campaign = getCampaign[campaignId];
if (
recipient == sponsor || campaign.wasEndedEarly || recipient == address(0) || campaign.token == address(0)
|| addressBook.addressVerifiedUntil(recipient) < block.timestamp || block.timestamp >= campaign.endsAt
|| getClaimStatus[campaignId][recipient] != ClaimStatus.NotSponsored
|| addressBook.addressVerifiedUntil(sponsor) < block.timestamp
|| getSponsoredRecipient[campaignId][sponsor] != address(0)
|| getSponsor[campaignId][sponsor] == recipient
) {
return false;
}
return true;
}
///////////////////////////////////////////////////////////////////////////////
/// CONFIG LOGIC ///
//////////////////////////////////////////////////////////////////////////////
/// @notice Create a new sponsorship campaign
/// @param token The ERC20 token used for rewards
/// @param initialDeposit The initial deposit amount
/// @param endTimestamp The timestamp when the campaign ends
/// @param lowerBound The minimum reward amount
/// @param upperBound The maximum reward amount
/// @param bonusRewardThreshold The threshold for bonus rewards
/// @param bonusRewardAmount The amount for bonus rewards
/// @return campaignId The ID of the created campaign
/// @custom:throws InvalidConfiguration Thrown when the configuration is invalid
function createCampaign(
IERC20 token,
uint256 initialDeposit,
uint256 endTimestamp,
uint256 lowerBound,
uint256 upperBound,
uint256 bonusRewardThreshold,
uint256 bonusRewardAmount
) external onlyOwner returns (uint256 campaignId) {
require(initialDeposit > 0, InvalidConfiguration());
require(lowerBound <= upperBound, InvalidConfiguration());
require(address(token) != address(0), InvalidConfiguration());
require(endTimestamp > block.timestamp, InvalidConfiguration());
require(bonusRewardAmount >= upperBound, InvalidConfiguration());
require(bonusRewardThreshold >= lowerBound, InvalidConfiguration());
require(bonusRewardThreshold <= upperBound, InvalidConfiguration());
unchecked {
campaignId = nextCampaignId++;
}
getCampaign[campaignId] = Campaign({
token: address(token),
funds: initialDeposit,
endsAt: endTimestamp,
wasEndedEarly: false,
lowerBound: lowerBound,
upperBound: upperBound,
bonusRewardThreshold: bonusRewardThreshold,
bonusRewardAmount: bonusRewardAmount,
randomnessSeed: block.prevrandao
});
emit CampaignCreated(campaignId);
SafeTransferLib.safeTransferFrom(address(token), msg.sender, address(this), initialDeposit);
}
/// @notice Fund an existing campaign
/// @param campaignId The ID of the campaign to fund
/// @param amount The amount of funds to add to the campaign
/// @custom:throws InvalidConfiguration Thrown when the amount is zero
/// @custom:throws CampaignNotFound Thrown when the campaign does not exist
/// @custom:throws CampaignEnded Thrown when the campaign has already ended
/// @dev For simplicity, we allow any address to fund a campaign
function fundCampaign(uint256 campaignId, uint256 amount) external {
Campaign storage campaign = getCampaign[campaignId];
require(amount > 0, InvalidConfiguration());
require(campaign.token != address(0), CampaignNotFound());
require(block.timestamp < campaign.endsAt, CampaignEnded());
unchecked {
campaign.funds += amount;
}
emit CampaignFunded(campaignId, amount);
SafeTransferLib.safeTransferFrom(campaign.token, msg.sender, address(this), amount);
}
/// @notice Withdraw unclaimed funds from a ended campaign
/// @param campaignId The ID of the campaign to withdraw from
/// @custom:throws CampaignNotFound Thrown when the campaign does not exist
/// @custom:throws CampaignEnded Thrown when the campaign has not yet ended
function withdrawUnclaimedFunds(uint256 campaignId) external onlyOwner {
Campaign storage campaign = getCampaign[campaignId];
require(campaign.token != address(0), CampaignNotFound());
require(block.timestamp >= campaign.endsAt, CampaignActive());
uint256 unclaimedFunds = campaign.funds;
campaign.funds = 0;
emit ExcessFundsWithdrawn(campaignId, unclaimedFunds);
SafeTransferLib.safeTransfer(campaign.token, msg.sender, unclaimedFunds);
}
/// @notice End a campaign early
/// @param campaignId The ID of the campaign to end early
/// @custom:throws CampaignNotFound Thrown when the campaign does not exist
/// @custom:throws CampaignEnded Thrown when the campaign has already ended
/// @dev Note that ending a campaign early does not prevent already sponsored recipients from claiming their rewards.
function endCampaignEarly(uint256 campaignId) external onlyOwner {
Campaign storage campaign = getCampaign[campaignId];
require(campaign.token != address(0), CampaignNotFound());
require(!campaign.wasEndedEarly && block.timestamp < campaign.endsAt, CampaignEnded());
campaign.wasEndedEarly = true;
emit CampaignEndedEarly(campaignId);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @notice Simple single owner authorization mixin.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/auth/Ownable.sol)
///
/// @dev Note:
/// This implementation does NOT auto-initialize the owner to `msg.sender`.
/// You MUST call the `_initializeOwner` in the constructor / initializer.
///
/// While the ownable portion follows
/// [EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility,
/// the nomenclature for the 2-step ownership handover may be unique to this codebase.
abstract contract Ownable {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CUSTOM ERRORS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The caller is not authorized to call the function.
error Unauthorized();
/// @dev The `newOwner` cannot be the zero address.
error NewOwnerIsZeroAddress();
/// @dev The `pendingOwner` does not have a valid handover request.
error NoHandoverRequest();
/// @dev Cannot double-initialize.
error AlreadyInitialized();
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* EVENTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The ownership is transferred from `oldOwner` to `newOwner`.
/// This event is intentionally kept the same as OpenZeppelin's Ownable to be
/// compatible with indexers and [EIP-173](https://eips.ethereum.org/EIPS/eip-173),
/// despite it not being as lightweight as a single argument event.
event OwnershipTransferred(address indexed oldOwner, address indexed newOwner);
/// @dev An ownership handover to `pendingOwner` has been requested.
event OwnershipHandoverRequested(address indexed pendingOwner);
/// @dev The ownership handover to `pendingOwner` has been canceled.
event OwnershipHandoverCanceled(address indexed pendingOwner);
/// @dev `keccak256(bytes("OwnershipTransferred(address,address)"))`.
uint256 private constant _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE =
0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0;
/// @dev `keccak256(bytes("OwnershipHandoverRequested(address)"))`.
uint256 private constant _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE =
0xdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d;
/// @dev `keccak256(bytes("OwnershipHandoverCanceled(address)"))`.
uint256 private constant _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE =
0xfa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c92;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* STORAGE */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The owner slot is given by:
/// `bytes32(~uint256(uint32(bytes4(keccak256("_OWNER_SLOT_NOT")))))`.
/// It is intentionally chosen to be a high value
/// to avoid collision with lower slots.
/// The choice of manual storage layout is to enable compatibility
/// with both regular and upgradeable contracts.
bytes32 internal constant _OWNER_SLOT =
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927;
/// The ownership handover slot of `newOwner` is given by:
/// ```
/// mstore(0x00, or(shl(96, user), _HANDOVER_SLOT_SEED))
/// let handoverSlot := keccak256(0x00, 0x20)
/// ```
/// It stores the expiry timestamp of the two-step ownership handover.
uint256 private constant _HANDOVER_SLOT_SEED = 0x389a75e1;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* INTERNAL FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Override to return true to make `_initializeOwner` prevent double-initialization.
function _guardInitializeOwner() internal pure virtual returns (bool guard) {}
/// @dev Initializes the owner directly without authorization guard.
/// This function must be called upon initialization,
/// regardless of whether the contract is upgradeable or not.
/// This is to enable generalization to both regular and upgradeable contracts,
/// and to save gas in case the initial owner is not the caller.
/// For performance reasons, this function will not check if there
/// is an existing owner.
function _initializeOwner(address newOwner) internal virtual {
if (_guardInitializeOwner()) {
/// @solidity memory-safe-assembly
assembly {
let ownerSlot := _OWNER_SLOT
if sload(ownerSlot) {
mstore(0x00, 0x0dc149f0) // `AlreadyInitialized()`.
revert(0x1c, 0x04)
}
// Clean the upper 96 bits.
newOwner := shr(96, shl(96, newOwner))
// Store the new value.
sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner))))
// Emit the {OwnershipTransferred} event.
log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)
}
} else {
/// @solidity memory-safe-assembly
assembly {
// Clean the upper 96 bits.
newOwner := shr(96, shl(96, newOwner))
// Store the new value.
sstore(_OWNER_SLOT, newOwner)
// Emit the {OwnershipTransferred} event.
log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, 0, newOwner)
}
}
}
/// @dev Sets the owner directly without authorization guard.
function _setOwner(address newOwner) internal virtual {
if (_guardInitializeOwner()) {
/// @solidity memory-safe-assembly
assembly {
let ownerSlot := _OWNER_SLOT
// Clean the upper 96 bits.
newOwner := shr(96, shl(96, newOwner))
// Emit the {OwnershipTransferred} event.
log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)
// Store the new value.
sstore(ownerSlot, or(newOwner, shl(255, iszero(newOwner))))
}
} else {
/// @solidity memory-safe-assembly
assembly {
let ownerSlot := _OWNER_SLOT
// Clean the upper 96 bits.
newOwner := shr(96, shl(96, newOwner))
// Emit the {OwnershipTransferred} event.
log3(0, 0, _OWNERSHIP_TRANSFERRED_EVENT_SIGNATURE, sload(ownerSlot), newOwner)
// Store the new value.
sstore(ownerSlot, newOwner)
}
}
}
/// @dev Throws if the sender is not the owner.
function _checkOwner() internal view virtual {
/// @solidity memory-safe-assembly
assembly {
// If the caller is not the stored owner, revert.
if iszero(eq(caller(), sload(_OWNER_SLOT))) {
mstore(0x00, 0x82b42900) // `Unauthorized()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Returns how long a two-step ownership handover is valid for in seconds.
/// Override to return a different value if needed.
/// Made internal to conserve bytecode. Wrap it in a public function if needed.
function _ownershipHandoverValidFor() internal view virtual returns (uint64) {
return 48 * 3600;
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* PUBLIC UPDATE FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Allows the owner to transfer the ownership to `newOwner`.
function transferOwnership(address newOwner) public payable virtual onlyOwner {
/// @solidity memory-safe-assembly
assembly {
if iszero(shl(96, newOwner)) {
mstore(0x00, 0x7448fbae) // `NewOwnerIsZeroAddress()`.
revert(0x1c, 0x04)
}
}
_setOwner(newOwner);
}
/// @dev Allows the owner to renounce their ownership.
function renounceOwnership() public payable virtual onlyOwner {
_setOwner(address(0));
}
/// @dev Request a two-step ownership handover to the caller.
/// The request will automatically expire in 48 hours (172800 seconds) by default.
function requestOwnershipHandover() public payable virtual {
unchecked {
uint256 expires = block.timestamp + _ownershipHandoverValidFor();
/// @solidity memory-safe-assembly
assembly {
// Compute and set the handover slot to `expires`.
mstore(0x0c, _HANDOVER_SLOT_SEED)
mstore(0x00, caller())
sstore(keccak256(0x0c, 0x20), expires)
// Emit the {OwnershipHandoverRequested} event.
log2(0, 0, _OWNERSHIP_HANDOVER_REQUESTED_EVENT_SIGNATURE, caller())
}
}
}
/// @dev Cancels the two-step ownership handover to the caller, if any.
function cancelOwnershipHandover() public payable virtual {
/// @solidity memory-safe-assembly
assembly {
// Compute and set the handover slot to 0.
mstore(0x0c, _HANDOVER_SLOT_SEED)
mstore(0x00, caller())
sstore(keccak256(0x0c, 0x20), 0)
// Emit the {OwnershipHandoverCanceled} event.
log2(0, 0, _OWNERSHIP_HANDOVER_CANCELED_EVENT_SIGNATURE, caller())
}
}
/// @dev Allows the owner to complete the two-step ownership handover to `pendingOwner`.
/// Reverts if there is no existing ownership handover requested by `pendingOwner`.
function completeOwnershipHandover(address pendingOwner) public payable virtual onlyOwner {
/// @solidity memory-safe-assembly
assembly {
// Compute and set the handover slot to 0.
mstore(0x0c, _HANDOVER_SLOT_SEED)
mstore(0x00, pendingOwner)
let handoverSlot := keccak256(0x0c, 0x20)
// If the handover does not exist, or has expired.
if gt(timestamp(), sload(handoverSlot)) {
mstore(0x00, 0x6f5e8818) // `NoHandoverRequest()`.
revert(0x1c, 0x04)
}
// Set the handover slot to 0.
sstore(handoverSlot, 0)
}
_setOwner(pendingOwner);
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* PUBLIC READ FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Returns the owner of the contract.
function owner() public view virtual returns (address result) {
/// @solidity memory-safe-assembly
assembly {
result := sload(_OWNER_SLOT)
}
}
/// @dev Returns the expiry timestamp for the two-step ownership handover to `pendingOwner`.
function ownershipHandoverExpiresAt(address pendingOwner)
public
view
virtual
returns (uint256 result)
{
/// @solidity memory-safe-assembly
assembly {
// Compute the handover slot.
mstore(0x0c, _HANDOVER_SLOT_SEED)
mstore(0x00, pendingOwner)
// Load the handover slot.
result := sload(keccak256(0x0c, 0x20))
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* MODIFIERS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Marks a function as only callable by the owner.
modifier onlyOwner() virtual {
_checkOwner();
_;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface IAddressBook {
/// @notice Emitted when an account is verified
event AccountVerified(address indexed account, uint256 verifiedUntil);
/// @notice Returns a timestamp representing when the address' verification will expire
/// @param account The address to check
/// @return timestamp The timestamp when the address' verification will expire
function addressVerifiedUntil(address account) external view returns (uint256 timestamp);
/// @notice Registers a wallet to receive grants
/// @param account The address that will be registered
/// @param root The root of the Merkle tree (signup-sequencer or world-id-contracts provides this)
/// @param nullifierHash The nullifier for this proof, preventing double signaling
/// @param proof The zero knowledge proof that demonstrates the claimer has a verified World ID
/// @param proofTime A timestamp representing when the proof was created
/// @custom:throws Will revert if the proof is invalid or expired
function verify(address account, uint256 root, uint256 nullifierHash, uint256[8] calldata proof, uint256 proofTime)
external
payable;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)
/// @author Permit2 operations from (https://github.com/Uniswap/permit2/blob/main/src/libraries/Permit2Lib.sol)
///
/// @dev Note:
/// - For ETH transfers, please use `forceSafeTransferETH` for DoS protection.
library SafeTransferLib {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CUSTOM ERRORS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The ETH transfer has failed.
error ETHTransferFailed();
/// @dev The ERC20 `transferFrom` has failed.
error TransferFromFailed();
/// @dev The ERC20 `transfer` has failed.
error TransferFailed();
/// @dev The ERC20 `approve` has failed.
error ApproveFailed();
/// @dev The ERC20 `totalSupply` query has failed.
error TotalSupplyQueryFailed();
/// @dev The Permit2 operation has failed.
error Permit2Failed();
/// @dev The Permit2 amount must be less than `2**160 - 1`.
error Permit2AmountOverflow();
/// @dev The Permit2 approve operation has failed.
error Permit2ApproveFailed();
/// @dev The Permit2 lockdown operation has failed.
error Permit2LockdownFailed();
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CONSTANTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Suggested gas stipend for contract receiving ETH that disallows any storage writes.
uint256 internal constant GAS_STIPEND_NO_STORAGE_WRITES = 2300;
/// @dev Suggested gas stipend for contract receiving ETH to perform a few
/// storage reads and writes, but low enough to prevent griefing.
uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000;
/// @dev The unique EIP-712 domain separator for the DAI token contract.
bytes32 internal constant DAI_DOMAIN_SEPARATOR =
0xdbb8cf42e1ecb028be3f3dbc922e1d878b963f411dc388ced501601c60f7c6f7;
/// @dev The address for the WETH9 contract on Ethereum mainnet.
address internal constant WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
/// @dev The canonical Permit2 address.
/// [Github](https://github.com/Uniswap/permit2)
/// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3)
address internal constant PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3;
/// @dev The canonical address of the `SELFDESTRUCT` ETH mover.
/// See: https://gist.github.com/Vectorized/1cb8ad4cf393b1378e08f23f79bd99fa
/// [Etherscan](https://etherscan.io/address/0x00000000000073c48c8055bD43D1A53799176f0D)
address internal constant ETH_MOVER = 0x00000000000073c48c8055bD43D1A53799176f0D;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* ETH OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
// If the ETH transfer MUST succeed with a reasonable gas budget, use the force variants.
//
// The regular variants:
// - Forwards all remaining gas to the target.
// - Reverts if the target reverts.
// - Reverts if the current contract has insufficient balance.
//
// The force variants:
// - Forwards with an optional gas stipend
// (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases).
// - If the target reverts, or if the gas stipend is exhausted,
// creates a temporary contract to force send the ETH via `SELFDESTRUCT`.
// Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758.
// - Reverts if the current contract has insufficient balance.
//
// The try variants:
// - Forwards with a mandatory gas stipend.
// - Instead of reverting, returns whether the transfer succeeded.
/// @dev Sends `amount` (in wei) ETH to `to`.
function safeTransferETH(address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
if iszero(call(gas(), to, amount, codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Sends all the ETH in the current contract to `to`.
function safeTransferAllETH(address to) internal {
/// @solidity memory-safe-assembly
assembly {
// Transfer all the ETH and check if it succeeded or not.
if iszero(call(gas(), to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`.
function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal {
/// @solidity memory-safe-assembly
assembly {
if lt(selfbalance(), amount) {
mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
revert(0x1c, 0x04)
}
if iszero(call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, to) // Store the address in scratch space.
mstore8(0x0b, 0x73) // Opcode `PUSH20`.
mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
}
}
}
/// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`.
function forceSafeTransferAllETH(address to, uint256 gasStipend) internal {
/// @solidity memory-safe-assembly
assembly {
if iszero(call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, to) // Store the address in scratch space.
mstore8(0x0b, 0x73) // Opcode `PUSH20`.
mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
}
}
}
/// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`.
function forceSafeTransferETH(address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
if lt(selfbalance(), amount) {
mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
revert(0x1c, 0x04)
}
if iszero(call(GAS_STIPEND_NO_GRIEF, to, amount, codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, to) // Store the address in scratch space.
mstore8(0x0b, 0x73) // Opcode `PUSH20`.
mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
}
}
}
/// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`.
function forceSafeTransferAllETH(address to) internal {
/// @solidity memory-safe-assembly
assembly {
// forgefmt: disable-next-item
if iszero(call(GAS_STIPEND_NO_GRIEF, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) {
mstore(0x00, to) // Store the address in scratch space.
mstore8(0x0b, 0x73) // Opcode `PUSH20`.
mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`.
if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation.
}
}
}
/// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`.
function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend)
internal
returns (bool success)
{
/// @solidity memory-safe-assembly
assembly {
success := call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)
}
}
/// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`.
function trySafeTransferAllETH(address to, uint256 gasStipend)
internal
returns (bool success)
{
/// @solidity memory-safe-assembly
assembly {
success := call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)
}
}
/// @dev Force transfers ETH to `to`, without triggering the fallback (if any).
/// This method attempts to use a separate contract to send via `SELFDESTRUCT`,
/// and upon failure, deploys a minimal vault to accrue the ETH.
function safeMoveETH(address to, uint256 amount) internal returns (address vault) {
/// @solidity memory-safe-assembly
assembly {
to := shr(96, shl(96, to)) // Clean upper 96 bits.
for { let mover := ETH_MOVER } iszero(eq(to, address())) {} {
let selfBalanceBefore := selfbalance()
if or(lt(selfBalanceBefore, amount), eq(to, mover)) {
mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`.
revert(0x1c, 0x04)
}
if extcodesize(mover) {
let balanceBefore := balance(to) // Check via delta, in case `SELFDESTRUCT` is bricked.
mstore(0x00, to)
pop(call(gas(), mover, amount, 0x00, 0x20, codesize(), 0x00))
// If `address(to).balance >= amount + balanceBefore`, skip vault workflow.
if iszero(lt(balance(to), add(amount, balanceBefore))) { break }
// Just in case `SELFDESTRUCT` is changed to not revert and do nothing.
if lt(selfBalanceBefore, selfbalance()) { invalid() }
}
let m := mload(0x40)
// If the mover is missing or bricked, deploy a minimal vault
// that withdraws all ETH to `to` when being called only by `to`.
// forgefmt: disable-next-item
mstore(add(m, 0x20), 0x33146025575b600160005260206000f35b3d3d3d3d47335af1601a5760003dfd)
mstore(m, or(to, shl(160, 0x6035600b3d3960353df3fe73)))
// Compute and store the bytecode hash.
mstore8(0x00, 0xff) // Write the prefix.
mstore(0x35, keccak256(m, 0x40))
mstore(0x01, shl(96, address())) // Deployer.
mstore(0x15, 0) // Salt.
vault := keccak256(0x00, 0x55)
pop(call(gas(), vault, amount, codesize(), 0x00, codesize(), 0x00))
// The vault returns a single word on success. Failure reverts with empty data.
if iszero(returndatasize()) {
if iszero(create2(0, m, 0x40, 0)) { revert(codesize(), codesize()) } // For gas estimation.
}
mstore(0x40, m) // Restore the free memory pointer.
break
}
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* ERC20 OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
/// Reverts upon failure.
///
/// The `from` account must have at least `amount` approved for
/// the current contract to manage.
function safeTransferFrom(address token, address from, address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x60, amount) // Store the `amount` argument.
mstore(0x40, to) // Store the `to` argument.
mstore(0x2c, shl(96, from)) // Store the `from` argument.
mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`.
let success := call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
if iszero(and(eq(mload(0x00), 1), success)) {
if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) {
mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
revert(0x1c, 0x04)
}
}
mstore(0x60, 0) // Restore the zero slot to zero.
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
///
/// The `from` account must have at least `amount` approved for the current contract to manage.
function trySafeTransferFrom(address token, address from, address to, uint256 amount)
internal
returns (bool success)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x60, amount) // Store the `amount` argument.
mstore(0x40, to) // Store the `to` argument.
mstore(0x2c, shl(96, from)) // Store the `from` argument.
mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`.
success := call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
if iszero(and(eq(mload(0x00), 1), success)) {
success := lt(or(iszero(extcodesize(token)), returndatasize()), success)
}
mstore(0x60, 0) // Restore the zero slot to zero.
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Sends all of ERC20 `token` from `from` to `to`.
/// Reverts upon failure.
///
/// The `from` account must have their entire balance approved for the current contract to manage.
function safeTransferAllFrom(address token, address from, address to)
internal
returns (uint256 amount)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x40, to) // Store the `to` argument.
mstore(0x2c, shl(96, from)) // Store the `from` argument.
mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`.
// Read the balance, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
gt(returndatasize(), 0x1f), // At least 32 bytes returned.
staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20)
)
) {
mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
revert(0x1c, 0x04)
}
mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`.
amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it.
// Perform the transfer, reverting upon failure.
let success := call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20)
if iszero(and(eq(mload(0x00), 1), success)) {
if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) {
mstore(0x00, 0x7939f424) // `TransferFromFailed()`.
revert(0x1c, 0x04)
}
}
mstore(0x60, 0) // Restore the zero slot to zero.
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Sends `amount` of ERC20 `token` from the current contract to `to`.
/// Reverts upon failure.
function safeTransfer(address token, address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
mstore(0x14, to) // Store the `to` argument.
mstore(0x34, amount) // Store the `amount` argument.
mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`.
// Perform the transfer, reverting upon failure.
let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
if iszero(and(eq(mload(0x00), 1), success)) {
if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) {
mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
revert(0x1c, 0x04)
}
}
mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
}
}
/// @dev Sends all of ERC20 `token` from the current contract to `to`.
/// Reverts upon failure.
function safeTransferAll(address token, address to) internal returns (uint256 amount) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`.
mstore(0x20, address()) // Store the address of the current contract.
// Read the balance, reverting upon failure.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
gt(returndatasize(), 0x1f), // At least 32 bytes returned.
staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20)
)
) {
mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
revert(0x1c, 0x04)
}
mstore(0x14, to) // Store the `to` argument.
amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it.
mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`.
// Perform the transfer, reverting upon failure.
let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
if iszero(and(eq(mload(0x00), 1), success)) {
if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) {
mstore(0x00, 0x90b8ec18) // `TransferFailed()`.
revert(0x1c, 0x04)
}
}
mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
}
}
/// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract.
/// Reverts upon failure.
function safeApprove(address token, address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
mstore(0x14, to) // Store the `to` argument.
mstore(0x34, amount) // Store the `amount` argument.
mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
if iszero(and(eq(mload(0x00), 1), success)) {
if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) {
mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`.
revert(0x1c, 0x04)
}
}
mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
}
}
/// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract.
/// If the initial attempt to approve fails, attempts to reset the approved amount to zero,
/// then retries the approval again (some tokens, e.g. USDT, requires this).
/// Reverts upon failure.
function safeApproveWithRetry(address token, address to, uint256 amount) internal {
/// @solidity memory-safe-assembly
assembly {
mstore(0x14, to) // Store the `to` argument.
mstore(0x34, amount) // Store the `amount` argument.
mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
// Perform the approval, retrying upon failure.
let success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
if iszero(and(eq(mload(0x00), 1), success)) {
if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) {
mstore(0x34, 0) // Store 0 for the `amount`.
mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`.
pop(call(gas(), token, 0, 0x10, 0x44, codesize(), 0x00)) // Reset the approval.
mstore(0x34, amount) // Store back the original `amount`.
// Retry the approval, reverting upon failure.
success := call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20)
if iszero(and(eq(mload(0x00), 1), success)) {
// Check the `extcodesize` again just in case the token selfdestructs lol.
if iszero(lt(or(iszero(extcodesize(token)), returndatasize()), success)) {
mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`.
revert(0x1c, 0x04)
}
}
}
}
mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten.
}
}
/// @dev Returns the amount of ERC20 `token` owned by `account`.
/// Returns zero if the `token` does not exist.
function balanceOf(address token, address account) internal view returns (uint256 amount) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x14, account) // Store the `account` argument.
mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`.
amount :=
mul( // The arguments of `mul` are evaluated from right to left.
mload(0x20),
and( // The arguments of `and` are evaluated from right to left.
gt(returndatasize(), 0x1f), // At least 32 bytes returned.
staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20)
)
)
}
}
/// @dev Performs a `token.balanceOf(account)` check.
/// `implemented` denotes whether the `token` does not implement `balanceOf`.
/// `amount` is zero if the `token` does not implement `balanceOf`.
function checkBalanceOf(address token, address account)
internal
view
returns (bool implemented, uint256 amount)
{
/// @solidity memory-safe-assembly
assembly {
mstore(0x14, account) // Store the `account` argument.
mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`.
implemented :=
and( // The arguments of `and` are evaluated from right to left.
gt(returndatasize(), 0x1f), // At least 32 bytes returned.
staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20)
)
amount := mul(mload(0x20), implemented)
}
}
/// @dev Returns the total supply of the `token`.
/// Reverts if the token does not exist or does not implement `totalSupply()`.
function totalSupply(address token) internal view returns (uint256 result) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, 0x18160ddd) // `totalSupply()`.
if iszero(
and(gt(returndatasize(), 0x1f), staticcall(gas(), token, 0x1c, 0x04, 0x00, 0x20))
) {
mstore(0x00, 0x54cd9435) // `TotalSupplyQueryFailed()`.
revert(0x1c, 0x04)
}
result := mload(0x00)
}
}
/// @dev Sends `amount` of ERC20 `token` from `from` to `to`.
/// If the initial attempt fails, try to use Permit2 to transfer the token.
/// Reverts upon failure.
///
/// The `from` account must have at least `amount` approved for the current contract to manage.
function safeTransferFrom2(address token, address from, address to, uint256 amount) internal {
if (!trySafeTransferFrom(token, from, to, amount)) {
permit2TransferFrom(token, from, to, amount);
}
}
/// @dev Sends `amount` of ERC20 `token` from `from` to `to` via Permit2.
/// Reverts upon failure.
function permit2TransferFrom(address token, address from, address to, uint256 amount)
internal
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(add(m, 0x74), shr(96, shl(96, token)))
mstore(add(m, 0x54), amount)
mstore(add(m, 0x34), to)
mstore(add(m, 0x20), shl(96, from))
// `transferFrom(address,address,uint160,address)`.
mstore(m, 0x36c78516000000000000000000000000)
let p := PERMIT2
let exists := eq(chainid(), 1)
if iszero(exists) { exists := iszero(iszero(extcodesize(p))) }
if iszero(
and(
call(gas(), p, 0, add(m, 0x10), 0x84, codesize(), 0x00),
lt(iszero(extcodesize(token)), exists) // Token has code and Permit2 exists.
)
) {
mstore(0x00, 0x7939f4248757f0fd) // `TransferFromFailed()` or `Permit2AmountOverflow()`.
revert(add(0x18, shl(2, iszero(iszero(shr(160, amount))))), 0x04)
}
}
}
/// @dev Permit a user to spend a given amount of
/// another user's tokens via native EIP-2612 permit if possible, falling
/// back to Permit2 if native permit fails or is not implemented on the token.
function permit2(
address token,
address owner,
address spender,
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
bool success;
/// @solidity memory-safe-assembly
assembly {
for {} shl(96, xor(token, WETH9)) {} {
mstore(0x00, 0x3644e515) // `DOMAIN_SEPARATOR()`.
if iszero(
and( // The arguments of `and` are evaluated from right to left.
lt(iszero(mload(0x00)), eq(returndatasize(), 0x20)), // Returns 1 non-zero word.
// Gas stipend to limit gas burn for tokens that don't refund gas when
// an non-existing function is called. 5K should be enough for a SLOAD.
staticcall(5000, token, 0x1c, 0x04, 0x00, 0x20)
)
) { break }
// After here, we can be sure that token is a contract.
let m := mload(0x40)
mstore(add(m, 0x34), spender)
mstore(add(m, 0x20), shl(96, owner))
mstore(add(m, 0x74), deadline)
if eq(mload(0x00), DAI_DOMAIN_SEPARATOR) {
mstore(0x14, owner)
mstore(0x00, 0x7ecebe00000000000000000000000000) // `nonces(address)`.
mstore(
add(m, 0x94),
lt(iszero(amount), staticcall(gas(), token, 0x10, 0x24, add(m, 0x54), 0x20))
)
mstore(m, 0x8fcbaf0c000000000000000000000000) // `IDAIPermit.permit`.
// `nonces` is already at `add(m, 0x54)`.
// `amount != 0` is already stored at `add(m, 0x94)`.
mstore(add(m, 0xb4), and(0xff, v))
mstore(add(m, 0xd4), r)
mstore(add(m, 0xf4), s)
success := call(gas(), token, 0, add(m, 0x10), 0x104, codesize(), 0x00)
break
}
mstore(m, 0xd505accf000000000000000000000000) // `IERC20Permit.permit`.
mstore(add(m, 0x54), amount)
mstore(add(m, 0x94), and(0xff, v))
mstore(add(m, 0xb4), r)
mstore(add(m, 0xd4), s)
success := call(gas(), token, 0, add(m, 0x10), 0xe4, codesize(), 0x00)
break
}
}
if (!success) simplePermit2(token, owner, spender, amount, deadline, v, r, s);
}
/// @dev Simple permit on the Permit2 contract.
function simplePermit2(
address token,
address owner,
address spender,
uint256 amount,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, 0x927da105) // `allowance(address,address,address)`.
{
let addressMask := shr(96, not(0))
mstore(add(m, 0x20), and(addressMask, owner))
mstore(add(m, 0x40), and(addressMask, token))
mstore(add(m, 0x60), and(addressMask, spender))
mstore(add(m, 0xc0), and(addressMask, spender))
}
let p := mul(PERMIT2, iszero(shr(160, amount)))
if iszero(
and( // The arguments of `and` are evaluated from right to left.
gt(returndatasize(), 0x5f), // Returns 3 words: `amount`, `expiration`, `nonce`.
staticcall(gas(), p, add(m, 0x1c), 0x64, add(m, 0x60), 0x60)
)
) {
mstore(0x00, 0x6b836e6b8757f0fd) // `Permit2Failed()` or `Permit2AmountOverflow()`.
revert(add(0x18, shl(2, iszero(p))), 0x04)
}
mstore(m, 0x2b67b570) // `Permit2.permit` (PermitSingle variant).
// `owner` is already `add(m, 0x20)`.
// `token` is already at `add(m, 0x40)`.
mstore(add(m, 0x60), amount)
mstore(add(m, 0x80), 0xffffffffffff) // `expiration = type(uint48).max`.
// `nonce` is already at `add(m, 0xa0)`.
// `spender` is already at `add(m, 0xc0)`.
mstore(add(m, 0xe0), deadline)
mstore(add(m, 0x100), 0x100) // `signature` offset.
mstore(add(m, 0x120), 0x41) // `signature` length.
mstore(add(m, 0x140), r)
mstore(add(m, 0x160), s)
mstore(add(m, 0x180), shl(248, v))
if iszero( // Revert if token does not have code, or if the call fails.
mul(extcodesize(token), call(gas(), p, 0, add(m, 0x1c), 0x184, codesize(), 0x00))) {
mstore(0x00, 0x6b836e6b) // `Permit2Failed()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Approves `spender` to spend `amount` of `token` for `address(this)`.
function permit2Approve(address token, address spender, uint160 amount, uint48 expiration)
internal
{
/// @solidity memory-safe-assembly
assembly {
let addressMask := shr(96, not(0))
let m := mload(0x40)
mstore(m, 0x87517c45) // `approve(address,address,uint160,uint48)`.
mstore(add(m, 0x20), and(addressMask, token))
mstore(add(m, 0x40), and(addressMask, spender))
mstore(add(m, 0x60), and(addressMask, amount))
mstore(add(m, 0x80), and(0xffffffffffff, expiration))
if iszero(call(gas(), PERMIT2, 0, add(m, 0x1c), 0xa0, codesize(), 0x00)) {
mstore(0x00, 0x324f14ae) // `Permit2ApproveFailed()`.
revert(0x1c, 0x04)
}
}
}
/// @dev Revokes an approval for `token` and `spender` for `address(this)`.
function permit2Lockdown(address token, address spender) internal {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, 0xcc53287f) // `Permit2.lockdown`.
mstore(add(m, 0x20), 0x20) // Offset of the `approvals`.
mstore(add(m, 0x40), 1) // `approvals.length`.
mstore(add(m, 0x60), shr(96, shl(96, token)))
mstore(add(m, 0x80), shr(96, shl(96, spender)))
if iszero(call(gas(), PERMIT2, 0, add(m, 0x1c), 0xa0, codesize(), 0x00)) {
mstore(0x00, 0x96b3de23) // `Permit2LockdownFailed()`.
revert(0x1c, 0x04)
}
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @notice Library for efficiently performing keccak256 hashes.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/EfficientHashLib.sol)
/// @dev To avoid stack-too-deep, you can use:
/// ```
/// bytes32[] memory buffer = EfficientHashLib.malloc(10);
/// EfficientHashLib.set(buffer, 0, value0);
/// ..
/// EfficientHashLib.set(buffer, 9, value9);
/// bytes32 finalHash = EfficientHashLib.hash(buffer);
/// ```
library EfficientHashLib {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* MALLOC-LESS HASHING OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Returns `keccak256(abi.encode(v0))`.
function hash(bytes32 v0) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, v0)
result := keccak256(0x00, 0x20)
}
}
/// @dev Returns `keccak256(abi.encode(v0))`.
function hash(uint256 v0) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, v0)
result := keccak256(0x00, 0x20)
}
}
/// @dev Returns `keccak256(abi.encode(v0, v1))`.
function hash(bytes32 v0, bytes32 v1) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, v0)
mstore(0x20, v1)
result := keccak256(0x00, 0x40)
}
}
/// @dev Returns `keccak256(abi.encode(v0, v1))`.
function hash(uint256 v0, uint256 v1) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, v0)
mstore(0x20, v1)
result := keccak256(0x00, 0x40)
}
}
/// @dev Returns `keccak256(abi.encode(v0, v1, v2))`.
function hash(bytes32 v0, bytes32 v1, bytes32 v2) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
result := keccak256(m, 0x60)
}
}
/// @dev Returns `keccak256(abi.encode(v0, v1, v2))`.
function hash(uint256 v0, uint256 v1, uint256 v2) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
result := keccak256(m, 0x60)
}
}
/// @dev Returns `keccak256(abi.encode(v0, v1, v2, v3))`.
function hash(bytes32 v0, bytes32 v1, bytes32 v2, bytes32 v3)
internal
pure
returns (bytes32 result)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
mstore(add(m, 0x60), v3)
result := keccak256(m, 0x80)
}
}
/// @dev Returns `keccak256(abi.encode(v0, v1, v2, v3))`.
function hash(uint256 v0, uint256 v1, uint256 v2, uint256 v3)
internal
pure
returns (bytes32 result)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
mstore(add(m, 0x60), v3)
result := keccak256(m, 0x80)
}
}
/// @dev Returns `keccak256(abi.encode(v0, .., v4))`.
function hash(bytes32 v0, bytes32 v1, bytes32 v2, bytes32 v3, bytes32 v4)
internal
pure
returns (bytes32 result)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
mstore(add(m, 0x60), v3)
mstore(add(m, 0x80), v4)
result := keccak256(m, 0xa0)
}
}
/// @dev Returns `keccak256(abi.encode(v0, .., v4))`.
function hash(uint256 v0, uint256 v1, uint256 v2, uint256 v3, uint256 v4)
internal
pure
returns (bytes32 result)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
mstore(add(m, 0x60), v3)
mstore(add(m, 0x80), v4)
result := keccak256(m, 0xa0)
}
}
/// @dev Returns `keccak256(abi.encode(v0, .., v5))`.
function hash(bytes32 v0, bytes32 v1, bytes32 v2, bytes32 v3, bytes32 v4, bytes32 v5)
internal
pure
returns (bytes32 result)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
mstore(add(m, 0x60), v3)
mstore(add(m, 0x80), v4)
mstore(add(m, 0xa0), v5)
result := keccak256(m, 0xc0)
}
}
/// @dev Returns `keccak256(abi.encode(v0, .., v5))`.
function hash(uint256 v0, uint256 v1, uint256 v2, uint256 v3, uint256 v4, uint256 v5)
internal
pure
returns (bytes32 result)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
mstore(add(m, 0x60), v3)
mstore(add(m, 0x80), v4)
mstore(add(m, 0xa0), v5)
result := keccak256(m, 0xc0)
}
}
/// @dev Returns `keccak256(abi.encode(v0, .., v6))`.
function hash(
bytes32 v0,
bytes32 v1,
bytes32 v2,
bytes32 v3,
bytes32 v4,
bytes32 v5,
bytes32 v6
) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
mstore(add(m, 0x60), v3)
mstore(add(m, 0x80), v4)
mstore(add(m, 0xa0), v5)
mstore(add(m, 0xc0), v6)
result := keccak256(m, 0xe0)
}
}
/// @dev Returns `keccak256(abi.encode(v0, .., v6))`.
function hash(
uint256 v0,
uint256 v1,
uint256 v2,
uint256 v3,
uint256 v4,
uint256 v5,
uint256 v6
) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
mstore(add(m, 0x60), v3)
mstore(add(m, 0x80), v4)
mstore(add(m, 0xa0), v5)
mstore(add(m, 0xc0), v6)
result := keccak256(m, 0xe0)
}
}
/// @dev Returns `keccak256(abi.encode(v0, .., v7))`.
function hash(
bytes32 v0,
bytes32 v1,
bytes32 v2,
bytes32 v3,
bytes32 v4,
bytes32 v5,
bytes32 v6,
bytes32 v7
) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
mstore(add(m, 0x60), v3)
mstore(add(m, 0x80), v4)
mstore(add(m, 0xa0), v5)
mstore(add(m, 0xc0), v6)
mstore(add(m, 0xe0), v7)
result := keccak256(m, 0x100)
}
}
/// @dev Returns `keccak256(abi.encode(v0, .., v7))`.
function hash(
uint256 v0,
uint256 v1,
uint256 v2,
uint256 v3,
uint256 v4,
uint256 v5,
uint256 v6,
uint256 v7
) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
mstore(add(m, 0x60), v3)
mstore(add(m, 0x80), v4)
mstore(add(m, 0xa0), v5)
mstore(add(m, 0xc0), v6)
mstore(add(m, 0xe0), v7)
result := keccak256(m, 0x100)
}
}
/// @dev Returns `keccak256(abi.encode(v0, .., v8))`.
function hash(
bytes32 v0,
bytes32 v1,
bytes32 v2,
bytes32 v3,
bytes32 v4,
bytes32 v5,
bytes32 v6,
bytes32 v7,
bytes32 v8
) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
mstore(add(m, 0x60), v3)
mstore(add(m, 0x80), v4)
mstore(add(m, 0xa0), v5)
mstore(add(m, 0xc0), v6)
mstore(add(m, 0xe0), v7)
mstore(add(m, 0x100), v8)
result := keccak256(m, 0x120)
}
}
/// @dev Returns `keccak256(abi.encode(v0, .., v8))`.
function hash(
uint256 v0,
uint256 v1,
uint256 v2,
uint256 v3,
uint256 v4,
uint256 v5,
uint256 v6,
uint256 v7,
uint256 v8
) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
mstore(add(m, 0x60), v3)
mstore(add(m, 0x80), v4)
mstore(add(m, 0xa0), v5)
mstore(add(m, 0xc0), v6)
mstore(add(m, 0xe0), v7)
mstore(add(m, 0x100), v8)
result := keccak256(m, 0x120)
}
}
/// @dev Returns `keccak256(abi.encode(v0, .., v9))`.
function hash(
bytes32 v0,
bytes32 v1,
bytes32 v2,
bytes32 v3,
bytes32 v4,
bytes32 v5,
bytes32 v6,
bytes32 v7,
bytes32 v8,
bytes32 v9
) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
mstore(add(m, 0x60), v3)
mstore(add(m, 0x80), v4)
mstore(add(m, 0xa0), v5)
mstore(add(m, 0xc0), v6)
mstore(add(m, 0xe0), v7)
mstore(add(m, 0x100), v8)
mstore(add(m, 0x120), v9)
result := keccak256(m, 0x140)
}
}
/// @dev Returns `keccak256(abi.encode(v0, .., v9))`.
function hash(
uint256 v0,
uint256 v1,
uint256 v2,
uint256 v3,
uint256 v4,
uint256 v5,
uint256 v6,
uint256 v7,
uint256 v8,
uint256 v9
) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
mstore(add(m, 0x60), v3)
mstore(add(m, 0x80), v4)
mstore(add(m, 0xa0), v5)
mstore(add(m, 0xc0), v6)
mstore(add(m, 0xe0), v7)
mstore(add(m, 0x100), v8)
mstore(add(m, 0x120), v9)
result := keccak256(m, 0x140)
}
}
/// @dev Returns `keccak256(abi.encode(v0, .., v10))`.
function hash(
bytes32 v0,
bytes32 v1,
bytes32 v2,
bytes32 v3,
bytes32 v4,
bytes32 v5,
bytes32 v6,
bytes32 v7,
bytes32 v8,
bytes32 v9,
bytes32 v10
) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
mstore(add(m, 0x60), v3)
mstore(add(m, 0x80), v4)
mstore(add(m, 0xa0), v5)
mstore(add(m, 0xc0), v6)
mstore(add(m, 0xe0), v7)
mstore(add(m, 0x100), v8)
mstore(add(m, 0x120), v9)
mstore(add(m, 0x140), v10)
result := keccak256(m, 0x160)
}
}
/// @dev Returns `keccak256(abi.encode(v0, .., v10))`.
function hash(
uint256 v0,
uint256 v1,
uint256 v2,
uint256 v3,
uint256 v4,
uint256 v5,
uint256 v6,
uint256 v7,
uint256 v8,
uint256 v9,
uint256 v10
) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
mstore(add(m, 0x60), v3)
mstore(add(m, 0x80), v4)
mstore(add(m, 0xa0), v5)
mstore(add(m, 0xc0), v6)
mstore(add(m, 0xe0), v7)
mstore(add(m, 0x100), v8)
mstore(add(m, 0x120), v9)
mstore(add(m, 0x140), v10)
result := keccak256(m, 0x160)
}
}
/// @dev Returns `keccak256(abi.encode(v0, .., v11))`.
function hash(
bytes32 v0,
bytes32 v1,
bytes32 v2,
bytes32 v3,
bytes32 v4,
bytes32 v5,
bytes32 v6,
bytes32 v7,
bytes32 v8,
bytes32 v9,
bytes32 v10,
bytes32 v11
) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
mstore(add(m, 0x60), v3)
mstore(add(m, 0x80), v4)
mstore(add(m, 0xa0), v5)
mstore(add(m, 0xc0), v6)
mstore(add(m, 0xe0), v7)
mstore(add(m, 0x100), v8)
mstore(add(m, 0x120), v9)
mstore(add(m, 0x140), v10)
mstore(add(m, 0x160), v11)
result := keccak256(m, 0x180)
}
}
/// @dev Returns `keccak256(abi.encode(v0, .., v11))`.
function hash(
uint256 v0,
uint256 v1,
uint256 v2,
uint256 v3,
uint256 v4,
uint256 v5,
uint256 v6,
uint256 v7,
uint256 v8,
uint256 v9,
uint256 v10,
uint256 v11
) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
mstore(add(m, 0x60), v3)
mstore(add(m, 0x80), v4)
mstore(add(m, 0xa0), v5)
mstore(add(m, 0xc0), v6)
mstore(add(m, 0xe0), v7)
mstore(add(m, 0x100), v8)
mstore(add(m, 0x120), v9)
mstore(add(m, 0x140), v10)
mstore(add(m, 0x160), v11)
result := keccak256(m, 0x180)
}
}
/// @dev Returns `keccak256(abi.encode(v0, .., v12))`.
function hash(
bytes32 v0,
bytes32 v1,
bytes32 v2,
bytes32 v3,
bytes32 v4,
bytes32 v5,
bytes32 v6,
bytes32 v7,
bytes32 v8,
bytes32 v9,
bytes32 v10,
bytes32 v11,
bytes32 v12
) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
mstore(add(m, 0x60), v3)
mstore(add(m, 0x80), v4)
mstore(add(m, 0xa0), v5)
mstore(add(m, 0xc0), v6)
mstore(add(m, 0xe0), v7)
mstore(add(m, 0x100), v8)
mstore(add(m, 0x120), v9)
mstore(add(m, 0x140), v10)
mstore(add(m, 0x160), v11)
mstore(add(m, 0x180), v12)
result := keccak256(m, 0x1a0)
}
}
/// @dev Returns `keccak256(abi.encode(v0, .., v12))`.
function hash(
uint256 v0,
uint256 v1,
uint256 v2,
uint256 v3,
uint256 v4,
uint256 v5,
uint256 v6,
uint256 v7,
uint256 v8,
uint256 v9,
uint256 v10,
uint256 v11,
uint256 v12
) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
mstore(add(m, 0x60), v3)
mstore(add(m, 0x80), v4)
mstore(add(m, 0xa0), v5)
mstore(add(m, 0xc0), v6)
mstore(add(m, 0xe0), v7)
mstore(add(m, 0x100), v8)
mstore(add(m, 0x120), v9)
mstore(add(m, 0x140), v10)
mstore(add(m, 0x160), v11)
mstore(add(m, 0x180), v12)
result := keccak256(m, 0x1a0)
}
}
/// @dev Returns `keccak256(abi.encode(v0, .., v13))`.
function hash(
bytes32 v0,
bytes32 v1,
bytes32 v2,
bytes32 v3,
bytes32 v4,
bytes32 v5,
bytes32 v6,
bytes32 v7,
bytes32 v8,
bytes32 v9,
bytes32 v10,
bytes32 v11,
bytes32 v12,
bytes32 v13
) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
mstore(add(m, 0x60), v3)
mstore(add(m, 0x80), v4)
mstore(add(m, 0xa0), v5)
mstore(add(m, 0xc0), v6)
mstore(add(m, 0xe0), v7)
mstore(add(m, 0x100), v8)
mstore(add(m, 0x120), v9)
mstore(add(m, 0x140), v10)
mstore(add(m, 0x160), v11)
mstore(add(m, 0x180), v12)
mstore(add(m, 0x1a0), v13)
result := keccak256(m, 0x1c0)
}
}
/// @dev Returns `keccak256(abi.encode(v0, .., v13))`.
function hash(
uint256 v0,
uint256 v1,
uint256 v2,
uint256 v3,
uint256 v4,
uint256 v5,
uint256 v6,
uint256 v7,
uint256 v8,
uint256 v9,
uint256 v10,
uint256 v11,
uint256 v12,
uint256 v13
) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40)
mstore(m, v0)
mstore(add(m, 0x20), v1)
mstore(add(m, 0x40), v2)
mstore(add(m, 0x60), v3)
mstore(add(m, 0x80), v4)
mstore(add(m, 0xa0), v5)
mstore(add(m, 0xc0), v6)
mstore(add(m, 0xe0), v7)
mstore(add(m, 0x100), v8)
mstore(add(m, 0x120), v9)
mstore(add(m, 0x140), v10)
mstore(add(m, 0x160), v11)
mstore(add(m, 0x180), v12)
mstore(add(m, 0x1a0), v13)
result := keccak256(m, 0x1c0)
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* BYTES32 BUFFER HASHING OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Returns `keccak256(abi.encode(buffer[0], .., buffer[buffer.length - 1]))`.
function hash(bytes32[] memory buffer) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
result := keccak256(add(buffer, 0x20), shl(5, mload(buffer)))
}
}
/// @dev Sets `buffer[i]` to `value`, without a bounds check.
/// Returns the `buffer` for function chaining.
function set(bytes32[] memory buffer, uint256 i, bytes32 value)
internal
pure
returns (bytes32[] memory)
{
/// @solidity memory-safe-assembly
assembly {
mstore(add(buffer, shl(5, add(1, i))), value)
}
return buffer;
}
/// @dev Sets `buffer[i]` to `value`, without a bounds check.
/// Returns the `buffer` for function chaining.
function set(bytes32[] memory buffer, uint256 i, uint256 value)
internal
pure
returns (bytes32[] memory)
{
/// @solidity memory-safe-assembly
assembly {
mstore(add(buffer, shl(5, add(1, i))), value)
}
return buffer;
}
/// @dev Returns `new bytes32[](n)`, without zeroing out the memory.
function malloc(uint256 n) internal pure returns (bytes32[] memory buffer) {
/// @solidity memory-safe-assembly
assembly {
buffer := mload(0x40)
mstore(buffer, n)
mstore(0x40, add(shl(5, add(1, n)), buffer))
}
}
/// @dev Frees memory that has been allocated for `buffer`.
/// No-op if `buffer.length` is zero, or if new memory has been allocated after `buffer`.
function free(bytes32[] memory buffer) internal pure {
/// @solidity memory-safe-assembly
assembly {
let n := mload(buffer)
mstore(shl(6, lt(iszero(n), eq(add(shl(5, add(1, n)), buffer), mload(0x40)))), buffer)
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* EQUALITY CHECKS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Returns `a == abi.decode(b, (bytes32))`.
function eq(bytes32 a, bytes memory b) internal pure returns (bool result) {
/// @solidity memory-safe-assembly
assembly {
result := and(eq(0x20, mload(b)), eq(a, mload(add(b, 0x20))))
}
}
/// @dev Returns `abi.decode(a, (bytes32)) == a`.
function eq(bytes memory a, bytes32 b) internal pure returns (bool result) {
/// @solidity memory-safe-assembly
assembly {
result := and(eq(0x20, mload(a)), eq(b, mload(add(a, 0x20))))
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* BYTE SLICE HASHING OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Returns the keccak256 of the slice from `start` to `end` (exclusive).
/// `start` and `end` are byte offsets.
function hash(bytes memory b, uint256 start, uint256 end)
internal
pure
returns (bytes32 result)
{
/// @solidity memory-safe-assembly
assembly {
let n := mload(b)
end := xor(end, mul(xor(end, n), lt(n, end)))
start := xor(start, mul(xor(start, n), lt(n, start)))
result := keccak256(add(add(b, 0x20), start), mul(gt(end, start), sub(end, start)))
}
}
/// @dev Returns the keccak256 of the slice from `start` to the end of the bytes.
function hash(bytes memory b, uint256 start) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let n := mload(b)
start := xor(start, mul(xor(start, n), lt(n, start)))
result := keccak256(add(add(b, 0x20), start), mul(gt(n, start), sub(n, start)))
}
}
/// @dev Returns the keccak256 of the bytes.
function hash(bytes memory b) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
result := keccak256(add(b, 0x20), mload(b))
}
}
/// @dev Returns the keccak256 of the slice from `start` to `end` (exclusive).
/// `start` and `end` are byte offsets.
function hashCalldata(bytes calldata b, uint256 start, uint256 end)
internal
pure
returns (bytes32 result)
{
/// @solidity memory-safe-assembly
assembly {
end := xor(end, mul(xor(end, b.length), lt(b.length, end)))
start := xor(start, mul(xor(start, b.length), lt(b.length, start)))
let n := mul(gt(end, start), sub(end, start))
calldatacopy(mload(0x40), add(b.offset, start), n)
result := keccak256(mload(0x40), n)
}
}
/// @dev Returns the keccak256 of the slice from `start` to the end of the bytes.
function hashCalldata(bytes calldata b, uint256 start) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
start := xor(start, mul(xor(start, b.length), lt(b.length, start)))
let n := mul(gt(b.length, start), sub(b.length, start))
calldatacopy(mload(0x40), add(b.offset, start), n)
result := keccak256(mload(0x40), n)
}
}
/// @dev Returns the keccak256 of the bytes.
function hashCalldata(bytes calldata b) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
calldatacopy(mload(0x40), b.offset, b.length)
result := keccak256(mload(0x40), b.length)
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* SHA2-256 HELPERS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Returns `sha256(abi.encode(b))`. Yes, it's more efficient.
function sha2(bytes32 b) internal view returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x00, b)
result := mload(staticcall(gas(), 2, 0x00, 0x20, 0x01, 0x20))
if iszero(returndatasize()) { invalid() }
}
}
/// @dev Returns the sha256 of the slice from `start` to `end` (exclusive).
/// `start` and `end` are byte offsets.
function sha2(bytes memory b, uint256 start, uint256 end)
internal
view
returns (bytes32 result)
{
/// @solidity memory-safe-assembly
assembly {
let n := mload(b)
end := xor(end, mul(xor(end, n), lt(n, end)))
start := xor(start, mul(xor(start, n), lt(n, start)))
// forgefmt: disable-next-item
result := mload(staticcall(gas(), 2, add(add(b, 0x20), start),
mul(gt(end, start), sub(end, start)), 0x01, 0x20))
if iszero(returndatasize()) { invalid() }
}
}
/// @dev Returns the sha256 of the slice from `start` to the end of the bytes.
function sha2(bytes memory b, uint256 start) internal view returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let n := mload(b)
start := xor(start, mul(xor(start, n), lt(n, start)))
// forgefmt: disable-next-item
result := mload(staticcall(gas(), 2, add(add(b, 0x20), start),
mul(gt(n, start), sub(n, start)), 0x01, 0x20))
if iszero(returndatasize()) { invalid() }
}
}
/// @dev Returns the sha256 of the bytes.
function sha2(bytes memory b) internal view returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
result := mload(staticcall(gas(), 2, add(b, 0x20), mload(b), 0x01, 0x20))
if iszero(returndatasize()) { invalid() }
}
}
/// @dev Returns the sha256 of the slice from `start` to `end` (exclusive).
/// `start` and `end` are byte offsets.
function sha2Calldata(bytes calldata b, uint256 start, uint256 end)
internal
view
returns (bytes32 result)
{
/// @solidity memory-safe-assembly
assembly {
end := xor(end, mul(xor(end, b.length), lt(b.length, end)))
start := xor(start, mul(xor(start, b.length), lt(b.length, start)))
let n := mul(gt(end, start), sub(end, start))
calldatacopy(mload(0x40), add(b.offset, start), n)
result := mload(staticcall(gas(), 2, mload(0x40), n, 0x01, 0x20))
if iszero(returndatasize()) { invalid() }
}
}
/// @dev Returns the sha256 of the slice from `start` to the end of the bytes.
function sha2Calldata(bytes calldata b, uint256 start) internal view returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
start := xor(start, mul(xor(start, b.length), lt(b.length, start)))
let n := mul(gt(b.length, start), sub(b.length, start))
calldatacopy(mload(0x40), add(b.offset, start), n)
result := mload(staticcall(gas(), 2, mload(0x40), n, 0x01, 0x20))
if iszero(returndatasize()) { invalid() }
}
}
/// @dev Returns the sha256 of the bytes.
function sha2Calldata(bytes calldata b) internal view returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
calldatacopy(mload(0x40), b.offset, b.length)
result := mload(staticcall(gas(), 2, mload(0x40), b.length, 0x01, 0x20))
if iszero(returndatasize()) { invalid() }
}
}
}{
"remappings": [
"forge-std/=lib/forge-std/src/",
"solady/=lib/solady/src/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"abi"
]
}
},
"evmVersion": "prague",
"viaIR": true
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract IAddressBook","name":"_addressBook","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyInitialized","type":"error"},{"inputs":[],"name":"AlreadyParticipated","type":"error"},{"inputs":[],"name":"CampaignActive","type":"error"},{"inputs":[],"name":"CampaignEnded","type":"error"},{"inputs":[],"name":"CampaignNotFound","type":"error"},{"inputs":[],"name":"CannotSponsorSelf","type":"error"},{"inputs":[],"name":"CannotSponsorSponsor","type":"error"},{"inputs":[],"name":"HasNotSponsoredYet","type":"error"},{"inputs":[],"name":"InsufficientFunds","type":"error"},{"inputs":[],"name":"InvalidConfiguration","type":"error"},{"inputs":[],"name":"NewOwnerIsZeroAddress","type":"error"},{"inputs":[],"name":"NoHandoverRequest","type":"error"},{"inputs":[],"name":"NotSponsored","type":"error"},{"inputs":[],"name":"NotVerified","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"campaignId","type":"uint256"}],"name":"CampaignCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"campaignId","type":"uint256"}],"name":"CampaignEndedEarly","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"campaignId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"CampaignFunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"campaignId","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"campaignId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ExcessFundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pendingOwner","type":"address"}],"name":"OwnershipHandoverRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"campaignId","type":"uint256"},{"indexed":true,"internalType":"address","name":"sponsor","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"Sponsored","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"addressBook","type":"address"}],"name":"WorldCampaignManagerInitialized","type":"event"},{"inputs":[],"name":"addressBook","outputs":[{"internalType":"contract IAddressBook","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"campaignId","type":"uint256"},{"internalType":"address","name":"sponsor","type":"address"},{"internalType":"address","name":"recipient","type":"address"}],"name":"canSponsor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancelOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"campaignId","type":"uint256"}],"name":"claim","outputs":[{"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"completeOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"initialDeposit","type":"uint256"},{"internalType":"uint256","name":"endTimestamp","type":"uint256"},{"internalType":"uint256","name":"lowerBound","type":"uint256"},{"internalType":"uint256","name":"upperBound","type":"uint256"},{"internalType":"uint256","name":"bonusRewardThreshold","type":"uint256"},{"internalType":"uint256","name":"bonusRewardAmount","type":"uint256"}],"name":"createCampaign","outputs":[{"internalType":"uint256","name":"campaignId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"campaignId","type":"uint256"}],"name":"endCampaignEarly","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"campaignId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"fundCampaign","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"getCampaign","outputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"funds","type":"uint256"},{"internalType":"uint256","name":"endsAt","type":"uint256"},{"internalType":"bool","name":"wasEndedEarly","type":"bool"},{"internalType":"uint256","name":"lowerBound","type":"uint256"},{"internalType":"uint256","name":"upperBound","type":"uint256"},{"internalType":"uint256","name":"bonusRewardThreshold","type":"uint256"},{"internalType":"uint256","name":"bonusRewardAmount","type":"uint256"},{"internalType":"uint256","name":"randomnessSeed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"getClaimStatus","outputs":[{"internalType":"enum WorldCampaignManager.ClaimStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"getSponsor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"getSponsoredRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pendingOwner","type":"address"}],"name":"ownershipHandoverExpiresAt","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"requestOwnershipHandover","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"campaignId","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"}],"name":"sponsor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"campaignId","type":"uint256"}],"name":"withdrawUnclaimedFunds","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60a0346100fb57601f6112a038819003918201601f19168301916001600160401b038311848410176100ff578084926020946040528339810103126100fb57516001600160a01b0381168082036100fb5760015f55156100ec5760805233638b78c6d81955335f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a37f9f249455d39c52e25d8a787a5db3918abba88b5e61e25460024f49d45e6bd38c602060018060a01b0360805116604051908152a160405161118c90816101148239608051818181610135015281816105a301528181610ef60152610fc10152f35b63c52a9bd360e01b5f5260045ffd5b5f80fd5b634e487b7160e01b5f52604160045260245ffdfe60806040526004361015610011575f80fd5b5f3560e01c806313b967c114610ba957806315a7817e14610b635780632569296214610b1a5780632e35d64c14610a8a578063379607f51461088f57806354d1f13d1461084b5780635598f8cc146107bc57806363ceb60d146104a5578063715018a61461045c5780638da5cb5b14610430578063918eab151461038a578063a2858a3b14610340578063a8bf0ba21461029c578063baef810314610238578063ca212f85146101ee578063f04e283e146101a1578063f2fde38b14610164578063f5887cdd146101205763fee81cf4146100ea575f80fd5b3461011c57602036600319011261011c57610103610d30565b63389a75e1600c525f52602080600c2054604051908152f35b5f80fd5b3461011c575f36600319011261011c576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b602036600319011261011c57610178610d30565b61018061104e565b8060601b156101945761019290611119565b005b637448fbae5f526004601cfd5b602036600319011261011c576101b5610d30565b6101bd61104e565b63389a75e1600c52805f526020600c2090815442116101e1575f6101929255611119565b636f5e88185f526004601cfd5b3461011c57604036600319011261011c57610207610d1a565b6004355f9081526002602090815260408083206001600160a01b039485168452825291829020549151919092168152f35b3461011c57604036600319011261011c57610251610d1a565b6004355f52600460205260405f209060018060a01b03165f5260205260ff60405f2054166040516003821015610288576020918152f35b634e487b7160e01b5f52602160045260245ffd5b3461011c57602036600319011261011c576004356102b861104e565b5f81815260016020526040902080549091906001600160a01b0316801561033157600283015442106103225760016101929301915f835493557f137b19547b9a385ba9f3de81fa753b7a46b8f1d3892184c636148501777ab2846020604051858152a233906110c8565b63b4469b3560e01b5f5260045ffd5b6337f9b70b60e11b5f5260045ffd5b3461011c57604036600319011261011c57610359610d1a565b6004355f9081526003602090815260408083206001600160a01b039485168452825291829020549151919092168152f35b3461011c57604036600319011261011c57600435602435815f52600160205260405f209181156104215782546001600160a01b031690811561033157600284015442101561041257600161019294018381540190557f318daf69d77e946364e804495b2184222324b99fddeb42ab5fd25a919f596e8c6020604051858152a23090339061106a565b63154eb81560e21b5f5260045ffd5b63c52a9bd360e01b5f5260045ffd5b3461011c575f36600319011261011c57638b78c6d819546040516001600160a01b039091168152602090f35b5f36600319011261011c5761046f61104e565b5f638b78c6d819547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a35f638b78c6d81955005b3461011c57604036600319011261011c576004356104c1610d1a565b90805f52600160205260405f2091604051926104dc84610d46565b80546001600160a01b03908116855260018201546020860152600282015460408601908152600383015460ff1615156060870190815260048401546080880152600584015460a0880152600684015460c0880152600784015460e08801526008909301546101008701529216933385146107ad57841561042157516001600160a01b031615610331575f8381526003602090815260408083203384529091529020546001600160a01b0316841461079e57604051632bc91fed60e01b8152600481018590527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169290602081602481875afa908115610757575f9161076c575b504211610716575142109081610762575b501561041257602060249160405192838092632bc91fed60e01b82523360048301525afa908115610757575f91610725575b504211610716575f8181526002602090815260408083203384529091529020546001600160a01b031661070757805f52600460205260405f20825f5260205260ff60405f205416600381101561028857610707575f81815260036020908152604080832085845282528083208054336001600160a01b03199182168117909255858552600284528285208286528452828520805490911687179055848452600483528184208685529092528220805460ff1916600117905591907fd99b50ad392d6a92233846ff4b7bf9b691f5dc0924d39c4dc5b9ba329a819c639080a4005b6322ce1a0760e01b5f5260045ffd5b63a95362b560e01b5f5260045ffd5b90506020813d60201161074f575b8161074060209383610d77565b8101031261011c575183610627565b3d9150610733565b6040513d5f823e3d90fd5b90505115846105f5565b90506020813d602011610796575b8161078760209383610d77565b8101031261011c5751866105e4565b3d915061077a565b631e06a41d60e11b5f5260045ffd5b63da20737d60e01b5f5260045ffd5b3461011c57602036600319011261011c576004355f52600160205261012060405f2060018060a01b0381541690600181015490600281015460ff600383015416600483015460058401549160068501549360086007870154960154966040519889526020890152604088015215156060870152608086015260a085015260c084015260e0830152610100820152f35b5f36600319011261011c5763389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2005b3461011c57602036600319011261011c576004355f818152600160209081526040808320600383529083203390935291905280546001600160a01b031615610331576002810154421015610412575f82815260046020908152604080832033845290915290205460ff16600381101561028857600103610a7b575f8281526002602090815260408083203384529091529020546001600160a01b031615610a6c575f828152600460208181526040808420338552909152909120805460ff1916600217905581015460058201548082036109ef5750905b60068101548210156109e3575b60018101908154908382106109d4576020946109cc93858094039055604051908382527f4ec90e965519d92681267467f775ada5bd214aa92c0dc93d90a5e880ce9ed026873393a35433906001600160a01b03166110c8565b604051908152f35b63356680b760e01b5f5260045ffd5b60078101549150610973565b818103908111610a44576008830154604051602081019182523360601b604082015260348152610a20605482610d77565b51902060018201809211610a44578115610a5857068101809111610a445790610966565b634e487b7160e01b5f52601160045260245ffd5b634e487b7160e01b5f52601260045260245ffd5b635c166c0d60e11b5f5260045ffd5b63a3624f6560e01b5f5260045ffd5b3461011c57602036600319011261011c57600435610aa661104e565b5f81815260016020526040902080546001600160a01b03161561033157600381019081549060ff8216159081610b0c575b50156104125760ff191660011790557f7abb60d1a803cce8bf3f3920ab3ff76223137e20d7423eadce63f1c39dbdf5e15f80a2005b600291500154421084610ad7565b5f36600319011261011c5763389a75e1600c52335f526202a30042016020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a2005b3461011c57606036600319011261011c57610b7c610d1a565b604435906001600160a01b038216820361011c57602091610b9f91600435610d99565b6040519015158152f35b3461011c5760e036600319011261011c576004356001600160a01b0381169081900361011c57604435906084359060c435906024359060643560a435610bed61104e565b8315610421578582116104215782156104215742871115610421578585106104215781811061042157858111610421576020966109cc956008925f549860018a015f5560405195610c3d87610d46565b8787528b8701948986526040880190815260608801905f82526080890192835260a0890193845260c0890194855260e089019586526101008901964488528d5f5260018f5260405f209960018060a01b039060018060a01b03905116166bffffffffffffffffffffffff60a01b8b5416178a555160018a0155516002890155600388019051151560ff8019835416911617905551600487015551600586015551600685015551600784015551910155837fbc0a5edd152fa5b886dcae82c5c109d113708653b4b9c0224549ccdf715af94e5f80a23090339061106a565b602435906001600160a01b038216820361011c57565b600435906001600160a01b038216820361011c57565b610120810190811067ffffffffffffffff821117610d6357604052565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff821117610d6357604052565b91825f52600160205260405f2092604051610db381610d46565b84546001600160a01b0390811680835260018701546020840152600287015460408401908152600388015460ff1615156060850181905260048901546080860152600589015460a0860152600689015460c0860152600789015460e0860152600890980154610100909401939093529381169416848114959093908615611046575b50851561103d575b8515611034575b508415610fa2575b8415610f96575b508315610f69575b8315610ed7575b8315610eac575b8315610e80575b505050610e7c57600190565b5f90565b909192505f52600360205260405f20905f5260205260405f2060018060a01b03905416145f8080610e70565b5f8181526002602090815260408083208584529091529020546001600160a01b031615159350610e69565b604051632bc91fed60e01b8152600481018390529093506020816024817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa908115610757575f91610f37575b50421192610e62565b90506020813d602011610f61575b81610f5260209383610d77565b8101031261011c57515f610f2e565b3d9150610f45565b8093505f52600460205260405f20825f5260205260ff60405f205416600381101561028857151592610e5b565b5142101593505f610e53565b604051632bc91fed60e01b8152600481018590529094506020816024817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa908115610757575f91611002575b50421193610e4c565b90506020813d60201161102c575b8161101d60209383610d77565b8101031261011c57515f610ff9565b3d9150611010565b1594505f610e44565b84159550610e3d565b95505f610e35565b638b78c6d81954330361105d57565b6382b429005f526004601cfd5b916040519360605260405260601b602c526323b872dd60601b600c5260205f6064601c82855af1908160015f511416156110aa575b50505f606052604052565b3b153d1710156110bb575f8061109f565b637939f4245f526004601cfd5b919060145260345263a9059cbb60601b5f5260205f6044601082855af1908160015f511416156110fb575b50505f603452565b3b153d17101561110c575f806110f3565b6390b8ec185f526004601cfd5b60018060a01b031680638b78c6d819547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3638b78c6d8195556fea2646970667358221220478dfc78f54dbe084eabd647baae88e865f1dcf9fef4a7d61e30092dc2532fec64736f6c634300081d003300000000000000000000000057b930d551e677cc36e2fa036ae2fe8fdae0330d
Deployed Bytecode
0x60806040526004361015610011575f80fd5b5f3560e01c806313b967c114610ba957806315a7817e14610b635780632569296214610b1a5780632e35d64c14610a8a578063379607f51461088f57806354d1f13d1461084b5780635598f8cc146107bc57806363ceb60d146104a5578063715018a61461045c5780638da5cb5b14610430578063918eab151461038a578063a2858a3b14610340578063a8bf0ba21461029c578063baef810314610238578063ca212f85146101ee578063f04e283e146101a1578063f2fde38b14610164578063f5887cdd146101205763fee81cf4146100ea575f80fd5b3461011c57602036600319011261011c57610103610d30565b63389a75e1600c525f52602080600c2054604051908152f35b5f80fd5b3461011c575f36600319011261011c576040517f00000000000000000000000057b930d551e677cc36e2fa036ae2fe8fdae0330d6001600160a01b03168152602090f35b602036600319011261011c57610178610d30565b61018061104e565b8060601b156101945761019290611119565b005b637448fbae5f526004601cfd5b602036600319011261011c576101b5610d30565b6101bd61104e565b63389a75e1600c52805f526020600c2090815442116101e1575f6101929255611119565b636f5e88185f526004601cfd5b3461011c57604036600319011261011c57610207610d1a565b6004355f9081526002602090815260408083206001600160a01b039485168452825291829020549151919092168152f35b3461011c57604036600319011261011c57610251610d1a565b6004355f52600460205260405f209060018060a01b03165f5260205260ff60405f2054166040516003821015610288576020918152f35b634e487b7160e01b5f52602160045260245ffd5b3461011c57602036600319011261011c576004356102b861104e565b5f81815260016020526040902080549091906001600160a01b0316801561033157600283015442106103225760016101929301915f835493557f137b19547b9a385ba9f3de81fa753b7a46b8f1d3892184c636148501777ab2846020604051858152a233906110c8565b63b4469b3560e01b5f5260045ffd5b6337f9b70b60e11b5f5260045ffd5b3461011c57604036600319011261011c57610359610d1a565b6004355f9081526003602090815260408083206001600160a01b039485168452825291829020549151919092168152f35b3461011c57604036600319011261011c57600435602435815f52600160205260405f209181156104215782546001600160a01b031690811561033157600284015442101561041257600161019294018381540190557f318daf69d77e946364e804495b2184222324b99fddeb42ab5fd25a919f596e8c6020604051858152a23090339061106a565b63154eb81560e21b5f5260045ffd5b63c52a9bd360e01b5f5260045ffd5b3461011c575f36600319011261011c57638b78c6d819546040516001600160a01b039091168152602090f35b5f36600319011261011c5761046f61104e565b5f638b78c6d819547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a35f638b78c6d81955005b3461011c57604036600319011261011c576004356104c1610d1a565b90805f52600160205260405f2091604051926104dc84610d46565b80546001600160a01b03908116855260018201546020860152600282015460408601908152600383015460ff1615156060870190815260048401546080880152600584015460a0880152600684015460c0880152600784015460e08801526008909301546101008701529216933385146107ad57841561042157516001600160a01b031615610331575f8381526003602090815260408083203384529091529020546001600160a01b0316841461079e57604051632bc91fed60e01b8152600481018590527f00000000000000000000000057b930d551e677cc36e2fa036ae2fe8fdae0330d6001600160a01b03169290602081602481875afa908115610757575f9161076c575b504211610716575142109081610762575b501561041257602060249160405192838092632bc91fed60e01b82523360048301525afa908115610757575f91610725575b504211610716575f8181526002602090815260408083203384529091529020546001600160a01b031661070757805f52600460205260405f20825f5260205260ff60405f205416600381101561028857610707575f81815260036020908152604080832085845282528083208054336001600160a01b03199182168117909255858552600284528285208286528452828520805490911687179055848452600483528184208685529092528220805460ff1916600117905591907fd99b50ad392d6a92233846ff4b7bf9b691f5dc0924d39c4dc5b9ba329a819c639080a4005b6322ce1a0760e01b5f5260045ffd5b63a95362b560e01b5f5260045ffd5b90506020813d60201161074f575b8161074060209383610d77565b8101031261011c575183610627565b3d9150610733565b6040513d5f823e3d90fd5b90505115846105f5565b90506020813d602011610796575b8161078760209383610d77565b8101031261011c5751866105e4565b3d915061077a565b631e06a41d60e11b5f5260045ffd5b63da20737d60e01b5f5260045ffd5b3461011c57602036600319011261011c576004355f52600160205261012060405f2060018060a01b0381541690600181015490600281015460ff600383015416600483015460058401549160068501549360086007870154960154966040519889526020890152604088015215156060870152608086015260a085015260c084015260e0830152610100820152f35b5f36600319011261011c5763389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2005b3461011c57602036600319011261011c576004355f818152600160209081526040808320600383529083203390935291905280546001600160a01b031615610331576002810154421015610412575f82815260046020908152604080832033845290915290205460ff16600381101561028857600103610a7b575f8281526002602090815260408083203384529091529020546001600160a01b031615610a6c575f828152600460208181526040808420338552909152909120805460ff1916600217905581015460058201548082036109ef5750905b60068101548210156109e3575b60018101908154908382106109d4576020946109cc93858094039055604051908382527f4ec90e965519d92681267467f775ada5bd214aa92c0dc93d90a5e880ce9ed026873393a35433906001600160a01b03166110c8565b604051908152f35b63356680b760e01b5f5260045ffd5b60078101549150610973565b818103908111610a44576008830154604051602081019182523360601b604082015260348152610a20605482610d77565b51902060018201809211610a44578115610a5857068101809111610a445790610966565b634e487b7160e01b5f52601160045260245ffd5b634e487b7160e01b5f52601260045260245ffd5b635c166c0d60e11b5f5260045ffd5b63a3624f6560e01b5f5260045ffd5b3461011c57602036600319011261011c57600435610aa661104e565b5f81815260016020526040902080546001600160a01b03161561033157600381019081549060ff8216159081610b0c575b50156104125760ff191660011790557f7abb60d1a803cce8bf3f3920ab3ff76223137e20d7423eadce63f1c39dbdf5e15f80a2005b600291500154421084610ad7565b5f36600319011261011c5763389a75e1600c52335f526202a30042016020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a2005b3461011c57606036600319011261011c57610b7c610d1a565b604435906001600160a01b038216820361011c57602091610b9f91600435610d99565b6040519015158152f35b3461011c5760e036600319011261011c576004356001600160a01b0381169081900361011c57604435906084359060c435906024359060643560a435610bed61104e565b8315610421578582116104215782156104215742871115610421578585106104215781811061042157858111610421576020966109cc956008925f549860018a015f5560405195610c3d87610d46565b8787528b8701948986526040880190815260608801905f82526080890192835260a0890193845260c0890194855260e089019586526101008901964488528d5f5260018f5260405f209960018060a01b039060018060a01b03905116166bffffffffffffffffffffffff60a01b8b5416178a555160018a0155516002890155600388019051151560ff8019835416911617905551600487015551600586015551600685015551600784015551910155837fbc0a5edd152fa5b886dcae82c5c109d113708653b4b9c0224549ccdf715af94e5f80a23090339061106a565b602435906001600160a01b038216820361011c57565b600435906001600160a01b038216820361011c57565b610120810190811067ffffffffffffffff821117610d6357604052565b634e487b7160e01b5f52604160045260245ffd5b90601f8019910116810190811067ffffffffffffffff821117610d6357604052565b91825f52600160205260405f2092604051610db381610d46565b84546001600160a01b0390811680835260018701546020840152600287015460408401908152600388015460ff1615156060850181905260048901546080860152600589015460a0860152600689015460c0860152600789015460e0860152600890980154610100909401939093529381169416848114959093908615611046575b50851561103d575b8515611034575b508415610fa2575b8415610f96575b508315610f69575b8315610ed7575b8315610eac575b8315610e80575b505050610e7c57600190565b5f90565b909192505f52600360205260405f20905f5260205260405f2060018060a01b03905416145f8080610e70565b5f8181526002602090815260408083208584529091529020546001600160a01b031615159350610e69565b604051632bc91fed60e01b8152600481018390529093506020816024817f00000000000000000000000057b930d551e677cc36e2fa036ae2fe8fdae0330d6001600160a01b03165afa908115610757575f91610f37575b50421192610e62565b90506020813d602011610f61575b81610f5260209383610d77565b8101031261011c57515f610f2e565b3d9150610f45565b8093505f52600460205260405f20825f5260205260ff60405f205416600381101561028857151592610e5b565b5142101593505f610e53565b604051632bc91fed60e01b8152600481018590529094506020816024817f00000000000000000000000057b930d551e677cc36e2fa036ae2fe8fdae0330d6001600160a01b03165afa908115610757575f91611002575b50421193610e4c565b90506020813d60201161102c575b8161101d60209383610d77565b8101031261011c57515f610ff9565b3d9150611010565b1594505f610e44565b84159550610e3d565b95505f610e35565b638b78c6d81954330361105d57565b6382b429005f526004601cfd5b916040519360605260405260601b602c526323b872dd60601b600c5260205f6064601c82855af1908160015f511416156110aa575b50505f606052604052565b3b153d1710156110bb575f8061109f565b637939f4245f526004601cfd5b919060145260345263a9059cbb60601b5f5260205f6044601082855af1908160015f511416156110fb575b50505f603452565b3b153d17101561110c575f806110f3565b6390b8ec185f526004601cfd5b60018060a01b031680638b78c6d819547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3638b78c6d8195556fea2646970667358221220478dfc78f54dbe084eabd647baae88e865f1dcf9fef4a7d61e30092dc2532fec64736f6c634300081d0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000057b930d551e677cc36e2fa036ae2fe8fdae0330d
-----Decoded View---------------
Arg [0] : _addressBook (address): 0x57b930D551e677CC36e2fA036Ae2fe8FdaE0330D
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000057b930d551e677cc36e2fa036ae2fe8fdae0330d
Deployed Bytecode Sourcemap
463:16479:3:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;463:16479:3;;;;;;:::i;:::-;11885:237:0;;;463:16479:3;11885:237:0;463:16479:3;11885:237:0;;;;463:16479:3;;;;;;;;;;;;;;;;-1:-1:-1;;463:16479:3;;;;;;5325:41;-1:-1:-1;;;;;463:16479:3;;;;;;;;;-1:-1:-1;;463:16479:3;;;;;;:::i;:::-;12478:70:0;;:::i;:::-;8479:183;;;;;;8681:8;;;:::i;:::-;463:16479:3;8479:183:0;;463:16479:3;8479:183:0;463:16479:3;8479:183:0;;463:16479:3;;;-1:-1:-1;;463:16479:3;;;;;;:::i;:::-;12478:70:0;;:::i;:::-;10506:526;;;;463:16479:3;10506:526:0;463:16479:3;10506:526:0;;;;;;;;;463:16479:3;11051:12:0;10506:526;;11051:12;:::i;10506:526::-;;463:16479:3;10506:526:0;463:16479:3;10506:526:0;;463:16479:3;;;;;;-1:-1:-1;;463:16479:3;;;;;;:::i;:::-;;;;;;;5661:76;463:16479;;;;;;;;-1:-1:-1;;;;;463:16479:3;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;463:16479:3;;;;;;:::i;:::-;;;;;;;;;;;5986:73;463:16479;;;;;;-1:-1:-1;463:16479:3;;;;;-1:-1:-1;463:16479:3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;463:16479:3;;;;;;12478:70:0;;:::i;:::-;463:16479:3;;;;;;;;;;;;;;;-1:-1:-1;;;;;463:16479:3;15818:28;;463:16479;;15904:15;;;463:16479;15885:15;:34;463:16479;;;16148:14;15974;;463:16479;;;;;;16032:48;463:16479;;;;;;16032:48;16136:10;16148:14;;:::i;463:16479::-;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;463:16479:3;;;;;;:::i;:::-;;;;;;;5832:65;463:16479;;;;;;;;-1:-1:-1;;;;;463:16479:3;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;463:16479:3;;;;;;;;;;;;;;;;;14983:10;;;463:16479;;;;-1:-1:-1;;;;;463:16479:3;;15036:28;;463:16479;;15121:15;;;463:16479;15103:15;:33;463:16479;;;;15358:6;15189:14;;463:16479;;;;;;15238:34;463:16479;;;;;;15238:34;15351:4;15331:10;;15358:6;;:::i;463:16479::-;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;463:16479:3;;;;-1:-1:-1;;11523:61:0;463:16479:3;;-1:-1:-1;;;;;463:16479:3;;;;;;;;;;;-1:-1:-1;;463:16479:3;;;;12478:70:0;;:::i;:::-;463:16479:3;6813:405:0;;;;;;;463:16479:3;-1:-1:-1;;6813:405:0;463:16479:3;;;;;;;-1:-1:-1;;463:16479:3;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;:::i;:::-;;;-1:-1:-1;;;;;463:16479:3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7944:10;7931:23;;463:16479;;7994:23;;463:16479;;;-1:-1:-1;;;;;463:16479:3;8060:28;463:16479;;;;;;;;;;;;;;;7944:10;463:16479;;;;;;;;-1:-1:-1;;;;;463:16479:3;8127:47;;463:16479;;;;-1:-1:-1;;;8217:43:3;;463:16479;8217:43;;463:16479;;;8217:11;-1:-1:-1;;;;;463:16479:3;;;;;;;;8217:43;;;;;;;463:16479;8217:43;;;463:16479;8264:15;;-1:-1:-1;463:16479:3;;;8264:15;8313:33;:60;;;;463:16479;;;;;;;;;;;;;;;;;8409:44;;7944:10;463:16479;8409:44;;463:16479;8409:44;;;;;;;463:16479;8409:44;;;463:16479;8264:15;;-1:-1:-1;463:16479:3;;;;;;;;;;;;;;;7944:10;463:16479;;;;;;;;-1:-1:-1;;;;;463:16479:3;;;;;;;;;;;;;-1:-1:-1;463:16479:3;;;;;-1:-1:-1;463:16479:3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7944:10;-1:-1:-1;;;;;;463:16479:3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;463:16479:3;-1:-1:-1;463:16479:3;;;7944:10;463:16479;8906:44;;463:16479;8906:44;463:16479;;;;;;;;;;;;;;;;;;;8409:44;;;463:16479;8409:44;;463:16479;8409:44;;;;;;463:16479;8409:44;;;:::i;:::-;;;463:16479;;;;;8409:44;;;;;;-1:-1:-1;8409:44:3;;;463:16479;;;;;;;;;8313:60;463:16479;;;;8313:60;;;8217:43;;;463:16479;8217:43;;463:16479;8217:43;;;;;;463:16479;8217:43;;;:::i;:::-;;;463:16479;;;;;8217:43;;;;;;-1:-1:-1;8217:43:3;;463:16479;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;463:16479:3;;;;;;;;;;;;;;;;;;;;;;;5527:47;463:16479;5527:47;;463:16479;5527:47;;;;463:16479;;5527:47;;;463:16479;;;5527:47;;463:16479;5527:47;;;463:16479;5527:47;;;;463:16479;5527:47;;;;;463:16479;5527:47;;463:16479;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;463:16479:3;;;;9831:339:0;;;;463:16479:3;9831:339:0;463:16479:3;9831:339:0;;;;;;463:16479:3;9831:339:0;;463:16479:3;;;;;;;-1:-1:-1;;463:16479:3;;;;;;;;;;;;;;;;;;;9673:10;463:16479;;;;;9696:10;463:16479;;;;;;;;-1:-1:-1;;;;;463:16479:3;9726:28;463:16479;;9811:15;;;463:16479;9793:15;:33;463:16479;;;;;;;;;;;;;;;;9696:10;463:16479;;;;;;;;;;9673:10;463:16479;;;;;;9862:62;463:16479;;;;;;9811:15;463:16479;;;;;;;;9696:10;463:16479;;;;;;;;-1:-1:-1;;;;;463:16479:3;9959:59;463:16479;;;;;;;;;;;;;;;9696:10;463:16479;;;;;;;;;;-1:-1:-1;;463:16479:3;9811:15;463:16479;;;10134:19;;463:16479;10157:19;;;463:16479;10134:42;;;;;10192:34;10130:392;;10552:29;;;463:16479;10536:45;;;10532:117;;10130:392;463:16479;10667:14;;463:16479;;;10667:30;;;;463:16479;;;;10922:12;463:16479;;;;;;;;;;;;;10809:45;9696:10;;10809:45;;463:16479;9696:10;;-1:-1:-1;;;;;463:16479:3;10922:12;:::i;:::-;463:16479;;;;;;;;;;;;;;;10532:117;10612:26;;;463:16479;;-1:-1:-1;10532:117:3;;10130:392;463:16479;;;;;;;;10396:23;;;463:16479;;;;10379:53;;463:16479;;;9696:10;463:16479;;;;;;10379:53;;;;;;;:::i;:::-;24492:76:1;;;463:16479:3;;;;;;;;;;;;;;;;;;;;10130:392;;;463:16479;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;463:16479:3;;;;;;12478:70:0;;:::i;:::-;463:16479:3;;;;;;;;;;;;-1:-1:-1;;;;;463:16479:3;16702:28;463:16479;;16770:22;;;463:16479;;;;;;;16769:23;:60;;;;463:16479;;;;;-1:-1:-1;;463:16479:3;;;;;16903:30;463:16479;;16903:30;463:16479;16769:60;16814:15;;;;463:16479;16796:15;:33;16769:60;;;463:16479;;;-1:-1:-1;;463:16479:3;;;;9239:383:0;;;;463:16479:3;9239:383:0;7972:9;9132:15;463:16479:3;9239:383:0;;;;;;463:16479:3;9239:383:0;;463:16479:3;;;;;;;-1:-1:-1;;463:16479:3;;;;;;:::i;:::-;;;;-1:-1:-1;;;;;463:16479:3;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;-1:-1:-1;;463:16479:3;;;;;;-1:-1:-1;;;;;463:16479:3;;;;;;;;;;;;;;;;;;;;;;;;12478:70:0;;:::i;:::-;13235:18:3;;463:16479;;13296:24;;;463:16479;;13363:28;;463:16479;;13449:15;13434:30;;463:16479;;;13507:31;;;463:16479;;13581:34;;;463:16479;;13658:34;;;463:16479;;;;14340:14;463:16479;;;;;;;;;;;;;;;;;:::i;:::-;;;;13828:382;;;463:16479;;;;;13828:382;;463:16479;;;;13828:382;;463:16479;;;;;13828:382;;463:16479;;;;13828:382;;463:16479;;;;13828:382;;463:16479;;;;13828:382;;463:16479;;;13828:382;;;14183:16;;463:16479;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;14226:27;;463:16479;14226:27;;14333:4;14313:10;;14340:14;;:::i;463:16479::-;;;;-1:-1:-1;;;;;463:16479:3;;;;;;:::o;:::-;;;;-1:-1:-1;;;;;463:16479:3;;;;;;:::o;:::-;;;;;;;;;;;;;;;:::o;:::-;;;;-1:-1:-1;463:16479:3;;;;;-1:-1:-1;463:16479:3;;;;;;;;;;;;;;;;;;;;;;:::o;11269:797::-;;463:16479;;;11411:11;463:16479;;;;;;;;;;;:::i;:::-;;;-1:-1:-1;;;;;463:16479:3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;11462:20;;;;463:16479;;;11462:46;;;;11269:797;11462:73;;;;;11269:797;11462:105;;;;11269:797;11462:186;;;;;11269:797;11462:224;;;;11269:797;11462:309;;;;;11269:797;11462:388;;;;11269:797;11462:464;;;;11269:797;11462:528;;;;11269:797;11445:593;;;;;11411:11;11269:797;:::o;11445:593::-;463:16479;12015:12;:::o;11462:528::-;463:16479;;;;;;;;;;;;11946:31;-1:-1:-1;463:16479:3;;;;-1:-1:-1;463:16479:3;;;;;;;;;11946:44;11462:528;;;;;:464;463:16479;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;463:16479:3;11870:56;;;-1:-1:-1;11462:464:3;;:388;463:16479;;-1:-1:-1;;;11791:41:3;;463:16479;11791:41;;463:16479;;;;;-1:-1:-1;463:16479:3;;11791:41;463:16479;11791:11;-1:-1:-1;;;;;463:16479:3;11791:41;;;;;;;463:16479;11791:41;;;11462:388;11835:15;;-1:-1:-1;11462:388:3;;;11791:41;;;463:16479;11791:41;;463:16479;11791:41;;;;;;463:16479;11791:41;;;:::i;:::-;;;463:16479;;;;;11791:41;;;;;;-1:-1:-1;11791:41:3;;11462:309;463:16479;;;;;;;;;;;;-1:-1:-1;463:16479:3;;;;;-1:-1:-1;463:16479:3;;;;;;;;;11706:65;;11462:309;;;:224;463:16479;11652:15;:34;;;-1:-1:-1;11462:224:3;;;:186;463:16479;;-1:-1:-1;;;11587:43:3;;463:16479;11587:43;;463:16479;;;;;-1:-1:-1;463:16479:3;;11587:43;463:16479;11587:11;-1:-1:-1;;;;;463:16479:3;11587:43;;;;;;;463:16479;11587:43;;;11462:186;11633:15;;-1:-1:-1;11462:186:3;;;11587:43;;;463:16479;11587:43;;463:16479;11587:43;;;;;;463:16479;11587:43;;;:::i;:::-;;;463:16479;;;;;11587:43;;;;;;-1:-1:-1;11587:43:3;;11462:105;11539:28;;-1:-1:-1;11462:105:3;;;:73;11512:23;;;-1:-1:-1;11462:73:3;;:46;;-1:-1:-1;11462:46:3;;;7292:355:0;-1:-1:-1;;7390:251:0;;;;;7292:355::o;7390:251::-;;;;;;;12202:1026:2;;12347:875;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;12202:1026;12347:875;;;;;;;12202:1026::o;12347:875::-;;;;;;;;;;;;;;;;;;;;16340:887;;;16467:754;;;;;;;;;;;;;;;;;;;;;;;;;;;16340:887;16467:754;;;;;16340:887::o;16467:754::-;;;;;;;;;;;;;;;;;;;;6145:1089:0;463:16479:3;;;;;6813:405:0;;;;;;-1:-1:-1;6813:405:0;;-1:-1:-1;;6813:405:0;6145:1089::o
Swarm Source
ipfs://478dfc78f54dbe084eabd647baae88e865f1dcf9fef4a7d61e30092dc2532fec
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.