Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 16972480 | 476 days ago | IN | Create: WhitelistManagerFacet | 0 ETH | 0.02893964 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
WhitelistManagerFacet
Compiler Version
v0.8.1+commit.df193b15
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "../../../diamond/IDiamondFacet.sol"; import "./WhitelistManagerInternal.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk contract WhitelistManagerFacet is IDiamondFacet { function getFacetName() external pure override returns (string memory) { return "whitelist-manager"; } // CAUTION: Don't forget to update the version when adding new functionality function getFacetVersion() external pure override returns (string memory) { return "3.1.0"; } function getFacetPI() external pure override returns (string[] memory) { string[] memory pi = new string[](5); pi[0] = "getWhitelistingSettings()"; pi[1] = "setWhitelistingSettings(bool,uint256,uint256,uint256)"; pi[2] = "whitelistMe(uint256,string)"; pi[3] = "whitelistAccounts(address[],uint256[])"; pi[4] = "getWhitelistEntry(address)"; return pi; } function getFacetProtectedPI() external pure override returns (string[] memory) { string[] memory pi = new string[](2); pi[0] = "setWhitelistingSettings(bool,uint256,uint256,uint256)"; pi[1] = "whitelistAccounts(address[],uint256[])"; return pi; } function supportsInterface(bytes4 interfaceId) external pure override returns (bool) { return interfaceId == type(IDiamondFacet).interfaceId; } function getWhitelistingSettings() external view returns (bool, uint256, uint256, uint256, uint256) { return WhitelistManagerInternal._getWhitelistingSettings(); } function setWhitelistingSettings( bool whitelistingAllowed, uint256 whitelistingFeeWei, uint256 whitelistingPriceWeiPerToken, uint256 maxNrOfWhitelistedTokensPerAccount ) external { WhitelistManagerInternal._setWhitelistingSettings( whitelistingAllowed, whitelistingFeeWei, whitelistingPriceWeiPerToken, maxNrOfWhitelistedTokensPerAccount ); } // Send 0 for nrOfTokens to de-list the address function whitelistMe( uint256 nrOfTokens, string memory paymentMethodName ) external payable { WhitelistManagerInternal._whitelistAccount( msg.sender, nrOfTokens, paymentMethodName ); } // Send 0 for nrOfTokens to de-list an address function whitelistAccounts( address[] memory accounts, uint256[] memory nrOfTokensArray ) external { WhitelistManagerInternal._whitelistAccounts( accounts, nrOfTokensArray ); } function getWhitelistEntry(address account) external view returns (uint256) { return WhitelistManagerInternal._getWhitelistEntry(account); } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "@openzeppelin/contracts/interfaces/IERC165.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk interface IDiamondFacet is IERC165 { // NOTE: The override MUST remain 'pure'. function getFacetName() external pure returns (string memory); // NOTE: The override MUST remain 'pure'. function getFacetVersion() external pure returns (string memory); // NOTE: The override MUST remain 'pure'. function getFacetPI() external pure returns (string[] memory); // NOTE: The override MUST remain 'pure'. function getFacetProtectedPI() external pure returns (string[] memory); }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "../payment-handler/PaymentHandlerLib.sol"; import "./WhitelistManagerStorage.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk library WhitelistManagerInternal { event Whitelist(address account, uint256 nrOfTokens); function _getWhitelistingSettings() internal view returns (bool, uint256, uint256, uint256, uint256) { return ( __s().whitelistingAllowed, __s().whitelistingFeeWei, __s().whitelistingPriceWeiPerToken, __s().maxNrOfWhitelistedTokensPerAccount, __s().totalNrOfWhitelists ); } function _setWhitelistingSettings( bool whitelistingAllowed, uint256 whitelistingFeeWei, uint256 whitelistingPriceWeiPerToken, uint256 maxNrOfWhitelistedTokensPerAccount ) internal { __s().whitelistingAllowed = whitelistingAllowed; __s().whitelistingFeeWei = whitelistingFeeWei; __s().whitelistingPriceWeiPerToken = whitelistingPriceWeiPerToken; __s().maxNrOfWhitelistedTokensPerAccount = maxNrOfWhitelistedTokensPerAccount; } // NOTE: Send 0 for nrOfTokens to de-list the address function _whitelistAccount( address account, uint256 nrOfTokens, string memory paymentMethodName ) internal { require(__s().whitelistingAllowed, "WM:NA"); PaymentHandlerLib._handlePayment( 1, __s().whitelistingFeeWei, nrOfTokens, __s().whitelistingPriceWeiPerToken, paymentMethodName ); _whitelist(account, nrOfTokens); } // NOTE: Send 0 for nrOfTokens to de-list an address // NOTE: This is always allowed function _whitelistAccounts( address[] memory accounts, uint256[] memory nrOfTokensArray ) internal { require(accounts.length == nrOfTokensArray.length, "WM:IL"); for (uint256 i = 0; i < accounts.length; i++) { _whitelist(accounts[i], nrOfTokensArray[i]); } } function _getWhitelistEntry(address account) internal view returns (uint256) { return __s().whitelistEntries[account]; } function _whitelist( address account, uint256 nrOfTokens ) private { require(__s().maxNrOfWhitelistedTokensPerAccount == 0 || nrOfTokens <= __s().maxNrOfWhitelistedTokensPerAccount, "WM:EMAX"); if (nrOfTokens == 0){ // de-list the account uint256 nrOfTokensToBeRemoved = __s().whitelistEntries[account]; __s().whitelistEntries[account] = 0; __s().totalNrOfWhitelists -= nrOfTokensToBeRemoved; } else{ __s().whitelistEntries[account] = nrOfTokens; __s().totalNrOfWhitelists += nrOfTokens; } emit Whitelist(account, nrOfTokens); } function __s() private pure returns (WhitelistManagerStorage.Layout storage) { return WhitelistManagerStorage.layout(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol";
// 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); }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "./PaymentHandlerInternal.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk library PaymentHandlerLib { function _handlePayment( uint256 nrOfItems1, uint256 priceWeiPerItem1, uint256 nrOfItems2, uint256 priceWeiPerItem2, string memory paymentMethodName ) internal { PaymentHandlerInternal._handlePayment( nrOfItems1, priceWeiPerItem1, nrOfItems2, priceWeiPerItem2, paymentMethodName ); } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk. Just got the basic /// idea from: https://github.com/solidstate-network/solidstate-solidity library WhitelistManagerStorage { struct Layout { bool whitelistingAllowed; uint256 whitelistingFeeWei; uint256 whitelistingPriceWeiPerToken; uint256 maxNrOfWhitelistedTokensPerAccount; mapping(address => uint256) whitelistEntries; uint256 totalNrOfWhitelists; mapping(bytes32 => bytes) extra; } bytes32 internal constant STORAGE_SLOT = keccak256("qomet-tech.contracts.facets.collection.whitelist-manager.storage"); function layout() internal pure returns (Layout storage s) { bytes32 slot = STORAGE_SLOT; /* solhint-disable no-inline-assembly */ assembly { s.slot := slot } /* solhint-enable no-inline-assembly */ } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "@openzeppelin/contracts/interfaces/IERC20.sol"; import "../../IUniswapV2Pair.sol"; import "../payment-method-manager/PaymentMethodManagerLib.sol"; import "./PaymentHandlerStorage.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk library PaymentHandlerInternal { bytes32 constant public WEI_PAYMENT_METHOD_HASH = keccak256(abi.encode("WEI")); event TransferTo( address to, uint256 amount, string data ); event TransferETH20To( string paymentMethodName, address to, uint256 amount, string data ); function _getPaymentHandlerSettings() internal view returns (address) { return __s().payoutAddress; } function _setPaymentHandlerSettings( address payoutAddress ) internal { __s().payoutAddress = payoutAddress; } function _transferTo( string memory paymentMethodName, address to, uint256 amount, string memory data ) internal { require(to != address(0), "PH:TTZ"); require(amount > 0, "PH:ZAM"); bytes32 nameHash = keccak256(abi.encode(paymentMethodName)); require(nameHash == WEI_PAYMENT_METHOD_HASH || PaymentMethodManagerLib._paymentMethodExists(nameHash), "PH:MNS"); if (nameHash == WEI_PAYMENT_METHOD_HASH) { require(amount <= address(this).balance, "PH:MTB"); /* solhint-disable avoid-low-level-calls */ (bool success, ) = to.call{value: amount}(new bytes(0)); /* solhint-enable avoid-low-level-calls */ require(success, "PH:TF"); emit TransferTo(to, amount, data); } else { address erc20 = PaymentMethodManagerLib._getERC20PaymentMethodAddress(nameHash); require(amount <= IERC20(erc20).balanceOf(address(this)), "PH:MTB"); IERC20(erc20).transfer(to, amount); emit TransferETH20To(paymentMethodName, to, amount, data); } } function _handlePayment( uint256 nrOfItems1, uint256 priceWeiPerItem1, uint256 nrOfItems2, uint256 priceWeiPerItem2, string memory paymentMethodName ) internal { uint256 totalWei = nrOfItems1 * priceWeiPerItem1 + nrOfItems2 * priceWeiPerItem2; if (totalWei == 0) { return; } bytes32 nameHash = keccak256(abi.encode(paymentMethodName)); require(nameHash == WEI_PAYMENT_METHOD_HASH || PaymentMethodManagerLib._paymentMethodExists(nameHash), "PH:MNS"); if (nameHash == WEI_PAYMENT_METHOD_HASH) { PaymentMethodManagerLib._handleWeiPayment( msg.sender, __s().payoutAddress, msg.value, totalWei, ""); } else { PaymentMethodManagerLib. _handleERC20Payment( paymentMethodName, msg.sender, __s().payoutAddress, totalWei, ""); } } function __s() private pure returns (PaymentHandlerStorage.Layout storage) { return PaymentHandlerStorage.layout(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol) pragma solidity ^0.8.0; import "../token/ERC20/IERC20.sol";
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom(address from, address to, uint value) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn(address indexed sender, uint amount0, uint amount1, address indexed to); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; function skim(address to) external; function sync() external; function initialize(address, address) external; }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "./PaymentMethodManagerInternal.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk library PaymentMethodManagerLib { function _handleWeiPayment( address payer, address dest, uint256 paidPriceWei, // could be the msg.value uint256 priceWeiToPay, string memory data ) internal { PaymentMethodManagerInternal._handleWeiPayment( payer, dest, paidPriceWei, priceWeiToPay, data ); } function _handleERC20Payment( string memory paymentMethodName, address payer, address dest, uint256 priceWeiToPay, string memory data ) internal { PaymentMethodManagerInternal._handleERC20Payment( paymentMethodName, payer, dest, priceWeiToPay, data ); } function _paymentMethodExists( bytes32 paymentMethodNameHash ) internal view returns (bool) { return PaymentMethodManagerLib._paymentMethodExists(paymentMethodNameHash); } function _paymentMethodEnabled( bytes32 paymentMethodNameHash ) internal view returns (bool) { return PaymentMethodManagerLib._paymentMethodEnabled(paymentMethodNameHash); } function _getERC20PaymentMethodAddress( bytes32 paymentMethodNameHash ) internal view returns (address) { return PaymentMethodManagerLib._getERC20PaymentMethodAddress(paymentMethodNameHash); } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk. Just got the basic /// idea from: https://github.com/solidstate-network/solidstate-solidity library PaymentHandlerStorage { struct Layout { address payoutAddress; mapping(bytes32 => bytes) extra; } bytes32 internal constant STORAGE_SLOT = keccak256("qomet-tech.contracts.facets.collection.payment-handler.storage"); function layout() internal pure returns (Layout storage s) { bytes32 slot = STORAGE_SLOT; /* solhint-disable no-inline-assembly */ assembly { s.slot := slot } /* solhint-enable no-inline-assembly */ } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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); /** * @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); }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; import "@openzeppelin/contracts/interfaces/IERC20.sol"; import "../../IUniswapV2Pair.sol"; import "./PaymentMethodManagerStorage.sol"; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk library PaymentMethodManagerInternal { event ERC20PaymentMethodUpdate( string paymentMethodName, address erc20, address wethPair, bool enabled, string data ); event WeiPayment( address payer, address dest, uint256 paidPriceWei, uint256 priceWeiToPay, string data ); event ERC20Payment( string paymentMethodName, address payer, address dest, uint256 amountWei, uint256 amountTokens, string data ); function _getPaymentMethodManagerSettings() internal view returns (address) { return __s().wethAddress; } function _setPaymentMethodManagerSettings( address wethAddress ) internal { __s().wethAddress = wethAddress; } function _getERC20PaymentMethods() internal view returns (string[] memory) { return __s().erc20PaymentMethodNames; } function _getERC20PaymentMethod( string memory paymentMethodName ) internal view returns (address, address, bool) { bytes32 nameHash = keccak256(abi.encode(paymentMethodName)); require(_paymentMethodExists(nameHash), "PMM:NEM"); return ( __s().erc20PaymentMethods[nameHash].erc20, __s().erc20PaymentMethods[nameHash].wethPair, __s().erc20PaymentMethods[nameHash].enabled ); } function _addOrUpdateERC20PaymentMethod( string memory paymentMethodName, address erc20, address wethPair, bool enabled, string memory data ) internal { bytes32 nameHash = keccak256(abi.encode(paymentMethodName)); __s().erc20PaymentMethods[nameHash].erc20 = erc20; __s().erc20PaymentMethods[nameHash].wethPair = wethPair; __s().erc20PaymentMethods[nameHash].enabled = enabled; address token0 = IUniswapV2Pair(wethPair).token0(); address token1 = IUniswapV2Pair(wethPair).token1(); require(token0 == __s().wethAddress || token1 == __s().wethAddress, "PMM:IPC"); bool reverseIndices = (token1 == __s().wethAddress); __s().erc20PaymentMethods[nameHash].reverseIndices = reverseIndices; if (__s().erc20PaymentMethodNamesIndex[paymentMethodName] == 0) { __s().erc20PaymentMethodNames.push(paymentMethodName); __s().erc20PaymentMethodNamesIndex[paymentMethodName] = __s().erc20PaymentMethodNames.length; } emit ERC20PaymentMethodUpdate( paymentMethodName, erc20, wethPair, enabled, data); } function _enableERC20TokenPayment( string memory paymentMethodName, bool enabled ) internal { bytes32 nameHash = keccak256(abi.encode(paymentMethodName)); require(_paymentMethodExists(nameHash), "PMM:NEM"); __s().erc20PaymentMethods[nameHash].enabled = enabled; emit ERC20PaymentMethodUpdate( paymentMethodName, __s().erc20PaymentMethods[nameHash].erc20, __s().erc20PaymentMethods[nameHash].wethPair, enabled, "" ); } function _handleWeiPayment( address payer, address dest, uint256 paidPriceWei, // could be the msg.value uint256 priceWeiToPay, string memory data ) internal { require(paidPriceWei >= priceWeiToPay, "PMM:IF"); uint256 remainder = paidPriceWei - priceWeiToPay; if (dest != address(0)) { /* solhint-disable avoid-low-level-calls */ (bool success, ) = dest.call{value: priceWeiToPay}(new bytes(0)); /* solhint-enable avoid-low-level-calls */ require(success, "PMM:TF"); emit WeiPayment(payer, dest, paidPriceWei, priceWeiToPay, data); } else { emit WeiPayment( payer, address(this), paidPriceWei, priceWeiToPay, data); } if (remainder > 0) { /* solhint-disable avoid-low-level-calls */ (bool success, ) = payer.call{value: remainder}(new bytes(0)); /* solhint-enable avoid-low-level-calls */ require(success, "PMM:RTF"); } } function _handleERC20Payment( string memory paymentMethodName, address payer, address dest, uint256 priceWeiToPay, string memory data ) internal { bytes32 nameHash = keccak256(abi.encode(paymentMethodName)); require(_paymentMethodExists(nameHash), "PMM:NEM"); require(_paymentMethodEnabled(nameHash), "PMM:NENM"); PaymentMethodManagerStorage.ERC20PaymentMethod memory paymentMethod = __s().erc20PaymentMethods[nameHash]; (uint112 amount0, uint112 amount1,) = IUniswapV2Pair(paymentMethod.wethPair).getReserves(); uint256 reserveWei = amount0; uint256 reserveTokens = amount1; if (paymentMethod.reverseIndices) { reserveWei = amount1; reserveTokens = amount0; } require(reserveWei > 0, "PMM:NWR"); // TODO(kam): check if this is OK uint256 amountTokens = (priceWeiToPay * reserveTokens) / reserveWei; if (dest == address(0)) { dest = address(this); } // this contract must have already been approved by the msg.sender IERC20(paymentMethod.erc20).transferFrom(payer, dest, amountTokens); emit ERC20Payment( paymentMethodName, payer, dest, priceWeiToPay, amountTokens, data); } function _paymentMethodExists( bytes32 paymentMethodNameHash ) internal view returns (bool) { return __s().erc20PaymentMethods[paymentMethodNameHash].erc20 != address(0) && __s().erc20PaymentMethods[paymentMethodNameHash].wethPair != address(0); } function _paymentMethodEnabled( bytes32 paymentMethodNameHash ) internal view returns (bool) { return __s().erc20PaymentMethods[paymentMethodNameHash].enabled; } function _getERC20PaymentMethodAddress( bytes32 paymentMethodNameHash ) internal view returns (address) { require(_paymentMethodExists(paymentMethodNameHash), "PMM:NEM"); return __s().erc20PaymentMethods[paymentMethodNameHash].erc20; } function __s() private pure returns (PaymentMethodManagerStorage.Layout storage) { return PaymentMethodManagerStorage.layout(); } }
/* * This file is part of the Qomet Technologies contracts (https://github.com/qomet-tech/contracts). * Copyright (c) 2022 Qomet Technologies (https://qomet.tech) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // SPDX-License-Identifier: GNU General Public License v3.0 pragma solidity 0.8.1; /// @author Kam Amini <[email protected]> /// /// @notice Use at your own risk. Just got the basic /// idea from: https://github.com/solidstate-network/solidstate-solidity library PaymentMethodManagerStorage { struct ERC20PaymentMethod { // The internal unique name of the ERC-20 payment method string name; // The ERC-20 contract address erc20; // Uniswap V2 Pair with WETH address wethPair; // True if the read pair from Uniswap has a reverse ordering // for contract addresses bool reverseIndices; // If the payment method is enabled bool enabled; } struct Layout { // The WETH ERC-20 contract address. // On mainnet, it is: 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 address wethAddress; // The list of the existing ERC20 payment method names string[] erc20PaymentMethodNames; mapping(string => uint256) erc20PaymentMethodNamesIndex; // name > erc20 payment method mapping(bytes32 => ERC20PaymentMethod) erc20PaymentMethods; // Reserved for future upgrades mapping(bytes32 => bytes) extra; } bytes32 internal constant STORAGE_SLOT = keccak256("qomet-tech.contracts.facets.collection.payment-method-manager.storage"); function layout() internal pure returns (Layout storage s) { bytes32 slot = STORAGE_SLOT; /* solhint-disable no-inline-assembly */ assembly { s.slot := slot } /* solhint-enable no-inline-assembly */ } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"name":"getFacetName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getFacetPI","outputs":[{"internalType":"string[]","name":"","type":"string[]"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getFacetProtectedPI","outputs":[{"internalType":"string[]","name":"","type":"string[]"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getFacetVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getWhitelistEntry","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWhitelistingSettings","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"whitelistingAllowed","type":"bool"},{"internalType":"uint256","name":"whitelistingFeeWei","type":"uint256"},{"internalType":"uint256","name":"whitelistingPriceWeiPerToken","type":"uint256"},{"internalType":"uint256","name":"maxNrOfWhitelistedTokensPerAccount","type":"uint256"}],"name":"setWhitelistingSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"nrOfTokensArray","type":"uint256[]"}],"name":"whitelistAccounts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"nrOfTokens","type":"uint256"},{"internalType":"string","name":"paymentMethodName","type":"string"}],"name":"whitelistMe","outputs":[],"stateMutability":"payable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50611822806100206000396000f3fe6080604052600436106100915760003560e01c806368498a331161005957806368498a3314610145578063704d4ebc1461015a578063846b03e81461017a578063be6d44c2146101a7578063f8c2be4f146101cd57610091565b806301ffc9a71461009657806302f5133f146100cc5780631078fade146100e1578063320dcd9714610103578063669ce5bc14610125575b600080fd5b3480156100a257600080fd5b506100b66100b13660046111d2565b6101e2565b6040516100c3919061140b565b60405180910390f35b6100df6100da366004611248565b6101fc565b005b3480156100ed57600080fd5b506100f661020b565b6040516100c391906113ab565b34801561010f57600080fd5b506101186103f3565b6040516100c3919061143b565b34801561013157600080fd5b506100df610140366004611198565b61041e565b34801561015157600080fd5b506100f6610430565b34801561016657600080fd5b506100df6101753660046110be565b6104e0565b34801561018657600080fd5b5061019a61019536600461109d565b6104ea565b6040516100c39190611606565b3480156101b357600080fd5b506101bc6104fb565b6040516100c3959493929190611416565b3480156101d957600080fd5b5061011861051c565b6001600160e01b0319811663b2fe033560e01b145b919050565b61020733838361053b565b5050565b60408051600580825260c0820190925260609160009190816020015b60608152602001906001900390816102275790505090506040518060400160405280601981526020017f67657457686974656c697374696e6753657474696e67732829000000000000008152508160008151811061029557634e487b7160e01b600052603260045260246000fd5b602002602001018190525060405180606001604052806035815260200161179260359139816001815181106102da57634e487b7160e01b600052603260045260246000fd5b60200260200101819052506040518060400160405280601b81526020017f77686974656c6973744d652875696e743235362c737472696e672900000000008152508160028151811061033c57634e487b7160e01b600052603260045260246000fd5b60200260200101819052506040518060600160405280602681526020016117c7602691398160038151811061038157634e487b7160e01b600052603260045260246000fd5b60200260200101819052506040518060400160405280601a81526020017f67657457686974656c697374456e747279286164647265737329000000000000815250816004815181106103e357634e487b7160e01b600052603260045260246000fd5b6020908102919091010152905090565b6040805180820190915260118152703bb434ba32b634b9ba16b6b0b730b3b2b960791b602082015290565b61042a8484848461059f565b50505050565b604080516002808252606082810190935260009190816020015b606081526020019060019003908161044a579050509050604051806060016040528060358152602001611792603591398160008151811061049b57634e487b7160e01b600052603260045260246000fd5b60200260200101819052506040518060600160405280602681526020016117c760269139816001815181106103e357634e487b7160e01b600052603260045260246000fd5b61020782826105e4565b60006104f58261067b565b92915050565b600080600080600061050b6106a7565b945094509450945094509091929394565b6040805180820190915260058152640332e312e360dc1b602082015290565b6105436106fc565b5460ff1661056c5760405162461bcd60e51b8152600401610563906114e8565b60405180910390fd5b61059060016105796106fc565b60010154846105866106fc565b600201548561070b565b61059a838361071f565b505050565b836105a86106fc565b805460ff1916911515919091179055826105c06106fc565b60010155816105cd6106fc565b60020155806105da6106fc565b6003015550505050565b80518251146106055760405162461bcd60e51b815260040161056390611548565b60005b825181101561059a5761066983828151811061063457634e487b7160e01b600052603260045260246000fd5b602002602001015183838151811061065c57634e487b7160e01b600052603260045260246000fd5b602002602001015161071f565b8061067381611739565b915050610608565b60006106856106fc565b6001600160a01b03929092166000908152600490920160205250604090205490565b60008060008060006106b76106fc565b5460ff166106c36106fc565b600101546106cf6106fc565b600201546106db6106fc565b600301546106e76106fc565b60050154945094509450945094509091929394565b600061070661085c565b905090565b6107188585858585610880565b5050505050565b6107276106fc565b600301541580610742575061073a6106fc565b600301548111155b61075e5760405162461bcd60e51b8152600401610563906115e5565b806107d857600061076d6106fc565b6001600160a01b0384166000908152600491909101602052604081205491506107946106fc565b6001600160a01b03851660009081526004919091016020526040902055806107ba6106fc565b60050160008282546107cc91906116bb565b9091555061081f915050565b806107e16106fc565b6001600160a01b03841660009081526004919091016020526040902055806108076106fc565b60050160008282546108199190611664565b90915550505b7f447615df38266f7c2e25889e02cfbee3ed7713cc91ac1629e2bbcc955fdc81908282604051610850929190611392565b60405180910390a15050565b7f6a750c3f0170e00826e45980ae09840984f615da7bb80c8479ebe8542325a0d590565b600061088c838561169c565b610896868861169c565b6108a09190611664565b9050806108ad5750610718565b6000826040516020016108c0919061143b565b6040516020818303038152906040528051906020012090506040516020016108e7906115c8565b6040516020818303038152906040528051906020012081148061090e575061090e816109c5565b61092a5760405162461bcd60e51b815260040161056390611507565b604051602001610939906115c8565b6040516020818303038152906040528051906020012081141561098c57610987336109626109d0565b546040805160208101909152600081526001600160a01b0390911690349086906109da565b6109bc565b6109bc83336109996109d0565b546040805160208101909152600081526001600160a01b039091169086906109e7565b50505050505050565b60006104f5826109c5565b60006107066109f4565b6107188585858585610a18565b6107188585858585610c02565b7fbbdc48a4c38ee68aae7b7a4d695913f62d41dea3b689e93b0a6ca9163997770990565b81831015610a385760405162461bcd60e51b8152600401610563906115a8565b6000610a4483856116bb565b90506001600160a01b03851615610b2757604080516000808252602082019092526001600160a01b038716908590604051610a7f919061130d565b60006040518083038185875af1925050503d8060008114610abc576040519150601f19603f3d011682016040523d82523d6000602084013e610ac1565b606091505b5050905080610ae25760405162461bcd60e51b815260040161056390611567565b7fae01f7fdfbf70980d6561b6b989d6c37709c4beec3fdbbf489e2644ed0e9e01d8787878787604051610b1995949392919061134d565b60405180910390a150610b67565b7fae01f7fdfbf70980d6561b6b989d6c37709c4beec3fdbbf489e2644ed0e9e01d8630868686604051610b5e95949392919061134d565b60405180910390a15b8015610bfa57604080516000808252602082019092526001600160a01b038816908390604051610b97919061130d565b60006040518083038185875af1925050503d8060008114610bd4576040519150601f19603f3d011682016040523d82523d6000602084013e610bd9565b606091505b50509050806109bc5760405162461bcd60e51b8152600401610563906114c7565b505050505050565b600085604051602001610c15919061143b565b604051602081830303815290604052805190602001209050610c3681610f4d565b610c525760405162461bcd60e51b815260040161056390611587565b610c5b81610fb0565b610c775760405162461bcd60e51b8152600401610563906114a5565b6000610c81610fdb565b60030160008381526020019081526020016000206040518060a0016040529081600082018054610cb0906116fe565b80601f0160208091040260200160405190810160405280929190818152602001828054610cdc906116fe565b8015610d295780601f10610cfe57610100808354040283529160200191610d29565b820191906000526020600020905b815481529060010190602001808311610d0c57829003601f168201915b505050918352505060018201546001600160a01b03908116602083015260029092015480831660408084019190915260ff600160a01b830481161515606080860191909152600160a81b909304161515608090930192909252838201518251630240bc6b60e21b8152925194955060009485949190911692630902f1ac926004808301939192829003018186803b158015610dc357600080fd5b505afa158015610dd7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dfb91906111fa565b50606085015191935091506001600160701b03808416919083169015610e2c5750506001600160701b038082169083165b60008211610e4c5760405162461bcd60e51b815260040161056390611527565b600082610e59838b61169c565b610e63919061167c565b90506001600160a01b038a16610e77573099505b85602001516001600160a01b03166323b872dd8c8c846040518463ffffffff1660e01b8152600401610eab93929190611329565b602060405180830381600087803b158015610ec557600080fd5b505af1158015610ed9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610efd919061117c565b507f1037c144de58762bd1228de78600efc4417a4454b1c3bd22079d10505b6c7deb8c8c8c8c858d604051610f379695949392919061144e565b60405180910390a1505050505050505050505050565b600080610f58610fdb565b600084815260039190910160205260409020600101546001600160a01b0316148015906104f557506000610f8a610fdb565b60009384526003016020526040909220600201546001600160a01b031690911415919050565b6000610fba610fdb565b6000928352600301602052506040902060020154600160a81b900460ff1690565b60007feab495bca05def827c8b418094a353de6fa10ca0186c78b0e150e44e21830d8c610706565b80356001600160a01b03811681146101f757600080fd5b600082601f83011261102a578081fd5b8135602061103f61103a83611640565b61160f565b828152818101908583018385028701840188101561105b578586fd5b855b858110156110795781358452928401929084019060010161105d565b5090979650505050505050565b80516001600160701b03811681146101f757600080fd5b6000602082840312156110ae578081fd5b6110b782611003565b9392505050565b600080604083850312156110d0578081fd5b823567ffffffffffffffff808211156110e7578283fd5b818501915085601f8301126110fa578283fd5b8135602061110a61103a83611640565b82815281810190858301838502870184018b1015611126578788fd5b8796505b8487101561114f5761113b81611003565b83526001969096019591830191830161112a565b5096505086013592505080821115611165578283fd5b506111728582860161101a565b9150509250929050565b60006020828403121561118d578081fd5b81516110b781611780565b600080600080608085870312156111ad578182fd5b84356111b881611780565b966020860135965060408601359560600135945092505050565b6000602082840312156111e3578081fd5b81356001600160e01b0319811681146110b7578182fd5b60008060006060848603121561120e578283fd5b61121784611086565b925061122560208501611086565b9150604084015163ffffffff8116811461123d578182fd5b809150509250925092565b6000806040838503121561125a578182fd5b8235915060208084013567ffffffffffffffff80821115611279578384fd5b818601915086601f83011261128c578384fd5b81358181111561129e5761129e61176a565b6112b0601f8201601f1916850161160f565b915080825287848285010111156112c5578485fd5b8084840185840137810190920192909252919491935090915050565b600081518084526112f98160208601602086016116d2565b601f01601f19169290920160200192915050565b6000825161131f8184602087016116d2565b9190910192915050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090611387908301846112e1565b979650505050505050565b6001600160a01b03929092168252602082015260400190565b6000602080830181845280855180835260408601915060408482028701019250838701855b828110156113fe57603f198886030184526113ec8583516112e1565b945092850192908501906001016113d0565b5092979650505050505050565b901515815260200190565b9415158552602085019390935260408401919091526060830152608082015260a00190565b6000602082526110b760208301846112e1565b600060c0825261146160c08301896112e1565b6001600160a01b03888116602085015287166040840152606083018690526080830185905282810360a084015261149881856112e1565b9998505050505050505050565b602080825260089082015267504d4d3a4e454e4d60c01b604082015260600190565b6020808252600790820152662826a69d292a2360c91b604082015260600190565b602080825260059082015264574d3a4e4160d81b604082015260600190565b60208082526006908201526550483a4d4e5360d01b604082015260600190565b6020808252600790820152662826a69d272ba960c91b604082015260600190565b60208082526005908201526415d34e925360da1b604082015260600190565b6020808252600690820152652826a69d2a2360d11b604082015260600190565b602080825260079082015266504d4d3a4e454d60c81b604082015260600190565b6020808252600690820152652826a69d24a360d11b604082015260600190565b60208082526003908201526257454960e81b604082015260600190565b6020808252600790820152660ae9a748a9a82b60cb1b604082015260600190565b90815260200190565b604051601f8201601f1916810167ffffffffffffffff811182821017156116385761163861176a565b604052919050565b600067ffffffffffffffff82111561165a5761165a61176a565b5060209081020190565b6000821982111561167757611677611754565b500190565b60008261169757634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156116b6576116b6611754565b500290565b6000828210156116cd576116cd611754565b500390565b60005b838110156116ed5781810151838201526020016116d5565b8381111561042a5750506000910152565b60028104600182168061171257607f821691505b6020821081141561173357634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561174d5761174d611754565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b801515811461178e57600080fd5b5056fe73657457686974656c697374696e6753657474696e677328626f6f6c2c75696e743235362c75696e743235362c75696e743235362977686974656c6973744163636f756e747328616464726573735b5d2c75696e743235365b5d29a2646970667358221220702a31487db3bc940603a0e7fd68c5694984ea3e12d32663ecbd0735b1abd4c964736f6c63430008010033
Deployed Bytecode
0x6080604052600436106100915760003560e01c806368498a331161005957806368498a3314610145578063704d4ebc1461015a578063846b03e81461017a578063be6d44c2146101a7578063f8c2be4f146101cd57610091565b806301ffc9a71461009657806302f5133f146100cc5780631078fade146100e1578063320dcd9714610103578063669ce5bc14610125575b600080fd5b3480156100a257600080fd5b506100b66100b13660046111d2565b6101e2565b6040516100c3919061140b565b60405180910390f35b6100df6100da366004611248565b6101fc565b005b3480156100ed57600080fd5b506100f661020b565b6040516100c391906113ab565b34801561010f57600080fd5b506101186103f3565b6040516100c3919061143b565b34801561013157600080fd5b506100df610140366004611198565b61041e565b34801561015157600080fd5b506100f6610430565b34801561016657600080fd5b506100df6101753660046110be565b6104e0565b34801561018657600080fd5b5061019a61019536600461109d565b6104ea565b6040516100c39190611606565b3480156101b357600080fd5b506101bc6104fb565b6040516100c3959493929190611416565b3480156101d957600080fd5b5061011861051c565b6001600160e01b0319811663b2fe033560e01b145b919050565b61020733838361053b565b5050565b60408051600580825260c0820190925260609160009190816020015b60608152602001906001900390816102275790505090506040518060400160405280601981526020017f67657457686974656c697374696e6753657474696e67732829000000000000008152508160008151811061029557634e487b7160e01b600052603260045260246000fd5b602002602001018190525060405180606001604052806035815260200161179260359139816001815181106102da57634e487b7160e01b600052603260045260246000fd5b60200260200101819052506040518060400160405280601b81526020017f77686974656c6973744d652875696e743235362c737472696e672900000000008152508160028151811061033c57634e487b7160e01b600052603260045260246000fd5b60200260200101819052506040518060600160405280602681526020016117c7602691398160038151811061038157634e487b7160e01b600052603260045260246000fd5b60200260200101819052506040518060400160405280601a81526020017f67657457686974656c697374456e747279286164647265737329000000000000815250816004815181106103e357634e487b7160e01b600052603260045260246000fd5b6020908102919091010152905090565b6040805180820190915260118152703bb434ba32b634b9ba16b6b0b730b3b2b960791b602082015290565b61042a8484848461059f565b50505050565b604080516002808252606082810190935260009190816020015b606081526020019060019003908161044a579050509050604051806060016040528060358152602001611792603591398160008151811061049b57634e487b7160e01b600052603260045260246000fd5b60200260200101819052506040518060600160405280602681526020016117c760269139816001815181106103e357634e487b7160e01b600052603260045260246000fd5b61020782826105e4565b60006104f58261067b565b92915050565b600080600080600061050b6106a7565b945094509450945094509091929394565b6040805180820190915260058152640332e312e360dc1b602082015290565b6105436106fc565b5460ff1661056c5760405162461bcd60e51b8152600401610563906114e8565b60405180910390fd5b61059060016105796106fc565b60010154846105866106fc565b600201548561070b565b61059a838361071f565b505050565b836105a86106fc565b805460ff1916911515919091179055826105c06106fc565b60010155816105cd6106fc565b60020155806105da6106fc565b6003015550505050565b80518251146106055760405162461bcd60e51b815260040161056390611548565b60005b825181101561059a5761066983828151811061063457634e487b7160e01b600052603260045260246000fd5b602002602001015183838151811061065c57634e487b7160e01b600052603260045260246000fd5b602002602001015161071f565b8061067381611739565b915050610608565b60006106856106fc565b6001600160a01b03929092166000908152600490920160205250604090205490565b60008060008060006106b76106fc565b5460ff166106c36106fc565b600101546106cf6106fc565b600201546106db6106fc565b600301546106e76106fc565b60050154945094509450945094509091929394565b600061070661085c565b905090565b6107188585858585610880565b5050505050565b6107276106fc565b600301541580610742575061073a6106fc565b600301548111155b61075e5760405162461bcd60e51b8152600401610563906115e5565b806107d857600061076d6106fc565b6001600160a01b0384166000908152600491909101602052604081205491506107946106fc565b6001600160a01b03851660009081526004919091016020526040902055806107ba6106fc565b60050160008282546107cc91906116bb565b9091555061081f915050565b806107e16106fc565b6001600160a01b03841660009081526004919091016020526040902055806108076106fc565b60050160008282546108199190611664565b90915550505b7f447615df38266f7c2e25889e02cfbee3ed7713cc91ac1629e2bbcc955fdc81908282604051610850929190611392565b60405180910390a15050565b7f6a750c3f0170e00826e45980ae09840984f615da7bb80c8479ebe8542325a0d590565b600061088c838561169c565b610896868861169c565b6108a09190611664565b9050806108ad5750610718565b6000826040516020016108c0919061143b565b6040516020818303038152906040528051906020012090506040516020016108e7906115c8565b6040516020818303038152906040528051906020012081148061090e575061090e816109c5565b61092a5760405162461bcd60e51b815260040161056390611507565b604051602001610939906115c8565b6040516020818303038152906040528051906020012081141561098c57610987336109626109d0565b546040805160208101909152600081526001600160a01b0390911690349086906109da565b6109bc565b6109bc83336109996109d0565b546040805160208101909152600081526001600160a01b039091169086906109e7565b50505050505050565b60006104f5826109c5565b60006107066109f4565b6107188585858585610a18565b6107188585858585610c02565b7fbbdc48a4c38ee68aae7b7a4d695913f62d41dea3b689e93b0a6ca9163997770990565b81831015610a385760405162461bcd60e51b8152600401610563906115a8565b6000610a4483856116bb565b90506001600160a01b03851615610b2757604080516000808252602082019092526001600160a01b038716908590604051610a7f919061130d565b60006040518083038185875af1925050503d8060008114610abc576040519150601f19603f3d011682016040523d82523d6000602084013e610ac1565b606091505b5050905080610ae25760405162461bcd60e51b815260040161056390611567565b7fae01f7fdfbf70980d6561b6b989d6c37709c4beec3fdbbf489e2644ed0e9e01d8787878787604051610b1995949392919061134d565b60405180910390a150610b67565b7fae01f7fdfbf70980d6561b6b989d6c37709c4beec3fdbbf489e2644ed0e9e01d8630868686604051610b5e95949392919061134d565b60405180910390a15b8015610bfa57604080516000808252602082019092526001600160a01b038816908390604051610b97919061130d565b60006040518083038185875af1925050503d8060008114610bd4576040519150601f19603f3d011682016040523d82523d6000602084013e610bd9565b606091505b50509050806109bc5760405162461bcd60e51b8152600401610563906114c7565b505050505050565b600085604051602001610c15919061143b565b604051602081830303815290604052805190602001209050610c3681610f4d565b610c525760405162461bcd60e51b815260040161056390611587565b610c5b81610fb0565b610c775760405162461bcd60e51b8152600401610563906114a5565b6000610c81610fdb565b60030160008381526020019081526020016000206040518060a0016040529081600082018054610cb0906116fe565b80601f0160208091040260200160405190810160405280929190818152602001828054610cdc906116fe565b8015610d295780601f10610cfe57610100808354040283529160200191610d29565b820191906000526020600020905b815481529060010190602001808311610d0c57829003601f168201915b505050918352505060018201546001600160a01b03908116602083015260029092015480831660408084019190915260ff600160a01b830481161515606080860191909152600160a81b909304161515608090930192909252838201518251630240bc6b60e21b8152925194955060009485949190911692630902f1ac926004808301939192829003018186803b158015610dc357600080fd5b505afa158015610dd7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dfb91906111fa565b50606085015191935091506001600160701b03808416919083169015610e2c5750506001600160701b038082169083165b60008211610e4c5760405162461bcd60e51b815260040161056390611527565b600082610e59838b61169c565b610e63919061167c565b90506001600160a01b038a16610e77573099505b85602001516001600160a01b03166323b872dd8c8c846040518463ffffffff1660e01b8152600401610eab93929190611329565b602060405180830381600087803b158015610ec557600080fd5b505af1158015610ed9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610efd919061117c565b507f1037c144de58762bd1228de78600efc4417a4454b1c3bd22079d10505b6c7deb8c8c8c8c858d604051610f379695949392919061144e565b60405180910390a1505050505050505050505050565b600080610f58610fdb565b600084815260039190910160205260409020600101546001600160a01b0316148015906104f557506000610f8a610fdb565b60009384526003016020526040909220600201546001600160a01b031690911415919050565b6000610fba610fdb565b6000928352600301602052506040902060020154600160a81b900460ff1690565b60007feab495bca05def827c8b418094a353de6fa10ca0186c78b0e150e44e21830d8c610706565b80356001600160a01b03811681146101f757600080fd5b600082601f83011261102a578081fd5b8135602061103f61103a83611640565b61160f565b828152818101908583018385028701840188101561105b578586fd5b855b858110156110795781358452928401929084019060010161105d565b5090979650505050505050565b80516001600160701b03811681146101f757600080fd5b6000602082840312156110ae578081fd5b6110b782611003565b9392505050565b600080604083850312156110d0578081fd5b823567ffffffffffffffff808211156110e7578283fd5b818501915085601f8301126110fa578283fd5b8135602061110a61103a83611640565b82815281810190858301838502870184018b1015611126578788fd5b8796505b8487101561114f5761113b81611003565b83526001969096019591830191830161112a565b5096505086013592505080821115611165578283fd5b506111728582860161101a565b9150509250929050565b60006020828403121561118d578081fd5b81516110b781611780565b600080600080608085870312156111ad578182fd5b84356111b881611780565b966020860135965060408601359560600135945092505050565b6000602082840312156111e3578081fd5b81356001600160e01b0319811681146110b7578182fd5b60008060006060848603121561120e578283fd5b61121784611086565b925061122560208501611086565b9150604084015163ffffffff8116811461123d578182fd5b809150509250925092565b6000806040838503121561125a578182fd5b8235915060208084013567ffffffffffffffff80821115611279578384fd5b818601915086601f83011261128c578384fd5b81358181111561129e5761129e61176a565b6112b0601f8201601f1916850161160f565b915080825287848285010111156112c5578485fd5b8084840185840137810190920192909252919491935090915050565b600081518084526112f98160208601602086016116d2565b601f01601f19169290920160200192915050565b6000825161131f8184602087016116d2565b9190910192915050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090611387908301846112e1565b979650505050505050565b6001600160a01b03929092168252602082015260400190565b6000602080830181845280855180835260408601915060408482028701019250838701855b828110156113fe57603f198886030184526113ec8583516112e1565b945092850192908501906001016113d0565b5092979650505050505050565b901515815260200190565b9415158552602085019390935260408401919091526060830152608082015260a00190565b6000602082526110b760208301846112e1565b600060c0825261146160c08301896112e1565b6001600160a01b03888116602085015287166040840152606083018690526080830185905282810360a084015261149881856112e1565b9998505050505050505050565b602080825260089082015267504d4d3a4e454e4d60c01b604082015260600190565b6020808252600790820152662826a69d292a2360c91b604082015260600190565b602080825260059082015264574d3a4e4160d81b604082015260600190565b60208082526006908201526550483a4d4e5360d01b604082015260600190565b6020808252600790820152662826a69d272ba960c91b604082015260600190565b60208082526005908201526415d34e925360da1b604082015260600190565b6020808252600690820152652826a69d2a2360d11b604082015260600190565b602080825260079082015266504d4d3a4e454d60c81b604082015260600190565b6020808252600690820152652826a69d24a360d11b604082015260600190565b60208082526003908201526257454960e81b604082015260600190565b6020808252600790820152660ae9a748a9a82b60cb1b604082015260600190565b90815260200190565b604051601f8201601f1916810167ffffffffffffffff811182821017156116385761163861176a565b604052919050565b600067ffffffffffffffff82111561165a5761165a61176a565b5060209081020190565b6000821982111561167757611677611754565b500190565b60008261169757634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156116b6576116b6611754565b500290565b6000828210156116cd576116cd611754565b500390565b60005b838110156116ed5781810151838201526020016116d5565b8381111561042a5750506000910152565b60028104600182168061171257607f821691505b6020821081141561173357634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561174d5761174d611754565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b801515811461178e57600080fd5b5056fe73657457686974656c697374696e6753657474696e677328626f6f6c2c75696e743235362c75696e743235362c75696e743235362977686974656c6973744163636f756e747328616464726573735b5d2c75696e743235365b5d29a2646970667358221220702a31487db3bc940603a0e7fd68c5694984ea3e12d32663ecbd0735b1abd4c964736f6c63430008010033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.