Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00
Cross-Chain Transactions
Loading...
Loading
Contract Name:
OpenOceanSettler
Compiler Version
v0.8.10+commit.fc410830
Optimization Enabled:
Yes with 200 runs
Other Settings:
london EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/cryptography/SignatureCheckerUpgradeable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "./libraries/UniversalERC20New.sol";
import "./libraries/PermitableNew.sol";
import "./libraries/RevertReasonParser.sol";
contract OpenOceanSettler is OwnableUpgradeable, PausableUpgradeable, Permitable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
using UniversalERC20 for IERC20;
event AddAggregator(address aggregator);
event DelAggregator(address aggregator);
event SetFeeReceiver(address feeReceiver);
event OSwap(address indexed from, bytes32 indexed orderHash, address swapAddress, uint256 returnAmount);
address payable public feeReceiver;
mapping(address => bool) public aggregators;
mapping(address => bool) public operators;
struct SwapData {
address from;
IERC20[] path;
uint256[] amounts;
address swapAddress;
bytes swapExtraData;
bytes32 orderHash;
bytes permit;
uint256 flag;
}
function initialize(address payable _feeReceiver) public initializer {
OwnableUpgradeable.__Ownable_init();
PausableUpgradeable.__Pausable_init();
setFeeReceiver(_feeReceiver);
}
receive() external payable {}
modifier onlyOperator() {
require(operators[msg.sender], "Operator: caller is not the operator");
_;
}
function addAggregator(address[] calldata _aggregators) public onlyOwner {
for (uint i = 0; i < _aggregators.length; i++) {
require(
_aggregators[i] != address(0),
"aggregator is zero address"
);
aggregators[_aggregators[i]] = true;
emit AddAggregator(_aggregators[i]);
}
}
function delAggregator(address _aggregator) public onlyOwner {
aggregators[_aggregator] = false;
emit DelAggregator(_aggregator);
}
function setFeeReceiver(address payable _feeReceiver) public onlyOwner {
feeReceiver = _feeReceiver;
emit SetFeeReceiver(_feeReceiver);
}
function batchSwap(
SwapData[] calldata swaps
) public payable onlyOperator whenNotPaused returns (uint256[] memory) {
uint256[] memory returnAmounts = new uint256[](swaps.length);
for (uint i = 0; i < swaps.length; i++) {
returnAmounts[i] = swap(swaps[i]);
}
return returnAmounts;
}
function swap(
SwapData calldata data
) internal returns (uint256 returnAmount) {
require(
data.path.length == 2 && data.amounts.length == 3,
"Invalid amounts length"
);
require(data.swapAddress != address(0), "SwapAddress is zero address");
require(aggregators[data.swapAddress], "SwapAddress is not support");
IERC20 srcToken = data.path[0];
IERC20 dstToken = data.path[1];
require(_claim(data.from, srcToken, data.permit),"Transfer is failed");
require(srcToken.universalBalanceOf(address(this)) >= data.amounts[0], "Transfer is failed.");
uint256 initialDstBalance = dstToken.universalBalanceOf(address(this));
srcToken.universalApprove(data.swapAddress, data.amounts[0]);
(bool success, ) = data.swapAddress.call{value: msg.value}(data.swapExtraData);
//uint256 returnAmount = 0;
if (!success) {
uint256 gasFee = data.amounts[2];
if (gasFee > 0) {
srcToken.safeTransfer(feeReceiver, gasFee);
}
srcToken.safeTransfer(data.from, data.amounts[0].sub(gasFee));
} else {
returnAmount = dstToken.universalBalanceOf(address(this)).sub(initialDstBalance);
require(returnAmount > 0, "Return amount is not zero");
uint256 fee = data.amounts[1];
if (data.flag == 1) {
srcToken.universalTransfer(feeReceiver, fee);
} else {
dstToken.universalTransfer(feeReceiver, fee);
returnAmount = returnAmount.sub(fee);
}
dstToken.safeTransfer(data.from, returnAmount);
}
emit OSwap(data.from, data.orderHash, data.swapAddress, returnAmount);
}
function _claim(
address from,
IERC20 token,
bytes calldata permit
) private returns(bool){
return _permit(address(token), permit, from);
}
function setPermit2(address _permit2) external onlyOwner {
permit2 = _permit2;
}
function updateOperator(address _operator, bool on) public onlyOwner {
operators[_operator] = on;
}
function withdraw(
IERC20 token,
address payable receiver,
uint256 amount
) public onlyOwner {
token.universalTransfer(receiver, amount);
}
function pause() public onlyOwner {
_pause();
}
function unpause() public onlyOwner {
_unpause();
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
pragma abicoder v1;
/// @title Library that allows to parse unsuccessful arbitrary calls revert reasons.
/// See https://solidity.readthedocs.io/en/latest/control-structures.html#revert for details.
/// Note that we assume revert reason being abi-encoded as Error(string) so it may fail to parse reason
/// if structured reverts appear in the future.
///
/// All unsuccessful parsings get encoded as Unknown(data) string
library RevertReasonParser {
bytes4 constant private _PANIC_SELECTOR = bytes4(keccak256("Panic(uint256)"));
bytes4 constant private _ERROR_SELECTOR = bytes4(keccak256("Error(string)"));
function parse(bytes memory data, string memory prefix) internal pure returns (string memory) {
if (data.length >= 4) {
bytes4 selector;
assembly { // solhint-disable-line no-inline-assembly
selector := mload(add(data, 0x20))
}
// 68 = 4-byte selector + 32 bytes offset + 32 bytes length
if (selector == _ERROR_SELECTOR && data.length >= 68) {
uint256 offset;
bytes memory reason;
assembly { // solhint-disable-line no-inline-assembly
// 36 = 32 bytes data length + 4-byte selector
offset := mload(add(data, 36))
reason := add(data, add(36, offset))
}
/*
revert reason is padded up to 32 bytes with ABI encoder: Error(string)
also sometimes there is extra 32 bytes of zeros padded in the end:
https://github.com/ethereum/solidity/issues/10170
because of that we can't check for equality and instead check
that offset + string length + extra 36 bytes is less than overall data length
*/
require(data.length >= 36 + offset + reason.length, "Invalid revert reason");
return string(abi.encodePacked(prefix, "Error(", reason, ")"));
}
// 36 = 4-byte selector + 32 bytes integer
else if (selector == _PANIC_SELECTOR && data.length == 36) {
uint256 code;
assembly { // solhint-disable-line no-inline-assembly
// 36 = 32 bytes data length + 4-byte selector
code := mload(add(data, 36))
}
return string(abi.encodePacked(prefix, "Panic(", _toHex(code), ")"));
}
}
return string(abi.encodePacked(prefix, "Unknown(", _toHex(data), ")"));
}
function _toHex(uint256 value) private pure returns(string memory) {
return _toHex(abi.encodePacked(value));
}
function _toHex(bytes memory data) private pure returns(string memory) {
bytes16 alphabet = 0x30313233343536373839616263646566;
bytes memory str = new bytes(2 + data.length * 2);
str[0] = "0";
str[1] = "x";
for (uint256 i = 0; i < data.length; i++) {
str[2 * i + 2] = alphabet[uint8(data[i] >> 4)];
str[2 * i + 3] = alphabet[uint8(data[i] & 0x0f)];
}
return string(str);
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;
pragma abicoder v2;
import "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol";
import "./RevertReasonParser.sol";
/// @title Interface for DAI-style permits
interface IDaiLikePermit {
function permit(
address holder,
address spender,
uint256 nonce,
uint256 expiry,
bool allowed,
uint8 v,
bytes32 r,
bytes32 s
) external;
}
/// @title SignatureTransfer
/// @notice Handles ERC20 token transfers through signature based actions
/// @dev Requires user's token approval on the Permit2 contract
interface IPermit2 {
/// @notice The token and amount details for a transfer signed in the permit transfer signature
struct TokenPermissions {
// ERC20 token address
address token;
// the maximum amount that can be spent
uint256 amount;
}
/// @notice The signed permit message for a single token transfer
struct PermitTransferFrom {
TokenPermissions permitted;
// a unique value for every token owner's signature to prevent signature replays
uint256 nonce;
// deadline on the permit signature
uint256 deadline;
}
/// @notice Specifies the recipient address and amount for batched transfers.
/// @dev Recipients and amounts correspond to the index of the signed token permissions array.
/// @dev Reverts if the requested amount is greater than the permitted signed amount.
struct SignatureTransferDetails {
// recipient address
address to;
// spender requested amount
uint256 requestedAmount;
}
/// @notice A map from token owner address and a caller specified word index to a bitmap. Used to set bits in the bitmap to prevent against signature replay protection
/// @dev Uses unordered nonces so that permit messages do not need to be spent in a certain order
/// @dev The mapping is indexed first by the token owner, then by an index specified in the nonce
/// @dev It returns a uint256 bitmap
/// @dev The index, or wordPosition is capped at type(uint248).max
function nonceBitmap(address, uint256) external view returns (uint256);
/// @notice Transfers a token using a signed permit message
/// @dev Reverts if the requested amount is greater than the permitted signed amount
/// @param permit The permit data signed over by the owner
/// @param owner The owner of the tokens to transfer
/// @param transferDetails The spender's requested transfer details for the permitted token
/// @param signature The signature to verify
function permitTransferFrom(
PermitTransferFrom memory permit,
SignatureTransferDetails calldata transferDetails,
address owner,
bytes calldata signature
) external;
/// @notice Returns the domain separator for the current chain.
/// @dev Uses cached version if chainid and address are unchanged from construction.
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
contract Permitable {
address public permit2;
function permit2DomainSeperator() external view returns (bytes32) {
return IPermit2(permit2).DOMAIN_SEPARATOR();
}
function _permit(address token, bytes calldata permit, address from) internal returns (bool) {
if (permit.length > 0) {
if (permit.length == 32 * 7 || permit.length == 32 * 8) {
(bool success, bytes memory result) = _permit1(token, permit);
if (!success) {
revert(RevertReasonParser.parse(result, "Permit failed: "));
}
return false;
} else {
(bool success, bytes memory result) = _permit2(permit, from);
if (!success) {
revert(RevertReasonParser.parse(result, "Permit2 failed: "));
}
return true;
}
}
return false;
}
function _isPermit2(bytes calldata permit) internal pure returns (bool) {
return permit.length == 32 * 11 || permit.length == 32 * 12;
}
function _permit1(address token, bytes calldata permit) private returns (bool success, bytes memory result) {
if (permit.length == 32 * 7) {
// solhint-disable-next-line avoid-low-level-calls
(success, result) = token.call(abi.encodePacked(IERC20Permit.permit.selector, permit));
} else if (permit.length == 32 * 8) {
// solhint-disable-next-line avoid-low-level-calls
(success, result) = token.call(abi.encodePacked(IDaiLikePermit.permit.selector, permit));
}
}
function _permit2(bytes calldata permit, address from) private returns (bool success, bytes memory result) {
(, , address owner, ) = abi.decode(
permit,
(IPermit2.PermitTransferFrom, IPermit2.SignatureTransferDetails, address, bytes)
);
require(owner == from, "Permit2 denied");
// solhint-disable-next-line avoid-low-level-calls
(success, result) = permit2.call(abi.encodePacked(IPermit2.permitTransferFrom.selector, permit)); // TODO support batch permit
}
/// @notice Finds the next valid nonce for a user, starting from 0.
/// @param owner The owner of the nonces
/// @return nonce The first valid nonce starting from 0
function permit2NextNonce(address owner) external view returns (uint256 nonce) {
nonce = _permit2NextNonce(owner, 0, 0);
}
/// @notice Finds the next valid nonce for a user, after from a given nonce.
/// @dev This can be helpful if you're signing multiple nonces in a row and need the next nonce to sign but the start one is still valid.
/// @param owner The owner of the nonces
/// @param start The nonce to start from
/// @return nonce The first valid nonce after the given nonce
function permit2NextNonceAfter(address owner, uint256 start) external view returns (uint256 nonce) {
uint248 word = uint248(start >> 8);
uint8 pos = uint8(start);
if (pos == type(uint8).max) {
// If the position is 255, we need to move to the next word
word++;
pos = 0;
} else {
// Otherwise, we just move to the next position
pos++;
}
nonce = _permit2NextNonce(owner, word, pos);
}
/// @notice Finds the next valid nonce for a user, starting from a given word and position.
/// @param owner The owner of the nonces
/// @param word Word to start looking from
/// @param pos Position inside the word to start looking from
function _permit2NextNonce(address owner, uint248 word, uint8 pos) internal view returns (uint256 nonce) {
while (true) {
uint256 bitmap = IPermit2(permit2).nonceBitmap(owner, word);
// Check if the bitmap is completely full
if (bitmap == type(uint256).max) {
// If so, move to the next word
++word;
pos = 0;
continue;
}
if (pos != 0) {
// If the position is not 0, we need to shift the bitmap to ignore the bits before position
bitmap = bitmap >> pos;
}
// Find the first zero bit in the bitmap
while (bitmap & 1 == 1) {
bitmap = bitmap >> 1;
++pos;
}
return _permit2NonceFromWordAndPos(word, pos);
}
}
/// @notice Constructs a nonce from a word and a position inside the word
/// @param word The word containing the nonce
/// @param pos The position of the nonce inside the word
/// @return nonce The nonce constructed from the word and position
function _permit2NonceFromWordAndPos(uint248 word, uint8 pos) internal pure returns (uint256 nonce) {
// The last 248 bits of the word are the nonce bits
nonce = uint256(word) << 8;
// The first 8 bits of the word are the position inside the word
nonce |= pos;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
library UniversalERC20 {
using SafeMath for uint256;
using SafeERC20 for IERC20;
IERC20 internal constant ZERO_ADDRESS = IERC20(0x0000000000000000000000000000000000000000);
IERC20 internal constant ETH_ADDRESS = IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);
IERC20 internal constant MATIC_ADDRESS = IERC20(0x0000000000000000000000000000000000001010);
function universalTransfer(
IERC20 token,
address payable to,
uint256 amount
) internal {
if (amount > 0) {
if (isETH(token)) {
(bool result, ) = to.call{value: amount}("");
require(result, "Failed to transfer ETH");
} else {
token.safeTransfer(to, amount);
}
}
}
function universalApprove(
IERC20 token,
address to,
uint256 amount
) internal {
require(!isETH(token), "Approve called on ETH");
if (amount == 0) {
token.safeApprove(to, 0);
} else {
uint256 allowance = token.allowance(address(this), to);
if (allowance < amount) {
if (allowance > 0) {
token.safeApprove(to, 0);
}
token.safeApprove(to, amount);
}
}
}
function universalBalanceOf(IERC20 token, address account) internal view returns (uint256) {
if (isETH(token)) {
return account.balance;
} else {
return token.balanceOf(account);
}
}
function isETH(IERC20 token) internal pure returns (bool) {
return
address(token) == address(ETH_ADDRESS) ||
address(token) == address(MATIC_ADDRESS) ||
address(token) == address(ZERO_ADDRESS);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/SignatureChecker.sol)
pragma solidity ^0.8.0;
import "./ECDSAUpgradeable.sol";
import "../AddressUpgradeable.sol";
import "../../interfaces/IERC1271Upgradeable.sol";
/**
* @dev Signature verification helper: Provide a single mechanism to verify both private-key (EOA) ECDSA signature and
* ERC1271 contract signatures. Using this instead of ECDSA.recover in your contract will make them compatible with
* smart contract wallets such as Argent and Gnosis.
*
* Note: unlike ECDSA signatures, contract signature's are revocable, and the outcome of this function can thus change
* through time. It could return true at block N and false at block N+1 (or the opposite).
*
* _Available since v4.1._
*/
library SignatureCheckerUpgradeable {
function isValidSignatureNow(
address signer,
bytes32 hash,
bytes memory signature
) internal view returns (bool) {
(address recovered, ECDSAUpgradeable.RecoverError error) = ECDSAUpgradeable.tryRecover(hash, signature);
if (error == ECDSAUpgradeable.RecoverError.NoError && recovered == signer) {
return true;
}
(bool success, bytes memory result) = signer.staticcall(
abi.encodeWithSelector(IERC1271Upgradeable.isValidSignature.selector, hash, signature)
);
return (success && result.length == 32 && abi.decode(result, (bytes4)) == IERC1271Upgradeable.isValidSignature.selector);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract PausableUpgradeable is Initializable, ContextUpgradeable {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
function __Pausable_init() internal onlyInitializing {
__Context_init_unchained();
__Pausable_init_unchained();
}
function __Pausable_init_unchained() internal onlyInitializing {
_paused = false;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal onlyInitializing {
__Context_init_unchained();
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
uint256[49] private __gap;
}// 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/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; // EIP-2612 is Final as of 2022-11-01. This file is deprecated. import "./IERC20Permit.sol";
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC1271 standard signature validation method for
* contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
*
* _Available since v4.1._
*/
interface IERC1271Upgradeable {
/**
* @dev Should return whether the signature provided is valid for the provided data
* @param hash Hash of the data to be signed
* @param signature Signature byte array associated with _data
*/
function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../StringsUpgradeable.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSAUpgradeable {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
// Check the signature length
// - case 65: r,s,v signature (standard)
// - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else if (signature.length == 64) {
bytes32 r;
bytes32 vs;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s;
uint8 v;
assembly {
s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
v := add(shr(255, vs), 27)
}
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", StringsUpgradeable.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)
pragma solidity ^0.8.0;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
* initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() initializer {}
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
*/
bool private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Modifier to protect an initializer function from being invoked twice.
*/
modifier initializer() {
// If the contract is initializing we ignore whether _initialized is set in order to support multiple
// inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
// contract may have been reentered.
require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");
bool isTopLevelCall = !_initializing;
if (isTopLevelCall) {
_initializing = true;
_initialized = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
}
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} modifier, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
function _isConstructor() private view returns (bool) {
return !AddressUpgradeable.isContract(address(this));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
__Context_init_unchained();
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library StringsUpgradeable {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"remappings": [],
"evmVersion": "london"
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"aggregator","type":"address"}],"name":"AddAggregator","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"aggregator","type":"address"}],"name":"DelAggregator","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"bytes32","name":"orderHash","type":"bytes32"},{"indexed":false,"internalType":"address","name":"swapAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"returnAmount","type":"uint256"}],"name":"OSwap","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"feeReceiver","type":"address"}],"name":"SetFeeReceiver","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address[]","name":"_aggregators","type":"address[]"}],"name":"addAggregator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"aggregators","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"from","type":"address"},{"internalType":"contract IERC20[]","name":"path","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"address","name":"swapAddress","type":"address"},{"internalType":"bytes","name":"swapExtraData","type":"bytes"},{"internalType":"bytes32","name":"orderHash","type":"bytes32"},{"internalType":"bytes","name":"permit","type":"bytes"},{"internalType":"uint256","name":"flag","type":"uint256"}],"internalType":"struct OpenOceanSettler.SwapData[]","name":"swaps","type":"tuple[]"}],"name":"batchSwap","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_aggregator","type":"address"}],"name":"delAggregator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeReceiver","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"_feeReceiver","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"operators","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"permit2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"permit2DomainSeperator","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"permit2NextNonce","outputs":[{"internalType":"uint256","name":"nonce","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"}],"name":"permit2NextNonceAfter","outputs":[{"internalType":"uint256","name":"nonce","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_feeReceiver","type":"address"}],"name":"setFeeReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_permit2","type":"address"}],"name":"setPermit2","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"bool","name":"on","type":"bool"}],"name":"updateOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address payable","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
608060405234801561001057600080fd5b50612a9a806100206000396000f3fe60806040526004361061012e5760003560e01c80638456cb59116100ab578063c4d66de81161006f578063c4d66de814610341578063d9caed1214610361578063dfb1293614610381578063efdcd974146103a1578063f2fde38b146103c1578063ff3a920f146103e157600080fd5b80638456cb59146102ae5780638da5cb5b146102c3578063ac320a90146102e1578063b3f0067414610301578063be698cfc1461032157600080fd5b80633f4ba83a116100f25780633f4ba83a146102295780635c975abb1461023e5780636d44a3b214610256578063715018a614610276578063844fb31c1461028b57600080fd5b8063101ec30a1461013a578063112cdab91461015c57806312261ee7146101a157806313e7c9d8146101d957806321c3bc4c1461020957600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a610155366004612411565b610401565b005b34801561016857600080fd5b5061018c610177366004612411565b60996020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b3480156101ad57600080fd5b506097546101c1906001600160a01b031681565b6040516001600160a01b039091168152602001610198565b3480156101e557600080fd5b5061018c6101f4366004612411565b609a6020526000908152604090205460ff1681565b34801561021557600080fd5b5061015a61022436600461247a565b610456565b34801561023557600080fd5b5061015a6105da565b34801561024a57600080fd5b5060655460ff1661018c565b34801561026257600080fd5b5061015a6102713660046124ca565b61060e565b34801561028257600080fd5b5061015a610663565b34801561029757600080fd5b506102a0610697565b604051908152602001610198565b3480156102ba57600080fd5b5061015a61070a565b3480156102cf57600080fd5b506033546001600160a01b03166101c1565b6102f46102ef36600461247a565b61073c565b6040516101989190612503565b34801561030d57600080fd5b506098546101c1906001600160a01b031681565b34801561032d57600080fd5b506102a061033c366004612547565b6108a7565b34801561034d57600080fd5b5061015a61035c366004612411565b6108f2565b34801561036d57600080fd5b5061015a61037c366004612573565b6109c5565b34801561038d57600080fd5b5061015a61039c366004612411565b610a03565b3480156103ad57600080fd5b5061015a6103bc366004612411565b610a85565b3480156103cd57600080fd5b5061015a6103dc366004612411565b610afd565b3480156103ed57600080fd5b506102a06103fc366004612411565b610b98565b6033546001600160a01b031633146104345760405162461bcd60e51b815260040161042b906125b4565b60405180910390fd5b609780546001600160a01b0319166001600160a01b0392909216919091179055565b6033546001600160a01b031633146104805760405162461bcd60e51b815260040161042b906125b4565b60005b818110156105d557600083838381811061049f5761049f6125e9565b90506020020160208101906104b49190612411565b6001600160a01b0316141561050b5760405162461bcd60e51b815260206004820152601a60248201527f61676772656761746f72206973207a65726f2061646472657373000000000000604482015260640161042b565b600160996000858585818110610523576105236125e9565b90506020020160208101906105389190612411565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790557f3c2e997dfcda81cee806d36ea9c069913d276e873b388b126482814ef56e9730838383818110610593576105936125e9565b90506020020160208101906105a89190612411565b6040516001600160a01b03909116815260200160405180910390a1806105cd81612615565b915050610483565b505050565b6033546001600160a01b031633146106045760405162461bcd60e51b815260040161042b906125b4565b61060c610ba6565b565b6033546001600160a01b031633146106385760405162461bcd60e51b815260040161042b906125b4565b6001600160a01b03919091166000908152609a60205260409020805460ff1916911515919091179055565b6033546001600160a01b0316331461068d5760405162461bcd60e51b815260040161042b906125b4565b61060c6000610c39565b60975460408051633644e51560e01b815290516000926001600160a01b031691633644e5159160048083019260209291908290030181865afa1580156106e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107059190612630565b905090565b6033546001600160a01b031633146107345760405162461bcd60e51b815260040161042b906125b4565b61060c610c8b565b336000908152609a602052604090205460609060ff166107aa5760405162461bcd60e51b8152602060048201526024808201527f4f70657261746f723a2063616c6c6572206973206e6f7420746865206f70657260448201526330ba37b960e11b606482015260840161042b565b60655460ff16156107f05760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161042b565b60008267ffffffffffffffff81111561080b5761080b612649565b604051908082528060200260200182016040528015610834578160200160208202803683370190505b50905060005b8381101561089d5761086e858583818110610857576108576125e9565b9050602002810190610869919061265f565b610d06565b828281518110610880576108806125e9565b60209081029190910101528061089581612615565b91505061083a565b5090505b92915050565b6000600882901c8260ff80821614156108d057816108c48161267f565b925050600090506108de565b806108da816126a6565b9150505b6108e98583836112ce565b95945050505050565b600054610100900460ff1661090d5760005460ff1615610911565b303b155b6109745760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161042b565b600054610100900460ff16158015610996576000805461ffff19166101011790555b61099e6113b6565b6109a66113ed565b6109af82610a85565b80156109c1576000805461ff00191690555b5050565b6033546001600160a01b031633146109ef5760405162461bcd60e51b815260040161042b906125b4565b6105d56001600160a01b0384168383611424565b6033546001600160a01b03163314610a2d5760405162461bcd60e51b815260040161042b906125b4565b6001600160a01b038116600081815260996020908152604091829020805460ff1916905590519182527ff11d18001d3397a2024bf40def3a2374cd366b56ec54eba9a0f59d1ca85c27b391015b60405180910390a150565b6033546001600160a01b03163314610aaf5760405162461bcd60e51b815260040161042b906125b4565b609880546001600160a01b0319166001600160a01b0383169081179091556040519081527fffb40bfdfd246e95f543d08d9713c339f1d90fa9265e39b4f562f9011d7c919f90602001610a7a565b6033546001600160a01b03163314610b275760405162461bcd60e51b815260040161042b906125b4565b6001600160a01b038116610b8c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161042b565b610b9581610c39565b50565b60006108a1826000806112ce565b60655460ff16610bef5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161042b565b6065805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60655460ff1615610cd15760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161042b565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610c1c3390565b6000610d1560208301836126c6565b90506002148015610d345750610d2e60408301836126c6565b90506003145b610d795760405162461bcd60e51b8152602060048201526016602482015275092dcecc2d8d2c840c2dadeeadce8e640d8cadccee8d60531b604482015260640161042b565b6000610d8b6080840160608501612411565b6001600160a01b03161415610de25760405162461bcd60e51b815260206004820152601b60248201527f5377617041646472657373206973207a65726f20616464726573730000000000604482015260640161042b565b60996000610df66080850160608601612411565b6001600160a01b0316815260208101919091526040016000205460ff16610e5f5760405162461bcd60e51b815260206004820152601a60248201527f5377617041646472657373206973206e6f7420737570706f7274000000000000604482015260640161042b565b6000610e6e60208401846126c6565b6000818110610e7f57610e7f6125e9565b9050602002016020810190610e949190612411565b90506000610ea560208501856126c6565b6001818110610eb657610eb66125e9565b9050602002016020810190610ecb9190612411565b9050610ef0610edd6020860186612411565b83610eeb60c0880188612710565b6114ee565b610f315760405162461bcd60e51b8152602060048201526012602482015271151c985b9cd9995c881a5cc819985a5b195960721b604482015260640161042b565b610f3e60408501856126c6565b6000818110610f4f57610f4f6125e9565b90506020020135610f7230846001600160a01b031661150790919063ffffffff16565b1015610fb65760405162461bcd60e51b81526020600482015260136024820152722a3930b739b332b91034b9903330b4b632b21760691b604482015260640161042b565b6000610fcb6001600160a01b03831630611507565b905061101e610fe06080870160608801612411565b610fed60408801886126c6565b6000818110610ffe57610ffe6125e9565b90506020020135856001600160a01b03166115999092919063ffffffff16565b60006110306080870160608801612411565b6001600160a01b0316346110476080890189612710565b604051611055929190612757565b60006040518083038185875af1925050503d8060008114611092576040519150601f19603f3d011682016040523d82523d6000602084013e611097565b606091505b505090508061114a5760006110af60408801886126c6565b60028181106110c0576110c06125e9565b90506020020135905060008111156110ec576098546110ec906001600160a01b038781169116836116ae565b6111446110fc6020890189612411565b6111338361110d60408c018c6126c6565b600081811061111e5761111e6125e9565b9050602002013561171190919063ffffffff16565b6001600160a01b03881691906116ae565b50611258565b611167826111616001600160a01b03861630611507565b90611711565b9450600085116111b95760405162461bcd60e51b815260206004820152601960248201527f52657475726e20616d6f756e74206973206e6f74207a65726f00000000000000604482015260640161042b565b60006111c860408801886126c6565b60018181106111d9576111d96125e9565b9050602002013590508660e001356001141561120e57609854611209906001600160a01b03878116911683611424565b611235565b609854611228906001600160a01b03868116911683611424565b6112328682611711565b95505b6112566112456020890189612411565b6001600160a01b03861690886116ae565b505b60a086013561126a6020880188612411565b6001600160a01b03167fdb1dbe5521d653ceda13f62b24a9193dad6eaf697b4db14cabd9d7ff4a641b2e6112a460808a0160608b01612411565b604080516001600160a01b039092168252602082018a90520160405180910390a350505050919050565b60005b6097546040516313f80ad160e21b81526001600160a01b0386811660048301526001600160f81b03861660248301526000921690634fe02b4490604401602060405180830381865afa15801561132b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134f9190612630565b9050600019811415611370576113648461267f565b935060009250506112d1565b60ff83161561137f5760ff83161c5b806001166001141561139e5760011c611397836126a6565b925061137f565b505060ff811660ff19600884901b16175b9392505050565b600054610100900460ff166113dd5760405162461bcd60e51b815260040161042b90612767565b6113e561171d565b61060c611744565b600054610100900460ff166114145760405162461bcd60e51b815260040161042b90612767565b61141c61171d565b61060c611774565b80156105d557611433836117a7565b156114da576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611485576040519150601f19603f3d011682016040523d82523d6000602084013e61148a565b606091505b50509050806114d45760405162461bcd60e51b815260206004820152601660248201527508cc2d2d8cac840e8de40e8e4c2dce6cccae4408aa8960531b604482015260640161042b565b50505050565b6105d56001600160a01b03841683836116ae565b60006114fc848484886117f2565b90505b949350505050565b6000611512836117a7565b1561152857506001600160a01b038116316108a1565b6040516370a0823160e01b81526001600160a01b0383811660048301528416906370a0823190602401602060405180830381865afa15801561156e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115929190612630565b90506108a1565b6115a2836117a7565b156115e75760405162461bcd60e51b8152602060048201526015602482015274082e0e0e4deecca40c6c2d8d8cac840dedc408aa89605b1b604482015260640161042b565b80611601576105d56001600160a01b0384168360006118da565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611651573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116759190612630565b9050818110156114d457801561169a5761169a6001600160a01b0385168460006118da565b6114d46001600160a01b03851684846118da565b6040516001600160a01b0383166024820152604481018290526105d590849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526119ef565b60006113af82846127b2565b600054610100900460ff1661060c5760405162461bcd60e51b815260040161042b90612767565b600054610100900460ff1661176b5760405162461bcd60e51b815260040161042b90612767565b61060c33610c39565b600054610100900460ff1661179b5760405162461bcd60e51b815260040161042b90612767565b6065805460ff19169055565b60006001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14806117de57506001600160a01b038216611010145b806108a15750506001600160a01b03161590565b600082156118cf5760e083148061180a575061010083145b1561187b5760008061181d878787611ac4565b915091508161187057611857816040518060400160405280600f81526020016e02832b936b4ba103330b4b632b21d1608d1b815250611bfb565b60405162461bcd60e51b815260040161042b91906127f5565b6000925050506114ff565b600080611889868686611f6c565b91509150816118c457611857816040518060400160405280601081526020016f02832b936b4ba19103330b4b632b21d160851b815250611bfb565b6001925050506114ff565b506000949350505050565b8015806119545750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa15801561192e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119529190612630565b155b6119bf5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161042b565b6040516001600160a01b0383166024820152604481018290526105d590849063095ea7b360e01b906064016116da565b6000611a44826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166120699092919063ffffffff16565b9050805160001480611a65575080806020019051810190611a659190612828565b6105d55760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161042b565b6000606060e0831415611b5f576040516001600160a01b03861690611af89063d505accf60e01b9087908790602001612845565b60408051601f1981840301815290829052611b1291612869565b6000604051808303816000865af19150503d8060008114611b4f576040519150601f19603f3d011682016040523d82523d6000602084013e611b54565b606091505b509092509050611bf3565b610100831415611bf3576040516001600160a01b03861690611b90906323f2ebc360e21b9087908790602001612845565b60408051601f1981840301815290829052611baa91612869565b6000604051808303816000865af19150503d8060008114611be7576040519150601f19603f3d011682016040523d82523d6000602084013e611bec565b606091505b5090925090505b935093915050565b60606004835110611e8b5760208301516001600160e01b0319811662461bcd60e51b148015611c2c57506044845110155b15611d7e57602484810151808601820180519192909190611c4e90849061287b565b611c58919061287b565b86511015611ca5576040805162461bcd60e51b815260206004820152601560248201527424b73b30b634b2103932bb32b93a103932b0b9b7b760591b604482015290519081900360640190fd5b84816040516020018083805190602001908083835b60208310611cd95780518252601f199092019160209182019101611cba565b51815160209384036101000a60001901801990921691161790526508ae4e4dee4560d31b919093019081528451600690910192850191508083835b60208310611d335780518252601f199092019160209182019101611d14565b6001836020036101000a03801982511681845116808217855250505050505090500180602960f81b8152506001019250505060405160208183030381529060405293505050506108a1565b6001600160e01b03198116634e487b7160e01b148015611d9f575083516024145b15611e8957602484015183611db382612078565b6040516020018083805190602001908083835b60208310611de55780518252601f199092019160209182019101611dc6565b51815160209384036101000a6000190180199092169116179052650a0c2dcd2c6560d31b919093019081528451600690910192850191508083835b60208310611e3f5780518252601f199092019160209182019101611e20565b6001836020036101000a03801982511681845116808217855250505050505090500180602960f81b81525060010192505050604051602081830303815290604052925050506108a1565b505b81611e958461209e565b6040516020018083805190602001908083835b60208310611ec75780518252601f199092019160209182019101611ea8565b51815160209384036101000a6000190180199092169116179052670aadcd6dcdeeedc560c31b919093019081528451600890910192850191508083835b60208310611f235780518252601f199092019160209182019101611f04565b6001836020036101000a03801982511681845116808217855250505050505090500180602960f81b81525060010192505050604051602081830303815290604052905092915050565b6000606081611f7d85870187612946565b5092505050836001600160a01b0316816001600160a01b031614611fd45760405162461bcd60e51b815260206004820152600e60248201526d14195c9b5a5d0c8819195b9a595960921b604482015260640161042b565b6097546040516001600160a01b0390911690611fff9063187945bd60e11b9089908990602001612845565b60408051601f198184030181529082905261201991612869565b6000604051808303816000865af19150503d8060008114612056576040519150601f19603f3d011682016040523d82523d6000602084013e61205b565b606091505b509097909650945050505050565b60606114ff8484600085612286565b60606108a182604051602001808281526020019150506040516020818303038152906040525b80516060906f181899199a1a9b1b9c1cb0b131b232b360811b906000906120c6906002612a45565b6120d190600261287b565b67ffffffffffffffff8111156120e9576120e9612649565b6040519080825280601f01601f191660200182016040528015612113576020820181803683370190505b509050600360fc1b8160008151811061212e5761212e6125e9565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061215d5761215d6125e9565b60200101906001600160f81b031916908160001a90535060005b845181101561227e57826004868381518110612195576121956125e9565b01602001516001600160f81b031916901c60f81c601081106121b9576121b96125e9565b1a60f81b826121c9836002612a45565b6121d490600261287b565b815181106121e4576121e46125e9565b60200101906001600160f81b031916908160001a9053508285828151811061220e5761220e6125e9565b60209101015160f81c600f166010811061222a5761222a6125e9565b1a60f81b8261223a836002612a45565b61224590600361287b565b81518110612255576122556125e9565b60200101906001600160f81b031916908160001a9053508061227681612615565b915050612177565b509392505050565b6060824710156122e75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161042b565b600080866001600160a01b031685876040516123039190612869565b60006040518083038185875af1925050503d8060008114612340576040519150601f19603f3d011682016040523d82523d6000602084013e612345565b606091505b509150915061235687838387612361565b979650505050505050565b606083156123cd5782516123c6576001600160a01b0385163b6123c65760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161042b565b50816114ff565b6114ff83838151156123e25781518083602001fd5b8060405162461bcd60e51b815260040161042b91906127f5565b6001600160a01b0381168114610b9557600080fd5b60006020828403121561242357600080fd5b81356113af816123fc565b60008083601f84011261244057600080fd5b50813567ffffffffffffffff81111561245857600080fd5b6020830191508360208260051b850101111561247357600080fd5b9250929050565b6000806020838503121561248d57600080fd5b823567ffffffffffffffff8111156124a457600080fd5b6124b08582860161242e565b90969095509350505050565b8015158114610b9557600080fd5b600080604083850312156124dd57600080fd5b82356124e8816123fc565b915060208301356124f8816124bc565b809150509250929050565b6020808252825182820181905260009190848201906040850190845b8181101561253b5783518352928401929184019160010161251f565b50909695505050505050565b6000806040838503121561255a57600080fd5b8235612565816123fc565b946020939093013593505050565b60008060006060848603121561258857600080fd5b8335612593816123fc565b925060208401356125a3816123fc565b929592945050506040919091013590565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415612629576126296125ff565b5060010190565b60006020828403121561264257600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b6000823560fe1983360301811261267557600080fd5b9190910192915050565b60006001600160f81b038281168082141561269c5761269c6125ff565b6001019392505050565b600060ff821660ff8114156126bd576126bd6125ff565b60010192915050565b6000808335601e198436030181126126dd57600080fd5b83018035915067ffffffffffffffff8211156126f857600080fd5b6020019150600581901b360382131561247357600080fd5b6000808335601e1984360301811261272757600080fd5b83018035915067ffffffffffffffff82111561274257600080fd5b60200191503681900382131561247357600080fd5b8183823760009101908152919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000828210156127c4576127c46125ff565b500390565b60005b838110156127e45781810151838201526020016127cc565b838111156114d45750506000910152565b60208152600082518060208401526128148160408501602087016127c9565b601f01601f19169190910160400192915050565b60006020828403121561283a57600080fd5b81516113af816124bc565b6001600160e01b031984168152818360048301376000910160040190815292915050565b600082516126758184602087016127c9565b6000821982111561288e5761288e6125ff565b500190565b6040516060810167ffffffffffffffff811182821017156128b6576128b6612649565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156128e5576128e5612649565b604052919050565b6000604082840312156128ff57600080fd5b6040516040810181811067ffffffffffffffff8211171561292257612922612649565b6040529050808235612933816123fc565b8152602092830135920191909152919050565b60008060008084860361010081121561295e57600080fd5b608081121561296c57600080fd5b50612975612893565b61297f87876128ed565b81526020604087013581830152606087013560408301528195506129a688608089016128ed565b945060c087013591506129b8826123fc565b90925060e08601359067ffffffffffffffff808311156129d757600080fd5b828801925088601f8401126129eb57600080fd5b8235818111156129fd576129fd612649565b612a0f601f8201601f191684016128bc565b91508082528983828601011115612a2557600080fd5b808385018484013760008382840101525080935050505092959194509250565b6000816000190483118215151615612a5f57612a5f6125ff565b50029056fea2646970667358221220e57d98489e35000a7424fc54f1b70259f7043edbbd96af3c42228a653e1ec31364736f6c634300080a0033
Deployed Bytecode
0x60806040526004361061012e5760003560e01c80638456cb59116100ab578063c4d66de81161006f578063c4d66de814610341578063d9caed1214610361578063dfb1293614610381578063efdcd974146103a1578063f2fde38b146103c1578063ff3a920f146103e157600080fd5b80638456cb59146102ae5780638da5cb5b146102c3578063ac320a90146102e1578063b3f0067414610301578063be698cfc1461032157600080fd5b80633f4ba83a116100f25780633f4ba83a146102295780635c975abb1461023e5780636d44a3b214610256578063715018a614610276578063844fb31c1461028b57600080fd5b8063101ec30a1461013a578063112cdab91461015c57806312261ee7146101a157806313e7c9d8146101d957806321c3bc4c1461020957600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a610155366004612411565b610401565b005b34801561016857600080fd5b5061018c610177366004612411565b60996020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b3480156101ad57600080fd5b506097546101c1906001600160a01b031681565b6040516001600160a01b039091168152602001610198565b3480156101e557600080fd5b5061018c6101f4366004612411565b609a6020526000908152604090205460ff1681565b34801561021557600080fd5b5061015a61022436600461247a565b610456565b34801561023557600080fd5b5061015a6105da565b34801561024a57600080fd5b5060655460ff1661018c565b34801561026257600080fd5b5061015a6102713660046124ca565b61060e565b34801561028257600080fd5b5061015a610663565b34801561029757600080fd5b506102a0610697565b604051908152602001610198565b3480156102ba57600080fd5b5061015a61070a565b3480156102cf57600080fd5b506033546001600160a01b03166101c1565b6102f46102ef36600461247a565b61073c565b6040516101989190612503565b34801561030d57600080fd5b506098546101c1906001600160a01b031681565b34801561032d57600080fd5b506102a061033c366004612547565b6108a7565b34801561034d57600080fd5b5061015a61035c366004612411565b6108f2565b34801561036d57600080fd5b5061015a61037c366004612573565b6109c5565b34801561038d57600080fd5b5061015a61039c366004612411565b610a03565b3480156103ad57600080fd5b5061015a6103bc366004612411565b610a85565b3480156103cd57600080fd5b5061015a6103dc366004612411565b610afd565b3480156103ed57600080fd5b506102a06103fc366004612411565b610b98565b6033546001600160a01b031633146104345760405162461bcd60e51b815260040161042b906125b4565b60405180910390fd5b609780546001600160a01b0319166001600160a01b0392909216919091179055565b6033546001600160a01b031633146104805760405162461bcd60e51b815260040161042b906125b4565b60005b818110156105d557600083838381811061049f5761049f6125e9565b90506020020160208101906104b49190612411565b6001600160a01b0316141561050b5760405162461bcd60e51b815260206004820152601a60248201527f61676772656761746f72206973207a65726f2061646472657373000000000000604482015260640161042b565b600160996000858585818110610523576105236125e9565b90506020020160208101906105389190612411565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790557f3c2e997dfcda81cee806d36ea9c069913d276e873b388b126482814ef56e9730838383818110610593576105936125e9565b90506020020160208101906105a89190612411565b6040516001600160a01b03909116815260200160405180910390a1806105cd81612615565b915050610483565b505050565b6033546001600160a01b031633146106045760405162461bcd60e51b815260040161042b906125b4565b61060c610ba6565b565b6033546001600160a01b031633146106385760405162461bcd60e51b815260040161042b906125b4565b6001600160a01b03919091166000908152609a60205260409020805460ff1916911515919091179055565b6033546001600160a01b0316331461068d5760405162461bcd60e51b815260040161042b906125b4565b61060c6000610c39565b60975460408051633644e51560e01b815290516000926001600160a01b031691633644e5159160048083019260209291908290030181865afa1580156106e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107059190612630565b905090565b6033546001600160a01b031633146107345760405162461bcd60e51b815260040161042b906125b4565b61060c610c8b565b336000908152609a602052604090205460609060ff166107aa5760405162461bcd60e51b8152602060048201526024808201527f4f70657261746f723a2063616c6c6572206973206e6f7420746865206f70657260448201526330ba37b960e11b606482015260840161042b565b60655460ff16156107f05760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161042b565b60008267ffffffffffffffff81111561080b5761080b612649565b604051908082528060200260200182016040528015610834578160200160208202803683370190505b50905060005b8381101561089d5761086e858583818110610857576108576125e9565b9050602002810190610869919061265f565b610d06565b828281518110610880576108806125e9565b60209081029190910101528061089581612615565b91505061083a565b5090505b92915050565b6000600882901c8260ff80821614156108d057816108c48161267f565b925050600090506108de565b806108da816126a6565b9150505b6108e98583836112ce565b95945050505050565b600054610100900460ff1661090d5760005460ff1615610911565b303b155b6109745760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161042b565b600054610100900460ff16158015610996576000805461ffff19166101011790555b61099e6113b6565b6109a66113ed565b6109af82610a85565b80156109c1576000805461ff00191690555b5050565b6033546001600160a01b031633146109ef5760405162461bcd60e51b815260040161042b906125b4565b6105d56001600160a01b0384168383611424565b6033546001600160a01b03163314610a2d5760405162461bcd60e51b815260040161042b906125b4565b6001600160a01b038116600081815260996020908152604091829020805460ff1916905590519182527ff11d18001d3397a2024bf40def3a2374cd366b56ec54eba9a0f59d1ca85c27b391015b60405180910390a150565b6033546001600160a01b03163314610aaf5760405162461bcd60e51b815260040161042b906125b4565b609880546001600160a01b0319166001600160a01b0383169081179091556040519081527fffb40bfdfd246e95f543d08d9713c339f1d90fa9265e39b4f562f9011d7c919f90602001610a7a565b6033546001600160a01b03163314610b275760405162461bcd60e51b815260040161042b906125b4565b6001600160a01b038116610b8c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161042b565b610b9581610c39565b50565b60006108a1826000806112ce565b60655460ff16610bef5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161042b565b6065805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60655460ff1615610cd15760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161042b565b6065805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258610c1c3390565b6000610d1560208301836126c6565b90506002148015610d345750610d2e60408301836126c6565b90506003145b610d795760405162461bcd60e51b8152602060048201526016602482015275092dcecc2d8d2c840c2dadeeadce8e640d8cadccee8d60531b604482015260640161042b565b6000610d8b6080840160608501612411565b6001600160a01b03161415610de25760405162461bcd60e51b815260206004820152601b60248201527f5377617041646472657373206973207a65726f20616464726573730000000000604482015260640161042b565b60996000610df66080850160608601612411565b6001600160a01b0316815260208101919091526040016000205460ff16610e5f5760405162461bcd60e51b815260206004820152601a60248201527f5377617041646472657373206973206e6f7420737570706f7274000000000000604482015260640161042b565b6000610e6e60208401846126c6565b6000818110610e7f57610e7f6125e9565b9050602002016020810190610e949190612411565b90506000610ea560208501856126c6565b6001818110610eb657610eb66125e9565b9050602002016020810190610ecb9190612411565b9050610ef0610edd6020860186612411565b83610eeb60c0880188612710565b6114ee565b610f315760405162461bcd60e51b8152602060048201526012602482015271151c985b9cd9995c881a5cc819985a5b195960721b604482015260640161042b565b610f3e60408501856126c6565b6000818110610f4f57610f4f6125e9565b90506020020135610f7230846001600160a01b031661150790919063ffffffff16565b1015610fb65760405162461bcd60e51b81526020600482015260136024820152722a3930b739b332b91034b9903330b4b632b21760691b604482015260640161042b565b6000610fcb6001600160a01b03831630611507565b905061101e610fe06080870160608801612411565b610fed60408801886126c6565b6000818110610ffe57610ffe6125e9565b90506020020135856001600160a01b03166115999092919063ffffffff16565b60006110306080870160608801612411565b6001600160a01b0316346110476080890189612710565b604051611055929190612757565b60006040518083038185875af1925050503d8060008114611092576040519150601f19603f3d011682016040523d82523d6000602084013e611097565b606091505b505090508061114a5760006110af60408801886126c6565b60028181106110c0576110c06125e9565b90506020020135905060008111156110ec576098546110ec906001600160a01b038781169116836116ae565b6111446110fc6020890189612411565b6111338361110d60408c018c6126c6565b600081811061111e5761111e6125e9565b9050602002013561171190919063ffffffff16565b6001600160a01b03881691906116ae565b50611258565b611167826111616001600160a01b03861630611507565b90611711565b9450600085116111b95760405162461bcd60e51b815260206004820152601960248201527f52657475726e20616d6f756e74206973206e6f74207a65726f00000000000000604482015260640161042b565b60006111c860408801886126c6565b60018181106111d9576111d96125e9565b9050602002013590508660e001356001141561120e57609854611209906001600160a01b03878116911683611424565b611235565b609854611228906001600160a01b03868116911683611424565b6112328682611711565b95505b6112566112456020890189612411565b6001600160a01b03861690886116ae565b505b60a086013561126a6020880188612411565b6001600160a01b03167fdb1dbe5521d653ceda13f62b24a9193dad6eaf697b4db14cabd9d7ff4a641b2e6112a460808a0160608b01612411565b604080516001600160a01b039092168252602082018a90520160405180910390a350505050919050565b60005b6097546040516313f80ad160e21b81526001600160a01b0386811660048301526001600160f81b03861660248301526000921690634fe02b4490604401602060405180830381865afa15801561132b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134f9190612630565b9050600019811415611370576113648461267f565b935060009250506112d1565b60ff83161561137f5760ff83161c5b806001166001141561139e5760011c611397836126a6565b925061137f565b505060ff811660ff19600884901b16175b9392505050565b600054610100900460ff166113dd5760405162461bcd60e51b815260040161042b90612767565b6113e561171d565b61060c611744565b600054610100900460ff166114145760405162461bcd60e51b815260040161042b90612767565b61141c61171d565b61060c611774565b80156105d557611433836117a7565b156114da576000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611485576040519150601f19603f3d011682016040523d82523d6000602084013e61148a565b606091505b50509050806114d45760405162461bcd60e51b815260206004820152601660248201527508cc2d2d8cac840e8de40e8e4c2dce6cccae4408aa8960531b604482015260640161042b565b50505050565b6105d56001600160a01b03841683836116ae565b60006114fc848484886117f2565b90505b949350505050565b6000611512836117a7565b1561152857506001600160a01b038116316108a1565b6040516370a0823160e01b81526001600160a01b0383811660048301528416906370a0823190602401602060405180830381865afa15801561156e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115929190612630565b90506108a1565b6115a2836117a7565b156115e75760405162461bcd60e51b8152602060048201526015602482015274082e0e0e4deecca40c6c2d8d8cac840dedc408aa89605b1b604482015260640161042b565b80611601576105d56001600160a01b0384168360006118da565b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611651573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116759190612630565b9050818110156114d457801561169a5761169a6001600160a01b0385168460006118da565b6114d46001600160a01b03851684846118da565b6040516001600160a01b0383166024820152604481018290526105d590849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526119ef565b60006113af82846127b2565b600054610100900460ff1661060c5760405162461bcd60e51b815260040161042b90612767565b600054610100900460ff1661176b5760405162461bcd60e51b815260040161042b90612767565b61060c33610c39565b600054610100900460ff1661179b5760405162461bcd60e51b815260040161042b90612767565b6065805460ff19169055565b60006001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14806117de57506001600160a01b038216611010145b806108a15750506001600160a01b03161590565b600082156118cf5760e083148061180a575061010083145b1561187b5760008061181d878787611ac4565b915091508161187057611857816040518060400160405280600f81526020016e02832b936b4ba103330b4b632b21d1608d1b815250611bfb565b60405162461bcd60e51b815260040161042b91906127f5565b6000925050506114ff565b600080611889868686611f6c565b91509150816118c457611857816040518060400160405280601081526020016f02832b936b4ba19103330b4b632b21d160851b815250611bfb565b6001925050506114ff565b506000949350505050565b8015806119545750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa15801561192e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119529190612630565b155b6119bf5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b606482015260840161042b565b6040516001600160a01b0383166024820152604481018290526105d590849063095ea7b360e01b906064016116da565b6000611a44826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166120699092919063ffffffff16565b9050805160001480611a65575080806020019051810190611a659190612828565b6105d55760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161042b565b6000606060e0831415611b5f576040516001600160a01b03861690611af89063d505accf60e01b9087908790602001612845565b60408051601f1981840301815290829052611b1291612869565b6000604051808303816000865af19150503d8060008114611b4f576040519150601f19603f3d011682016040523d82523d6000602084013e611b54565b606091505b509092509050611bf3565b610100831415611bf3576040516001600160a01b03861690611b90906323f2ebc360e21b9087908790602001612845565b60408051601f1981840301815290829052611baa91612869565b6000604051808303816000865af19150503d8060008114611be7576040519150601f19603f3d011682016040523d82523d6000602084013e611bec565b606091505b5090925090505b935093915050565b60606004835110611e8b5760208301516001600160e01b0319811662461bcd60e51b148015611c2c57506044845110155b15611d7e57602484810151808601820180519192909190611c4e90849061287b565b611c58919061287b565b86511015611ca5576040805162461bcd60e51b815260206004820152601560248201527424b73b30b634b2103932bb32b93a103932b0b9b7b760591b604482015290519081900360640190fd5b84816040516020018083805190602001908083835b60208310611cd95780518252601f199092019160209182019101611cba565b51815160209384036101000a60001901801990921691161790526508ae4e4dee4560d31b919093019081528451600690910192850191508083835b60208310611d335780518252601f199092019160209182019101611d14565b6001836020036101000a03801982511681845116808217855250505050505090500180602960f81b8152506001019250505060405160208183030381529060405293505050506108a1565b6001600160e01b03198116634e487b7160e01b148015611d9f575083516024145b15611e8957602484015183611db382612078565b6040516020018083805190602001908083835b60208310611de55780518252601f199092019160209182019101611dc6565b51815160209384036101000a6000190180199092169116179052650a0c2dcd2c6560d31b919093019081528451600690910192850191508083835b60208310611e3f5780518252601f199092019160209182019101611e20565b6001836020036101000a03801982511681845116808217855250505050505090500180602960f81b81525060010192505050604051602081830303815290604052925050506108a1565b505b81611e958461209e565b6040516020018083805190602001908083835b60208310611ec75780518252601f199092019160209182019101611ea8565b51815160209384036101000a6000190180199092169116179052670aadcd6dcdeeedc560c31b919093019081528451600890910192850191508083835b60208310611f235780518252601f199092019160209182019101611f04565b6001836020036101000a03801982511681845116808217855250505050505090500180602960f81b81525060010192505050604051602081830303815290604052905092915050565b6000606081611f7d85870187612946565b5092505050836001600160a01b0316816001600160a01b031614611fd45760405162461bcd60e51b815260206004820152600e60248201526d14195c9b5a5d0c8819195b9a595960921b604482015260640161042b565b6097546040516001600160a01b0390911690611fff9063187945bd60e11b9089908990602001612845565b60408051601f198184030181529082905261201991612869565b6000604051808303816000865af19150503d8060008114612056576040519150601f19603f3d011682016040523d82523d6000602084013e61205b565b606091505b509097909650945050505050565b60606114ff8484600085612286565b60606108a182604051602001808281526020019150506040516020818303038152906040525b80516060906f181899199a1a9b1b9c1cb0b131b232b360811b906000906120c6906002612a45565b6120d190600261287b565b67ffffffffffffffff8111156120e9576120e9612649565b6040519080825280601f01601f191660200182016040528015612113576020820181803683370190505b509050600360fc1b8160008151811061212e5761212e6125e9565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061215d5761215d6125e9565b60200101906001600160f81b031916908160001a90535060005b845181101561227e57826004868381518110612195576121956125e9565b01602001516001600160f81b031916901c60f81c601081106121b9576121b96125e9565b1a60f81b826121c9836002612a45565b6121d490600261287b565b815181106121e4576121e46125e9565b60200101906001600160f81b031916908160001a9053508285828151811061220e5761220e6125e9565b60209101015160f81c600f166010811061222a5761222a6125e9565b1a60f81b8261223a836002612a45565b61224590600361287b565b81518110612255576122556125e9565b60200101906001600160f81b031916908160001a9053508061227681612615565b915050612177565b509392505050565b6060824710156122e75760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161042b565b600080866001600160a01b031685876040516123039190612869565b60006040518083038185875af1925050503d8060008114612340576040519150601f19603f3d011682016040523d82523d6000602084013e612345565b606091505b509150915061235687838387612361565b979650505050505050565b606083156123cd5782516123c6576001600160a01b0385163b6123c65760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161042b565b50816114ff565b6114ff83838151156123e25781518083602001fd5b8060405162461bcd60e51b815260040161042b91906127f5565b6001600160a01b0381168114610b9557600080fd5b60006020828403121561242357600080fd5b81356113af816123fc565b60008083601f84011261244057600080fd5b50813567ffffffffffffffff81111561245857600080fd5b6020830191508360208260051b850101111561247357600080fd5b9250929050565b6000806020838503121561248d57600080fd5b823567ffffffffffffffff8111156124a457600080fd5b6124b08582860161242e565b90969095509350505050565b8015158114610b9557600080fd5b600080604083850312156124dd57600080fd5b82356124e8816123fc565b915060208301356124f8816124bc565b809150509250929050565b6020808252825182820181905260009190848201906040850190845b8181101561253b5783518352928401929184019160010161251f565b50909695505050505050565b6000806040838503121561255a57600080fd5b8235612565816123fc565b946020939093013593505050565b60008060006060848603121561258857600080fd5b8335612593816123fc565b925060208401356125a3816123fc565b929592945050506040919091013590565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415612629576126296125ff565b5060010190565b60006020828403121561264257600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b6000823560fe1983360301811261267557600080fd5b9190910192915050565b60006001600160f81b038281168082141561269c5761269c6125ff565b6001019392505050565b600060ff821660ff8114156126bd576126bd6125ff565b60010192915050565b6000808335601e198436030181126126dd57600080fd5b83018035915067ffffffffffffffff8211156126f857600080fd5b6020019150600581901b360382131561247357600080fd5b6000808335601e1984360301811261272757600080fd5b83018035915067ffffffffffffffff82111561274257600080fd5b60200191503681900382131561247357600080fd5b8183823760009101908152919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000828210156127c4576127c46125ff565b500390565b60005b838110156127e45781810151838201526020016127cc565b838111156114d45750506000910152565b60208152600082518060208401526128148160408501602087016127c9565b601f01601f19169190910160400192915050565b60006020828403121561283a57600080fd5b81516113af816124bc565b6001600160e01b031984168152818360048301376000910160040190815292915050565b600082516126758184602087016127c9565b6000821982111561288e5761288e6125ff565b500190565b6040516060810167ffffffffffffffff811182821017156128b6576128b6612649565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156128e5576128e5612649565b604052919050565b6000604082840312156128ff57600080fd5b6040516040810181811067ffffffffffffffff8211171561292257612922612649565b6040529050808235612933816123fc565b8152602092830135920191909152919050565b60008060008084860361010081121561295e57600080fd5b608081121561296c57600080fd5b50612975612893565b61297f87876128ed565b81526020604087013581830152606087013560408301528195506129a688608089016128ed565b945060c087013591506129b8826123fc565b90925060e08601359067ffffffffffffffff808311156129d757600080fd5b828801925088601f8401126129eb57600080fd5b8235818111156129fd576129fd612649565b612a0f601f8201601f191684016128bc565b91508082528983828601011115612a2557600080fd5b808385018484013760008382840101525080935050505092959194509250565b6000816000190483118215151615612a5f57612a5f6125ff565b50029056fea2646970667358221220e57d98489e35000a7424fc54f1b70259f7043edbbd96af3c42228a653e1ec31364736f6c634300080a0033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
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.