Source Code
Overview
MNT Balance
MNT Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
ArchetypeLogicErc721a
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 1 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
// ArchetypeLogic v0.8.0
//
// d8888 888 888
// d88888 888 888
// d88P888 888 888
// d88P 888 888d888 .d8888b 88888b. .d88b. 888888 888 888 88888b. .d88b.
// d88P 888 888P" d88P" 888 "88b d8P Y8b 888 888 888 888 "88b d8P Y8b
// d88P 888 888 888 888 888 88888888 888 888 888 888 888 88888888
// d8888888888 888 Y88b. 888 888 Y8b. Y88b. Y88b 888 888 d88P Y8b.
// d88P 888 888 "Y8888P 888 888 "Y8888 "Y888 "Y88888 88888P" "Y8888
// 888 888
// Y8b d88P 888
// "Y88P" 888
pragma solidity ^0.8.20;
import "../ArchetypePayouts.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "solady/src/utils/MerkleProofLib.sol";
import "solady/src/utils/ECDSA.sol";
error InvalidConfig();
error MintNotYetStarted();
error MintEnded();
error WalletUnauthorizedToMint();
error InsufficientEthSent();
error ExcessiveEthSent();
error Erc20BalanceTooLow();
error MaxSupplyExceeded();
error ListMaxSupplyExceeded();
error NumberOfMintsExceeded();
error MintingPaused();
error InvalidReferral();
error InvalidSignature();
error MaxBatchSizeExceeded();
error BurnToMintDisabled();
error NotTokenOwner();
error NotPlatform();
error NotOwner();
error NotShareholder();
error NotApprovedToTransfer();
error InvalidAmountOfTokens();
error WrongPassword();
error LockedForever();
error Blacklisted();
//
// STRUCTS
//
struct Auth {
bytes32 key;
bytes32[] proof;
}
struct BonusDiscount {
uint16 numMints;
uint16 numBonusMints;
}
struct Config {
string baseUri;
address affiliateSigner;
uint32 maxSupply;
uint32 maxBatchSize;
uint16 affiliateFee; //BPS
uint16 affiliateDiscount; //BPS
uint16 defaultRoyalty; //BPS
}
// allocation splits for withdrawn owner funds, must sum to 100%
struct PayoutConfig {
uint16 ownerBps;
uint16 platformBps;
uint16 partnerBps;
uint16 superAffiliateBps;
address partner;
address superAffiliate;
address ownerAltPayout;
}
struct Options {
bool uriLocked;
bool maxSupplyLocked;
bool affiliateFeeLocked;
bool ownerAltPayoutLocked;
}
struct AdvancedInvite {
uint128 price;
uint128 reservePrice;
uint128 delta;
uint32 start;
uint32 end;
uint32 limit;
uint32 maxSupply;
uint32 interval;
uint32 unitSize; // mint 1 get x
address tokenAddress;
bool isBlacklist;
}
struct Invite {
uint128 price;
uint32 start;
uint32 end;
uint32 limit;
uint32 maxSupply;
uint32 unitSize; // mint 1 get x
address tokenAddress;
bool isBlacklist;
}
struct BurnInvite {
IERC721 burnErc721;
address burnAddress;
address tokenAddress;
uint128 price; // flat price - does not support discounts
bool reversed; // side of the ratio (false=burn {ratio} get 1, true=burn 1 get {ratio})
uint16 ratio;
uint32 start;
uint32 end;
uint64 limit;
}
struct ValidationArgs {
address owner;
address affiliate;
uint256 quantity;
uint256 curSupply;
uint256 listSupply;
}
// UPDATE CONSTANTS BEFORE DEPLOY
address constant PLATFORM = 0x8952caF7E5bf1fe63ebe94148ca802F3eF127C98;
address constant BATCH = 0xEa49e7bE310716dA66725c84a5127d2F6A202eAf;
address constant PAYOUTS = 0xaAfdfA4a935d8511bF285af11A0544ce7e4a1199;
uint16 constant MAXBPS = 5000; // max fee or discount is 50%
uint32 constant UINT32_MAX = 2**32 - 1;
library ArchetypeLogicErc721a {
//
// EVENTS
//
event Invited(bytes32 indexed key, bytes32 indexed cid);
event BurnInvited(bytes32 indexed key, bytes32 indexed cid);
event Referral(address indexed affiliate, address token, uint128 wad, uint256 numMints);
event Withdrawal(address indexed src, address token, uint128 wad);
// calculate price based on affiliate usage and mint discounts
function computePrice(
AdvancedInvite storage invite,
uint16 affiliateDiscount,
uint256 numTokens,
uint256 listSupply,
bool affiliateUsed
) public view returns (uint256) {
uint256 price = invite.price;
uint256 cost;
if (invite.interval > 0 && invite.delta > 0) {
// Apply dutch pricing
uint256 diff = (((block.timestamp - invite.start) / invite.interval) * invite.delta);
if (price > invite.reservePrice) {
if (diff > price - invite.reservePrice) {
price = invite.reservePrice;
} else {
price = price - diff;
}
} else if (price < invite.reservePrice) {
if (diff > invite.reservePrice - price) {
price = invite.reservePrice;
} else {
price = price + diff;
}
}
cost = price * numTokens;
} else if (invite.interval == 0 && invite.delta > 0) {
// Apply linear curve
uint256 lastPrice = price + invite.delta * listSupply;
cost = lastPrice * numTokens + (invite.delta * numTokens * (numTokens - 1)) / 2;
} else {
cost = price * numTokens;
}
if (affiliateUsed) {
cost = cost - ((cost * affiliateDiscount) / 10000);
}
return cost;
}
function bonusMintsAwarded(uint256 numNfts, uint256 packedDiscount) internal pure returns (uint256) {
for (uint8 i = 0; i < 8; i++) {
uint32 discount = uint32((packedDiscount >> (32 * i)) & 0xFFFFFFFF);
uint16 tierNumMints = uint16(discount >> 16);
uint16 tierBonusMints = uint16(discount);
if (tierNumMints == 0) {
break; // End of valid discounts
}
if (numNfts >= tierNumMints) {
return (numNfts / tierNumMints) * tierBonusMints;
}
}
return 0;
}
function validateMint(
AdvancedInvite storage i,
Config storage config,
Auth calldata auth,
mapping(address => mapping(bytes32 => uint256)) storage minted,
bytes calldata signature,
ValidationArgs memory args,
uint128 cost
) public view {
address msgSender = _msgSender();
if (args.affiliate != address(0)) {
if (
args.affiliate == PLATFORM || args.affiliate == args.owner || args.affiliate == msgSender
) {
revert InvalidReferral();
}
validateAffiliate(args.affiliate, signature, config.affiliateSigner);
}
if (i.limit == 0) {
revert MintingPaused();
}
if (!i.isBlacklist) {
if (!verify(auth, i.tokenAddress, msgSender)) {
revert WalletUnauthorizedToMint();
}
} else {
if (verify(auth, i.tokenAddress, msgSender)) {
revert Blacklisted();
}
}
if (block.timestamp < i.start) {
revert MintNotYetStarted();
}
if (i.end > i.start && block.timestamp > i.end) {
revert MintEnded();
}
if (i.limit < i.maxSupply) {
uint256 totalAfterMint = minted[msgSender][auth.key] + args.quantity;
if (totalAfterMint > i.limit) {
revert NumberOfMintsExceeded();
}
}
if (i.maxSupply < config.maxSupply) {
uint256 totalAfterMint = args.listSupply + args.quantity;
if (totalAfterMint > i.maxSupply) {
revert ListMaxSupplyExceeded();
}
}
if (args.quantity > config.maxBatchSize) {
revert MaxBatchSizeExceeded();
}
if ((args.curSupply + args.quantity) > config.maxSupply) {
revert MaxSupplyExceeded();
}
if (i.tokenAddress != address(0)) {
IERC20 erc20Token = IERC20(i.tokenAddress);
if (erc20Token.allowance(msgSender, address(this)) < cost) {
revert NotApprovedToTransfer();
}
if (erc20Token.balanceOf(msgSender) < cost) {
revert Erc20BalanceTooLow();
}
if (msg.value != 0) {
revert ExcessiveEthSent();
}
} else {
if (msg.value < cost) {
revert InsufficientEthSent();
}
}
}
function validateBurnToMint(
BurnInvite storage burnInvite,
Config storage config,
Auth calldata auth,
uint256[] calldata tokenIds,
uint256 curSupply,
mapping(address => mapping(bytes32 => uint256)) storage minted,
uint128 cost
) public view {
if (burnInvite.limit == 0) {
revert MintingPaused();
}
if (block.timestamp < burnInvite.start) {
revert MintNotYetStarted();
}
if (burnInvite.end > burnInvite.start && block.timestamp > burnInvite.end) {
revert MintEnded();
}
// check if msgSender owns tokens and has correct approvals
address msgSender = _msgSender();
for (uint256 i; i < tokenIds.length; ) {
if (burnInvite.burnErc721.ownerOf(tokenIds[i]) != msgSender) {
revert NotTokenOwner();
}
unchecked {
++i;
}
}
if (!verify(auth, burnInvite.tokenAddress, msgSender)) {
revert WalletUnauthorizedToMint();
}
if (!burnInvite.burnErc721.isApprovedForAll(msgSender, address(this))) {
revert NotApprovedToTransfer();
}
uint256 quantity;
if (burnInvite.reversed) {
quantity = tokenIds.length * burnInvite.ratio;
} else {
if (tokenIds.length % burnInvite.ratio != 0) {
revert InvalidAmountOfTokens();
}
quantity = tokenIds.length / burnInvite.ratio;
}
if (quantity > config.maxBatchSize) {
revert MaxBatchSizeExceeded();
}
if (burnInvite.limit < config.maxSupply) {
uint256 totalAfterMint = minted[msgSender][keccak256(abi.encodePacked("burn", auth.key))] +
quantity;
if (totalAfterMint > burnInvite.limit) {
revert NumberOfMintsExceeded();
}
}
if ((curSupply + quantity) > config.maxSupply) {
revert MaxSupplyExceeded();
}
if (burnInvite.tokenAddress != address(0)) {
IERC20 erc20Token = IERC20(burnInvite.tokenAddress);
if (erc20Token.allowance(msgSender, address(this)) < cost) {
revert NotApprovedToTransfer();
}
if (erc20Token.balanceOf(msgSender) < cost) {
revert Erc20BalanceTooLow();
}
if (msg.value != 0) {
revert ExcessiveEthSent();
}
} else {
if (msg.value < cost) {
revert InsufficientEthSent();
}
}
}
function updateBalances(
address tokenAddress,
Config storage config,
mapping(address => uint128) storage _ownerBalance,
mapping(address => mapping(address => uint128)) storage _affiliateBalance,
address affiliate,
uint256 quantity,
uint128 value
) public {
uint128 affiliateWad;
if (affiliate != address(0)) {
affiliateWad = (value * config.affiliateFee) / 10000;
_affiliateBalance[affiliate][tokenAddress] += affiliateWad;
emit Referral(affiliate, tokenAddress, affiliateWad, quantity);
}
uint128 balance = _ownerBalance[tokenAddress];
uint128 ownerWad = value - affiliateWad;
_ownerBalance[tokenAddress] = balance + ownerWad;
if (tokenAddress != address(0)) {
IERC20 erc20Token = IERC20(tokenAddress);
bool success = erc20Token.transferFrom(_msgSender(), address(this), value);
if (!success) {
revert TransferFailed();
}
}
}
function withdrawTokensAffiliate(
mapping(address => mapping(address => uint128)) storage _affiliateBalance,
address[] calldata tokens
) public {
address msgSender = _msgSender();
for (uint256 i; i < tokens.length; i++) {
address tokenAddress = tokens[i];
uint128 wad = _affiliateBalance[msgSender][tokenAddress];
_affiliateBalance[msgSender][tokenAddress] = 0;
if (wad == 0) {
revert BalanceEmpty();
}
if (tokenAddress == address(0)) {
bool success = false;
(success, ) = msgSender.call{ value: wad }("");
if (!success) {
revert TransferFailed();
}
} else {
IERC20 erc20Token = IERC20(tokenAddress);
bool success = erc20Token.transfer(msgSender, wad);
if (!success) {
revert TransferFailed();
}
}
emit Withdrawal(msgSender, tokenAddress, wad);
}
}
function withdrawTokens(
PayoutConfig storage payoutConfig,
mapping(address => uint128) storage _ownerBalance,
address owner,
address[] calldata tokens
) public {
address msgSender = _msgSender();
for (uint256 i; i < tokens.length; i++) {
address tokenAddress = tokens[i];
uint128 wad;
if (
msgSender == owner ||
msgSender == PLATFORM ||
msgSender == payoutConfig.partner ||
msgSender == payoutConfig.superAffiliate ||
msgSender == payoutConfig.ownerAltPayout
) {
wad = _ownerBalance[tokenAddress];
_ownerBalance[tokenAddress] = 0;
} else {
revert NotShareholder();
}
if (wad == 0) {
revert BalanceEmpty();
}
if (payoutConfig.ownerAltPayout == address(0)) {
address[] memory recipients = new address[](4);
recipients[0] = owner;
recipients[1] = PLATFORM;
recipients[2] = payoutConfig.partner;
recipients[3] = payoutConfig.superAffiliate;
uint16[] memory splits = new uint16[](4);
splits[0] = payoutConfig.ownerBps;
splits[1] = payoutConfig.platformBps;
splits[2] = payoutConfig.partnerBps;
splits[3] = payoutConfig.superAffiliateBps;
if (tokenAddress == address(0)) {
ArchetypePayouts(PAYOUTS).updateBalances{ value: wad }(
wad,
tokenAddress,
recipients,
splits
);
} else {
ArchetypePayouts(PAYOUTS).updateBalances(wad, tokenAddress, recipients, splits);
}
} else {
uint256 ownerShare = (uint256(wad) * payoutConfig.ownerBps) / 10000;
uint256 remainingShare = wad - ownerShare;
if (tokenAddress == address(0)) {
(bool success, ) = payable(payoutConfig.ownerAltPayout).call{ value: ownerShare }("");
if (!success) revert TransferFailed();
} else {
IERC20(tokenAddress).transfer(payoutConfig.ownerAltPayout, ownerShare);
}
address[] memory recipients = new address[](3);
recipients[0] = PLATFORM;
recipients[1] = payoutConfig.partner;
recipients[2] = payoutConfig.superAffiliate;
uint16[] memory splits = new uint16[](3);
uint16 remainingBps = 10000 - payoutConfig.ownerBps;
splits[1] = uint16((uint256(payoutConfig.partnerBps) * 10000) / remainingBps);
splits[2] = uint16((uint256(payoutConfig.superAffiliateBps) * 10000) / remainingBps);
splits[0] = 10000 - splits[1] - splits[2];
if (tokenAddress == address(0)) {
ArchetypePayouts(PAYOUTS).updateBalances{ value: remainingShare }(
remainingShare,
tokenAddress,
recipients,
splits
);
} else {
ArchetypePayouts(PAYOUTS).updateBalances(
remainingShare,
tokenAddress,
recipients,
splits
);
}
}
emit Withdrawal(msgSender, tokenAddress, wad);
}
}
function validateAffiliate(
address affiliate,
bytes calldata signature,
address affiliateSigner
) public view {
bytes32 signedMessagehash = ECDSA.toEthSignedMessageHash(
keccak256(abi.encodePacked(affiliate))
);
address signer = ECDSA.recover(signedMessagehash, signature);
if (signer != affiliateSigner) {
revert InvalidSignature();
}
}
function verify(
Auth calldata auth,
address tokenAddress,
address account
) public pure returns (bool) {
// keys 0-255 and tokenAddress are public
if (uint256(auth.key) <= 0xff || auth.key == keccak256(abi.encodePacked(tokenAddress))) {
return true;
}
return MerkleProofLib.verify(auth.proof, auth.key, keccak256(abi.encodePacked(account)));
}
function _msgSender() internal view returns (address) {
return msg.sender == BATCH ? tx.origin : msg.sender;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// ArchetypePayouts v0.7.0
//
// d8888 888 888
// d88888 888 888
// d88P888 888 888
// d88P 888 888d888 .d8888b 88888b. .d88b. 888888 888 888 88888b. .d88b.
// d88P 888 888P" d88P" 888 "88b d8P Y8b 888 888 888 888 "88b d8P Y8b
// d88P 888 888 888 888 888 88888888 888 888 888 888 888 88888888
// d8888888888 888 Y88b. 888 888 Y8b. Y88b. Y88b 888 888 d88P Y8b.
// d88P 888 888 "Y8888P 888 888 "Y8888 "Y888 "Y88888 88888P" "Y8888
// 888 888
// Y8b d88P 888
//
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
error InvalidLength();
error InvalidSplitShares();
error TransferFailed();
error BalanceEmpty();
error NotApprovedToWithdraw();
contract ArchetypePayouts {
event Withdrawal(address indexed src, address token, uint256 wad);
event FundsAdded(address indexed recipient, address token, uint256 amount);
mapping(address => mapping(address => uint256)) private _balance;
mapping(address => mapping(address => bool)) private _approvals;
function updateBalances(
uint256 totalAmount,
address token,
address[] calldata recipients,
uint16[] calldata splits
) public payable {
if (recipients.length != splits.length) {
revert InvalidLength();
}
uint256 totalShares = 0;
for (uint256 i = 0; i < splits.length; i++) {
totalShares += splits[i];
}
if (totalShares != 10000) {
revert InvalidSplitShares();
}
if (token == address(0)) {
// ETH payments
uint256 totalReceived = msg.value;
for (uint256 i = 0; i < recipients.length; i++) {
if (splits[i] > 0) {
uint256 amountToAdd = (totalReceived * splits[i]) / 10000;
_balance[recipients[i]][token] += amountToAdd;
emit FundsAdded(recipients[i], token, amountToAdd);
}
}
} else {
// ERC20 payments
IERC20 paymentToken = IERC20(token);
bool success = paymentToken.transferFrom(msg.sender, address(this), totalAmount);
if (!success) {
revert TransferFailed();
}
for (uint256 i = 0; i < recipients.length; i++) {
if (splits[i] > 0) {
uint256 amountToAdd = (totalAmount * splits[i]) / 10000;
_balance[recipients[i]][token] += amountToAdd;
emit FundsAdded(recipients[i], token, amountToAdd);
}
}
}
}
function withdraw() external {
address msgSender = msg.sender;
_withdraw(msgSender, msgSender, address(0));
}
function withdrawTokens(address[] memory tokens) external {
address msgSender = msg.sender;
for (uint256 i = 0; i < tokens.length; i++) {
_withdraw(msgSender, msgSender, tokens[i]);
}
}
function withdrawFrom(address from, address to) public {
if (from != msg.sender && !_approvals[from][to]) {
revert NotApprovedToWithdraw();
}
_withdraw(from, to, address(0));
}
function withdrawTokensFrom(
address from,
address to,
address[] memory tokens
) public {
if (from != msg.sender && !_approvals[from][to]) {
revert NotApprovedToWithdraw();
}
for (uint256 i = 0; i < tokens.length; i++) {
_withdraw(from, to, tokens[i]);
}
}
function _withdraw(
address from,
address to,
address token
) internal {
uint256 wad;
wad = _balance[from][token];
_balance[from][token] = 0;
if (wad == 0) {
revert BalanceEmpty();
}
if (token == address(0)) {
bool success = false;
(success, ) = to.call{ value: wad }("");
if (!success) {
revert TransferFailed();
}
} else {
IERC20 erc20Token = IERC20(token);
bool success = erc20Token.transfer(to, wad);
if (!success) {
revert TransferFailed();
}
}
emit Withdrawal(from, token, wad);
}
function approveWithdrawal(address delegate, bool approved) external {
_approvals[msg.sender][delegate] = approved;
}
function isApproved(address from, address delegate) external view returns (bool) {
return _approvals[from][delegate];
}
function balance(address recipient) external view returns (uint256) {
return _balance[recipient][address(0)];
}
function balanceToken(address recipient, address token) external view returns (uint256) {
return _balance[recipient][token];
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @notice Gas optimized ECDSA wrapper.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/ECDSA.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/ECDSA.sol)
/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/ECDSA.sol)
///
/// @dev Note:
/// - The recovery functions use the ecrecover precompile (0x1).
/// - As of Solady version 0.0.68, the `recover` variants will revert upon recovery failure.
/// This is for more safety by default.
/// Use the `tryRecover` variants if you need to get the zero address back
/// upon recovery failure instead.
/// - As of Solady version 0.0.134, all `bytes signature` variants accept both
/// regular 65-byte `(r, s, v)` and EIP-2098 `(r, vs)` short form signatures.
/// See: https://eips.ethereum.org/EIPS/eip-2098
/// This is for calldata efficiency on smart accounts prevalent on L2s.
///
/// WARNING! Do NOT directly use signatures as unique identifiers:
/// - The recovery operations do NOT check if a signature is non-malleable.
/// - Use a nonce in the digest to prevent replay attacks on the same contract.
/// - Use EIP-712 for the digest to prevent replay attacks across different chains and contracts.
/// EIP-712 also enables readable signing of typed data for better user safety.
/// - If you need a unique hash from a signature, please use the `canonicalHash` functions.
library ECDSA {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CONSTANTS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The order of the secp256k1 elliptic curve.
uint256 internal constant N = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141;
/// @dev `N/2 + 1`. Used for checking the malleability of the signature.
uint256 private constant _HALF_N_PLUS_1 =
0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a1;
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CUSTOM ERRORS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev The signature is invalid.
error InvalidSignature();
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* RECOVERY OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Recovers the signer's address from a message digest `hash`, and the `signature`.
function recover(bytes32 hash, bytes memory signature) internal view returns (address result) {
/// @solidity memory-safe-assembly
assembly {
result := 1
let m := mload(0x40) // Cache the free memory pointer.
for {} 1 {} {
mstore(0x00, hash)
mstore(0x40, mload(add(signature, 0x20))) // `r`.
if eq(mload(signature), 64) {
let vs := mload(add(signature, 0x40))
mstore(0x20, add(shr(255, vs), 27)) // `v`.
mstore(0x60, shr(1, shl(1, vs))) // `s`.
break
}
if eq(mload(signature), 65) {
mstore(0x20, byte(0, mload(add(signature, 0x60)))) // `v`.
mstore(0x60, mload(add(signature, 0x40))) // `s`.
break
}
result := 0
break
}
result :=
mload(
staticcall(
gas(), // Amount of gas left for the transaction.
result, // Address of `ecrecover`.
0x00, // Start of input.
0x80, // Size of input.
0x01, // Start of output.
0x20 // Size of output.
)
)
// `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
if iszero(returndatasize()) {
mstore(0x00, 0x8baa579f) // `InvalidSignature()`.
revert(0x1c, 0x04)
}
mstore(0x60, 0) // Restore the zero slot.
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Recovers the signer's address from a message digest `hash`, and the `signature`.
function recoverCalldata(bytes32 hash, bytes calldata signature)
internal
view
returns (address result)
{
/// @solidity memory-safe-assembly
assembly {
result := 1
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x00, hash)
for {} 1 {} {
if eq(signature.length, 64) {
let vs := calldataload(add(signature.offset, 0x20))
mstore(0x20, add(shr(255, vs), 27)) // `v`.
mstore(0x40, calldataload(signature.offset)) // `r`.
mstore(0x60, shr(1, shl(1, vs))) // `s`.
break
}
if eq(signature.length, 65) {
mstore(0x20, byte(0, calldataload(add(signature.offset, 0x40)))) // `v`.
calldatacopy(0x40, signature.offset, 0x40) // Copy `r` and `s`.
break
}
result := 0
break
}
result :=
mload(
staticcall(
gas(), // Amount of gas left for the transaction.
result, // Address of `ecrecover`.
0x00, // Start of input.
0x80, // Size of input.
0x01, // Start of output.
0x20 // Size of output.
)
)
// `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
if iszero(returndatasize()) {
mstore(0x00, 0x8baa579f) // `InvalidSignature()`.
revert(0x1c, 0x04)
}
mstore(0x60, 0) // Restore the zero slot.
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Recovers the signer's address from a message digest `hash`,
/// and the EIP-2098 short form signature defined by `r` and `vs`.
function recover(bytes32 hash, bytes32 r, bytes32 vs) internal view returns (address result) {
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x00, hash)
mstore(0x20, add(shr(255, vs), 27)) // `v`.
mstore(0x40, r)
mstore(0x60, shr(1, shl(1, vs))) // `s`.
result :=
mload(
staticcall(
gas(), // Amount of gas left for the transaction.
1, // Address of `ecrecover`.
0x00, // Start of input.
0x80, // Size of input.
0x01, // Start of output.
0x20 // Size of output.
)
)
// `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
if iszero(returndatasize()) {
mstore(0x00, 0x8baa579f) // `InvalidSignature()`.
revert(0x1c, 0x04)
}
mstore(0x60, 0) // Restore the zero slot.
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Recovers the signer's address from a message digest `hash`,
/// and the signature defined by `v`, `r`, `s`.
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s)
internal
view
returns (address result)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x00, hash)
mstore(0x20, and(v, 0xff))
mstore(0x40, r)
mstore(0x60, s)
result :=
mload(
staticcall(
gas(), // Amount of gas left for the transaction.
1, // Address of `ecrecover`.
0x00, // Start of input.
0x80, // Size of input.
0x01, // Start of output.
0x20 // Size of output.
)
)
// `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
if iszero(returndatasize()) {
mstore(0x00, 0x8baa579f) // `InvalidSignature()`.
revert(0x1c, 0x04)
}
mstore(0x60, 0) // Restore the zero slot.
mstore(0x40, m) // Restore the free memory pointer.
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* TRY-RECOVER OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
// WARNING!
// These functions will NOT revert upon recovery failure.
// Instead, they will return the zero address upon recovery failure.
// It is critical that the returned address is NEVER compared against
// a zero address (e.g. an uninitialized address variable).
/// @dev Recovers the signer's address from a message digest `hash`, and the `signature`.
function tryRecover(bytes32 hash, bytes memory signature)
internal
view
returns (address result)
{
/// @solidity memory-safe-assembly
assembly {
result := 1
let m := mload(0x40) // Cache the free memory pointer.
for {} 1 {} {
mstore(0x00, hash)
mstore(0x40, mload(add(signature, 0x20))) // `r`.
if eq(mload(signature), 64) {
let vs := mload(add(signature, 0x40))
mstore(0x20, add(shr(255, vs), 27)) // `v`.
mstore(0x60, shr(1, shl(1, vs))) // `s`.
break
}
if eq(mload(signature), 65) {
mstore(0x20, byte(0, mload(add(signature, 0x60)))) // `v`.
mstore(0x60, mload(add(signature, 0x40))) // `s`.
break
}
result := 0
break
}
pop(
staticcall(
gas(), // Amount of gas left for the transaction.
result, // Address of `ecrecover`.
0x00, // Start of input.
0x80, // Size of input.
0x40, // Start of output.
0x20 // Size of output.
)
)
mstore(0x60, 0) // Restore the zero slot.
// `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
result := mload(xor(0x60, returndatasize()))
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Recovers the signer's address from a message digest `hash`, and the `signature`.
function tryRecoverCalldata(bytes32 hash, bytes calldata signature)
internal
view
returns (address result)
{
/// @solidity memory-safe-assembly
assembly {
result := 1
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x00, hash)
for {} 1 {} {
if eq(signature.length, 64) {
let vs := calldataload(add(signature.offset, 0x20))
mstore(0x20, add(shr(255, vs), 27)) // `v`.
mstore(0x40, calldataload(signature.offset)) // `r`.
mstore(0x60, shr(1, shl(1, vs))) // `s`.
break
}
if eq(signature.length, 65) {
mstore(0x20, byte(0, calldataload(add(signature.offset, 0x40)))) // `v`.
calldatacopy(0x40, signature.offset, 0x40) // Copy `r` and `s`.
break
}
result := 0
break
}
pop(
staticcall(
gas(), // Amount of gas left for the transaction.
result, // Address of `ecrecover`.
0x00, // Start of input.
0x80, // Size of input.
0x40, // Start of output.
0x20 // Size of output.
)
)
mstore(0x60, 0) // Restore the zero slot.
// `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
result := mload(xor(0x60, returndatasize()))
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Recovers the signer's address from a message digest `hash`,
/// and the EIP-2098 short form signature defined by `r` and `vs`.
function tryRecover(bytes32 hash, bytes32 r, bytes32 vs)
internal
view
returns (address result)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x00, hash)
mstore(0x20, add(shr(255, vs), 27)) // `v`.
mstore(0x40, r)
mstore(0x60, shr(1, shl(1, vs))) // `s`.
pop(
staticcall(
gas(), // Amount of gas left for the transaction.
1, // Address of `ecrecover`.
0x00, // Start of input.
0x80, // Size of input.
0x40, // Start of output.
0x20 // Size of output.
)
)
mstore(0x60, 0) // Restore the zero slot.
// `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
result := mload(xor(0x60, returndatasize()))
mstore(0x40, m) // Restore the free memory pointer.
}
}
/// @dev Recovers the signer's address from a message digest `hash`,
/// and the signature defined by `v`, `r`, `s`.
function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s)
internal
view
returns (address result)
{
/// @solidity memory-safe-assembly
assembly {
let m := mload(0x40) // Cache the free memory pointer.
mstore(0x00, hash)
mstore(0x20, and(v, 0xff))
mstore(0x40, r)
mstore(0x60, s)
pop(
staticcall(
gas(), // Amount of gas left for the transaction.
1, // Address of `ecrecover`.
0x00, // Start of input.
0x80, // Size of input.
0x40, // Start of output.
0x20 // Size of output.
)
)
mstore(0x60, 0) // Restore the zero slot.
// `returndatasize()` will be `0x20` upon success, and `0x00` otherwise.
result := mload(xor(0x60, returndatasize()))
mstore(0x40, m) // Restore the free memory pointer.
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* HASHING OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Returns an Ethereum Signed Message, created from a `hash`.
/// This produces a hash corresponding to the one signed with the
/// [`eth_sign`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign)
/// JSON-RPC method as part of EIP-191.
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
mstore(0x20, hash) // Store into scratch space for keccak256.
mstore(0x00, "\x00\x00\x00\x00\x19Ethereum Signed Message:\n32") // 28 bytes.
result := keccak256(0x04, 0x3c) // `32 * 2 - (32 - 28) = 60 = 0x3c`.
}
}
/// @dev Returns an Ethereum Signed Message, created from `s`.
/// This produces a hash corresponding to the one signed with the
/// [`eth_sign`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign)
/// JSON-RPC method as part of EIP-191.
/// Note: Supports lengths of `s` up to 999999 bytes.
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32 result) {
/// @solidity memory-safe-assembly
assembly {
let sLength := mload(s)
let o := 0x20
mstore(o, "\x19Ethereum Signed Message:\n") // 26 bytes, zero-right-padded.
mstore(0x00, 0x00)
// Convert the `s.length` to ASCII decimal representation: `base10(s.length)`.
for { let temp := sLength } 1 {} {
o := sub(o, 1)
mstore8(o, add(48, mod(temp, 10)))
temp := div(temp, 10)
if iszero(temp) { break }
}
let n := sub(0x3a, o) // Header length: `26 + 32 - o`.
// Throw an out-of-offset error (consumes all gas) if the header exceeds 32 bytes.
returndatacopy(returndatasize(), returndatasize(), gt(n, 0x20))
mstore(s, or(mload(0x00), mload(n))) // Temporarily store the header.
result := keccak256(add(s, sub(0x20, n)), add(n, sLength))
mstore(s, sLength) // Restore the length.
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* CANONICAL HASH FUNCTIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
// The following functions returns the hash of the signature in it's canonicalized format,
// which is the 65-byte `abi.encodePacked(r, s, uint8(v))`, where `v` is either 27 or 28.
// If `s` is greater than `N / 2` then it will be converted to `N - s`
// and the `v` value will be flipped.
// If the signature has an invalid length, or if `v` is invalid,
// a uniquely corrupt hash will be returned.
// These functions are useful for "poor-mans-VRF".
/// @dev Returns the canonical hash of `signature`.
function canonicalHash(bytes memory signature) internal pure returns (bytes32 result) {
// @solidity memory-safe-assembly
assembly {
let l := mload(signature)
for {} 1 {} {
mstore(0x00, mload(add(signature, 0x20))) // `r`.
let s := mload(add(signature, 0x40))
let v := mload(add(signature, 0x41))
if eq(l, 64) {
v := add(shr(255, s), 27)
s := shr(1, shl(1, s))
}
if iszero(lt(s, _HALF_N_PLUS_1)) {
v := xor(v, 7)
s := sub(N, s)
}
mstore(0x21, v)
mstore(0x20, s)
result := keccak256(0x00, 0x41)
mstore(0x21, 0) // Restore the overwritten part of the free memory pointer.
break
}
// If the length is neither 64 nor 65, return a uniquely corrupted hash.
if iszero(lt(sub(l, 64), 2)) {
// `bytes4(keccak256("InvalidSignatureLength"))`.
result := xor(keccak256(add(signature, 0x20), l), 0xd62f1ab2)
}
}
}
/// @dev Returns the canonical hash of `signature`.
function canonicalHashCalldata(bytes calldata signature)
internal
pure
returns (bytes32 result)
{
// @solidity memory-safe-assembly
assembly {
let l := signature.length
for {} 1 {} {
mstore(0x00, calldataload(signature.offset)) // `r`.
let s := calldataload(add(signature.offset, 0x20))
let v := calldataload(add(signature.offset, 0x21))
if eq(l, 64) {
v := add(shr(255, s), 27)
s := shr(1, shl(1, s))
}
if iszero(lt(s, _HALF_N_PLUS_1)) {
v := xor(v, 7)
s := sub(N, s)
}
mstore(0x21, v)
mstore(0x20, s)
result := keccak256(0x00, 0x41)
mstore(0x21, 0) // Restore the overwritten part of the free memory pointer.
break
}
// If the length is neither 64 nor 65, return a uniquely corrupted hash.
if iszero(lt(sub(l, 64), 2)) {
calldatacopy(mload(0x40), signature.offset, l)
// `bytes4(keccak256("InvalidSignatureLength"))`.
result := xor(keccak256(mload(0x40), l), 0xd62f1ab2)
}
}
}
/// @dev Returns the canonical hash of `signature`.
function canonicalHash(bytes32 r, bytes32 vs) internal pure returns (bytes32 result) {
// @solidity memory-safe-assembly
assembly {
mstore(0x00, r) // `r`.
let v := add(shr(255, vs), 27)
let s := shr(1, shl(1, vs))
mstore(0x21, v)
mstore(0x20, s)
result := keccak256(0x00, 0x41)
mstore(0x21, 0) // Restore the overwritten part of the free memory pointer.
}
}
/// @dev Returns the canonical hash of `signature`.
function canonicalHash(uint8 v, bytes32 r, bytes32 s) internal pure returns (bytes32 result) {
// @solidity memory-safe-assembly
assembly {
mstore(0x00, r) // `r`.
if iszero(lt(s, _HALF_N_PLUS_1)) {
v := xor(v, 7)
s := sub(N, s)
}
mstore(0x21, v)
mstore(0x20, s)
result := keccak256(0x00, 0x41)
mstore(0x21, 0) // Restore the overwritten part of the free memory pointer.
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* EMPTY CALLDATA HELPERS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Returns an empty calldata bytes.
function emptySignature() internal pure returns (bytes calldata signature) {
/// @solidity memory-safe-assembly
assembly {
signature.length := 0
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
/// @notice Gas optimized verification of proof of inclusion for a leaf in a Merkle tree.
/// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/MerkleProofLib.sol)
/// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/MerkleProofLib.sol)
/// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/MerkleProof.sol)
library MerkleProofLib {
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* MERKLE PROOF VERIFICATION OPERATIONS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Returns whether `leaf` exists in the Merkle tree with `root`, given `proof`.
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf)
internal
pure
returns (bool isValid)
{
/// @solidity memory-safe-assembly
assembly {
if mload(proof) {
// Initialize `offset` to the offset of `proof` elements in memory.
let offset := add(proof, 0x20)
// Left shift by 5 is equivalent to multiplying by 0x20.
let end := add(offset, shl(5, mload(proof)))
// Iterate over proof elements to compute root hash.
for {} 1 {} {
// Slot of `leaf` in scratch space.
// If the condition is true: 0x20, otherwise: 0x00.
let scratch := shl(5, gt(leaf, mload(offset)))
// Store elements to hash contiguously in scratch space.
// Scratch space is 64 bytes (0x00 - 0x3f) and both elements are 32 bytes.
mstore(scratch, leaf)
mstore(xor(scratch, 0x20), mload(offset))
// Reuse `leaf` to store the hash to reduce stack operations.
leaf := keccak256(0x00, 0x40)
offset := add(offset, 0x20)
if iszero(lt(offset, end)) { break }
}
}
isValid := eq(leaf, root)
}
}
/// @dev Returns whether `leaf` exists in the Merkle tree with `root`, given `proof`.
function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf)
internal
pure
returns (bool isValid)
{
/// @solidity memory-safe-assembly
assembly {
if proof.length {
// Left shift by 5 is equivalent to multiplying by 0x20.
let end := add(proof.offset, shl(5, proof.length))
// Initialize `offset` to the offset of `proof` in the calldata.
let offset := proof.offset
// Iterate over proof elements to compute root hash.
for {} 1 {} {
// Slot of `leaf` in scratch space.
// If the condition is true: 0x20, otherwise: 0x00.
let scratch := shl(5, gt(leaf, calldataload(offset)))
// Store elements to hash contiguously in scratch space.
// Scratch space is 64 bytes (0x00 - 0x3f) and both elements are 32 bytes.
mstore(scratch, leaf)
mstore(xor(scratch, 0x20), calldataload(offset))
// Reuse `leaf` to store the hash to reduce stack operations.
leaf := keccak256(0x00, 0x40)
offset := add(offset, 0x20)
if iszero(lt(offset, end)) { break }
}
}
isValid := eq(leaf, root)
}
}
/// @dev Returns whether all `leaves` exist in the Merkle tree with `root`,
/// given `proof` and `flags`.
///
/// Note:
/// - Breaking the invariant `flags.length == (leaves.length - 1) + proof.length`
/// will always return false.
/// - The sum of the lengths of `proof` and `leaves` must never overflow.
/// - Any non-zero word in the `flags` array is treated as true.
/// - The memory offset of `proof` must be non-zero
/// (i.e. `proof` is not pointing to the scratch space).
function verifyMultiProof(
bytes32[] memory proof,
bytes32 root,
bytes32[] memory leaves,
bool[] memory flags
) internal pure returns (bool isValid) {
// Rebuilds the root by consuming and producing values on a queue.
// The queue starts with the `leaves` array, and goes into a `hashes` array.
// After the process, the last element on the queue is verified
// to be equal to the `root`.
//
// The `flags` array denotes whether the sibling
// should be popped from the queue (`flag == true`), or
// should be popped from the `proof` (`flag == false`).
/// @solidity memory-safe-assembly
assembly {
// Cache the lengths of the arrays.
let leavesLength := mload(leaves)
let proofLength := mload(proof)
let flagsLength := mload(flags)
// Advance the pointers of the arrays to point to the data.
leaves := add(0x20, leaves)
proof := add(0x20, proof)
flags := add(0x20, flags)
// If the number of flags is correct.
for {} eq(add(leavesLength, proofLength), add(flagsLength, 1)) {} {
// For the case where `proof.length + leaves.length == 1`.
if iszero(flagsLength) {
// `isValid = (proof.length == 1 ? proof[0] : leaves[0]) == root`.
isValid := eq(mload(xor(leaves, mul(xor(proof, leaves), proofLength))), root)
break
}
// The required final proof offset if `flagsLength` is not zero, otherwise zero.
let proofEnd := add(proof, shl(5, proofLength))
// We can use the free memory space for the queue.
// We don't need to allocate, since the queue is temporary.
let hashesFront := mload(0x40)
// Copy the leaves into the hashes.
// Sometimes, a little memory expansion costs less than branching.
// Should cost less, even with a high free memory offset of 0x7d00.
leavesLength := shl(5, leavesLength)
for { let i := 0 } iszero(eq(i, leavesLength)) { i := add(i, 0x20) } {
mstore(add(hashesFront, i), mload(add(leaves, i)))
}
// Compute the back of the hashes.
let hashesBack := add(hashesFront, leavesLength)
// This is the end of the memory for the queue.
// We recycle `flagsLength` to save on stack variables (sometimes save gas).
flagsLength := add(hashesBack, shl(5, flagsLength))
for {} 1 {} {
// Pop from `hashes`.
let a := mload(hashesFront)
// Pop from `hashes`.
let b := mload(add(hashesFront, 0x20))
hashesFront := add(hashesFront, 0x40)
// If the flag is false, load the next proof,
// else, pops from the queue.
if iszero(mload(flags)) {
// Loads the next proof.
b := mload(proof)
proof := add(proof, 0x20)
// Unpop from `hashes`.
hashesFront := sub(hashesFront, 0x20)
}
// Advance to the next flag.
flags := add(flags, 0x20)
// Slot of `a` in scratch space.
// If the condition is true: 0x20, otherwise: 0x00.
let scratch := shl(5, gt(a, b))
// Hash the scratch space and push the result onto the queue.
mstore(scratch, a)
mstore(xor(scratch, 0x20), b)
mstore(hashesBack, keccak256(0x00, 0x40))
hashesBack := add(hashesBack, 0x20)
if iszero(lt(hashesBack, flagsLength)) { break }
}
isValid :=
and(
// Checks if the last value in the queue is same as the root.
eq(mload(sub(hashesBack, 0x20)), root),
// And whether all the proofs are used, if required.
eq(proofEnd, proof)
)
break
}
}
}
/// @dev Returns whether all `leaves` exist in the Merkle tree with `root`,
/// given `proof` and `flags`.
///
/// Note:
/// - Breaking the invariant `flags.length == (leaves.length - 1) + proof.length`
/// will always return false.
/// - Any non-zero word in the `flags` array is treated as true.
/// - The calldata offset of `proof` must be non-zero
/// (i.e. `proof` is from a regular Solidity function with a 4-byte selector).
function verifyMultiProofCalldata(
bytes32[] calldata proof,
bytes32 root,
bytes32[] calldata leaves,
bool[] calldata flags
) internal pure returns (bool isValid) {
// Rebuilds the root by consuming and producing values on a queue.
// The queue starts with the `leaves` array, and goes into a `hashes` array.
// After the process, the last element on the queue is verified
// to be equal to the `root`.
//
// The `flags` array denotes whether the sibling
// should be popped from the queue (`flag == true`), or
// should be popped from the `proof` (`flag == false`).
/// @solidity memory-safe-assembly
assembly {
// If the number of flags is correct.
for {} eq(add(leaves.length, proof.length), add(flags.length, 1)) {} {
// For the case where `proof.length + leaves.length == 1`.
if iszero(flags.length) {
// `isValid = (proof.length == 1 ? proof[0] : leaves[0]) == root`.
// forgefmt: disable-next-item
isValid := eq(
calldataload(
xor(leaves.offset, mul(xor(proof.offset, leaves.offset), proof.length))
),
root
)
break
}
// The required final proof offset if `flagsLength` is not zero, otherwise zero.
let proofEnd := add(proof.offset, shl(5, proof.length))
// We can use the free memory space for the queue.
// We don't need to allocate, since the queue is temporary.
let hashesFront := mload(0x40)
// Copy the leaves into the hashes.
// Sometimes, a little memory expansion costs less than branching.
// Should cost less, even with a high free memory offset of 0x7d00.
calldatacopy(hashesFront, leaves.offset, shl(5, leaves.length))
// Compute the back of the hashes.
let hashesBack := add(hashesFront, shl(5, leaves.length))
// This is the end of the memory for the queue.
// We recycle `flagsLength` to save on stack variables (sometimes save gas).
flags.length := add(hashesBack, shl(5, flags.length))
// We don't need to make a copy of `proof.offset` or `flags.offset`,
// as they are pass-by-value (this trick may not always save gas).
for {} 1 {} {
// Pop from `hashes`.
let a := mload(hashesFront)
// Pop from `hashes`.
let b := mload(add(hashesFront, 0x20))
hashesFront := add(hashesFront, 0x40)
// If the flag is false, load the next proof,
// else, pops from the queue.
if iszero(calldataload(flags.offset)) {
// Loads the next proof.
b := calldataload(proof.offset)
proof.offset := add(proof.offset, 0x20)
// Unpop from `hashes`.
hashesFront := sub(hashesFront, 0x20)
}
// Advance to the next flag offset.
flags.offset := add(flags.offset, 0x20)
// Slot of `a` in scratch space.
// If the condition is true: 0x20, otherwise: 0x00.
let scratch := shl(5, gt(a, b))
// Hash the scratch space and push the result onto the queue.
mstore(scratch, a)
mstore(xor(scratch, 0x20), b)
mstore(hashesBack, keccak256(0x00, 0x40))
hashesBack := add(hashesBack, 0x20)
if iszero(lt(hashesBack, flags.length)) { break }
}
isValid :=
and(
// Checks if the last value in the queue is same as the root.
eq(mload(sub(hashesBack, 0x20)), root),
// And whether all the proofs are used, if required.
eq(proofEnd, proof.offset)
)
break
}
}
}
/*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
/* EMPTY CALLDATA HELPERS */
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/
/// @dev Returns an empty calldata bytes32 array.
function emptyProof() internal pure returns (bytes32[] calldata proof) {
/// @solidity memory-safe-assembly
assembly {
proof.length := 0
}
}
/// @dev Returns an empty calldata bytes32 array.
function emptyLeaves() internal pure returns (bytes32[] calldata leaves) {
/// @solidity memory-safe-assembly
assembly {
leaves.length := 0
}
}
/// @dev Returns an empty calldata bool array.
function emptyFlags() internal pure returns (bool[] calldata flags) {
/// @solidity memory-safe-assembly
assembly {
flags.length := 0
}
}
}{
"optimizer": {
"enabled": true,
"runs": 1
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"name":"BalanceEmpty","type":"error"},{"inputs":[],"name":"Blacklisted","type":"error"},{"inputs":[],"name":"Erc20BalanceTooLow","type":"error"},{"inputs":[],"name":"ExcessiveEthSent","type":"error"},{"inputs":[],"name":"InsufficientEthSent","type":"error"},{"inputs":[],"name":"InvalidAmountOfTokens","type":"error"},{"inputs":[],"name":"InvalidReferral","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"ListMaxSupplyExceeded","type":"error"},{"inputs":[],"name":"MaxBatchSizeExceeded","type":"error"},{"inputs":[],"name":"MaxSupplyExceeded","type":"error"},{"inputs":[],"name":"MintEnded","type":"error"},{"inputs":[],"name":"MintNotYetStarted","type":"error"},{"inputs":[],"name":"MintingPaused","type":"error"},{"inputs":[],"name":"NotApprovedToTransfer","type":"error"},{"inputs":[],"name":"NotShareholder","type":"error"},{"inputs":[],"name":"NotTokenOwner","type":"error"},{"inputs":[],"name":"NumberOfMintsExceeded","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"WalletUnauthorizedToMint","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"key","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"cid","type":"bytes32"}],"name":"BurnInvited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"key","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"cid","type":"bytes32"}],"name":"Invited","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"affiliate","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint128","name":"wad","type":"uint128"},{"indexed":false,"internalType":"uint256","name":"numMints","type":"uint256"}],"name":"Referral","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"src","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint128","name":"wad","type":"uint128"}],"name":"Withdrawal","type":"event"},{"inputs":[{"internalType":"address","name":"affiliate","type":"address"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"address","name":"affiliateSigner","type":"address"}],"name":"validateAffiliate","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"key","type":"bytes32"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"internalType":"struct Auth","name":"auth","type":"tuple"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"account","type":"address"}],"name":"verify","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"}]Contract Creation Code
61275861003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100825760003560e01c806305cdd44e14610087578063140fbc85146100a95780632a70e582146100c957806340fe1ac7146100f15780634c1b6fbc14610104578063704c38fc146101175780638e1ab86614610138578063f778d65d14610158575b600080fd5b81801561009357600080fd5b506100a76100a2366004611ed6565b61016b565b005b8180156100b557600080fd5b506100a76100c4366004611f8f565b6103b3565b6100dc6100d7366004611ff2565b6105d0565b60405190151581526020015b60405180910390f35b6100a76100ff366004612096565b610693565b6100a76101123660046120fd565b61076a565b61012a61012536600461222b565b610cb1565b6040519081526020016100e8565b81801561014457600080fd5b506100a7610153366004612288565b610ef7565b6100a76101663660046122f1565b611801565b60006001600160a01b038416156102765760018701546127109061019a90600160e01b900461ffff1684612397565b6101a491906123d8565b6001600160a01b03808616600090815260208881526040808320938d168352929052908120805492935083929091906101e79084906001600160801b03166123fe565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550836001600160a01b03167f8abfbe92bb62ff992ef6347c68d007f25a6e5aea2ad2f05e89f3486947cc0b2089838660405161026d939291906001600160a01b039390931683526001600160801b03919091166020830152604082015260600190565b60405180910390a25b6001600160a01b0388166000908152602087905260408120546001600160801b0316906102a38385612425565b90506102af81836123fe565b6001600160a01b038b16600081815260208b90526040902080546001600160801b0319166001600160801b039390931692909217909155156103a7578960006001600160a01b0382166323b872dd610305611d9d565b6040516001600160e01b031960e084901b1681526001600160a01b0390911660048201523060248201526001600160801b03891660448201526064016020604051808303816000875af1158015610360573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103849190612445565b9050806103a4576040516312171d8360e31b815260040160405180910390fd5b50505b50505050505050505050565b60006103bd611d9d565b905060005b828110156105c95760008484838181106103de576103de612462565b90506020020160208101906103f39190612478565b6001600160a01b03848116600090815260208981526040808320938516835292905290812080546001600160801b031981169091559192506001600160801b0390911690819003610457576040516321cd723f60e21b815260040160405180910390fd5b6001600160a01b0382166104ea576000846001600160a01b0316826001600160801b031660405160006040518083038185875af1925050503d80600081146104bb576040519150601f19603f3d011682016040523d82523d6000602084013e6104c0565b606091505b505080915050806104e4576040516312171d8360e31b815260040160405180910390fd5b50610583565b60405163a9059cbb60e01b815282906000906001600160a01b0383169063a9059cbb9061051d9089908790600401612495565b6020604051808303816000875af115801561053c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105609190612445565b905080610580576040516312171d8360e31b815260040160405180910390fd5b50505b836001600160a01b031660008051602061270383398151915283836040516105ac929190612495565b60405180910390a2505080806105c1906124b7565b9150506103c2565b5050505050565b600060ff843511158061060c5750826040516020016105ef91906124d0565b604051602081830303815290604052805190602001208460000135145b156106195750600161068c565b61068961062960208601866124e8565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506040518835925061066e915086906020016124d0565b60405160208183030381529060405280519060200120611dc4565b90505b9392505050565b60006106ea856040516020016106a991906124d0565b604051602081830303815290604052805190602001206020527b19457468657265756d205369676e6564204d6573736167653a0a3332600052603c60042090565b9050600061072e8286868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611e0692505050565b9050826001600160a01b0316816001600160a01b03161461076257604051638baa579f60e01b815260040160405180910390fd5b505050505050565b6000610774611d9d565b60208401519091506001600160a01b0316156108315760208301516001600160a01b0316738952caf7e5bf1fe63ebe94148ca802f3ef127c9814806107d2575082600001516001600160a01b031683602001516001600160a01b0316145b806107f25750806001600160a01b031683602001516001600160a01b0316145b156108105760405163119833d760e11b815260040160405180910390fd5b602083015160018901546108319190879087906001600160a01b0316610693565b6001890154600160c01b900463ffffffff16600003610863576040516375ab03ab60e11b815260040160405180910390fd5b6002890154600160e01b900460ff166108b9576002890154610897908890600160401b90046001600160a01b0316836105d0565b6108b45760405163d838648f60e01b815260040160405180910390fd5b6108f8565b60028901546108da908890600160401b90046001600160a01b0316836105d0565b156108f8576040516309550c7760e01b815260040160405180910390fd5b6001890154600160801b900463ffffffff1642101561092a57604051630e91d3a160e11b815260040160405180910390fd5b600189015463ffffffff600160801b82048116600160a01b9092041611801561096357506001890154600160a01b900463ffffffff1642115b156109815760405163124212e560e21b815260040160405180910390fd5b600189015463ffffffff600160e01b82048116600160c01b909204161015610a0b576040808401516001600160a01b038316600090815260208981528382208b3583529052918220546109d49190612531565b60018b0154909150600160c01b900463ffffffff16811115610a09576040516315fcbc9d60e01b815260040160405180910390fd5b505b600188810154908a0154600160a01b90910463ffffffff908116600160e01b909204161015610a8157600083604001518460800151610a4a9190612531565b60018b0154909150600160e01b900463ffffffff16811115610a7f5760405163103f447360e31b815260040160405180910390fd5b505b60018801546040840151600160c01b90910463ffffffff161015610ab857604051637a7e96df60e01b815260040160405180910390fd5b600188015460408401516060850151600160a01b90920463ffffffff1691610ae09190612531565b1115610aff57604051638a164f6360e01b815260040160405180910390fd5b6002890154600160401b90046001600160a01b031615610c7c576002890154604051636eb1769f60e11b8152600160401b9091046001600160a01b0316906001600160801b03841690829063dd62ed3e90610b60908690309060040161254a565b602060405180830381865afa158015610b7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba19190612564565b1015610bc0576040516302df483560e21b815260040160405180910390fd5b6040516370a0823160e01b81526001600160801b038416906001600160a01b038316906370a0823190610bf790869060040161257d565b602060405180830381865afa158015610c14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c389190612564565b1015610c575760405163046abae760e31b815260040160405180910390fd5b3415610c76576040516301b2422760e61b815260040160405180910390fd5b50610ca6565b816001600160801b0316341015610ca65760405163f244866f60e01b815260040160405180910390fd5b505050505050505050565b845460028601546000916001600160801b031690829063ffffffff1615801590610ce7575060018801546001600160801b031615155b15610e1257600188015460028901546000916001600160801b0381169163ffffffff90811691610d2091600160801b9091041642612591565b610d2a91906125a4565b610d3491906125b8565b8954909150600160801b90046001600160801b0316831115610d9d578854610d6c90600160801b90046001600160801b031684612591565b811115610d8c578854600160801b90046001600160801b03169250610e00565b610d968184612591565b9250610e00565b8854600160801b90046001600160801b0316831015610e00578854610dd3908490600160801b90046001600160801b0316612591565b811115610df3578854600160801b90046001600160801b03169250610e00565b610dfd8184612531565b92505b610e0a87846125b8565b915050610ebe565b600288015463ffffffff16158015610e36575060018801546001600160801b031615155b15610eb1576001880154600090610e579087906001600160801b03166125b8565b610e619084612531565b90506002610e70600189612591565b60018b0154610e89908a906001600160801b03166125b8565b610e9391906125b8565b610e9d91906125a4565b610ea788836125b8565b610e0a9190612531565b610ebb86836125b8565b90505b8315610eec57612710610ed561ffff8916836125b8565b610edf91906125a4565b610ee99082612591565b90505b979650505050505050565b6000610f01611d9d565b905060005b828110156117f8576000848483818110610f2257610f22612462565b9050602002016020810190610f379190612478565b90506000866001600160a01b0316846001600160a01b03161480610f7757506001600160a01b038416738952caf7e5bf1fe63ebe94148ca802f3ef127c98145b80610f95575088546001600160a01b03858116600160401b90920416145b80610faf575060018901546001600160a01b038581169116145b80610fc9575060028901546001600160a01b038581169116145b1561100557506001600160a01b038116600090815260208890526040902080546001600160801b031981169091556001600160801b031661101e565b60405163650a61e160e01b815260040160405180910390fd5b806001600160801b0316600003611048576040516321cd723f60e21b815260040160405180910390fd5b60028901546001600160a01b03166113535760408051600480825260a0820190925260009160208201608080368337019050509050878160008151811061109157611091612462565b60200260200101906001600160a01b031690816001600160a01b031681525050738952caf7e5bf1fe63ebe94148ca802f3ef127c98816001815181106110d9576110d9612462565b6001600160a01b0392831660209182029290920101528a548251600160401b909104909116908290600290811061111257611112612462565b6001600160a01b03928316602091820292909201015260018b015482519116908290600390811061114557611145612462565b6001600160a01b039290921660209283029190910182015260408051600480825260a08201909252600092909190820160808036833750508c54825192935061ffff169183915060009061119b5761119b612462565b61ffff92831660209182029290920101528b5482516201000090910490911690829060019081106111ce576111ce612462565b61ffff92831660209182029290920101528b548251600160201b909104909116908290600290811061120257611202612462565b61ffff92831660209182029290920101528b548251600160301b909104909116908290600390811061123657611236612462565b61ffff909216602092830291909101909101526001600160a01b0384166112d9576040516001627d6bf960e11b0319815273aafdfa4a935d8511bf285af11a0544ce7e4a11999063ff05280e906001600160801b038616906112a2908790899088908890600401612647565b6000604051808303818588803b1580156112bb57600080fd5b505af11580156112cf573d6000803e3d6000fd5b505050505061134c565b6040516001627d6bf960e11b0319815273aafdfa4a935d8511bf285af11a0544ce7e4a11999063ff05280e90611319908690889087908790600401612647565b600060405180830381600087803b15801561133357600080fd5b505af1158015611347573d6000803e3d6000fd5b505050505b50506117b2565b8854600090612710906113739061ffff166001600160801b0385166125b8565b61137d91906125a4565b90506000611394826001600160801b038516612591565b90506001600160a01b0384166114205760028b01546040516000916001600160a01b03169084908381818185875af1925050503d80600081146113f3576040519150601f19603f3d011682016040523d82523d6000602084013e6113f8565b606091505b505090508061141a576040516312171d8360e31b815260040160405180910390fd5b5061149b565b60028b015460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018490529085169063a9059cbb906044016020604051808303816000875af1158015611475573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114999190612445565b505b6040805160038082526080820190925260009160208201606080368337019050509050738952caf7e5bf1fe63ebe94148ca802f3ef127c98816000815181106114e6576114e6612462565b6001600160a01b0392831660209182029290920101528c548251600160401b909104909116908290600190811061151f5761151f612462565b6001600160a01b03928316602091820292909201015260018d015482519116908290600290811061155257611552612462565b6001600160a01b039290921660209283029190910182015260408051600380825260808201909252600092909190820160608036833750508e549192506000916115a3915061ffff1661271061268c565b8e5490915061ffff808316916115c491600160201b909104166127106125b8565b6115ce91906125a4565b826001815181106115e1576115e1612462565b61ffff92831660209182029290920101528e548282169161160c91600160301b9004166127106125b8565b61161691906125a4565b8260028151811061162957611629612462565b602002602001019061ffff16908161ffff16815250508160028151811061165257611652612462565b60200260200101518260018151811061166d5761166d612462565b6020026020010151612710611682919061268c565b61168c919061268c565b8260008151811061169f5761169f612462565b61ffff909216602092830291909101909101526001600160a01b038716611739576040516001627d6bf960e11b0319815273aafdfa4a935d8511bf285af11a0544ce7e4a11999063ff05280e9086906117029082908c90899089906004016126a7565b6000604051808303818588803b15801561171b57600080fd5b505af115801561172f573d6000803e3d6000fd5b50505050506117ac565b6040516001627d6bf960e11b0319815273aafdfa4a935d8511bf285af11a0544ce7e4a11999063ff05280e906117799087908b90889088906004016126a7565b600060405180830381600087803b15801561179357600080fd5b505af11580156117a7573d6000803e3d6000fd5b505050505b50505050505b836001600160a01b031660008051602061270383398151915283836040516117db929190612495565b60405180910390a2505080806117f0906124b7565b915050610f06565b50505050505050565b60048801546001600160401b031660000361182f576040516375ab03ab60e11b815260040160405180910390fd5b6003880154600160981b900463ffffffff1642101561186157604051630e91d3a160e11b815260040160405180910390fd5b600388015463ffffffff600160981b82048116600160b81b9092041611801561189a57506003880154600160b81b900463ffffffff1642115b156118b85760405163124212e560e21b815260040160405180910390fd5b60006118c2611d9d565b905060005b8581101561198a5789546001600160a01b038084169116636352211e8989858181106118f5576118f5612462565b905060200201356040518263ffffffff1660e01b815260040161191a91815260200190565b602060405180830381865afa158015611937573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195b91906126d1565b6001600160a01b031614611982576040516359dc379f60e01b815260040160405180910390fd5b6001016118c7565b5060028901546119a59088906001600160a01b0316836105d0565b6119c25760405163d838648f60e01b815260040160405180910390fd5b885460405163e985e9c560e01b81526001600160a01b039091169063e985e9c5906119f3908490309060040161254a565b602060405180830381865afa158015611a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a349190612445565b611a51576040516302df483560e21b815260040160405180910390fd5b6003890154600090600160801b900460ff1615611a895760038a0154611a8290600160881b900461ffff16876125b8565b9050611ade565b60038a0154611aa390600160881b900461ffff16876126ee565b15611ac157604051630421c69d60e31b815260040160405180910390fd5b60038a0154611adb90600160881b900461ffff16876125a4565b90505b6001890154600160c01b900463ffffffff16811115611b1057604051637a7e96df60e01b815260040160405180910390fd5b600189015460048b0154600160a01b90910463ffffffff166001600160401b039091161015611bc8576001600160a01b038216600090815260208581526040808320815163313ab93760e11b818501528c3560248083019190915283518083039091018152604490910183528051908401208452909152812054611b95908390612531565b60048c01549091506001600160401b0316811115611bc6576040516315fcbc9d60e01b815260040160405180910390fd5b505b6001890154600160a01b900463ffffffff16611be48287612531565b1115611c0357604051638a164f6360e01b815260040160405180910390fd5b60028a01546001600160a01b031615611d735760028a0154604051636eb1769f60e11b81526001600160a01b03909116906001600160801b03851690829063dd62ed3e90611c57908790309060040161254a565b602060405180830381865afa158015611c74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c989190612564565b1015611cb7576040516302df483560e21b815260040160405180910390fd5b6040516370a0823160e01b81526001600160801b038516906001600160a01b038316906370a0823190611cee90879060040161257d565b602060405180830381865afa158015611d0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d2f9190612564565b1015611d4e5760405163046abae760e31b815260040160405180910390fd5b3415611d6d576040516301b2422760e61b815260040160405180910390fd5b506103a7565b826001600160801b03163410156103a75760405163f244866f60e01b815260040160405180910390fd5b60003373ea49e7be310716da66725c84a5127d2f6a202eaf14611dbf57503390565b503290565b6000835115611dff5760208401845160051b81015b8151841160051b938452815160209485185260406000209390910190808210611dd95750505b5014919050565b6040516001908360005260208301516040526040835103611e4257604083015160ff81901c601b016020526001600160ff1b0316606052611e68565b6041835103611e6357606083015160001a6020526040830151606052611e68565b600091505b6020600160806000855afa5191503d611e8957638baa579f6000526004601cfd5b600060605260405292915050565b6001600160a01b0381168114611eac57600080fd5b50565b8035611eba81611e97565b919050565b80356001600160801b0381168114611eba57600080fd5b600080600080600080600060e0888a031215611ef157600080fd5b8735611efc81611e97565b96506020880135955060408801359450606088013593506080880135611f2181611e97565b925060a08801359150611f3660c08901611ebf565b905092959891949750929550565b60008083601f840112611f5657600080fd5b5081356001600160401b03811115611f6d57600080fd5b6020830191508360208260051b8501011115611f8857600080fd5b9250929050565b600080600060408486031215611fa457600080fd5b8335925060208401356001600160401b03811115611fc157600080fd5b611fcd86828701611f44565b9497909650939450505050565b600060408284031215611fec57600080fd5b50919050565b60008060006060848603121561200757600080fd5b83356001600160401b0381111561201d57600080fd5b61202986828701611fda565b935050602084013561203a81611e97565b9150604084013561204a81611e97565b809150509250925092565b60008083601f84011261206757600080fd5b5081356001600160401b0381111561207e57600080fd5b602083019150836020828501011115611f8857600080fd5b600080600080606085870312156120ac57600080fd5b84356120b781611e97565b935060208501356001600160401b038111156120d257600080fd5b6120de87828801612055565b90945092505060408501356120f281611e97565b939692955090935050565b600080600080600080600080888a0361016081121561211b57600080fd5b8935985060208a0135975060408a01356001600160401b038082111561214057600080fd5b61214c8d838e01611fda565b985060608c0135975060808c013591508082111561216957600080fd5b6121758d838e01612055565b909750955085915060a0609f198401121561218f57600080fd5b604051925060a08301915082821081831117156121bc57634e487b7160e01b600052604160045260246000fd5b506040526121cc60a08b01611eaf565b81526121da60c08b01611eaf565b602082015260e08a013560408201526101008a013560608201526101208a01356080820152915061220e6101408a01611ebf565b90509295985092959890939650565b8015158114611eac57600080fd5b600080600080600060a0868803121561224357600080fd5b85359450602086013561ffff8116811461225c57600080fd5b93506040860135925060608601359150608086013561227a8161221d565b809150509295509295909350565b6000806000806000608086880312156122a057600080fd5b853594506020860135935060408601356122b981611e97565b925060608601356001600160401b038111156122d457600080fd5b6122e088828901611f44565b969995985093965092949392505050565b60008060008060008060008060e0898b03121561230d57600080fd5b883597506020890135965060408901356001600160401b038082111561233257600080fd5b61233e8c838d01611fda565b975060608b013591508082111561235457600080fd5b506123618b828c01611f44565b9096509450506080890135925060a0890135915061220e60c08a01611ebf565b634e487b7160e01b600052601160045260246000fd5b6001600160801b038181168382160280821691908281146123ba576123ba612381565b505092915050565b634e487b7160e01b600052601260045260246000fd5b60006001600160801b03838116806123f2576123f26123c2565b92169190910492915050565b6001600160801b0381811683821601908082111561241e5761241e612381565b5092915050565b6001600160801b0382811682821603908082111561241e5761241e612381565b60006020828403121561245757600080fd5b815161068c8161221d565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561248a57600080fd5b813561068c81611e97565b6001600160a01b039290921682526001600160801b0316602082015260400190565b6000600182016124c9576124c9612381565b5060010190565b60609190911b6001600160601b031916815260140190565b6000808335601e198436030181126124ff57600080fd5b8301803591506001600160401b0382111561251957600080fd5b6020019150600581901b3603821315611f8857600080fd5b8082018082111561254457612544612381565b92915050565b6001600160a01b0392831681529116602082015260400190565b60006020828403121561257657600080fd5b5051919050565b6001600160a01b0391909116815260200190565b8181038181111561254457612544612381565b6000826125b3576125b36123c2565b500490565b808202811582820484141761254457612544612381565b600081518084526020808501945080840160005b838110156126085781516001600160a01b0316875295820195908201906001016125e3565b509495945050505050565b600081518084526020808501945080840160005b8381101561260857815161ffff1687529582019590820190600101612627565b6001600160801b03851681526001600160a01b038416602082015260806040820181905260009061267a908301856125cf565b8281036060840152610eec8185612613565b61ffff82811682821603908082111561241e5761241e612381565b8481526001600160a01b038416602082015260806040820181905260009061267a908301856125cf565b6000602082840312156126e357600080fd5b815161068c81611e97565b6000826126fd576126fd6123c2565b50069056fe02128911bc7070fd6c100b116c2dd9a3bb6bf132d5259a65ca8d0c86ccd78f49a2646970667358221220a6f183c2f75746ba144248ded18cbdb20ceba938690fc06f4ea69b2c1d67823264736f6c63430008140033
Deployed Bytecode
0x73e3aceb398937126cd8bcebbbcfc0b5a08742ab1530146080604052600436106100825760003560e01c806305cdd44e14610087578063140fbc85146100a95780632a70e582146100c957806340fe1ac7146100f15780634c1b6fbc14610104578063704c38fc146101175780638e1ab86614610138578063f778d65d14610158575b600080fd5b81801561009357600080fd5b506100a76100a2366004611ed6565b61016b565b005b8180156100b557600080fd5b506100a76100c4366004611f8f565b6103b3565b6100dc6100d7366004611ff2565b6105d0565b60405190151581526020015b60405180910390f35b6100a76100ff366004612096565b610693565b6100a76101123660046120fd565b61076a565b61012a61012536600461222b565b610cb1565b6040519081526020016100e8565b81801561014457600080fd5b506100a7610153366004612288565b610ef7565b6100a76101663660046122f1565b611801565b60006001600160a01b038416156102765760018701546127109061019a90600160e01b900461ffff1684612397565b6101a491906123d8565b6001600160a01b03808616600090815260208881526040808320938d168352929052908120805492935083929091906101e79084906001600160801b03166123fe565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550836001600160a01b03167f8abfbe92bb62ff992ef6347c68d007f25a6e5aea2ad2f05e89f3486947cc0b2089838660405161026d939291906001600160a01b039390931683526001600160801b03919091166020830152604082015260600190565b60405180910390a25b6001600160a01b0388166000908152602087905260408120546001600160801b0316906102a38385612425565b90506102af81836123fe565b6001600160a01b038b16600081815260208b90526040902080546001600160801b0319166001600160801b039390931692909217909155156103a7578960006001600160a01b0382166323b872dd610305611d9d565b6040516001600160e01b031960e084901b1681526001600160a01b0390911660048201523060248201526001600160801b03891660448201526064016020604051808303816000875af1158015610360573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103849190612445565b9050806103a4576040516312171d8360e31b815260040160405180910390fd5b50505b50505050505050505050565b60006103bd611d9d565b905060005b828110156105c95760008484838181106103de576103de612462565b90506020020160208101906103f39190612478565b6001600160a01b03848116600090815260208981526040808320938516835292905290812080546001600160801b031981169091559192506001600160801b0390911690819003610457576040516321cd723f60e21b815260040160405180910390fd5b6001600160a01b0382166104ea576000846001600160a01b0316826001600160801b031660405160006040518083038185875af1925050503d80600081146104bb576040519150601f19603f3d011682016040523d82523d6000602084013e6104c0565b606091505b505080915050806104e4576040516312171d8360e31b815260040160405180910390fd5b50610583565b60405163a9059cbb60e01b815282906000906001600160a01b0383169063a9059cbb9061051d9089908790600401612495565b6020604051808303816000875af115801561053c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105609190612445565b905080610580576040516312171d8360e31b815260040160405180910390fd5b50505b836001600160a01b031660008051602061270383398151915283836040516105ac929190612495565b60405180910390a2505080806105c1906124b7565b9150506103c2565b5050505050565b600060ff843511158061060c5750826040516020016105ef91906124d0565b604051602081830303815290604052805190602001208460000135145b156106195750600161068c565b61068961062960208601866124e8565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506040518835925061066e915086906020016124d0565b60405160208183030381529060405280519060200120611dc4565b90505b9392505050565b60006106ea856040516020016106a991906124d0565b604051602081830303815290604052805190602001206020527b19457468657265756d205369676e6564204d6573736167653a0a3332600052603c60042090565b9050600061072e8286868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611e0692505050565b9050826001600160a01b0316816001600160a01b03161461076257604051638baa579f60e01b815260040160405180910390fd5b505050505050565b6000610774611d9d565b60208401519091506001600160a01b0316156108315760208301516001600160a01b0316738952caf7e5bf1fe63ebe94148ca802f3ef127c9814806107d2575082600001516001600160a01b031683602001516001600160a01b0316145b806107f25750806001600160a01b031683602001516001600160a01b0316145b156108105760405163119833d760e11b815260040160405180910390fd5b602083015160018901546108319190879087906001600160a01b0316610693565b6001890154600160c01b900463ffffffff16600003610863576040516375ab03ab60e11b815260040160405180910390fd5b6002890154600160e01b900460ff166108b9576002890154610897908890600160401b90046001600160a01b0316836105d0565b6108b45760405163d838648f60e01b815260040160405180910390fd5b6108f8565b60028901546108da908890600160401b90046001600160a01b0316836105d0565b156108f8576040516309550c7760e01b815260040160405180910390fd5b6001890154600160801b900463ffffffff1642101561092a57604051630e91d3a160e11b815260040160405180910390fd5b600189015463ffffffff600160801b82048116600160a01b9092041611801561096357506001890154600160a01b900463ffffffff1642115b156109815760405163124212e560e21b815260040160405180910390fd5b600189015463ffffffff600160e01b82048116600160c01b909204161015610a0b576040808401516001600160a01b038316600090815260208981528382208b3583529052918220546109d49190612531565b60018b0154909150600160c01b900463ffffffff16811115610a09576040516315fcbc9d60e01b815260040160405180910390fd5b505b600188810154908a0154600160a01b90910463ffffffff908116600160e01b909204161015610a8157600083604001518460800151610a4a9190612531565b60018b0154909150600160e01b900463ffffffff16811115610a7f5760405163103f447360e31b815260040160405180910390fd5b505b60018801546040840151600160c01b90910463ffffffff161015610ab857604051637a7e96df60e01b815260040160405180910390fd5b600188015460408401516060850151600160a01b90920463ffffffff1691610ae09190612531565b1115610aff57604051638a164f6360e01b815260040160405180910390fd5b6002890154600160401b90046001600160a01b031615610c7c576002890154604051636eb1769f60e11b8152600160401b9091046001600160a01b0316906001600160801b03841690829063dd62ed3e90610b60908690309060040161254a565b602060405180830381865afa158015610b7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ba19190612564565b1015610bc0576040516302df483560e21b815260040160405180910390fd5b6040516370a0823160e01b81526001600160801b038416906001600160a01b038316906370a0823190610bf790869060040161257d565b602060405180830381865afa158015610c14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c389190612564565b1015610c575760405163046abae760e31b815260040160405180910390fd5b3415610c76576040516301b2422760e61b815260040160405180910390fd5b50610ca6565b816001600160801b0316341015610ca65760405163f244866f60e01b815260040160405180910390fd5b505050505050505050565b845460028601546000916001600160801b031690829063ffffffff1615801590610ce7575060018801546001600160801b031615155b15610e1257600188015460028901546000916001600160801b0381169163ffffffff90811691610d2091600160801b9091041642612591565b610d2a91906125a4565b610d3491906125b8565b8954909150600160801b90046001600160801b0316831115610d9d578854610d6c90600160801b90046001600160801b031684612591565b811115610d8c578854600160801b90046001600160801b03169250610e00565b610d968184612591565b9250610e00565b8854600160801b90046001600160801b0316831015610e00578854610dd3908490600160801b90046001600160801b0316612591565b811115610df3578854600160801b90046001600160801b03169250610e00565b610dfd8184612531565b92505b610e0a87846125b8565b915050610ebe565b600288015463ffffffff16158015610e36575060018801546001600160801b031615155b15610eb1576001880154600090610e579087906001600160801b03166125b8565b610e619084612531565b90506002610e70600189612591565b60018b0154610e89908a906001600160801b03166125b8565b610e9391906125b8565b610e9d91906125a4565b610ea788836125b8565b610e0a9190612531565b610ebb86836125b8565b90505b8315610eec57612710610ed561ffff8916836125b8565b610edf91906125a4565b610ee99082612591565b90505b979650505050505050565b6000610f01611d9d565b905060005b828110156117f8576000848483818110610f2257610f22612462565b9050602002016020810190610f379190612478565b90506000866001600160a01b0316846001600160a01b03161480610f7757506001600160a01b038416738952caf7e5bf1fe63ebe94148ca802f3ef127c98145b80610f95575088546001600160a01b03858116600160401b90920416145b80610faf575060018901546001600160a01b038581169116145b80610fc9575060028901546001600160a01b038581169116145b1561100557506001600160a01b038116600090815260208890526040902080546001600160801b031981169091556001600160801b031661101e565b60405163650a61e160e01b815260040160405180910390fd5b806001600160801b0316600003611048576040516321cd723f60e21b815260040160405180910390fd5b60028901546001600160a01b03166113535760408051600480825260a0820190925260009160208201608080368337019050509050878160008151811061109157611091612462565b60200260200101906001600160a01b031690816001600160a01b031681525050738952caf7e5bf1fe63ebe94148ca802f3ef127c98816001815181106110d9576110d9612462565b6001600160a01b0392831660209182029290920101528a548251600160401b909104909116908290600290811061111257611112612462565b6001600160a01b03928316602091820292909201015260018b015482519116908290600390811061114557611145612462565b6001600160a01b039290921660209283029190910182015260408051600480825260a08201909252600092909190820160808036833750508c54825192935061ffff169183915060009061119b5761119b612462565b61ffff92831660209182029290920101528b5482516201000090910490911690829060019081106111ce576111ce612462565b61ffff92831660209182029290920101528b548251600160201b909104909116908290600290811061120257611202612462565b61ffff92831660209182029290920101528b548251600160301b909104909116908290600390811061123657611236612462565b61ffff909216602092830291909101909101526001600160a01b0384166112d9576040516001627d6bf960e11b0319815273aafdfa4a935d8511bf285af11a0544ce7e4a11999063ff05280e906001600160801b038616906112a2908790899088908890600401612647565b6000604051808303818588803b1580156112bb57600080fd5b505af11580156112cf573d6000803e3d6000fd5b505050505061134c565b6040516001627d6bf960e11b0319815273aafdfa4a935d8511bf285af11a0544ce7e4a11999063ff05280e90611319908690889087908790600401612647565b600060405180830381600087803b15801561133357600080fd5b505af1158015611347573d6000803e3d6000fd5b505050505b50506117b2565b8854600090612710906113739061ffff166001600160801b0385166125b8565b61137d91906125a4565b90506000611394826001600160801b038516612591565b90506001600160a01b0384166114205760028b01546040516000916001600160a01b03169084908381818185875af1925050503d80600081146113f3576040519150601f19603f3d011682016040523d82523d6000602084013e6113f8565b606091505b505090508061141a576040516312171d8360e31b815260040160405180910390fd5b5061149b565b60028b015460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018490529085169063a9059cbb906044016020604051808303816000875af1158015611475573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114999190612445565b505b6040805160038082526080820190925260009160208201606080368337019050509050738952caf7e5bf1fe63ebe94148ca802f3ef127c98816000815181106114e6576114e6612462565b6001600160a01b0392831660209182029290920101528c548251600160401b909104909116908290600190811061151f5761151f612462565b6001600160a01b03928316602091820292909201015260018d015482519116908290600290811061155257611552612462565b6001600160a01b039290921660209283029190910182015260408051600380825260808201909252600092909190820160608036833750508e549192506000916115a3915061ffff1661271061268c565b8e5490915061ffff808316916115c491600160201b909104166127106125b8565b6115ce91906125a4565b826001815181106115e1576115e1612462565b61ffff92831660209182029290920101528e548282169161160c91600160301b9004166127106125b8565b61161691906125a4565b8260028151811061162957611629612462565b602002602001019061ffff16908161ffff16815250508160028151811061165257611652612462565b60200260200101518260018151811061166d5761166d612462565b6020026020010151612710611682919061268c565b61168c919061268c565b8260008151811061169f5761169f612462565b61ffff909216602092830291909101909101526001600160a01b038716611739576040516001627d6bf960e11b0319815273aafdfa4a935d8511bf285af11a0544ce7e4a11999063ff05280e9086906117029082908c90899089906004016126a7565b6000604051808303818588803b15801561171b57600080fd5b505af115801561172f573d6000803e3d6000fd5b50505050506117ac565b6040516001627d6bf960e11b0319815273aafdfa4a935d8511bf285af11a0544ce7e4a11999063ff05280e906117799087908b90889088906004016126a7565b600060405180830381600087803b15801561179357600080fd5b505af11580156117a7573d6000803e3d6000fd5b505050505b50505050505b836001600160a01b031660008051602061270383398151915283836040516117db929190612495565b60405180910390a2505080806117f0906124b7565b915050610f06565b50505050505050565b60048801546001600160401b031660000361182f576040516375ab03ab60e11b815260040160405180910390fd5b6003880154600160981b900463ffffffff1642101561186157604051630e91d3a160e11b815260040160405180910390fd5b600388015463ffffffff600160981b82048116600160b81b9092041611801561189a57506003880154600160b81b900463ffffffff1642115b156118b85760405163124212e560e21b815260040160405180910390fd5b60006118c2611d9d565b905060005b8581101561198a5789546001600160a01b038084169116636352211e8989858181106118f5576118f5612462565b905060200201356040518263ffffffff1660e01b815260040161191a91815260200190565b602060405180830381865afa158015611937573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195b91906126d1565b6001600160a01b031614611982576040516359dc379f60e01b815260040160405180910390fd5b6001016118c7565b5060028901546119a59088906001600160a01b0316836105d0565b6119c25760405163d838648f60e01b815260040160405180910390fd5b885460405163e985e9c560e01b81526001600160a01b039091169063e985e9c5906119f3908490309060040161254a565b602060405180830381865afa158015611a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a349190612445565b611a51576040516302df483560e21b815260040160405180910390fd5b6003890154600090600160801b900460ff1615611a895760038a0154611a8290600160881b900461ffff16876125b8565b9050611ade565b60038a0154611aa390600160881b900461ffff16876126ee565b15611ac157604051630421c69d60e31b815260040160405180910390fd5b60038a0154611adb90600160881b900461ffff16876125a4565b90505b6001890154600160c01b900463ffffffff16811115611b1057604051637a7e96df60e01b815260040160405180910390fd5b600189015460048b0154600160a01b90910463ffffffff166001600160401b039091161015611bc8576001600160a01b038216600090815260208581526040808320815163313ab93760e11b818501528c3560248083019190915283518083039091018152604490910183528051908401208452909152812054611b95908390612531565b60048c01549091506001600160401b0316811115611bc6576040516315fcbc9d60e01b815260040160405180910390fd5b505b6001890154600160a01b900463ffffffff16611be48287612531565b1115611c0357604051638a164f6360e01b815260040160405180910390fd5b60028a01546001600160a01b031615611d735760028a0154604051636eb1769f60e11b81526001600160a01b03909116906001600160801b03851690829063dd62ed3e90611c57908790309060040161254a565b602060405180830381865afa158015611c74573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c989190612564565b1015611cb7576040516302df483560e21b815260040160405180910390fd5b6040516370a0823160e01b81526001600160801b038516906001600160a01b038316906370a0823190611cee90879060040161257d565b602060405180830381865afa158015611d0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d2f9190612564565b1015611d4e5760405163046abae760e31b815260040160405180910390fd5b3415611d6d576040516301b2422760e61b815260040160405180910390fd5b506103a7565b826001600160801b03163410156103a75760405163f244866f60e01b815260040160405180910390fd5b60003373ea49e7be310716da66725c84a5127d2f6a202eaf14611dbf57503390565b503290565b6000835115611dff5760208401845160051b81015b8151841160051b938452815160209485185260406000209390910190808210611dd95750505b5014919050565b6040516001908360005260208301516040526040835103611e4257604083015160ff81901c601b016020526001600160ff1b0316606052611e68565b6041835103611e6357606083015160001a6020526040830151606052611e68565b600091505b6020600160806000855afa5191503d611e8957638baa579f6000526004601cfd5b600060605260405292915050565b6001600160a01b0381168114611eac57600080fd5b50565b8035611eba81611e97565b919050565b80356001600160801b0381168114611eba57600080fd5b600080600080600080600060e0888a031215611ef157600080fd5b8735611efc81611e97565b96506020880135955060408801359450606088013593506080880135611f2181611e97565b925060a08801359150611f3660c08901611ebf565b905092959891949750929550565b60008083601f840112611f5657600080fd5b5081356001600160401b03811115611f6d57600080fd5b6020830191508360208260051b8501011115611f8857600080fd5b9250929050565b600080600060408486031215611fa457600080fd5b8335925060208401356001600160401b03811115611fc157600080fd5b611fcd86828701611f44565b9497909650939450505050565b600060408284031215611fec57600080fd5b50919050565b60008060006060848603121561200757600080fd5b83356001600160401b0381111561201d57600080fd5b61202986828701611fda565b935050602084013561203a81611e97565b9150604084013561204a81611e97565b809150509250925092565b60008083601f84011261206757600080fd5b5081356001600160401b0381111561207e57600080fd5b602083019150836020828501011115611f8857600080fd5b600080600080606085870312156120ac57600080fd5b84356120b781611e97565b935060208501356001600160401b038111156120d257600080fd5b6120de87828801612055565b90945092505060408501356120f281611e97565b939692955090935050565b600080600080600080600080888a0361016081121561211b57600080fd5b8935985060208a0135975060408a01356001600160401b038082111561214057600080fd5b61214c8d838e01611fda565b985060608c0135975060808c013591508082111561216957600080fd5b6121758d838e01612055565b909750955085915060a0609f198401121561218f57600080fd5b604051925060a08301915082821081831117156121bc57634e487b7160e01b600052604160045260246000fd5b506040526121cc60a08b01611eaf565b81526121da60c08b01611eaf565b602082015260e08a013560408201526101008a013560608201526101208a01356080820152915061220e6101408a01611ebf565b90509295985092959890939650565b8015158114611eac57600080fd5b600080600080600060a0868803121561224357600080fd5b85359450602086013561ffff8116811461225c57600080fd5b93506040860135925060608601359150608086013561227a8161221d565b809150509295509295909350565b6000806000806000608086880312156122a057600080fd5b853594506020860135935060408601356122b981611e97565b925060608601356001600160401b038111156122d457600080fd5b6122e088828901611f44565b969995985093965092949392505050565b60008060008060008060008060e0898b03121561230d57600080fd5b883597506020890135965060408901356001600160401b038082111561233257600080fd5b61233e8c838d01611fda565b975060608b013591508082111561235457600080fd5b506123618b828c01611f44565b9096509450506080890135925060a0890135915061220e60c08a01611ebf565b634e487b7160e01b600052601160045260246000fd5b6001600160801b038181168382160280821691908281146123ba576123ba612381565b505092915050565b634e487b7160e01b600052601260045260246000fd5b60006001600160801b03838116806123f2576123f26123c2565b92169190910492915050565b6001600160801b0381811683821601908082111561241e5761241e612381565b5092915050565b6001600160801b0382811682821603908082111561241e5761241e612381565b60006020828403121561245757600080fd5b815161068c8161221d565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561248a57600080fd5b813561068c81611e97565b6001600160a01b039290921682526001600160801b0316602082015260400190565b6000600182016124c9576124c9612381565b5060010190565b60609190911b6001600160601b031916815260140190565b6000808335601e198436030181126124ff57600080fd5b8301803591506001600160401b0382111561251957600080fd5b6020019150600581901b3603821315611f8857600080fd5b8082018082111561254457612544612381565b92915050565b6001600160a01b0392831681529116602082015260400190565b60006020828403121561257657600080fd5b5051919050565b6001600160a01b0391909116815260200190565b8181038181111561254457612544612381565b6000826125b3576125b36123c2565b500490565b808202811582820484141761254457612544612381565b600081518084526020808501945080840160005b838110156126085781516001600160a01b0316875295820195908201906001016125e3565b509495945050505050565b600081518084526020808501945080840160005b8381101561260857815161ffff1687529582019590820190600101612627565b6001600160801b03851681526001600160a01b038416602082015260806040820181905260009061267a908301856125cf565b8281036060840152610eec8185612613565b61ffff82811682821603908082111561241e5761241e612381565b8481526001600160a01b038416602082015260806040820181905260009061267a908301856125cf565b6000602082840312156126e357600080fd5b815161068c81611e97565b6000826126fd576126fd6123c2565b50069056fe02128911bc7070fd6c100b116c2dd9a3bb6bf132d5259a65ca8d0c86ccd78f49a2646970667358221220a6f183c2f75746ba144248ded18cbdb20ceba938690fc06f4ea69b2c1d67823264736f6c63430008140033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in MNT
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.