Source Code
Latest 25 from a total of 196 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Withdraw | 22437936 | 324 days ago | IN | 0 ETH | 0.00013048 | ||||
| Withdraw | 21817631 | 411 days ago | IN | 0 ETH | 0.00010211 | ||||
| Withdraw | 20491904 | 596 days ago | IN | 0 ETH | 0.00074321 | ||||
| Withdraw | 20265504 | 628 days ago | IN | 0 ETH | 0.00014105 | ||||
| Withdraw | 20056658 | 657 days ago | IN | 0 ETH | 0.00097368 | ||||
| Deposit | 20056647 | 657 days ago | IN | 0.204111 ETH | 0.00279818 | ||||
| Deposit | 19999091 | 665 days ago | IN | 0.0065 ETH | 0.0014068 | ||||
| Deposit | 19999080 | 665 days ago | IN | 0.008 ETH | 0.00156643 | ||||
| Withdraw | 19960340 | 670 days ago | IN | 0 ETH | 0.00199032 | ||||
| Deposit | 19960327 | 670 days ago | IN | 0 ETH | 0.00135108 | ||||
| Withdraw | 19960274 | 670 days ago | IN | 0 ETH | 0.00102838 | ||||
| Deposit | 19960241 | 670 days ago | IN | 0 ETH | 0.0010125 | ||||
| Deposit | 19927280 | 675 days ago | IN | 0.02 ETH | 0.00457707 | ||||
| Deposit | 19895412 | 679 days ago | IN | 5 ETH | 0.00207551 | ||||
| Deposit | 19886603 | 681 days ago | IN | 0 ETH | 0.00151671 | ||||
| Withdraw | 19538047 | 729 days ago | IN | 0 ETH | 0.00160657 | ||||
| Withdraw | 19505773 | 734 days ago | IN | 0 ETH | 0.00191828 | ||||
| Deposit | 19505752 | 734 days ago | IN | 0 ETH | 0.00307764 | ||||
| Deposit | 19449091 | 742 days ago | IN | 0 ETH | 0.00454733 | ||||
| Withdraw | 19439472 | 743 days ago | IN | 0 ETH | 0.00572525 | ||||
| Withdraw | 19370096 | 753 days ago | IN | 0 ETH | 0.01752533 | ||||
| Deposit | 19370008 | 753 days ago | IN | 0 ETH | 0.03676773 | ||||
| Withdraw | 19343251 | 757 days ago | IN | 0 ETH | 0.00429046 | ||||
| Deposit | 19343206 | 757 days ago | IN | 0 ETH | 0.01432583 | ||||
| Withdraw | 19333701 | 758 days ago | IN | 0 ETH | 0.00636302 |
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
||
|---|---|---|---|---|---|---|---|
| Execute | 20056647 | 657 days ago | 0.204111 ETH | ||||
| 0x3d602d80 | 20056647 | 657 days ago | Contract Creation | 0 ETH | |||
| Transfer* | 19999091 | 665 days ago | 0.0065 ETH | ||||
| 0x3d602d80 | 19999091 | 665 days ago | Contract Creation | 0 ETH | |||
| Transfer* | 19999080 | 665 days ago | 0.008 ETH | ||||
| 0x3d602d80 | 19999080 | 665 days ago | Contract Creation | 0 ETH | |||
| Transfer* | 19927280 | 675 days ago | 0.02 ETH | ||||
| 0x3d602d80 | 19927280 | 675 days ago | Contract Creation | 0 ETH | |||
| Execute | 19895412 | 679 days ago | 5 ETH | ||||
| 0x3d602d80 | 19895412 | 679 days ago | Contract Creation | 0 ETH | |||
| 0x3d602d80 | 19886603 | 681 days ago | Contract Creation | 0 ETH | |||
| 0x3d602d80 | 19505752 | 734 days ago | Contract Creation | 0 ETH | |||
| 0x3d602d80 | 19449091 | 742 days ago | Contract Creation | 0 ETH | |||
| 0x3d602d80 | 19370008 | 753 days ago | Contract Creation | 0 ETH | |||
| 0x3d602d80 | 19343206 | 757 days ago | Contract Creation | 0 ETH | |||
| 0x3d602d80 | 19333300 | 758 days ago | Contract Creation | 0 ETH | |||
| 0x3d602d80 | 19326447 | 759 days ago | Contract Creation | 0 ETH | |||
| Transfer* | 19287100 | 765 days ago | 0.2 ETH | ||||
| 0x3d602d80 | 19287100 | 765 days ago | Contract Creation | 0 ETH | |||
| Execute | 19269904 | 767 days ago | 0.07 ETH | ||||
| 0x3d602d80 | 19269904 | 767 days ago | Contract Creation | 0 ETH | |||
| Execute | 19269899 | 767 days ago | 0.06 ETH | ||||
| 0x3d602d80 | 19269899 | 767 days ago | Contract Creation | 0 ETH | |||
| Execute | 19269895 | 767 days ago | 0.08 ETH | ||||
| 0x3d602d80 | 19269895 | 767 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
This contract contains unverified libraries: Trade
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
Q
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;
import {IAccount} from "src/q/interfaces/IAccount.sol";
import {Errors} from "src/libraries/Errors.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {IOperator} from "src/storage/interfaces/IOperator.sol";
import {Commands} from "src/libraries/Commands.sol";
contract Q is ReentrancyGuard {
using SafeERC20 for IERC20;
/*//////////////////////////////////////////////////////////////
STATE VARIABLES
//////////////////////////////////////////////////////////////*/
/// @notice nonce for users
mapping(address => uint256) public nonces;
address public operator;
bytes32 public constant EXECUTE_TYPEHASH = keccak256("executeData(bytes data,address user,uint256 nonce)");
bytes32 private constant _TYPE_HASH =
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");
bytes32 private immutable _hashedName = keccak256(bytes("ozo"));
bytes32 private immutable _hashedVersion = keccak256(bytes("1"));
bytes32 private immutable _cachedDomainSeparator;
uint256 private immutable _cachedChainId;
address private immutable _cachedThis;
/*//////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event InitQ(address indexed operator, bytes32 indexed domainSeparator, bytes32 indexed executeTypehash);
event Deposit(
address indexed trader,
address indexed traderAccount,
address indexed token,
uint96 amount,
uint256 returnAmount
);
event Withdraw(address indexed trader, address indexed traderAccount, address indexed token, uint96 amount);
event Execute(bytes indexed data, uint256 msgValue);
event CreateTraderAccount(address indexed trader, address indexed traderAccount);
event CrossChainTrade(address indexed traderAccount, uint256 msgValue, bytes data, bytes signature);
/*//////////////////////////////////////////////////////////////
CONSTRUCTOR/MODIFIERS
//////////////////////////////////////////////////////////////*/
constructor(address _operator) {
operator = _operator;
_cachedDomainSeparator = _buildDomainSeparator();
_cachedChainId = block.chainid;
_cachedThis = address(this);
emit InitQ(_operator, _cachedDomainSeparator, EXECUTE_TYPEHASH);
}
modifier onlyAdmin() {
address admin = IOperator(operator).getAddress("ADMIN");
if (msg.sender != admin) revert Errors.NotAdmin();
_;
}
modifier onlyPlugin() {
bool isPlugin = IOperator(operator).getPlugin(msg.sender);
if (!isPlugin) revert Errors.NotPlugin();
_;
}
/*//////////////////////////////////////////////////////////////
EXTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
/// @notice Deposit multiple tokens to your account.
/// @param tokens The addresses of the tokens to be deposited.
/// @param amounts The amounts of the tokens to be deposited.
function deposit(
address[] calldata tokens,
uint96[] calldata amounts,
bytes[] calldata exchangeData,
bytes[] calldata signature
) external payable {
uint256 tLen = tokens.length;
uint256 i;
if (tLen != amounts.length) revert Errors.LengthMismatch();
for (; i < tLen;) {
deposit(tokens[i], amounts[i], exchangeData[i], signature[i]);
unchecked {
++i;
}
}
}
/// @notice Deposits token to your account.
/// @param token The address of the token to be deposited.
/// @param amount The amount of the token to be deposited.
/// @param exchangeData data to transfer the token to the defaultStableCoin
function deposit(address token, uint96 amount, bytes calldata exchangeData, bytes calldata signature)
public
payable
nonReentrant
{
if (amount == 0) revert Errors.ZeroAmount();
address defaultToken = IOperator(operator).getAddress("DEFAULTSTABLECOIN");
if (token == address(0)) {
if (msg.value != amount) revert Errors.InputMismatch();
} else {
uint256 tokenBalance = IERC20(token).balanceOf(msg.sender);
if (amount > tokenBalance) revert Errors.BalanceLessThanAmount();
}
address account = IOperator(operator).getTraderAccount(msg.sender);
if (account == address(0)) account = _createAccount(msg.sender);
uint256 returnAmount;
if (token != defaultToken) {
if (exchangeData.length == 0) revert Errors.ExchangeDataMismatch();
_verifyData(exchangeData, signature);
address exchangeRouter = IOperator(operator).getAddress("ONEINCHROUTER");
uint256 balanceBefore = IERC20(defaultToken).balanceOf(account);
if (token != address(0)) {
IERC20(token).safeTransferFrom(msg.sender, account, amount);
bytes memory approveData = abi.encodeWithSelector(IERC20.approve.selector, exchangeRouter, amount);
IAccount(account).execute(token, approveData, 0);
IAccount(account).execute(exchangeRouter, exchangeData, 0);
} else {
IAccount(account).execute{value: amount}(exchangeRouter, exchangeData, amount);
}
uint256 balanceAfter = IERC20(defaultToken).balanceOf(account);
if (balanceAfter <= balanceBefore) revert Errors.BalanceLessThanAmount();
returnAmount = balanceAfter - balanceBefore;
} else {
if (exchangeData.length != 0) revert Errors.ExchangeDataMismatch();
IERC20(defaultToken).safeTransferFrom(msg.sender, account, amount);
}
emit Deposit(msg.sender, account, token, amount, returnAmount);
}
/// @notice withdraw any number of tokens from the `Account` contract
/// @param token address of the token to be swapped
/// @param amount total amount of `defaultStableCoin` to be withdrawn
/// @param exchangeData calldata to swap from the dex
/// @param signature signature of the exchangeData by the admin
function withdraw(address token, uint96 amount, bytes calldata exchangeData, bytes calldata signature) external {
if (amount == 0) revert Errors.ZeroAmount();
address account = IOperator(operator).getTraderAccount(msg.sender);
if (account == address(0)) revert Errors.NotInitialised();
address defaultStableCoin = IOperator(operator).getAddress("DEFAULTSTABLECOIN");
uint256 tokenBalance = IERC20(defaultStableCoin).balanceOf(account);
if (amount > tokenBalance) revert Errors.BalanceLessThanAmount();
if (token == defaultStableCoin) {
if (exchangeData.length != 0) revert Errors.ExchangeDataMismatch();
bytes memory transferData = abi.encodeWithSignature("transfer(address,uint256)", msg.sender, amount);
IAccount(account).execute(defaultStableCoin, transferData, 0);
} else {
_verifyData(exchangeData, signature);
address exchangeRouter = IOperator(operator).getAddress("ONEINCHROUTER");
bytes memory approvalData = abi.encodeWithSignature("approve(address,uint256)", exchangeRouter, amount);
IAccount(account).execute(defaultStableCoin, approvalData, 0);
uint256 defaultStableCoinBalanceBefore = IERC20(defaultStableCoin).balanceOf(account);
IAccount(account).execute(exchangeRouter, exchangeData, 0);
uint256 defaultStableCoinBalanceAfter = IERC20(defaultStableCoin).balanceOf(account);
if (defaultStableCoinBalanceBefore - defaultStableCoinBalanceAfter != amount) {
revert Errors.ExchangeDataMismatch();
}
}
emit Withdraw(msg.sender, account, token, amount);
}
/// @notice Deposit & execute a trade in one transaction.
/// @param token The address of the token to be deposited.
/// @param amount The amount of the token to be deposited.
/// @param exchangeData data to transfer the token to the defaultStableCoin
/// @param data The data to be executed.
/// @param signature The signature of the data.
function depositAndExecute(
address token,
uint96 amount,
bytes calldata exchangeData,
bytes calldata data,
bytes calldata signature,
bytes calldata exchangeDataSignature
) external payable {
_verifyData(data, signature);
deposit(token, amount, exchangeData, exchangeDataSignature);
address perpTrade = IOperator(operator).getAddress("PERPTRADE");
(bool success,) = perpTrade.call{value: msg.value}(data);
if (!success) revert Errors.CallFailed(data);
emit Execute(data, msg.value);
}
/// @notice execute the type of trade
/// @dev can only be called by the `admin`
/// @param command the command of the ddex protocol from `Commands` library
/// @param data encoded data of parameters depending on the ddex
/// @param isOpen bool to check if its an increase or decrease trade
function execute(uint256 command, bytes calldata data, bool isOpen) public payable onlyAdmin {
bytes memory tradeData = abi.encodeWithSignature("execute(uint256,bytes,bool)", command, data, isOpen);
address perpTrade = IOperator(operator).getAddress("PERPTRADE");
(bool success,) = perpTrade.call{value: msg.value}(tradeData);
if (!success) revert Errors.CallFailed(tradeData);
emit Execute(data, msg.value);
}
/// @notice executes many trades in a single function
/// @dev can only be called by the `admin`
/// @param commands array of commands of the ddex protocol from `Commands` library
/// @param data array of encoded data of parameters depending on the ddex
/// @param msgValue msg.value for each command which has to be transfered when executing the position
/// @param isOpen array of bool to check if its an increase or decrease trade
function multiExecute(
uint256[] calldata commands,
bytes[] calldata data,
uint256[] calldata msgValue,
bool[] calldata isOpen
) public payable onlyAdmin {
if (data.length != msgValue.length) revert Errors.LengthMismatch();
address perpTrade = IOperator(operator).getAddress("PERPTRADE");
uint256 i;
for (; i < data.length;) {
uint256 command = commands[i];
bytes calldata tradeData = data[i];
uint256 value = msgValue[i];
bool openOrClose = isOpen[i];
bytes memory perpTradeData =
abi.encodeWithSignature("execute(uint256,bytes,bool)", command, tradeData, openOrClose);
(bool success,) = perpTrade.call{value: value}(perpTradeData);
if (!success) revert Errors.CallFailed(perpTradeData);
emit Execute(tradeData, value);
unchecked {
++i;
}
}
}
/// @notice Creates a new account for the trader.
/// @dev can only be called by a plugin
/// @param trader The address of the trader.
function createAccount(address trader) public onlyPlugin returns (address newAccount) {
address traderAccount = IOperator(operator).getTraderAccount(trader);
if (traderAccount != address(0)) revert Errors.AccountAlreadyExists();
newAccount = _createAccount(trader);
emit CreateTraderAccount(trader, newAccount);
}
/// @notice Trade on a exchange using lifi
/// @dev The function should be called by lifi
/// @param data The payload to be passed to the perpTrade contract
/// @dev "user" is the address of the trader, so to get account we have to query traderAccount[user]
function crossChainTradeReciever(bytes memory data, bytes memory signature) public payable nonReentrant {
bool success;
// EIP-712
_verifyData(data, signature);
(address token, address user, uint96 amount, bytes memory payload) =
abi.decode(data, (address, address, uint96, bytes));
address tradeAccount = IOperator(operator).getTraderAccount(user);
if (tradeAccount == address(0)) tradeAccount = _createAccount(user);
if (token != address(0)) _depositTo(token, tradeAccount, amount);
address perpTrade = IOperator(operator).getAddress("PERPTRADE");
(success, payload) = perpTrade.call{value: msg.value}(payload);
if (!success) revert Errors.CallFailed(payload);
emit CrossChainTrade(tradeAccount, msg.value, data, signature);
}
function sgReceive(uint16, bytes memory, uint256, address, uint256 amountLD, bytes memory payload)
external
payable
{
// Check the caller is stargate router
address stargateRouter = IOperator(operator).getAddress("STARGATE");
if (msg.sender != stargateRouter) revert Errors.NoAccess();
// Verify that the payload is signed by the admin
(bytes memory data, bytes memory signature) = abi.decode(payload, (bytes, bytes));
bool success;
_verifyData(data, signature);
(address token, address user, uint96 amount, bytes memory payload) =
abi.decode(data, (address, address, uint96, bytes));
// transfer the token amount to the user
address tradeAccount = IOperator(operator).getTraderAccount(user);
if (tradeAccount == address(0)) tradeAccount = _createAccount(user);
if (token != address(0)) IERC20(token).transfer(tradeAccount, amountLD);
// Execute the trade
address perpTrade = IOperator(operator).getAddress("PERPTRADE");
(success, payload) = perpTrade.call{value: msg.value}(payload);
if (!success) revert Errors.CallFailed(payload);
emit CrossChainTrade(tradeAccount, msg.value, data, signature);
}
function swap(address account, address tradeToken, bytes[] memory exchangeData) external onlyAdmin {
address exchangeRouter = IOperator(operator).getAddress("ONEINCHROUTER");
address defaultStableCoin = IOperator(operator).getAddress("DEFAULTSTABLECOIN");
uint256 balanceBefore = IERC20(defaultStableCoin).balanceOf(account);
uint256 ethBalance = account.balance;
if (ethBalance > 0) IAccount(account).execute(exchangeRouter, exchangeData[0], ethBalance);
if (tradeToken != address(0)) {
uint256 tokenInBalance = IERC20(tradeToken).balanceOf(account);
bytes memory tokenApprovalData =
abi.encodeWithSignature("approve(address,uint256)", exchangeRouter, tokenInBalance);
IAccount(account).execute(tradeToken, tokenApprovalData, 0);
IAccount(account).execute(exchangeRouter, exchangeData[1], 0);
}
uint256 balanceAfter = IERC20(defaultStableCoin).balanceOf(account);
if (balanceAfter <= balanceBefore) revert Errors.BalanceLessThanAmount();
}
function changeTraderAccount(address newTrader) external {
if (newTrader == address(0)) revert Errors.ZeroAddress();
address traderAccount = IOperator(operator).getTraderAccount(msg.sender);
IOperator(operator).setTraderAccount(newTrader, traderAccount);
}
/*//////////////////////////////////////////////////////////////
INTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/
function _createAccount(address trader) internal returns (address newAccount) {
bytes32 salt = keccak256(abi.encodePacked(trader));
address accountImplementation = IOperator(operator).getAddress("ACCOUNT");
newAccount = Clones.cloneDeterministic(accountImplementation, salt);
IOperator(operator).setTraderAccount(trader, newAccount);
}
/*
* `TradeRemote` is a function that will only be called by lifi
* It will be called when a trader wants to trade on a remote exchange
FLOW:
* TradeRemote called by lifi
* DepositRemote fucntion is called from inside TradeRemote
- it decodes msg.sender from the payload
- it creates a new account for the trader, if not already exists
- It transferFrom the tokens from the lifi to the Trader Account
* Trade Remote Pass the payload to the perpTrade contract
* perpTrade contract will execute the trade on the remote exchange
*/
function _depositTo(address token, address user, uint256 amount) internal {
if (amount == 0) revert Errors.ZeroAmount();
uint256 tokenBalance = IERC20(token).balanceOf(msg.sender);
if (amount > tokenBalance) revert Errors.BalanceLessThanAmount();
IERC20(token).safeTransferFrom(msg.sender, user, amount);
}
function DOMAIN_SEPARATOR() public view returns (bytes32) {
if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
return _cachedDomainSeparator;
} else {
return _buildDomainSeparator();
}
}
function _buildDomainSeparator() private view returns (bytes32) {
return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));
}
function _verifyData(bytes memory data, bytes memory signature) internal {
bytes32 structHash = keccak256(abi.encode(EXECUTE_TYPEHASH, keccak256(data), msg.sender, nonces[msg.sender]++));
bytes32 signedData = ECDSA.toTypedDataHash(DOMAIN_SEPARATOR(), structHash);
address signer = ECDSA.recover(signedData, signature);
address admin = IOperator(operator).getAddress("ADMIN");
if (signer != admin) revert Errors.NotAdmin();
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;
interface IAccount {
function execute(address adapter, bytes calldata data, uint256 ethToSend)
external
payable
returns (bytes memory returnData);
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;
library Errors {
// Zero Errors
error ZeroAmount();
error ZeroAddress();
error ZeroTotalRaised();
error ZeroClaimableAmount();
// Modifier Errors
error NotOwner();
error NotAdmin();
error CallerNotVault();
error CallerNotTrade();
error CallerNotVaultOwner();
error CallerNotGenerate();
error NoAccess();
error NotPlugin();
// State Errors
error BelowMinFundraisingPeriod();
error AboveMaxFundraisingPeriod();
error BelowMinLeverage();
error AboveMaxLeverage();
error BelowMinEndTime();
error TradeTokenNotApplicable();
// STV errors
error StvDoesNotExist();
error AlreadyOpened();
error MoreThanTotalRaised();
error MoreThanTotalReceived();
error StvNotOpen();
error StvNotClose();
error ClaimNotApplicable();
error StvStatusMismatch();
// General Errors
error BalanceLessThanAmount();
error FundraisingPeriodEnded();
error TotalRaisedMoreThanCapacity();
error StillFundraising();
error CommandMisMatch();
error TradeCommandMisMatch();
error NotInitialised();
error Initialised();
error LengthMismatch();
error TransferFailed();
error DelegateCallFailed();
error CallFailed(bytes);
error AccountAlreadyExists();
error SwapFailed();
error ExchangeDataMismatch();
error AccountNotExists();
error InputMismatch();
error AboveMaxDistributeIndex();
error BelowMinStvDepositAmount();
// Protocol specific errors
error GmxFeesMisMatch();
error UpdateOrderRequestMisMatch();
error CancelOrderRequestMisMatch();
// Subscriptions
error NotASubscriber();
error AlreadySubscribed();
error MoreThanLimit();
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-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;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
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));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
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");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
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");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.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);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (proxy/Clones.sol)
pragma solidity ^0.8.0;
/**
* @dev https://eips.ethereum.org/EIPS/eip-1167[EIP 1167] is a standard for
* deploying minimal proxy contracts, also known as "clones".
*
* > To simply and cheaply clone contract functionality in an immutable way, this standard specifies
* > a minimal bytecode implementation that delegates all calls to a known, fixed address.
*
* The library includes functions to deploy a proxy using either `create` (traditional deployment) or `create2`
* (salted deterministic deployment). It also includes functions to predict the addresses of clones deployed using the
* deterministic method.
*
* _Available since v3.4._
*/
library Clones {
/**
* @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
*
* This function uses the create opcode, which should never revert.
*/
function clone(address implementation) internal returns (address instance) {
/// @solidity memory-safe-assembly
assembly {
// Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes
// of the `implementation` address with the bytecode before the address.
mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))
// Packs the remaining 17 bytes of `implementation` with the bytecode after the address.
mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))
instance := create(0, 0x09, 0x37)
}
require(instance != address(0), "ERC1167: create failed");
}
/**
* @dev Deploys and returns the address of a clone that mimics the behaviour of `implementation`.
*
* This function uses the create2 opcode and a `salt` to deterministically deploy
* the clone. Using the same `implementation` and `salt` multiple time will revert, since
* the clones cannot be deployed twice at the same address.
*/
function cloneDeterministic(address implementation, bytes32 salt) internal returns (address instance) {
/// @solidity memory-safe-assembly
assembly {
// Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes
// of the `implementation` address with the bytecode before the address.
mstore(0x00, or(shr(0xe8, shl(0x60, implementation)), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))
// Packs the remaining 17 bytes of `implementation` with the bytecode after the address.
mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))
instance := create2(0, 0x09, 0x37, salt)
}
require(instance != address(0), "ERC1167: create2 failed");
}
/**
* @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
*/
function predictDeterministicAddress(
address implementation,
bytes32 salt,
address deployer
) internal pure returns (address predicted) {
/// @solidity memory-safe-assembly
assembly {
let ptr := mload(0x40)
mstore(add(ptr, 0x38), deployer)
mstore(add(ptr, 0x24), 0x5af43d82803e903d91602b57fd5bf3ff)
mstore(add(ptr, 0x14), implementation)
mstore(ptr, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73)
mstore(add(ptr, 0x58), salt)
mstore(add(ptr, 0x78), keccak256(add(ptr, 0x0c), 0x37))
predicted := keccak256(add(ptr, 0x43), 0x55)
}
}
/**
* @dev Computes the address of a clone deployed using {Clones-cloneDeterministic}.
*/
function predictDeterministicAddress(address implementation, bytes32 salt)
internal
view
returns (address predicted)
{
return predictDeterministicAddress(implementation, salt, address(this));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.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 ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV // Deprecated in v4.8
}
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");
}
}
/**
* @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) {
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.
/// @solidity memory-safe-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 {
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 = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 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 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", Strings.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 (last updated v4.8.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;
interface IOperator {
function getMaxDistributeIndex() external view returns (uint256);
function getAddress(string calldata adapter) external view returns (address);
function getAddresses(string[] calldata adapters) external view returns (address[] memory);
function getTraderAccount(address trader) external view returns (address);
function getPlugin(address plugin) external view returns (bool);
function getPlugins(address[] calldata plugins) external view returns (bool[] memory);
function setAddress(string calldata adapter, address addr) external;
function setAddresses(string[] calldata adapters, address[] calldata addresses) external;
function setPlugin(address plugin, bool isPlugin) external;
function setPlugins(address[] calldata plugins, bool[] calldata isPlugin) external;
function setTraderAccount(address trader, address account) external;
function getAllSubscribers(address manager) external view returns (address[] memory);
function getIsSubscriber(address manager, address subscriber) external view returns (bool);
function getSubscriptionAmount(address manager, address subscriber) external view returns (uint96);
function getTotalSubscribedAmountPerManager(address manager) external view returns (uint96);
function setSubscribe(address manager, address subscriber, uint96 maxLimit) external;
function setUnsubscribe(address manager, address subscriber) external;
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.17;
/// @title Commands similar to UniversalRouter
/// @notice Command Flags used to decode commands
/// @notice https://github.com/Uniswap/universal-router/blob/main/contracts/libraries/Commands.sol
library Commands {
// Masks to extract certain bits of commands
bytes1 internal constant FLAG_ALLOW_REVERT = 0x80;
bytes1 internal constant COMMAND_TYPE_MASK = 0x3f;
// Command Types. Maximum supported command at this moment is 0x3f.
// Command Types where value >= 0x00, for Perpetuals
uint256 constant GMX = 0x00;
uint256 constant PERP = 0x01;
uint256 constant CAP = 0x02;
uint256 constant KWENTA = 0x03;
// COMMAND_PLACEHOLDER = 0x04;
// Future perpetual protocols can be added below
// Command Types where value >= 0x10, for Spot
uint256 constant UNI = 0x10;
uint256 constant SUSHI = 0x11;
uint256 constant ONE_INCH = 0x12;
uint256 constant TRADER_JOE = 0x13;
uint256 constant PANCAKE = 0x14;
// COMMAND_PLACEHOLDER = 0x15;
// Future spot protocols can be added below
// Future financial services like options can be added with a value >= 0x20
// Command Types where value >= 0x30, for trade functions
uint256 constant CROSS_CHAIN = 0x30;
uint256 constant MODIFY_ORDER = 0x31;
uint256 constant CLAIM_REWARDS = 0x32;
// COMMAND_PLACEHOLDER = 0x3d;
// Future functions to interact with protocols can be added below
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-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.
*/
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].
*/
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 (last updated v4.8.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
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return 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.8.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @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] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator,
Rounding rounding
) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10**64) {
value /= 10**64;
result += 64;
}
if (value >= 10**32) {
value /= 10**32;
result += 32;
}
if (value >= 10**16) {
value /= 10**16;
result += 16;
}
if (value >= 10**8) {
value /= 10**8;
result += 8;
}
if (value >= 10**4) {
value /= 10**4;
result += 4;
}
if (value >= 10**2) {
value /= 10**2;
result += 2;
}
if (value >= 10**1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
}
}
}{
"remappings": [
"forge-std/=lib/forge-std/src/",
"@synthetix/=src/interfaces/synthetix/",
"@openzeppelin/=lib/openzeppelin-contracts/",
"@openzeppelin-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
"solmate/=lib/solmate/src/",
"ds-test/=lib/forge-std/lib/ds-test/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"libraries": {
"src/Generate.sol": {
"Generate": "0x74E0ca6E1Ecfb462a80f3B7ab6840013ee32C1C5"
},
"src/Trade.sol": {
"Trade": "0x16766913FAe839dA226a669C76F04b2B5E2380A0"
},
"src/libraries/BytesCheck.sol": {
"BytesCheck": "0x3F3A5DA6DBb99dC879A8eD2EC26c831Da962231F"
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_operator","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccountAlreadyExists","type":"error"},{"inputs":[],"name":"BalanceLessThanAmount","type":"error"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"CallFailed","type":"error"},{"inputs":[],"name":"ExchangeDataMismatch","type":"error"},{"inputs":[],"name":"InputMismatch","type":"error"},{"inputs":[],"name":"LengthMismatch","type":"error"},{"inputs":[],"name":"NoAccess","type":"error"},{"inputs":[],"name":"NotAdmin","type":"error"},{"inputs":[],"name":"NotInitialised","type":"error"},{"inputs":[],"name":"NotPlugin","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"trader","type":"address"},{"indexed":true,"internalType":"address","name":"traderAccount","type":"address"}],"name":"CreateTraderAccount","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"traderAccount","type":"address"},{"indexed":false,"internalType":"uint256","name":"msgValue","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"signature","type":"bytes"}],"name":"CrossChainTrade","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"trader","type":"address"},{"indexed":true,"internalType":"address","name":"traderAccount","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint96","name":"amount","type":"uint96"},{"indexed":false,"internalType":"uint256","name":"returnAmount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes","name":"data","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"msgValue","type":"uint256"}],"name":"Execute","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"bytes32","name":"domainSeparator","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"executeTypehash","type":"bytes32"}],"name":"InitQ","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"trader","type":"address"},{"indexed":true,"internalType":"address","name":"traderAccount","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint96","name":"amount","type":"uint96"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EXECUTE_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newTrader","type":"address"}],"name":"changeTraderAccount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"trader","type":"address"}],"name":"createAccount","outputs":[{"internalType":"address","name":"newAccount","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"crossChainTradeReciever","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint96","name":"amount","type":"uint96"},{"internalType":"bytes","name":"exchangeData","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint96[]","name":"amounts","type":"uint96[]"},{"internalType":"bytes[]","name":"exchangeData","type":"bytes[]"},{"internalType":"bytes[]","name":"signature","type":"bytes[]"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint96","name":"amount","type":"uint96"},{"internalType":"bytes","name":"exchangeData","type":"bytes"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes","name":"exchangeDataSignature","type":"bytes"}],"name":"depositAndExecute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"command","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bool","name":"isOpen","type":"bool"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"commands","type":"uint256[]"},{"internalType":"bytes[]","name":"data","type":"bytes[]"},{"internalType":"uint256[]","name":"msgValue","type":"uint256[]"},{"internalType":"bool[]","name":"isOpen","type":"bool[]"}],"name":"multiExecute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"amountLD","type":"uint256"},{"internalType":"bytes","name":"payload","type":"bytes"}],"name":"sgReceive","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"tradeToken","type":"address"},{"internalType":"bytes[]","name":"exchangeData","type":"bytes[]"}],"name":"swap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint96","name":"amount","type":"uint96"},{"internalType":"bytes","name":"exchangeData","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
600361012052626f7a6f60e81b610140527f3a2acf8fa7114853bf3f31f08da377cd70017e14d168242c29697de946b75d286080526101a0604052600161016052603160f81b610180527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660a0523480156200007a57600080fd5b5060405162003d6a38038062003d6a8339810160408190526200009d916200019c565b6001600055600280546001600160a01b0319166001600160a01b038316179055620001306080805160a08051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019390935260608301524692820192909252309181019190915260009060c00160405160208183030381529060405280519060200120905090565b60c08190524660e05230610100526040517f0e8122b9966a5ace153720b4cfa9a4339fe04cf7270694b3ad4068a61436900b91906001600160a01b038416907ff91786ff81895fe5dd9f9130d2b2604ea6c9e8d662a06004ffc56b7937f786c290600090a450620001ce565b600060208284031215620001af57600080fd5b81516001600160a01b0381168114620001c757600080fd5b9392505050565b60805160a05160c05160e05161010051613b57620002136000396000610c5001526000610c7a01526000610ca401526000610d1d01526000610cf50152613b576000f3fe6080604052600436106100e85760003560e01c806360d2f33d1161008a5780638a804a86116100595780638a804a861461024f5780639859387b1461026f578063ab8236f31461028f578063e2024790146102a257600080fd5b806360d2f33d146101c85780637ecebe00146101fc578063814f543c14610229578063865f694b1461023c57600080fd5b80633644e515116100c65780633644e515146101285780633e198dd014610150578063570ca73514610170578063575fd9fc146101a857600080fd5b80630818db78146100ed57806317c26d871461010257806323554c2e14610115575b600080fd5b6101006100fb366004613046565b6102b5565b005b6101006101103660046130da565b61098f565b610100610123366004613205565b610b68565b34801561013457600080fd5b5061013d610c43565b6040519081526020015b60405180910390f35b34801561015c57600080fd5b5061010061016b36600461338b565b610d73565b34801561017c57600080fd5b50600254610190906001600160a01b031681565b6040516001600160a01b039091168152602001610147565b3480156101b457600080fd5b506101006101c3366004613474565b61127d565b3480156101d457600080fd5b5061013d7f0e8122b9966a5ace153720b4cfa9a4339fe04cf7270694b3ad4068a61436900b81565b34801561020857600080fd5b5061013d610217366004613474565b60016020526000908152604090205481565b6101006102373660046134a6565b611375565b61010061024a366004613205565b61159e565b34801561025b57600080fd5b5061010061026a366004613046565b61189a565b34801561027b57600080fd5b5061019061028a366004613474565b611ee7565b61010061029d366004613504565b612063565b6101006102b03660046135a7565b6123b9565b6102bd6125ed565b846001600160601b03166000036102e757604051631f2a200560e01b815260040160405180910390fd5b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac1906103169060040161360a565b602060405180830381865afa158015610333573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103579190613635565b90506001600160a01b03871661039457856001600160601b0316341461038f5760405162a80fb560e51b815260040160405180910390fd5b61042d565b6040516370a0823160e01b81523360048201526000906001600160a01b038916906370a0823190602401602060405180830381865afa1580156103db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ff9190613652565b905080876001600160601b0316111561042b57604051631d00495b60e31b815260040160405180910390fd5b505b6002546040516360862d6960e01b81523360048201526000916001600160a01b0316906360862d6990602401602060405180830381865afa158015610476573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049a9190613635565b90506001600160a01b0381166104b6576104b333612646565b90505b6000826001600160a01b0316896001600160a01b0316146108e95760008690036104f357604051632e47553f60e21b815260040160405180910390fd5b61056687878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8b01819004810282018101909252898152925089915088908190840183828082843760009201919091525061278592505050565b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac1906105959060040161366b565b602060405180830381865afa1580156105b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d69190613635565b6040516370a0823160e01b81526001600160a01b0385811660048301529192506000918616906370a0823190602401602060405180830381865afa158015610622573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106469190613652565b90506001600160a01b038b16156107c0576106756001600160a01b038c1633866001600160601b038e16612918565b600063095ea7b360e01b838c604051602401610692929190613692565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051631409412160e31b81529091506001600160a01b0386169063a04a0908906106f7908f908590600090600401613704565b6000604051808303816000875af1158015610716573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261073e919081019061377d565b50604051631409412160e31b81526001600160a01b0386169063a04a0908906107729086908e908e906000906004016137da565b6000604051808303816000875af1158015610791573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107b9919081019061377d565b5050610845565b836001600160a01b031663a04a09088b6001600160601b0316848c8c8f6040518663ffffffff1660e01b81526004016107fc9493929190613810565b60006040518083038185885af115801561081a573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610843919081019061377d565b505b6040516370a0823160e01b81526001600160a01b038581166004830152600091908716906370a0823190602401602060405180830381865afa15801561088f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b39190613652565b90508181116108d557604051631d00495b60e31b815260040160405180910390fd5b6108df8282613865565b9350505050610926565b851561090857604051632e47553f60e21b815260040160405180910390fd5b6109266001600160a01b03841633846001600160601b038c16612918565b604080516001600160601b038a168152602081018390526001600160a01b03808c16929085169133917fd61ac9a3b4abf904d442799418365261a14d2991144971514183c10ba7e2089c910160405180910390a45050506109876001600055565b505050505050565b610a0286868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8a01819004810282018101909252888152925088915087908190840183828082843760009201919091525061278592505050565b610a108a8a8a8a86866102b5565b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac190610a3f90600401613878565b602060405180830381865afa158015610a5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a809190613635565b90506000816001600160a01b0316348989604051610a9f92919061389b565b60006040518083038185875af1925050503d8060008114610adc576040519150601f19603f3d011682016040523d82523d6000602084013e610ae1565b606091505b5050905080610b1057878760405163a5fa8d2b60e01b8152600401610b079291906138ab565b60405180910390fd5b8787604051610b2092919061389b565b604051908190038120348252907fb60d18dc467543f2cc9409a496144102e9e01d18e9ca7953811b769ac795f0a69060200160405180910390a2505050505050505050505050565b866000868214610b8e576040516001621398b960e31b0319815260040160405180910390fd5b81811015610c3757610c2f8a8a83818110610bab57610bab6138bf565b9050602002016020810190610bc09190613474565b898984818110610bd257610bd26138bf565b9050602002016020810190610be791906138d5565b888885818110610bf957610bf96138bf565b9050602002810190610c0b91906138f2565b888887818110610c1d57610c1d6138bf565b90506020028101906100fb91906138f2565b600101610b8e565b50505050505050505050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148015610c9c57507f000000000000000000000000000000000000000000000000000000000000000046145b15610cc657507f000000000000000000000000000000000000000000000000000000000000000090565b610d6e604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b905090565b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac190610da290600401613938565b602060405180830381865afa158015610dbf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de39190613635565b9050336001600160a01b03821614610e0e57604051637bfa4b9f60e01b815260040160405180910390fd5b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac190610e3d9060040161366b565b602060405180830381865afa158015610e5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7e9190613635565b60025460405163bf40fac160e01b81529192506000916001600160a01b039091169063bf40fac190610eb29060040161360a565b602060405180830381865afa158015610ecf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef39190613635565b6040516370a0823160e01b81526001600160a01b0388811660048301529192506000918316906370a0823190602401602060405180830381865afa158015610f3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f639190613652565b90506001600160a01b03871631801561100957876001600160a01b031663a04a09088588600081518110610f9957610f996138bf565b6020026020010151846040518463ffffffff1660e01b8152600401610fc093929190613704565b6000604051808303816000875af1158015610fdf573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611007919081019061377d565b505b6001600160a01b038716156111e2576040516370a0823160e01b81526001600160a01b038981166004830152600091908916906370a0823190602401602060405180830381865afa158015611062573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110869190613652565b6040516001600160a01b03871660248201526044810182905290915060009060640160408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b17905251631409412160e31b81529091506001600160a01b038b169063a04a090890611104908c908590600090600401613704565b6000604051808303816000875af1158015611123573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261114b919081019061377d565b50896001600160a01b031663a04a0908878a60018151811061116f5761116f6138bf565b602002602001015160006040518463ffffffff1660e01b815260040161119793929190613704565b6000604051808303816000875af11580156111b6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111de919081019061377d565b5050505b6040516370a0823160e01b81526001600160a01b038981166004830152600091908516906370a0823190602401602060405180830381865afa15801561122c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112509190613652565b905082811161127257604051631d00495b60e31b815260040160405180910390fd5b505050505050505050565b6001600160a01b0381166112a45760405163d92e233d60e01b815260040160405180910390fd5b6002546040516360862d6960e01b81523360048201526000916001600160a01b0316906360862d6990602401602060405180830381865afa1580156112ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113119190613635565b60025460405162eab46d60e61b81526001600160a01b0385811660048301528084166024830152929350911690633aad1b4090604401600060405180830381600087803b15801561136157600080fd5b505af1158015610987573d6000803e3d6000fd5b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac1906113a490600401613938565b602060405180830381865afa1580156113c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e59190613635565b9050336001600160a01b0382161461141057604051637bfa4b9f60e01b815260040160405180910390fd5b6000858585856040516024016114299493929190613957565b60408051601f198184030181529181526020820180516001600160e01b0316632053d50f60e21b179052600254905163bf40fac160e01b81529192506000916001600160a01b039091169063bf40fac19061148690600401613878565b602060405180830381865afa1580156114a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c79190613635565b90506000816001600160a01b031634846040516114e49190613984565b60006040518083038185875af1925050503d8060008114611521576040519150601f19603f3d011682016040523d82523d6000602084013e611526565b606091505b505090508061154a578260405163a5fa8d2b60e01b8152600401610b0791906139a0565b868660405161155a92919061389b565b604051908190038120348252907fb60d18dc467543f2cc9409a496144102e9e01d18e9ca7953811b769ac795f0a69060200160405180910390a25050505050505050565b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac1906115cd90600401613938565b602060405180830381865afa1580156115ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160e9190613635565b9050336001600160a01b0382161461163957604051637bfa4b9f60e01b815260040160405180910390fd5b85841461165c576040516001621398b960e31b0319815260040160405180910390fd5b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac19061168b90600401613878565b602060405180830381865afa1580156116a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116cc9190613635565b905060005b8781101561188d5760008b8b838181106116ed576116ed6138bf565b9050602002013590503660008b8b8581811061170b5761170b6138bf565b905060200281019061171d91906138f2565b9150915060008a8a86818110611735576117356138bf565b9050602002013590506000898987818110611752576117526138bf565b905060200201602081019061176791906139b3565b90506000858585846040516024016117829493929190613957565b60408051601f198184030181529181526020820180516001600160e01b0316632053d50f60e21b179052519091506000906001600160a01b038a169085906117cb908590613984565b60006040518083038185875af1925050503d8060008114611808576040519150601f19603f3d011682016040523d82523d6000602084013e61180d565b606091505b5050905080611831578160405163a5fa8d2b60e01b8152600401610b0791906139a0565b858560405161184192919061389b565b604051908190038120858252907fb60d18dc467543f2cc9409a496144102e9e01d18e9ca7953811b769ac795f0a69060200160405180910390a2876001019750505050505050506116d1565b5050505050505050505050565b846001600160601b03166000036118c457604051631f2a200560e01b815260040160405180910390fd5b6002546040516360862d6960e01b81523360048201526000916001600160a01b0316906360862d6990602401602060405180830381865afa15801561190d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119319190613635565b90506001600160a01b03811661195a5760405163421972d160e11b815260040160405180910390fd5b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac1906119899060040161360a565b602060405180830381865afa1580156119a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ca9190613635565b6040516370a0823160e01b81526001600160a01b0384811660048301529192506000918316906370a0823190602401602060405180830381865afa158015611a16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a3a9190613652565b905080886001600160601b03161115611a6657604051631d00495b60e31b815260040160405180910390fd5b816001600160a01b0316896001600160a01b031603611b5d578515611a9e57604051632e47553f60e21b815260040160405180910390fd5b60003389604051602401611ab3929190613692565b60408051601f198184030181529181526020820180516001600160e01b031663a9059cbb60e01b17905251631409412160e31b81529091506001600160a01b0385169063a04a090890611b0f9086908590600090600401613704565b6000604051808303816000875af1158015611b2e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611b56919081019061377d565b5050611e8e565b611bd087878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8b01819004810282018101909252898152925089915088908190840183828082843760009201919091525061278592505050565b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac190611bff9060040161366b565b602060405180830381865afa158015611c1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c409190613635565b90506000818a604051602401611c57929190613692565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b17905251631409412160e31b81529091506001600160a01b0386169063a04a090890611cb39087908590600090600401613704565b6000604051808303816000875af1158015611cd2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611cfa919081019061377d565b506040516370a0823160e01b81526001600160a01b038681166004830152600091908616906370a0823190602401602060405180830381865afa158015611d45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d699190613652565b604051631409412160e31b81529091506001600160a01b0387169063a04a090890611d9f9086908e908e906000906004016137da565b6000604051808303816000875af1158015611dbe573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611de6919081019061377d565b506040516370a0823160e01b81526001600160a01b038781166004830152600091908716906370a0823190602401602060405180830381865afa158015611e31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e559190613652565b90506001600160601b038c16611e6b8284613865565b14611e8957604051632e47553f60e21b815260040160405180910390fd5b505050505b6040516001600160601b03891681526001600160a01b03808b16919085169033907f7b91bc64e11e7b62e5bd0d98cbe597466b07a2eb251e2652e7a855e90c5bb5799060200160405180910390a4505050505050505050565b600254604051630fba0e4960e41b815233600482015260009182916001600160a01b039091169063fba0e49090602401602060405180830381865afa158015611f34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f5891906139d0565b905080611f7857604051634a526b2760e01b815260040160405180910390fd5b6002546040516360862d6960e01b81526001600160a01b03858116600483015260009216906360862d6990602401602060405180830381865afa158015611fc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fe79190613635565b90506001600160a01b03811615612011576040516369783db760e01b815260040160405180910390fd5b61201a84612646565b9250826001600160a01b0316846001600160a01b03167fbb777850bc7f41c07ecd6df089be81948ec5111a6425ea5da79a72613dd6f53460405160405180910390a35050919050565b60025460405163bf40fac160e01b8152602060048201526008602482015267535441524741544560c01b60448201526000916001600160a01b03169063bf40fac190606401602060405180830381865afa1580156120c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120e99190613635565b9050336001600160a01b038216146121145760405163160d3af160e11b815260040160405180910390fd5b6000808380602001905181019061212b91906139ed565b91509150600061213b8383612785565b600080600080868060200190518101906121559190613a46565b6002546040516360862d6960e01b81526001600160a01b038086166004830152959950939750919550935060009216906360862d6990602401602060405180830381865afa1580156121ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121cf9190613635565b90506001600160a01b0381166121eb576121e884612646565b90505b6001600160a01b0385161561226f5760405163a9059cbb60e01b81526001600160a01b038281166004830152602482018d905286169063a9059cbb906044016020604051808303816000875af1158015612249573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061226d91906139d0565b505b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac19061229e90600401613878565b602060405180830381865afa1580156122bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122df9190613635565b9050806001600160a01b031634846040516122fa9190613984565b60006040518083038185875af1925050503d8060008114612337576040519150601f19603f3d011682016040523d82523d6000602084013e61233c565b606091505b50909750925086612362578260405163a5fa8d2b60e01b8152600401610b0791906139a0565b816001600160a01b03167f9f35d1a548c87dcbf988877ed3a448147482461ef11c54724e455acc002ac1d2348b8b60405161239f93929190613abd565b60405180910390a250505050505050505050505050505050565b6123c16125ed565b60006123cd8383612785565b600080600080868060200190518101906123e79190613a46565b6002546040516360862d6960e01b81526001600160a01b038086166004830152959950939750919550935060009216906360862d6990602401602060405180830381865afa15801561243d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124619190613635565b90506001600160a01b03811661247d5761247a84612646565b90505b6001600160a01b038516156124a0576124a08582856001600160601b0316612978565b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac1906124cf90600401613878565b602060405180830381865afa1580156124ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125109190613635565b9050806001600160a01b0316348460405161252b9190613984565b60006040518083038185875af1925050503d8060008114612568576040519150601f19603f3d011682016040523d82523d6000602084013e61256d565b606091505b50909750925086612593578260405163a5fa8d2b60e01b8152600401610b0791906139a0565b816001600160a01b03167f9f35d1a548c87dcbf988877ed3a448147482461ef11c54724e455acc002ac1d2348b8b6040516125d093929190613abd565b60405180910390a2505050505050506125e96001600055565b5050565b60026000540361263f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b07565b6002600055565b6040516bffffffffffffffffffffffff19606083901b166020820152600090819060340160408051808303601f1901815290829052805160209182012060025463bf40fac160e01b8452600484019290925260076024840152661050d0d3d5539560ca1b604484015292506000916001600160a01b039091169063bf40fac190606401602060405180830381865afa1580156126e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061270a9190613635565b90506127168183612a3c565b60025460405162eab46d60e61b81526001600160a01b0387811660048301528084166024830152929550911690633aad1b4090604401600060405180830381600087803b15801561276657600080fd5b505af115801561277a573d6000803e3d6000fd5b505050505050919050565b815160208084019190912033600081815260019093526040832080547f0e8122b9966a5ace153720b4cfa9a4339fe04cf7270694b3ad4068a61436900b939291856127cf83613af2565b909155506040805160208101959095528401929092526001600160a01b03166060830152608082015260a0016040516020818303038152906040528051906020012090506000612861612820610c43565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b9050600061286f8285612adf565b60025460405163bf40fac160e01b81529192506000916001600160a01b039091169063bf40fac1906128a390600401613938565b602060405180830381865afa1580156128c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128e49190613635565b9050806001600160a01b0316826001600160a01b03161461098757604051637bfa4b9f60e01b815260040160405180910390fd5b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052612972908590612b03565b50505050565b8060000361299957604051631f2a200560e01b815260040160405180910390fd5b6040516370a0823160e01b81523360048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa1580156129e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a049190613652565b905080821115612a2757604051631d00495b60e31b815260040160405180910390fd5b6129726001600160a01b038516338585612918565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008360601b60e81c176000526e5af43d82803e903d91602b57fd5bf38360781b1760205281603760096000f590506001600160a01b038116612ad95760405162461bcd60e51b815260206004820152601760248201527f455243313136373a2063726561746532206661696c65640000000000000000006044820152606401610b07565b92915050565b6000806000612aee8585612bda565b91509150612afb81612c1f565b509392505050565b6000612b58826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612d6c9092919063ffffffff16565b805190915015612bd55780806020019051810190612b7691906139d0565b612bd55760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610b07565b505050565b6000808251604103612c105760208301516040840151606085015160001a612c0487828585612d83565b94509450505050612c18565b506000905060025b9250929050565b6000816004811115612c3357612c33613b0b565b03612c3b5750565b6001816004811115612c4f57612c4f613b0b565b03612c9c5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610b07565b6002816004811115612cb057612cb0613b0b565b03612cfd5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610b07565b6003816004811115612d1157612d11613b0b565b03612d695760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610b07565b50565b6060612d7b8484600085612e47565b949350505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612dba5750600090506003612e3e565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612e0e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612e3757600060019250925050612e3e565b9150600090505b94509492505050565b606082471015612ea85760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610b07565b600080866001600160a01b03168587604051612ec49190613984565b60006040518083038185875af1925050503d8060008114612f01576040519150601f19603f3d011682016040523d82523d6000602084013e612f06565b606091505b5091509150612f1787838387612f22565b979650505050505050565b60608315612f91578251600003612f8a576001600160a01b0385163b612f8a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b07565b5081612d7b565b612d7b8383815115612fa65781518083602001fd5b8060405162461bcd60e51b8152600401610b0791906139a0565b6001600160a01b0381168114612d6957600080fd5b8035612fe081612fc0565b919050565b6001600160601b0381168114612d6957600080fd5b8035612fe081612fe5565b60008083601f84011261301757600080fd5b5081356001600160401b0381111561302e57600080fd5b602083019150836020828501011115612c1857600080fd5b6000806000806000806080878903121561305f57600080fd5b863561306a81612fc0565b9550602087013561307a81612fe5565b945060408701356001600160401b038082111561309657600080fd5b6130a28a838b01613005565b909650945060608901359150808211156130bb57600080fd5b506130c889828a01613005565b979a9699509497509295939492505050565b60008060008060008060008060008060c08b8d0312156130f957600080fd5b6131028b612fd5565b995061311060208c01612ffa565b985060408b01356001600160401b038082111561312c57600080fd5b6131388e838f01613005565b909a50985060608d013591508082111561315157600080fd5b61315d8e838f01613005565b909850965060808d013591508082111561317657600080fd5b6131828e838f01613005565b909650945060a08d013591508082111561319b57600080fd5b506131a88d828e01613005565b915080935050809150509295989b9194979a5092959850565b60008083601f8401126131d357600080fd5b5081356001600160401b038111156131ea57600080fd5b6020830191508360208260051b8501011115612c1857600080fd5b6000806000806000806000806080898b03121561322157600080fd5b88356001600160401b038082111561323857600080fd5b6132448c838d016131c1565b909a50985060208b013591508082111561325d57600080fd5b6132698c838d016131c1565b909850965060408b013591508082111561328257600080fd5b61328e8c838d016131c1565b909650945060608b01359150808211156132a757600080fd5b506132b48b828c016131c1565b999c989b5096995094979396929594505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613306576133066132c8565b604052919050565b60006001600160401b03821115613327576133276132c8565b50601f01601f191660200190565b600082601f83011261334657600080fd5b81356133596133548261330e565b6132de565b81815284602083860101111561336e57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156133a057600080fd5b83356133ab81612fc0565b92506020848101356133bc81612fc0565b925060408501356001600160401b03808211156133d857600080fd5b818701915087601f8301126133ec57600080fd5b8135818111156133fe576133fe6132c8565b8060051b61340d8582016132de565b918252838101850191858101908b84111561342757600080fd5b86860192505b83831015613463578235858111156134455760008081fd5b6134538d89838a0101613335565b835250918601919086019061342d565b809750505050505050509250925092565b60006020828403121561348657600080fd5b813561349181612fc0565b9392505050565b8015158114612d6957600080fd5b600080600080606085870312156134bc57600080fd5b8435935060208501356001600160401b038111156134d957600080fd5b6134e587828801613005565b90945092505060408501356134f981613498565b939692955090935050565b60008060008060008060c0878903121561351d57600080fd5b863561ffff8116811461352f57600080fd5b955060208701356001600160401b038082111561354b57600080fd5b6135578a838b01613335565b9650604089013595506060890135915061357082612fc0565b9093506080880135925060a0880135908082111561358d57600080fd5b5061359a89828a01613335565b9150509295509295509295565b600080604083850312156135ba57600080fd5b82356001600160401b03808211156135d157600080fd5b6135dd86838701613335565b935060208501359150808211156135f357600080fd5b5061360085828601613335565b9150509250929050565b6020808252601190820152702222a320aaa62a29aa20a12622a1a7a4a760791b604082015260600190565b60006020828403121561364757600080fd5b815161349181612fc0565b60006020828403121561366457600080fd5b5051919050565b6020808252600d908201526c27a722a4a721a42927aaaa22a960991b604082015260600190565b6001600160a01b039290921682526001600160601b0316602082015260400190565b60005b838110156136cf5781810151838201526020016136b7565b50506000910152565b600081518084526136f08160208601602086016136b4565b601f01601f19169290920160200192915050565b6001600160a01b0384168152606060208201819052600090613728908301856136d8565b9050826040830152949350505050565b600082601f83011261374957600080fd5b81516137576133548261330e565b81815284602083860101111561376c57600080fd5b612d7b8260208301602087016136b4565b60006020828403121561378f57600080fd5b81516001600160401b038111156137a557600080fd5b612d7b84828501613738565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03851681526060602082018190526000906137ff90830185876137b1565b905082604083015295945050505050565b6001600160a01b038516815260606020820181905260009061383590830185876137b1565b90506001600160601b038316604083015295945050505050565b634e487b7160e01b600052601160045260246000fd5b81810381811115612ad957612ad961384f565b60208082526009908201526850455250545241444560b81b604082015260600190565b8183823760009101908152919050565b602081526000612d7b6020830184866137b1565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156138e757600080fd5b813561349181612fe5565b6000808335601e1984360301811261390957600080fd5b8301803591506001600160401b0382111561392357600080fd5b602001915036819003821315612c1857600080fd5b60208082526005908201526420a226a4a760d91b604082015260600190565b8481526060602082015260006139716060830185876137b1565b9050821515604083015295945050505050565b600082516139968184602087016136b4565b9190910192915050565b60208152600061349160208301846136d8565b6000602082840312156139c557600080fd5b813561349181613498565b6000602082840312156139e257600080fd5b815161349181613498565b60008060408385031215613a0057600080fd5b82516001600160401b0380821115613a1757600080fd5b613a2386838701613738565b93506020850151915080821115613a3957600080fd5b5061360085828601613738565b60008060008060808587031215613a5c57600080fd5b8451613a6781612fc0565b6020860151909450613a7881612fc0565b6040860151909350613a8981612fe5565b60608601519092506001600160401b03811115613aa557600080fd5b613ab187828801613738565b91505092959194509250565b838152606060208201526000613ad660608301856136d8565b8281036040840152613ae881856136d8565b9695505050505050565b600060018201613b0457613b0461384f565b5060010190565b634e487b7160e01b600052602160045260246000fdfea26469706673582212207d2fbac75d2d03c3c9966f1c665eee24941d42e9cb5e2235655f4a5b1049bd9564736f6c63430008130033000000000000000000000000bbf5d32ea4a9dc6c75bb7954c06a6f5133a47751
Deployed Bytecode
0x6080604052600436106100e85760003560e01c806360d2f33d1161008a5780638a804a86116100595780638a804a861461024f5780639859387b1461026f578063ab8236f31461028f578063e2024790146102a257600080fd5b806360d2f33d146101c85780637ecebe00146101fc578063814f543c14610229578063865f694b1461023c57600080fd5b80633644e515116100c65780633644e515146101285780633e198dd014610150578063570ca73514610170578063575fd9fc146101a857600080fd5b80630818db78146100ed57806317c26d871461010257806323554c2e14610115575b600080fd5b6101006100fb366004613046565b6102b5565b005b6101006101103660046130da565b61098f565b610100610123366004613205565b610b68565b34801561013457600080fd5b5061013d610c43565b6040519081526020015b60405180910390f35b34801561015c57600080fd5b5061010061016b36600461338b565b610d73565b34801561017c57600080fd5b50600254610190906001600160a01b031681565b6040516001600160a01b039091168152602001610147565b3480156101b457600080fd5b506101006101c3366004613474565b61127d565b3480156101d457600080fd5b5061013d7f0e8122b9966a5ace153720b4cfa9a4339fe04cf7270694b3ad4068a61436900b81565b34801561020857600080fd5b5061013d610217366004613474565b60016020526000908152604090205481565b6101006102373660046134a6565b611375565b61010061024a366004613205565b61159e565b34801561025b57600080fd5b5061010061026a366004613046565b61189a565b34801561027b57600080fd5b5061019061028a366004613474565b611ee7565b61010061029d366004613504565b612063565b6101006102b03660046135a7565b6123b9565b6102bd6125ed565b846001600160601b03166000036102e757604051631f2a200560e01b815260040160405180910390fd5b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac1906103169060040161360a565b602060405180830381865afa158015610333573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103579190613635565b90506001600160a01b03871661039457856001600160601b0316341461038f5760405162a80fb560e51b815260040160405180910390fd5b61042d565b6040516370a0823160e01b81523360048201526000906001600160a01b038916906370a0823190602401602060405180830381865afa1580156103db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ff9190613652565b905080876001600160601b0316111561042b57604051631d00495b60e31b815260040160405180910390fd5b505b6002546040516360862d6960e01b81523360048201526000916001600160a01b0316906360862d6990602401602060405180830381865afa158015610476573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061049a9190613635565b90506001600160a01b0381166104b6576104b333612646565b90505b6000826001600160a01b0316896001600160a01b0316146108e95760008690036104f357604051632e47553f60e21b815260040160405180910390fd5b61056687878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8b01819004810282018101909252898152925089915088908190840183828082843760009201919091525061278592505050565b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac1906105959060040161366b565b602060405180830381865afa1580156105b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105d69190613635565b6040516370a0823160e01b81526001600160a01b0385811660048301529192506000918616906370a0823190602401602060405180830381865afa158015610622573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106469190613652565b90506001600160a01b038b16156107c0576106756001600160a01b038c1633866001600160601b038e16612918565b600063095ea7b360e01b838c604051602401610692929190613692565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051631409412160e31b81529091506001600160a01b0386169063a04a0908906106f7908f908590600090600401613704565b6000604051808303816000875af1158015610716573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261073e919081019061377d565b50604051631409412160e31b81526001600160a01b0386169063a04a0908906107729086908e908e906000906004016137da565b6000604051808303816000875af1158015610791573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107b9919081019061377d565b5050610845565b836001600160a01b031663a04a09088b6001600160601b0316848c8c8f6040518663ffffffff1660e01b81526004016107fc9493929190613810565b60006040518083038185885af115801561081a573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610843919081019061377d565b505b6040516370a0823160e01b81526001600160a01b038581166004830152600091908716906370a0823190602401602060405180830381865afa15801561088f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b39190613652565b90508181116108d557604051631d00495b60e31b815260040160405180910390fd5b6108df8282613865565b9350505050610926565b851561090857604051632e47553f60e21b815260040160405180910390fd5b6109266001600160a01b03841633846001600160601b038c16612918565b604080516001600160601b038a168152602081018390526001600160a01b03808c16929085169133917fd61ac9a3b4abf904d442799418365261a14d2991144971514183c10ba7e2089c910160405180910390a45050506109876001600055565b505050505050565b610a0286868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8a01819004810282018101909252888152925088915087908190840183828082843760009201919091525061278592505050565b610a108a8a8a8a86866102b5565b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac190610a3f90600401613878565b602060405180830381865afa158015610a5c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a809190613635565b90506000816001600160a01b0316348989604051610a9f92919061389b565b60006040518083038185875af1925050503d8060008114610adc576040519150601f19603f3d011682016040523d82523d6000602084013e610ae1565b606091505b5050905080610b1057878760405163a5fa8d2b60e01b8152600401610b079291906138ab565b60405180910390fd5b8787604051610b2092919061389b565b604051908190038120348252907fb60d18dc467543f2cc9409a496144102e9e01d18e9ca7953811b769ac795f0a69060200160405180910390a2505050505050505050505050565b866000868214610b8e576040516001621398b960e31b0319815260040160405180910390fd5b81811015610c3757610c2f8a8a83818110610bab57610bab6138bf565b9050602002016020810190610bc09190613474565b898984818110610bd257610bd26138bf565b9050602002016020810190610be791906138d5565b888885818110610bf957610bf96138bf565b9050602002810190610c0b91906138f2565b888887818110610c1d57610c1d6138bf565b90506020028101906100fb91906138f2565b600101610b8e565b50505050505050505050565b6000306001600160a01b037f000000000000000000000000f9aa0bbe42ebf0bebc5a44bace12bab5f00a342b16148015610c9c57507f000000000000000000000000000000000000000000000000000000000000000146145b15610cc657507f2dec0ce41912e440446318f8f140a5bbf16cb64dddbbe39277410630b9ff4aac90565b610d6e604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f3a2acf8fa7114853bf3f31f08da377cd70017e14d168242c29697de946b75d28918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b905090565b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac190610da290600401613938565b602060405180830381865afa158015610dbf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de39190613635565b9050336001600160a01b03821614610e0e57604051637bfa4b9f60e01b815260040160405180910390fd5b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac190610e3d9060040161366b565b602060405180830381865afa158015610e5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7e9190613635565b60025460405163bf40fac160e01b81529192506000916001600160a01b039091169063bf40fac190610eb29060040161360a565b602060405180830381865afa158015610ecf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef39190613635565b6040516370a0823160e01b81526001600160a01b0388811660048301529192506000918316906370a0823190602401602060405180830381865afa158015610f3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f639190613652565b90506001600160a01b03871631801561100957876001600160a01b031663a04a09088588600081518110610f9957610f996138bf565b6020026020010151846040518463ffffffff1660e01b8152600401610fc093929190613704565b6000604051808303816000875af1158015610fdf573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611007919081019061377d565b505b6001600160a01b038716156111e2576040516370a0823160e01b81526001600160a01b038981166004830152600091908916906370a0823190602401602060405180830381865afa158015611062573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110869190613652565b6040516001600160a01b03871660248201526044810182905290915060009060640160408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b17905251631409412160e31b81529091506001600160a01b038b169063a04a090890611104908c908590600090600401613704565b6000604051808303816000875af1158015611123573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261114b919081019061377d565b50896001600160a01b031663a04a0908878a60018151811061116f5761116f6138bf565b602002602001015160006040518463ffffffff1660e01b815260040161119793929190613704565b6000604051808303816000875af11580156111b6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111de919081019061377d565b5050505b6040516370a0823160e01b81526001600160a01b038981166004830152600091908516906370a0823190602401602060405180830381865afa15801561122c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112509190613652565b905082811161127257604051631d00495b60e31b815260040160405180910390fd5b505050505050505050565b6001600160a01b0381166112a45760405163d92e233d60e01b815260040160405180910390fd5b6002546040516360862d6960e01b81523360048201526000916001600160a01b0316906360862d6990602401602060405180830381865afa1580156112ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113119190613635565b60025460405162eab46d60e61b81526001600160a01b0385811660048301528084166024830152929350911690633aad1b4090604401600060405180830381600087803b15801561136157600080fd5b505af1158015610987573d6000803e3d6000fd5b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac1906113a490600401613938565b602060405180830381865afa1580156113c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e59190613635565b9050336001600160a01b0382161461141057604051637bfa4b9f60e01b815260040160405180910390fd5b6000858585856040516024016114299493929190613957565b60408051601f198184030181529181526020820180516001600160e01b0316632053d50f60e21b179052600254905163bf40fac160e01b81529192506000916001600160a01b039091169063bf40fac19061148690600401613878565b602060405180830381865afa1580156114a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114c79190613635565b90506000816001600160a01b031634846040516114e49190613984565b60006040518083038185875af1925050503d8060008114611521576040519150601f19603f3d011682016040523d82523d6000602084013e611526565b606091505b505090508061154a578260405163a5fa8d2b60e01b8152600401610b0791906139a0565b868660405161155a92919061389b565b604051908190038120348252907fb60d18dc467543f2cc9409a496144102e9e01d18e9ca7953811b769ac795f0a69060200160405180910390a25050505050505050565b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac1906115cd90600401613938565b602060405180830381865afa1580156115ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160e9190613635565b9050336001600160a01b0382161461163957604051637bfa4b9f60e01b815260040160405180910390fd5b85841461165c576040516001621398b960e31b0319815260040160405180910390fd5b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac19061168b90600401613878565b602060405180830381865afa1580156116a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116cc9190613635565b905060005b8781101561188d5760008b8b838181106116ed576116ed6138bf565b9050602002013590503660008b8b8581811061170b5761170b6138bf565b905060200281019061171d91906138f2565b9150915060008a8a86818110611735576117356138bf565b9050602002013590506000898987818110611752576117526138bf565b905060200201602081019061176791906139b3565b90506000858585846040516024016117829493929190613957565b60408051601f198184030181529181526020820180516001600160e01b0316632053d50f60e21b179052519091506000906001600160a01b038a169085906117cb908590613984565b60006040518083038185875af1925050503d8060008114611808576040519150601f19603f3d011682016040523d82523d6000602084013e61180d565b606091505b5050905080611831578160405163a5fa8d2b60e01b8152600401610b0791906139a0565b858560405161184192919061389b565b604051908190038120858252907fb60d18dc467543f2cc9409a496144102e9e01d18e9ca7953811b769ac795f0a69060200160405180910390a2876001019750505050505050506116d1565b5050505050505050505050565b846001600160601b03166000036118c457604051631f2a200560e01b815260040160405180910390fd5b6002546040516360862d6960e01b81523360048201526000916001600160a01b0316906360862d6990602401602060405180830381865afa15801561190d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119319190613635565b90506001600160a01b03811661195a5760405163421972d160e11b815260040160405180910390fd5b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac1906119899060040161360a565b602060405180830381865afa1580156119a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ca9190613635565b6040516370a0823160e01b81526001600160a01b0384811660048301529192506000918316906370a0823190602401602060405180830381865afa158015611a16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a3a9190613652565b905080886001600160601b03161115611a6657604051631d00495b60e31b815260040160405180910390fd5b816001600160a01b0316896001600160a01b031603611b5d578515611a9e57604051632e47553f60e21b815260040160405180910390fd5b60003389604051602401611ab3929190613692565b60408051601f198184030181529181526020820180516001600160e01b031663a9059cbb60e01b17905251631409412160e31b81529091506001600160a01b0385169063a04a090890611b0f9086908590600090600401613704565b6000604051808303816000875af1158015611b2e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611b56919081019061377d565b5050611e8e565b611bd087878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8b01819004810282018101909252898152925089915088908190840183828082843760009201919091525061278592505050565b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac190611bff9060040161366b565b602060405180830381865afa158015611c1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c409190613635565b90506000818a604051602401611c57929190613692565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b17905251631409412160e31b81529091506001600160a01b0386169063a04a090890611cb39087908590600090600401613704565b6000604051808303816000875af1158015611cd2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611cfa919081019061377d565b506040516370a0823160e01b81526001600160a01b038681166004830152600091908616906370a0823190602401602060405180830381865afa158015611d45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d699190613652565b604051631409412160e31b81529091506001600160a01b0387169063a04a090890611d9f9086908e908e906000906004016137da565b6000604051808303816000875af1158015611dbe573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611de6919081019061377d565b506040516370a0823160e01b81526001600160a01b038781166004830152600091908716906370a0823190602401602060405180830381865afa158015611e31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e559190613652565b90506001600160601b038c16611e6b8284613865565b14611e8957604051632e47553f60e21b815260040160405180910390fd5b505050505b6040516001600160601b03891681526001600160a01b03808b16919085169033907f7b91bc64e11e7b62e5bd0d98cbe597466b07a2eb251e2652e7a855e90c5bb5799060200160405180910390a4505050505050505050565b600254604051630fba0e4960e41b815233600482015260009182916001600160a01b039091169063fba0e49090602401602060405180830381865afa158015611f34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f5891906139d0565b905080611f7857604051634a526b2760e01b815260040160405180910390fd5b6002546040516360862d6960e01b81526001600160a01b03858116600483015260009216906360862d6990602401602060405180830381865afa158015611fc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fe79190613635565b90506001600160a01b03811615612011576040516369783db760e01b815260040160405180910390fd5b61201a84612646565b9250826001600160a01b0316846001600160a01b03167fbb777850bc7f41c07ecd6df089be81948ec5111a6425ea5da79a72613dd6f53460405160405180910390a35050919050565b60025460405163bf40fac160e01b8152602060048201526008602482015267535441524741544560c01b60448201526000916001600160a01b03169063bf40fac190606401602060405180830381865afa1580156120c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120e99190613635565b9050336001600160a01b038216146121145760405163160d3af160e11b815260040160405180910390fd5b6000808380602001905181019061212b91906139ed565b91509150600061213b8383612785565b600080600080868060200190518101906121559190613a46565b6002546040516360862d6960e01b81526001600160a01b038086166004830152959950939750919550935060009216906360862d6990602401602060405180830381865afa1580156121ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121cf9190613635565b90506001600160a01b0381166121eb576121e884612646565b90505b6001600160a01b0385161561226f5760405163a9059cbb60e01b81526001600160a01b038281166004830152602482018d905286169063a9059cbb906044016020604051808303816000875af1158015612249573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061226d91906139d0565b505b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac19061229e90600401613878565b602060405180830381865afa1580156122bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122df9190613635565b9050806001600160a01b031634846040516122fa9190613984565b60006040518083038185875af1925050503d8060008114612337576040519150601f19603f3d011682016040523d82523d6000602084013e61233c565b606091505b50909750925086612362578260405163a5fa8d2b60e01b8152600401610b0791906139a0565b816001600160a01b03167f9f35d1a548c87dcbf988877ed3a448147482461ef11c54724e455acc002ac1d2348b8b60405161239f93929190613abd565b60405180910390a250505050505050505050505050505050565b6123c16125ed565b60006123cd8383612785565b600080600080868060200190518101906123e79190613a46565b6002546040516360862d6960e01b81526001600160a01b038086166004830152959950939750919550935060009216906360862d6990602401602060405180830381865afa15801561243d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124619190613635565b90506001600160a01b03811661247d5761247a84612646565b90505b6001600160a01b038516156124a0576124a08582856001600160601b0316612978565b60025460405163bf40fac160e01b81526000916001600160a01b03169063bf40fac1906124cf90600401613878565b602060405180830381865afa1580156124ec573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125109190613635565b9050806001600160a01b0316348460405161252b9190613984565b60006040518083038185875af1925050503d8060008114612568576040519150601f19603f3d011682016040523d82523d6000602084013e61256d565b606091505b50909750925086612593578260405163a5fa8d2b60e01b8152600401610b0791906139a0565b816001600160a01b03167f9f35d1a548c87dcbf988877ed3a448147482461ef11c54724e455acc002ac1d2348b8b6040516125d093929190613abd565b60405180910390a2505050505050506125e96001600055565b5050565b60026000540361263f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610b07565b6002600055565b6040516bffffffffffffffffffffffff19606083901b166020820152600090819060340160408051808303601f1901815290829052805160209182012060025463bf40fac160e01b8452600484019290925260076024840152661050d0d3d5539560ca1b604484015292506000916001600160a01b039091169063bf40fac190606401602060405180830381865afa1580156126e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061270a9190613635565b90506127168183612a3c565b60025460405162eab46d60e61b81526001600160a01b0387811660048301528084166024830152929550911690633aad1b4090604401600060405180830381600087803b15801561276657600080fd5b505af115801561277a573d6000803e3d6000fd5b505050505050919050565b815160208084019190912033600081815260019093526040832080547f0e8122b9966a5ace153720b4cfa9a4339fe04cf7270694b3ad4068a61436900b939291856127cf83613af2565b909155506040805160208101959095528401929092526001600160a01b03166060830152608082015260a0016040516020818303038152906040528051906020012090506000612861612820610c43565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b9050600061286f8285612adf565b60025460405163bf40fac160e01b81529192506000916001600160a01b039091169063bf40fac1906128a390600401613938565b602060405180830381865afa1580156128c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128e49190613635565b9050806001600160a01b0316826001600160a01b03161461098757604051637bfa4b9f60e01b815260040160405180910390fd5b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052612972908590612b03565b50505050565b8060000361299957604051631f2a200560e01b815260040160405180910390fd5b6040516370a0823160e01b81523360048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa1580156129e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a049190613652565b905080821115612a2757604051631d00495b60e31b815260040160405180910390fd5b6129726001600160a01b038516338585612918565b6000763d602d80600a3d3981f3363d3d373d3d3d363d730000008360601b60e81c176000526e5af43d82803e903d91602b57fd5bf38360781b1760205281603760096000f590506001600160a01b038116612ad95760405162461bcd60e51b815260206004820152601760248201527f455243313136373a2063726561746532206661696c65640000000000000000006044820152606401610b07565b92915050565b6000806000612aee8585612bda565b91509150612afb81612c1f565b509392505050565b6000612b58826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612d6c9092919063ffffffff16565b805190915015612bd55780806020019051810190612b7691906139d0565b612bd55760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610b07565b505050565b6000808251604103612c105760208301516040840151606085015160001a612c0487828585612d83565b94509450505050612c18565b506000905060025b9250929050565b6000816004811115612c3357612c33613b0b565b03612c3b5750565b6001816004811115612c4f57612c4f613b0b565b03612c9c5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610b07565b6002816004811115612cb057612cb0613b0b565b03612cfd5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610b07565b6003816004811115612d1157612d11613b0b565b03612d695760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610b07565b50565b6060612d7b8484600085612e47565b949350505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612dba5750600090506003612e3e565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612e0e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116612e3757600060019250925050612e3e565b9150600090505b94509492505050565b606082471015612ea85760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610b07565b600080866001600160a01b03168587604051612ec49190613984565b60006040518083038185875af1925050503d8060008114612f01576040519150601f19603f3d011682016040523d82523d6000602084013e612f06565b606091505b5091509150612f1787838387612f22565b979650505050505050565b60608315612f91578251600003612f8a576001600160a01b0385163b612f8a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610b07565b5081612d7b565b612d7b8383815115612fa65781518083602001fd5b8060405162461bcd60e51b8152600401610b0791906139a0565b6001600160a01b0381168114612d6957600080fd5b8035612fe081612fc0565b919050565b6001600160601b0381168114612d6957600080fd5b8035612fe081612fe5565b60008083601f84011261301757600080fd5b5081356001600160401b0381111561302e57600080fd5b602083019150836020828501011115612c1857600080fd5b6000806000806000806080878903121561305f57600080fd5b863561306a81612fc0565b9550602087013561307a81612fe5565b945060408701356001600160401b038082111561309657600080fd5b6130a28a838b01613005565b909650945060608901359150808211156130bb57600080fd5b506130c889828a01613005565b979a9699509497509295939492505050565b60008060008060008060008060008060c08b8d0312156130f957600080fd5b6131028b612fd5565b995061311060208c01612ffa565b985060408b01356001600160401b038082111561312c57600080fd5b6131388e838f01613005565b909a50985060608d013591508082111561315157600080fd5b61315d8e838f01613005565b909850965060808d013591508082111561317657600080fd5b6131828e838f01613005565b909650945060a08d013591508082111561319b57600080fd5b506131a88d828e01613005565b915080935050809150509295989b9194979a5092959850565b60008083601f8401126131d357600080fd5b5081356001600160401b038111156131ea57600080fd5b6020830191508360208260051b8501011115612c1857600080fd5b6000806000806000806000806080898b03121561322157600080fd5b88356001600160401b038082111561323857600080fd5b6132448c838d016131c1565b909a50985060208b013591508082111561325d57600080fd5b6132698c838d016131c1565b909850965060408b013591508082111561328257600080fd5b61328e8c838d016131c1565b909650945060608b01359150808211156132a757600080fd5b506132b48b828c016131c1565b999c989b5096995094979396929594505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613306576133066132c8565b604052919050565b60006001600160401b03821115613327576133276132c8565b50601f01601f191660200190565b600082601f83011261334657600080fd5b81356133596133548261330e565b6132de565b81815284602083860101111561336e57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156133a057600080fd5b83356133ab81612fc0565b92506020848101356133bc81612fc0565b925060408501356001600160401b03808211156133d857600080fd5b818701915087601f8301126133ec57600080fd5b8135818111156133fe576133fe6132c8565b8060051b61340d8582016132de565b918252838101850191858101908b84111561342757600080fd5b86860192505b83831015613463578235858111156134455760008081fd5b6134538d89838a0101613335565b835250918601919086019061342d565b809750505050505050509250925092565b60006020828403121561348657600080fd5b813561349181612fc0565b9392505050565b8015158114612d6957600080fd5b600080600080606085870312156134bc57600080fd5b8435935060208501356001600160401b038111156134d957600080fd5b6134e587828801613005565b90945092505060408501356134f981613498565b939692955090935050565b60008060008060008060c0878903121561351d57600080fd5b863561ffff8116811461352f57600080fd5b955060208701356001600160401b038082111561354b57600080fd5b6135578a838b01613335565b9650604089013595506060890135915061357082612fc0565b9093506080880135925060a0880135908082111561358d57600080fd5b5061359a89828a01613335565b9150509295509295509295565b600080604083850312156135ba57600080fd5b82356001600160401b03808211156135d157600080fd5b6135dd86838701613335565b935060208501359150808211156135f357600080fd5b5061360085828601613335565b9150509250929050565b6020808252601190820152702222a320aaa62a29aa20a12622a1a7a4a760791b604082015260600190565b60006020828403121561364757600080fd5b815161349181612fc0565b60006020828403121561366457600080fd5b5051919050565b6020808252600d908201526c27a722a4a721a42927aaaa22a960991b604082015260600190565b6001600160a01b039290921682526001600160601b0316602082015260400190565b60005b838110156136cf5781810151838201526020016136b7565b50506000910152565b600081518084526136f08160208601602086016136b4565b601f01601f19169290920160200192915050565b6001600160a01b0384168152606060208201819052600090613728908301856136d8565b9050826040830152949350505050565b600082601f83011261374957600080fd5b81516137576133548261330e565b81815284602083860101111561376c57600080fd5b612d7b8260208301602087016136b4565b60006020828403121561378f57600080fd5b81516001600160401b038111156137a557600080fd5b612d7b84828501613738565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03851681526060602082018190526000906137ff90830185876137b1565b905082604083015295945050505050565b6001600160a01b038516815260606020820181905260009061383590830185876137b1565b90506001600160601b038316604083015295945050505050565b634e487b7160e01b600052601160045260246000fd5b81810381811115612ad957612ad961384f565b60208082526009908201526850455250545241444560b81b604082015260600190565b8183823760009101908152919050565b602081526000612d7b6020830184866137b1565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156138e757600080fd5b813561349181612fe5565b6000808335601e1984360301811261390957600080fd5b8301803591506001600160401b0382111561392357600080fd5b602001915036819003821315612c1857600080fd5b60208082526005908201526420a226a4a760d91b604082015260600190565b8481526060602082015260006139716060830185876137b1565b9050821515604083015295945050505050565b600082516139968184602087016136b4565b9190910192915050565b60208152600061349160208301846136d8565b6000602082840312156139c557600080fd5b813561349181613498565b6000602082840312156139e257600080fd5b815161349181613498565b60008060408385031215613a0057600080fd5b82516001600160401b0380821115613a1757600080fd5b613a2386838701613738565b93506020850151915080821115613a3957600080fd5b5061360085828601613738565b60008060008060808587031215613a5c57600080fd5b8451613a6781612fc0565b6020860151909450613a7881612fc0565b6040860151909350613a8981612fe5565b60608601519092506001600160401b03811115613aa557600080fd5b613ab187828801613738565b91505092959194509250565b838152606060208201526000613ad660608301856136d8565b8281036040840152613ae881856136d8565b9695505050505050565b600060018201613b0457613b0461384f565b5060010190565b634e487b7160e01b600052602160045260246000fdfea26469706673582212207d2fbac75d2d03c3c9966f1c665eee24941d42e9cb5e2235655f4a5b1049bd9564736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000bbf5d32ea4a9dc6c75bb7954c06a6f5133a47751
-----Decoded View---------------
Arg [0] : _operator (address): 0xBBF5d32EA4A9Dc6c75BB7954c06a6F5133a47751
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000bbf5d32ea4a9dc6c75bb7954c06a6f5133a47751
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.