Source Code
Latest 25 from a total of 3,629 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Transfer Ownersh... | 27622581 | 16 days ago | IN | 0 ETH | 0.00000125 | ||||
| Execute Order | 23915337 | 119 days ago | IN | 0.0417 ETH | 0.00002486 | ||||
| Execute Order | 23911979 | 119 days ago | IN | 0 ETH | 0.00003573 | ||||
| Execute Order | 23745919 | 123 days ago | IN | 0.003 ETH | 0.0000254 | ||||
| Execute Order | 23716179 | 124 days ago | IN | 0.1097 ETH | 0.00002486 | ||||
| Execute Order | 23576750 | 127 days ago | IN | 0.068 ETH | 0.00003978 | ||||
| Execute Order | 23513273 | 129 days ago | IN | 0.00001 ETH | 0.00002594 | ||||
| Execute Order | 23402959 | 131 days ago | IN | 0 ETH | 0.00003561 | ||||
| Execute Order | 23394121 | 132 days ago | IN | 0 ETH | 0.00003552 | ||||
| Execute Order | 23390066 | 132 days ago | IN | 0.0082 ETH | 0.00002591 | ||||
| Execute Order | 23337889 | 133 days ago | IN | 0.0022 ETH | 0.00004805 | ||||
| Execute Order | 23336762 | 133 days ago | IN | 0.00022 ETH | 0.00003274 | ||||
| Execute Order | 23334737 | 133 days ago | IN | 0.00022 ETH | 0.00003622 | ||||
| Execute Order | 23283691 | 134 days ago | IN | 0.011 ETH | 0.00002476 | ||||
| Execute Order | 23274090 | 134 days ago | IN | 0.01299214 ETH | 0.00002486 | ||||
| Execute Order | 23205903 | 136 days ago | IN | 0.00425 ETH | 0.00002662 | ||||
| Execute Order | 23170554 | 137 days ago | IN | 0.1449 ETH | 0.00002385 | ||||
| Execute Order | 23032480 | 140 days ago | IN | 0 ETH | 0.00005091 | ||||
| Execute Order | 23014139 | 141 days ago | IN | 0.024 ETH | 0.00002355 | ||||
| Execute Order | 22971195 | 142 days ago | IN | 0.00545 ETH | 0.00002888 | ||||
| Execute Order | 22961574 | 142 days ago | IN | 0 ETH | 0.00007722 | ||||
| Execute Order | 22961170 | 142 days ago | IN | 0 ETH | 0.00007455 | ||||
| Execute Order | 22807352 | 146 days ago | IN | 0 ETH | 0.00003912 | ||||
| Execute Order | 22759955 | 147 days ago | IN | 0.0596 ETH | 0.00002479 | ||||
| Execute Order | 22617631 | 150 days ago | IN | 0.011 ETH | 0.00004113 |
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 23915337 | 119 days ago | 0 ETH | ||||
| 23915337 | 119 days ago | 0 ETH | ||||
| 23915337 | 119 days ago | 0 ETH | ||||
| 23915337 | 119 days ago | 0 ETH | ||||
| 23915337 | 119 days ago | 0.0417 ETH | ||||
| 23915337 | 119 days ago | 0 ETH | ||||
| 23911979 | 119 days ago | 0 ETH | ||||
| 23911979 | 119 days ago | 0 ETH | ||||
| 23911979 | 119 days ago | 0 ETH | ||||
| 23911979 | 119 days ago | 0 ETH | ||||
| 23911979 | 119 days ago | 0 ETH | ||||
| 23911979 | 119 days ago | 0 ETH | ||||
| 23911979 | 119 days ago | 0 ETH | ||||
| 23911979 | 119 days ago | 0 ETH | ||||
| 23911979 | 119 days ago | 0 ETH | ||||
| 23745919 | 123 days ago | 0 ETH | ||||
| 23745919 | 123 days ago | 0 ETH | ||||
| 23745919 | 123 days ago | 0 ETH | ||||
| 23745919 | 123 days ago | 0 ETH | ||||
| 23745919 | 123 days ago | 0.003 ETH | ||||
| 23745919 | 123 days ago | 0 ETH | ||||
| 23716179 | 124 days ago | 0 ETH | ||||
| 23716179 | 124 days ago | 0 ETH | ||||
| 23716179 | 124 days ago | 0 ETH | ||||
| 23716179 | 124 days ago | 0 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
SoulZapRouter
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Pausable} from "@openzeppelin/contracts/security/Pausable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {BytesLib} from "solidity-bytes-utils/contracts/BytesLib.sol";
import {ISoulTokenManager} from "./interfaces/ISoulTokenManager.sol";
import {ISoulZapRouter} from "./interfaces/ISoulZapRouter.sol";
import {IPermit2} from "./interfaces/IPermit2.sol";
import {SoulTokenManager} from "./SoulTokenManager.sol";
import {ZapErrors} from "./ZapErrors.sol";
/**
* @title Zap router for Soul vaults
* @author kexley, Beefy, SoulSoulidity
* @notice Adaptable router for zapping tokens to and from Soul vaults
* @dev Router that allows arbitary calls to external contracts. Users can zap directly or sign
* using Permit2 to allow a relayer to execute zaps on their behalf. Do not directly approve this
* contract for spending your tokens, approve the TokenManager instead
*/
contract SoulZapRouter is ISoulZapRouter, ZapErrors, Ownable, Pausable, ReentrancyGuard {
using SafeERC20 for IERC20;
using BytesLib for bytes;
/**
* @dev Witness string used in signing an order
*/
string private constant ORDER_STRING =
"Order order)Order(Input[] inputs,Output[] outputs,Relay relay,address user,address recipient)Input(address token,uint256 amount)Output(address token,uint256 minOutputAmount)Relay(address target,uint256 value,bytes data)TokenPermissions(address token,uint256 amount)";
/**
* @dev Witness typehash used in signing an order
*/
bytes32 private constant ORDER_TYPEHASH =
keccak256(
"Order(Input[] inputs,Output[] outputs,Relay relay,address user,address recipient)Input(address token,uint256 amount)Output(address token,uint256 minOutputAmount)Relay(address target,uint256 value,bytes data)"
);
/**
* @notice Permit2 immutable address
*/
address public immutable permit2;
/**
* @notice Token manager immutable address
*/
address public immutable tokenManager;
/**
* @notice Token and amount sent to the recipient at end of a zap
* @param token Address of the token sent to recipient
* @param amount Amount of the token sent to the recipient
*/
event TokenReturned(address indexed token, uint256 amount);
/**
* @notice External relay call at end of zap
* @param target Address of the target
* @param value Ether value of the call
* @param data Payload of the external call
*/
event RelayData(address indexed target, uint256 value, bytes data);
/**
* @notice Completed order
* @param order Order that has been fulfilled
* @param caller Address of the order's executor
* @param recipient Address of the order's recipient
*/
event FulfilledOrder(Order indexed order, address indexed caller, address indexed recipient);
/**
* @dev Initialize permit2 address and create an implementation of the token manager
* @param _permit2 Address for the permit2 contract
*/
constructor(address _permit2) {
permit2 = _permit2;
tokenManager = address(new SoulTokenManager());
}
/**
* @notice Execute an order directly
* @dev The user executes their own order directly. User must have already approved the token
* manager to move the tokens
* @param _order Order containing how many tokens to pull and the slippage amounts on outputs
* @param _route Route containing the steps to reach the output
*/
function executeOrder(Order calldata _order, Step[] calldata _route) external payable nonReentrant whenNotPaused {
if (msg.sender != _order.user) revert InvalidCaller(_order.user, msg.sender);
ISoulTokenManager(tokenManager).pullTokens(_order.user, _order.inputs);
_executeOrder(_order, _route);
}
/**
* @notice Execute an order using a signature from the input token owner
* @dev Execute an order indirectly by passing a signed permit from Permit2 that contains the
* order as witness data. The user who owns the tokens must have already approved Permit2.
* Route is supplied at this stage as slippages and amounts are already set in the signed order
* @param _permit Struct of tokens that have been permitted and the nonce/deadline
* @param _order Order that details the input/output tokens and amounts
* @param _signature Resulting string from signing the permit and order data
* @param _route Actual steps that will transform input tokens to output tokens
*/
function executeOrder(
IPermit2.PermitBatchTransferFrom calldata _permit,
Order calldata _order,
bytes calldata _signature,
Step[] calldata _route
) external nonReentrant whenNotPaused {
IPermit2(permit2).permitWitnessTransferFrom(
_permit,
_getTransferDetails(_order.inputs),
_order.user,
keccak256(abi.encode(ORDER_TYPEHASH, _order)),
ORDER_STRING,
_signature
);
_executeOrder(_order, _route);
}
/**
* @dev Executes a valid order by executing the steps on the route, validating the output
* amounts and then sending them to the recipient. A final external call is made to relay
* data in the order to chain together calls
* @param _order Order struct with details of inputs and outputs
* @param _route Actual steps to transform inputs to outputs
*/
function _executeOrder(Order calldata _order, Step[] calldata _route) private {
_executeSteps(_route);
_returnAssets(_order.outputs, _order.recipient, _order.relay.value);
_executeRelay(_order.relay);
emit FulfilledOrder(_order, msg.sender, _order.recipient);
}
/**
* @dev Executes various steps to achieve the order outputs by making external calls. Balance
* data is dynamically inserted into payloads to always move the full balances of this contract
* @param _route Array of the steps the contract will execute
*/
function _executeSteps(Step[] calldata _route) private {
uint256 routeLength = _route.length;
for (uint256 i; i < routeLength; ) {
Step calldata step = _route[i];
(address stepTarget, uint256 value, bytes memory callData, StepToken[] calldata stepTokens) = (
step.target,
step.value,
step.data,
step.tokens
);
if (stepTarget == permit2 || stepTarget == tokenManager) revert TargetingInvalidContract(stepTarget);
uint256 balance;
uint256 callDataLength = callData.length;
uint256 stepTokensLength = stepTokens.length;
for (uint256 j; j < stepTokensLength; ) {
StepToken calldata stepToken = stepTokens[j];
(address stepTokenAddress, int32 stepTokenIndex) = (stepToken.token, stepToken.index);
if (stepTokenAddress == address(0)) {
value = address(this).balance;
} else {
balance = IERC20(stepTokenAddress).balanceOf(address(this));
_approveToken(stepTokenAddress, stepTarget, balance);
if (stepTokenIndex >= 0) {
uint256 idx = uint256(int256(stepTokenIndex));
callData = bytes.concat(
callData.slice(0, idx),
abi.encode(balance),
callData.slice(idx + 32, callDataLength - (idx + 32))
);
}
}
unchecked {
++j;
}
}
(bool success, bytes memory result) = stepTarget.call{value: value}(callData);
if (!success) _propagateError(stepTarget, value, callData, result);
unchecked {
++i;
}
}
}
/**
* @dev Approve a token to be spent by an address if not already approved enough
* @param _token Address of token to be approved
* @param _spender Address of spender that will be allowed to move tokens
* @param _amount Number of tokens that are going to be spent
*/
function _approveToken(address _token, address _spender, uint256 _amount) private {
if (IERC20(_token).allowance(address(this), _spender) < _amount) {
IERC20(_token).forceApprove(_spender, type(uint256).max);
}
}
/**
* @dev Bubble up an error message from an underlying contract
* @param _target Address that the call was sent to
* @param _value Amount of ether sent with the call
* @param _data Payload data of the call
* @param _returnedData Returned data from the call
*/
function _propagateError(
address _target,
uint256 _value,
bytes memory _data,
bytes memory _returnedData
) private pure {
if (_returnedData.length == 0) revert CallFailed(_target, _value, _data);
assembly {
revert(add(32, _returnedData), mload(_returnedData))
}
}
/**
* @dev Return the outputs to the recipient address
* @param _outputs Token addresses and amounts to validate against to ensure no major slippage
* @param _recipient Address of the receiver of the outputs
* @param _relayValue Unwrapped native amount that is reserved for calling the relay address
*/
function _returnAssets(Output[] calldata _outputs, address _recipient, uint256 _relayValue) private {
uint256 balance;
uint256 outputsLength = _outputs.length;
for (uint256 i; i < outputsLength; ) {
Output calldata output = _outputs[i];
(address outputToken, uint256 outputMinAmount) = (output.token, output.minOutputAmount);
if (outputToken == address(0)) {
balance = address(this).balance;
if (balance < outputMinAmount) {
revert Slippage(outputToken, outputMinAmount, balance);
}
if (balance > _relayValue) {
balance -= _relayValue;
(bool success, ) = _recipient.call{value: balance}("");
if (!success) revert EtherTransferFailed(_recipient);
}
} else {
balance = IERC20(outputToken).balanceOf(address(this));
if (balance < outputMinAmount) {
revert Slippage(outputToken, outputMinAmount, balance);
} else if (balance > 0) {
IERC20(outputToken).safeTransfer(_recipient, balance);
}
}
emit TokenReturned(outputToken, balance);
unchecked {
++i;
}
}
}
/**
* @dev Call an external contract at the end of a zap with a payload signed in the order
* @param _relay Target address and payload data in a struct
*/
function _executeRelay(Relay calldata _relay) private {
(address relayTarget, uint256 relayValue, bytes calldata relaydata) = (
_relay.target,
_relay.value,
_relay.data
);
if (relayTarget != address(0)) {
if (relayTarget == permit2 || relayTarget == tokenManager) {
revert TargetingInvalidContract(relayTarget);
}
if (address(this).balance < relayValue) {
revert InsufficientRelayValue(address(this).balance, relayValue);
}
(bool success, bytes memory result) = relayTarget.call{value: relayValue}(relaydata);
if (!success) _propagateError(relayTarget, relayValue, relaydata, result);
emit RelayData(relayTarget, relayValue, relaydata);
}
}
/**
* @dev Parse the token transfer details from the order so it can be supplied to the Permit2
* transfer from request
* @param _inputs Token addresses and amounts in a struct
* @return transferDetails Transformed data
*/
function _getTransferDetails(
Input[] calldata _inputs
) private view returns (IPermit2.SignatureTransferDetails[] memory) {
uint256 inputsLength = _inputs.length;
IPermit2.SignatureTransferDetails[] memory transferDetails = new IPermit2.SignatureTransferDetails[](
inputsLength
);
for (uint256 i; i < inputsLength; ) {
transferDetails[i] = IPermit2.SignatureTransferDetails({
to: address(this),
requestedAmount: _inputs[i].amount
});
unchecked {
++i;
}
}
return transferDetails;
}
/**
* @notice Pause the contract from carrying out any more zaps
* @dev Only owner can pause
*/
function pause() external onlyOwner {
_pause();
}
/**
* @notice Unpause the contract to allow new zaps
* @dev Only owner can unpause
*/
function unpause() external onlyOwner {
_unpause();
}
/**
* @dev Allow receiving of native tokens
*/
receive() external payable {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
/**
* @title Permit2 interface
* @author kexley, Beefy
* @notice Interface for Permit2
*/
interface IPermit2 {
/**
* @dev Token and amount in a permit message
* @param token Address of token to transfer
* @param amount Amount of token to transfer
*/
struct TokenPermissions {
address token;
uint256 amount;
}
/**
* @dev Batched permit with the unique nonce and deadline
* @param permitted Tokens and corresponding amounts permitted for a transfer
* @param nonce Unique value for every token owner's signature to prevent signature replays
* @param deadline Deadline on the permit signature
*/
struct PermitBatchTransferFrom {
TokenPermissions[] permitted;
uint256 nonce;
uint256 deadline;
}
/**
* @dev Transfer details for permitBatchTransferFrom
* @param to Recipient of tokens
* @param requestedAmount Amount to transfer
*/
struct SignatureTransferDetails {
address to;
uint256 requestedAmount;
}
/**
* @notice Consume a permit2 message and transfer tokens
* @param permit Batched permit
* @param transferDetails Recipient and amount of tokens to transfer
* @param owner Source of tokens
* @param witness Verified order data that was witnessed in the permit2 signature
* @param witnessTypeString Order function string used to create EIP-712 type string
* @param signature Signature from user
*/
function permitWitnessTransferFrom(
PermitBatchTransferFrom memory permit,
SignatureTransferDetails[] calldata transferDetails,
address owner,
bytes32 witness,
string calldata witnessTypeString,
bytes calldata signature
) external;
/**
* @notice Domain separator to differentiate the chain a permit exists on
*/
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import {ISoulZapRouter} from "./ISoulZapRouter.sol";
/**
* @title Token manager interface
* @author kexley, Soul
* @notice Interface for the token manager
*/
interface ISoulTokenManager {
/**
* @notice Pull tokens from a user
* @param _user Address of user to transfer tokens from
* @param _inputs Addresses and amounts of tokens to transfer
*/
function pullTokens(address _user, ISoulZapRouter.Input[] calldata _inputs) external;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import {IPermit2} from "./IPermit2.sol";
/**
* @title Zap router interface
* @author kexley, Soul
* @notice Interface for zap router that contains the structs for orders and routes
*/
interface ISoulZapRouter {
/**
* @dev Input token and amount used in a step of the zap
* @param token Address of token
* @param amount Amount of token
*/
struct Input {
address token;
uint256 amount;
}
/**
* @dev Output token and amount from the end of the zap
* @param token Address of token
* @param minOutputAmount Minimum amount of token received
*/
struct Output {
address token;
uint256 minOutputAmount;
}
/**
* @dev External call at the end of zap
* @param target Target address to be called
* @param value Ether value of the call
* @param data Payload to call target address with
*/
struct Relay {
address target;
uint256 value;
bytes data;
}
/**
* @dev Token relevant to the current step of the route
* @param token Address of token
* @param index Location in the data that the balance of the token should be inserted
*/
struct StepToken {
address token;
int32 index;
}
/**
* @dev Step in a route
* @param target Target address to be called
* @param value Ether value to call the target address with
* @param data Payload to call target address with
* @param tokens Tokens relevant to the step that require approvals or their balances inserted
* into the data
*/
struct Step {
address target;
uint256 value;
bytes data;
StepToken[] tokens;
}
/**
* @dev Order created by the user
* @param inputs Tokens and amounts to be pulled from the user
* @param outputs Tokens and minimums to be sent to recipient
* @param relay External call to make after zap is completed
* @param user Source of input tokens
* @param recipient Destination of output tokens
*/
struct Order {
Input[] inputs;
Output[] outputs;
Relay relay;
address user;
address recipient;
}
/**
* @notice Execute an order directly
* @param _order Order created by the user
* @param _route Route supplied by user
*/
function executeOrder(Order calldata _order, Step[] calldata _route) external payable;
/**
* @notice Execute an order on behalf of a user
* @param _permit Token permits from Permit2 with the order as witness data signed by user
* @param _order Order created by user that was signed in the permit
* @param _signature Signature from user of combined permit and order
* @param _route Route supplied by user or third-party
*/
function executeOrder(
IPermit2.PermitBatchTransferFrom calldata _permit,
Order calldata _order,
bytes calldata _signature,
Step[] calldata _route
) external;
/**
* @notice Pause the contract from carrying out any more zaps
* @dev Only owner can pause
*/
function pause() external;
/**
* @notice Unpause the contract to allow new zaps
* @dev Only owner can unpause
*/
function unpause() external;
/**
* @notice Permit2 immutable address
*/
function permit2() external view returns (address);
/**
* @notice Token manager immutable address
*/
function tokenManager() external view returns (address);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {ISoulZapRouter} from "./interfaces/ISoulZapRouter.sol";
import {ZapErrors} from "./ZapErrors.sol";
/**
* @title Token manager
* @author kexley, Beefy, SoulSoulidity
* @notice Token manager handles the token approvals for the zap router
* @dev Users should approve this contract instead of the zap router to handle the input ERC20 tokens
*/
contract SoulTokenManager is ZapErrors {
using SafeERC20 for IERC20;
/**
* @notice Zap router immutable address
*/
address public immutable zap;
/**
* @dev This contract is created in the constructor of the zap router
*/
constructor() {
zap = msg.sender;
}
/**
* @notice Pulls tokens from a user and transfers them directly to the zap router
* @dev Only the token owner can call this function indirectly via the zap router
* @param _user Address to pull tokens from
* @param _inputs Token addresses and amounts to pull
*/
function pullTokens(address _user, ISoulZapRouter.Input[] calldata _inputs) external {
if (msg.sender != zap) revert CallerNotZap(msg.sender);
uint256 inputLength = _inputs.length;
for (uint256 i; i < inputLength; ) {
ISoulZapRouter.Input calldata input = _inputs[i];
unchecked {
++i;
}
if (input.token == address(0)) continue;
IERC20(input.token).safeTransferFrom(_user, msg.sender, input.amount);
}
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
/**
* @title Zap errors
* @author kexley, Beefy
* @notice Custom errors for the zap router
*/
contract ZapErrors {
error InvalidCaller(address owner, address caller);
error TargetingInvalidContract(address target);
error CallFailed(address target, uint256 value, bytes callData);
error Slippage(address token, uint256 minAmountOut, uint256 balance);
error EtherTransferFailed(address recipient);
error CallerNotZap(address caller);
error InsufficientRelayValue(uint256 balance, uint256 relayValue);
}// SPDX-License-Identifier: Unlicense /* * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá <[email protected]> * * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity. * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage. */ pragma solidity >=0.8.0 <0.9.0; library BytesLib { function concat( bytes memory _preBytes, bytes memory _postBytes ) internal pure returns (bytes memory) { bytes memory tempBytes; assembly { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // Store the length of the first bytes array at the beginning of // the memory for tempBytes. let length := mload(_preBytes) mstore(tempBytes, length) // Maintain a memory counter for the current write location in the // temp bytes array by adding the 32 bytes for the array length to // the starting location. let mc := add(tempBytes, 0x20) // Stop copying when the memory counter reaches the length of the // first bytes array. let end := add(mc, length) for { // Initialize a copy counter to the start of the _preBytes data, // 32 bytes into its memory. let cc := add(_preBytes, 0x20) } lt(mc, end) { // Increase both counters by 32 bytes each iteration. mc := add(mc, 0x20) cc := add(cc, 0x20) } { // Write the _preBytes data into the tempBytes memory 32 bytes // at a time. mstore(mc, mload(cc)) } // Add the length of _postBytes to the current length of tempBytes // and store it as the new length in the first 32 bytes of the // tempBytes memory. length := mload(_postBytes) mstore(tempBytes, add(length, mload(tempBytes))) // Move the memory counter back from a multiple of 0x20 to the // actual end of the _preBytes data. mc := end // Stop copying when the memory counter reaches the new combined // length of the arrays. end := add(mc, length) for { let cc := add(_postBytes, 0x20) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } // Update the free-memory pointer by padding our last write location // to 32 bytes: add 31 bytes to the end of tempBytes to move to the // next 32 byte block, then round down to the nearest multiple of // 32. If the sum of the length of the two arrays is zero then add // one before rounding down to leave a blank 32 bytes (the length block with 0). mstore(0x40, and( add(add(end, iszero(add(length, mload(_preBytes)))), 31), not(31) // Round down to the nearest 32 bytes. )) } return tempBytes; } function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal { assembly { // Read the first 32 bytes of _preBytes storage, which is the length // of the array. (We don't need to use the offset into the slot // because arrays use the entire slot.) let fslot := sload(_preBytes.slot) // Arrays of 31 bytes or less have an even value in their slot, // while longer arrays have an odd value. The actual length is // the slot divided by two for odd values, and the lowest order // byte divided by two for even values. // If the slot is even, bitwise and the slot with 255 and divide by // two to get the length. If the slot is odd, bitwise and the slot // with -1 and divide by two. let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) let newlength := add(slength, mlength) // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage switch add(lt(slength, 32), lt(newlength, 32)) case 2 { // Since the new array still fits in the slot, we just need to // update the contents of the slot. // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length sstore( _preBytes.slot, // all the modifications to the slot are inside this // next block add( // we can just add to the slot contents because the // bytes we want to change are the LSBs fslot, add( mul( div( // load the bytes from memory mload(add(_postBytes, 0x20)), // zero all bytes to the right exp(0x100, sub(32, mlength)) ), // and now shift left the number of bytes to // leave space for the length in the slot exp(0x100, sub(32, newlength)) ), // increase length by the double of the memory // bytes length mul(mlength, 2) ) ) ) } case 1 { // The stored value fits in the slot, but the combined value // will exceed it. // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // The contents of the _postBytes array start 32 bytes into // the structure. Our first read should obtain the `submod` // bytes that can fit into the unused space in the last word // of the stored array. To get this, we read 32 bytes starting // from `submod`, so the data we read overlaps with the array // contents by `submod` bytes. Masking the lowest-order // `submod` bytes allows us to add that value directly to the // stored value. let submod := sub(32, slength) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore( sc, add( and( fslot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00 ), and(mload(mc), mask) ) ) for { mc := add(mc, 0x20) sc := add(sc, 1) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } default { // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) // Start copying to the last used word of the stored array. let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // Copy over the first `submod` bytes of the new data as in // case 1 above. let slengthmod := mod(slength, 32) let mlengthmod := mod(mlength, 32) let submod := sub(32, slengthmod) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore(sc, add(sload(sc), and(mload(mc), mask))) for { sc := add(sc, 1) mc := add(mc, 0x20) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } } } function slice( bytes memory _bytes, uint256 _start, uint256 _length ) internal pure returns (bytes memory) { require(_length + 31 >= _length, "slice_overflow"); require(_bytes.length >= _start + _length, "slice_outOfBounds"); bytes memory tempBytes; assembly { switch iszero(_length) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(_length, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, _length) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) //zero out the 32 bytes slice we are about to return //we need to do it because Solidity does not garbage collect mstore(tempBytes, 0) mstore(0x40, add(tempBytes, 0x20)) } } return tempBytes; } function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) { require(_bytes.length >= _start + 20, "toAddress_outOfBounds"); address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) { require(_bytes.length >= _start + 1 , "toUint8_outOfBounds"); uint8 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x1), _start)) } return tempUint; } function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) { require(_bytes.length >= _start + 2, "toUint16_outOfBounds"); uint16 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x2), _start)) } return tempUint; } function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) { require(_bytes.length >= _start + 4, "toUint32_outOfBounds"); uint32 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x4), _start)) } return tempUint; } function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) { require(_bytes.length >= _start + 8, "toUint64_outOfBounds"); uint64 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x8), _start)) } return tempUint; } function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) { require(_bytes.length >= _start + 12, "toUint96_outOfBounds"); uint96 tempUint; assembly { tempUint := mload(add(add(_bytes, 0xc), _start)) } return tempUint; } function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) { require(_bytes.length >= _start + 16, "toUint128_outOfBounds"); uint128 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x10), _start)) } return tempUint; } function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) { require(_bytes.length >= _start + 32, "toUint256_outOfBounds"); uint256 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x20), _start)) } return tempUint; } function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) { require(_bytes.length >= _start + 32, "toBytes32_outOfBounds"); bytes32 tempBytes32; assembly { tempBytes32 := mload(add(add(_bytes, 0x20), _start)) } return tempBytes32; } function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) { bool success = true; assembly { let length := mload(_preBytes) // if lengths don't match the arrays are not equal switch eq(length, mload(_postBytes)) case 1 { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 let mc := add(_preBytes, 0x20) let end := add(mc, length) for { let cc := add(_postBytes, 0x20) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) } eq(add(lt(mc, end), cb), 2) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { // if any of these checks fails then arrays are not equal if iszero(eq(mload(mc), mload(cc))) { // unsuccess: success := 0 cb := 0 } } } default { // unsuccess: success := 0 } } return success; } function equal_nonAligned(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) { bool success = true; assembly { let length := mload(_preBytes) // if lengths don't match the arrays are not equal switch eq(length, mload(_postBytes)) case 1 { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 let endMinusWord := add(_preBytes, length) let mc := add(_preBytes, 0x20) let cc := add(_postBytes, 0x20) for { // the next line is the loop condition: // while(uint256(mc < endWord) + cb == 2) } eq(add(lt(mc, endMinusWord), cb), 2) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { // if any of these checks fails then arrays are not equal if iszero(eq(mload(mc), mload(cc))) { // unsuccess: success := 0 cb := 0 } } // Only if still successful // For <1 word tail bytes if gt(success, 0) { // Get the remainder of length/32 // length % 32 = AND(length, 32 - 1) let numTailBytes := and(length, 0x1f) let mcRem := mload(mc) let ccRem := mload(cc) for { let i := 0 // the next line is the loop condition: // while(uint256(i < numTailBytes) + cb == 2) } eq(add(lt(i, numTailBytes), cb), 2) { i := add(i, 1) } { if iszero(eq(byte(i, mcRem), byte(i, ccRem))) { // unsuccess: success := 0 cb := 0 } } } } default { // unsuccess: success := 0 } } return success; } function equalStorage( bytes storage _preBytes, bytes memory _postBytes ) internal view returns (bool) { bool success = true; assembly { // we know _preBytes_offset is 0 let fslot := sload(_preBytes.slot) // Decode the length of the stored array like in concatStorage(). let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) // if lengths don't match the arrays are not equal switch eq(slength, mlength) case 1 { // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage if iszero(iszero(slength)) { switch lt(slength, 32) case 1 { // blank the last byte which is the length fslot := mul(div(fslot, 0x100), 0x100) if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) { // unsuccess: success := 0 } } default { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := keccak256(0x0, 0x20) let mc := add(_postBytes, 0x20) let end := add(mc, mlength) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) for {} eq(add(lt(mc, end), cb), 2) { sc := add(sc, 1) mc := add(mc, 0x20) } { if iszero(eq(sload(sc), mload(mc))) { // unsuccess: success := 0 cb := 0 } } } } } default { // unsuccess: success := 0 } } return success; } }
{
"optimizer": {
"enabled": true,
"runs": 1000
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_permit2","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"callData","type":"bytes"}],"name":"CallFailed","type":"error"},{"inputs":[{"internalType":"address","name":"caller","type":"address"}],"name":"CallerNotZap","type":"error"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"EtherTransferFailed","type":"error"},{"inputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"relayValue","type":"uint256"}],"name":"InsufficientRelayValue","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"caller","type":"address"}],"name":"InvalidCaller","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"minAmountOut","type":"uint256"},{"internalType":"uint256","name":"balance","type":"uint256"}],"name":"Slippage","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"TargetingInvalidContract","type":"error"},{"anonymous":false,"inputs":[{"components":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct ISoulZapRouter.Input[]","name":"inputs","type":"tuple[]"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"minOutputAmount","type":"uint256"}],"internalType":"struct ISoulZapRouter.Output[]","name":"outputs","type":"tuple[]"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct ISoulZapRouter.Relay","name":"relay","type":"tuple"},{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"recipient","type":"address"}],"indexed":true,"internalType":"struct ISoulZapRouter.Order","name":"order","type":"tuple"},{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"FulfilledOrder","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"data","type":"bytes"}],"name":"RelayData","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokenReturned","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct IPermit2.TokenPermissions[]","name":"permitted","type":"tuple[]"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"internalType":"struct IPermit2.PermitBatchTransferFrom","name":"_permit","type":"tuple"},{"components":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct ISoulZapRouter.Input[]","name":"inputs","type":"tuple[]"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"minOutputAmount","type":"uint256"}],"internalType":"struct ISoulZapRouter.Output[]","name":"outputs","type":"tuple[]"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct ISoulZapRouter.Relay","name":"relay","type":"tuple"},{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct ISoulZapRouter.Order","name":"_order","type":"tuple"},{"internalType":"bytes","name":"_signature","type":"bytes"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"int32","name":"index","type":"int32"}],"internalType":"struct ISoulZapRouter.StepToken[]","name":"tokens","type":"tuple[]"}],"internalType":"struct ISoulZapRouter.Step[]","name":"_route","type":"tuple[]"}],"name":"executeOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct ISoulZapRouter.Input[]","name":"inputs","type":"tuple[]"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"minOutputAmount","type":"uint256"}],"internalType":"struct ISoulZapRouter.Output[]","name":"outputs","type":"tuple[]"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct ISoulZapRouter.Relay","name":"relay","type":"tuple"},{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct ISoulZapRouter.Order","name":"_order","type":"tuple"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"int32","name":"index","type":"int32"}],"internalType":"struct ISoulZapRouter.StepToken[]","name":"tokens","type":"tuple[]"}],"internalType":"struct ISoulZapRouter.Step[]","name":"_route","type":"tuple[]"}],"name":"executeOrder","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"permit2","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tokenManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
60c034610138576001600160401b0390601f6200255638819003918201601f19168301918483118484101761013d5780849260209460405283398101031261013857516001600160a01b03919082811681036101385760009182549160405192338682167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08780a36001600160a81b0319163360ff60a01b1916178455600180556080526104ef8281019182118383101761012457908291620020678339039082f090811561011857501660a052604051611f13908162000154823960805181818160f001528181610905015281816110220152611b35015260a051818181610134015281816105a7015281816112ce0152611c460152f35b604051903d90823e3d90fd5b634e487b7160e01b84526041600452602484fd5b600080fd5b634e487b7160e01b600052604160045260246000fdfe6080604052600436101561001b575b361561001957600080fd5b005b60003560e01c806312261ee7146100bb5780632a709b14146100b65780632e0af5e5146100b15780633f4ba83a146100ac5780635c975abb146100a7578063715018a6146100a25780638456cb591461009d5780638da5cb5b14610098578063f2fde38b146100935763f41b2db60361000e57610520565b610437565b6103f2565b610381565b61031a565b6102f4565b61024f565b6101c5565b610114565b6100d0565b60009103126100cb57565b600080fd5b346100cb5760003660031901126100cb5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b346100cb5760003660031901126100cb5760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b908160a09103126100cb5790565b9181601f840112156100cb5782359167ffffffffffffffff83116100cb57602083818601950101116100cb57565b9181601f840112156100cb5782359167ffffffffffffffff83116100cb576020808501948460051b0101116100cb57565b346100cb576003196080368201126100cb5760043567ffffffffffffffff918282116100cb5760609082360301126100cb576024358281116100cb5761020f903690600401610158565b906044358381116100cb57610228903690600401610166565b906064359485116100cb57610244610019953690600401610194565b9490936004016108e6565b346100cb576000806003193601126102f1576102696106b5565b805460ff8160a01c16156102ad5760ff60a01b191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a180f35b606460405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152fd5b80fd5b346100cb5760003660031901126100cb57602060ff60005460a01c166040519015158152f35b346100cb576000806003193601126102f1576103346106b5565b806001600160a01b03815473ffffffffffffffffffffffffffffffffffffffff1981168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b346100cb576000806003193601126102f15761039b6106b5565b6103a361083e565b7401000000000000000000000000000000000000000060ff60a01b198254161781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a180f35b346100cb5760003660031901126100cb5760206001600160a01b0360005416604051908152f35b6001600160a01b038116036100cb57565b359061043582610419565b565b346100cb5760203660031901126100cb5760043561045481610419565b61045c6106b5565b6001600160a01b0380911680156104b65760009182548273ffffffffffffffffffffffffffffffffffffffff198216178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b608460405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b60403660031901126100cb5767ffffffffffffffff6004358181116100cb5761054d903690600401610158565b906024359081116100cb57610566903690600401610194565b9061056f610891565b61057761083e565b60608301926105946105888561070d565b6001600160a01b031690565b330361065f576105cd6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169461070d565b6105d7828061071a565b9095803b156100cb5761061e9660008094604051998a95869485937f77fc3fa8000000000000000000000000000000000000000000000000000000008552600485016107de565b03925af193841561065a5761063894610641575b50611012565b61001960018055565b8061064e61065492610766565b806100c0565b38610632565b610832565b6106b161066b8561070d565b6040517f16cece480000000000000000000000000000000000000000000000000000000081526001600160a01b0390911660048201523360248201529081906044820190565b0390fd5b6001600160a01b036000541633036106c957565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b3561071781610419565b90565b903590601e19813603018212156100cb570180359067ffffffffffffffff82116100cb57602001918160061b360383136100cb57565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff811161077a57604052565b610750565b6040810190811067ffffffffffffffff82111761077a57604052565b90601f8019910116810190811067ffffffffffffffff82111761077a57604052565b602080916001600160a01b0381356107d481610419565b1684520135910152565b60609093919293826040946001600160a01b03868401911683528560208401525201929160005b828110610813575050505090565b90919293828082610826600194896107bd565b01950193929101610805565b6040513d6000823e3d90fd5b60ff60005460a01c1661084d57565b606460405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152fd5b6002600154146108a2576002600155565b606460405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b94939290916108f3610891565b6108fb61083e565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016610938610932858061071a565b90611c9a565b6109446060860161070d565b9260405160208101906109698161095b8a85610af6565b03601f19810183528261079b565b51902098610975610c14565b843b156100cb5760009687936109bb926040519d8e998a9889977ffe8ec1a700000000000000000000000000000000000000000000000000000000895260048901610e22565b03925af193841561065a576109d4946106415750611012565b61043560018055565b9035601e19823603018112156100cb57016020813591019167ffffffffffffffff82116100cb578160061b360383136100cb57565b9160209082815201919060005b818110610a2c5750505090565b90919280610a3c600192866107bd565b60409081019401929101610a1f565b9035605e19823603018112156100cb570190565b9035601e19823603018112156100cb57016020813591019167ffffffffffffffff82116100cb5781360383136100cb57565b908060209392818452848401376000828201840152601f01601f1916010190565b906060610ae6610717936001600160a01b038135610acf81610419565b168452602081013560208501526040810190610a5f565b9190928160408201520191610a91565b7fc709880ce3db9deadf408dae85548b37e4530edc88a93e955bd080b45f3255c28152604080602083015260e08201610b2f84806109dd565b60a0858501529182905261010084019160005b818110610bce57505050610bc06080610b9a610717959460c094610b8c610b83610b6f60208c018c6109dd565b603f198b8603810160608d01529491610a12565b928a018a610a4b565b908783030184880152610ab2565b95610bba610baa6060830161042a565b6001600160a01b031660a0870152565b0161042a565b6001600160a01b0316910152565b909192848082610be0600194886107bd565b019401929101610b42565b604051906104358261077f565b67ffffffffffffffff811161077a57601f01601f191660200190565b60405190610140820182811067ffffffffffffffff82111761077a5760405261010982527f3620616d6f756e74290000000000000000000000000000000000000000000000610120837f4f72646572206f72646572294f7264657228496e7075745b5d20696e7075747360208201527f2c4f75747075745b5d206f7574707574732c52656c61792072656c61792c616460408201527f647265737320757365722c6164647265737320726563697069656e7429496e7060608201527f7574286164647265737320746f6b656e2c75696e7432353620616d6f756e742960808201527f4f7574707574286164647265737320746f6b656e2c75696e74323536206d696e60a08201527f4f7574707574416d6f756e742952656c6179286164647265737320746172676560c08201527f742c75696e743235362076616c75652c6279746573206461746129546f6b656e60e08201527f5065726d697373696f6e73286164647265737320746f6b656e2c75696e7432356101008201520152565b90815180825260208080930193019160005b828110610db2575050505090565b835180516001600160a01b031686528201518583015260409094019392810192600101610da4565b60005b838110610ded5750506000910152565b8181015183820152602001610ddd565b90602091610e1681518092818552858086019101610dda565b601f01601f1916010190565b959391979694929760c08752610120870191610e3e81806109dd565b606060c08b01529384905261014089019360005b818110610ec357505050610e91610eb595936107179a9b95936040848c60e06020610ea398013591015201356101008c01528a820360208c0152610d92565b6001600160a01b039094166040890152565b60608701528582036080870152610dfd565b9260a0818503910152610a91565b90919480610ed3600192886107bd565b60409081019601929101610e52565b903590605e19813603018212156100cb570190565b90610f276040926001600160a01b038135610f1181610419565b1683526020810135602084015283810190610a5f565b8091848401376000828201840152601f01601f1916010190565b60408051918291610f5282806109dd565b8492919060005b818110610fed57505050610f7060208401846109dd565b60005b818110610fc8575050506080610fbb610f9e8594610f99610faa95610fc2980187610a4b565b610ef7565b610faa6060860161042a565b6001600160a01b0316815260200190565b920161042a565b03902090565b919495509192838082610fdd600194896107bd565b0195019101918695949392610f73565b919495509192838082611002600194896107bd565b0195019101918695949392610f59565b919060006001600160a01b0392837f000000000000000000000000000000000000000000000000000000000000000016915b8181106110d757505050506110ab6110a56110956110a061109b8661106c602082018261071a565b9490608083019561107c8761070d565b90602061108d604087018097610ee2565b013592611843565b87610ee2565b611af8565b61070d565b92610f41565b91169033907f1ba5b6ed656994657175705961138c96bd8ec133c35817fa85903f450129e0b1600080a4565b6110e281838661130b565b6110eb8161070d565b9061111e6040916110fe83820182611332565b929061110d606084018461071a565b929091602080950135953691611365565b948b87168a81149081156112c9575b506112aa5791908551926000935b83851061117457505050505060008091845190850184875af19261115d61146e565b931561116f5750505050600101611044565b6117df565b90919293958d61118588878761139c565b9061119a886111938461070d565b93016113ac565b908216806111b55750505050600147965b019392919061113b565b85516370a0823160e01b8152306004820152939993908990829060249082905afa92831561065a578c91600094611277575b506111f391849161149e565b60030b90600082121561120b575b50506001906111ab565b9061126f916112698b611221846001979e611dd8565b936112488c61123a8b5196879283019190602083019252565b03601f19810186528561079b565b61126361125d611257836113df565b926113df565b8961140d565b91611e58565b9161141a565b979038611201565b6111f392945061129c908b3d8d116112a3575b611294818361079b565b8101906113ba565b93916111e7565b503d61128a565b51631e055a2960e21b81526001600160a01b0387166004820152602490fd5b90508c7f000000000000000000000000000000000000000000000000000000000000000016143861112d565b634e487b7160e01b600052603260045260246000fd5b919081101561132d5760051b81013590607e19813603018212156100cb570190565b6112f5565b903590601e19813603018212156100cb570180359067ffffffffffffffff82116100cb576020019181360383136100cb57565b92919261137182610bf8565b9161137f604051938461079b565b8294818452818301116100cb578281602093846000960137010152565b919081101561132d5760061b0190565b358060030b81036100cb5790565b908160209103126100cb575190565b634e487b7160e01b600052601160045260246000fd5b90602082018092116113ed57565b6113c9565b90601f82018092116113ed57565b919082018092116113ed57565b919082039182116113ed57565b61043591939293604051948591835161143b81602096878088019101610dda565b830161144f82518093878085019101610dda565b0161146282518093868085019101610dda565b0103808552018361079b565b3d15611499573d9061147f82610bf8565b9161148d604051938461079b565b82523d6000602084013e565b606090565b6040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03838116602483015292936020939290921691908381604481865afa90811561065a57600091611619575b501061150757505050565b6040517f095ea7b3000000000000000000000000000000000000000000000000000000008382018181526001600160a01b03861660248401526000196044808501919091528352601f199592949290600090819061156660648961079b565b87519082885af161157561146e565b816115e9575b50806115df575b15611590575b505050505050565b604051928301919091526001600160a01b0316602482015260006044820152606493840181526115d4936115cf91906115c9908261079b565b8261164e565b61164e565b388080808080611588565b50833b1515611582565b80518015925085908315611601575b5050503861157b565b6116119350820181019101611636565b3884816115f8565b6116309150843d86116112a357611294818361079b565b386114fc565b908160209103126100cb575180151581036100cb5790565b6040516116ac916001600160a01b03166116678261077f565b6000806020958685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656487860152868151910182855af16116a661146e565b91611747565b80519082821592831561172f575b505050156116c55750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b61173f9350820181019101611636565b3882816116ba565b919290156117a8575081511561175b575090565b3b156117645790565b606460405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156117bb5750805190602001fd5b6106b19060405191829162461bcd60e51b8352602060048401526024830190610dfd565b91908351156117f057835160208501fd5b6001600160a01b0392916106b1916040519485947fe1eec8f10000000000000000000000000000000000000000000000000000000086521660048501526024840152606060448401526064830190610dfd565b919060005b818110611856575050505050565b61186181838661139c565b61186a8161070d565b6020809201356001600160a01b03821692831560001461196f5750479181831061193d575050868082116118dd575b50907feaf449319c042c9ba3474fa0c5329eb58cd1f23be110cdbf9d697b8d303dac156118d4600194935b6040519081529081906020820190565b0390a201611848565b6118e69161140d565b600080808084895af16118f761146e565b50156119035786611899565b6040517f464e254d0000000000000000000000000000000000000000000000000000000081526001600160a01b0386166004820152602490fd5b604051636a67a2d160e11b81526001600160a01b03919091166004820152602481019190915260448101829052606490fd5b9590946119a9979298939460409586516370a0823160e01b815289818060049d8e309083019190916001600160a01b036020820193169052565b0381855afa998a1561065a5760009a611a4e575b505088888a106000146119fd578751636a67a2d160e11b81526001600160a01b038d16818d01908152602081018b9052604081018c905281906060010390fd5b91959a509398506118d491965060019550877feaf449319c042c9ba3474fa0c5329eb58cd1f23be110cdbf9d697b8d303dac159398611a3d575b506118c4565b611a48908986611a6d565b38611a37565b611a65929a50803d106112a357611294818361079b565b9738806119bd565b916001600160a01b03604051927fa9059cbb000000000000000000000000000000000000000000000000000000006020850152166024830152604482015260448152608081019181831067ffffffffffffffff84111761077a576104359260405261164e565b908092918237016000815290565b604090610717949281528160208201520191610a91565b611b018161070d565b90611b156020820135916040810190611332565b6001600160a01b03929192938481169485611b3257505050505050565b807f0000000000000000000000000000000000000000000000000000000000000000168614908115611c42575b50611c1f57824710611be75760008060405180611b7d81878a611ad3565b039086855af190611b8c61146e565b9115611bd557505090611bc77f6c936258f37a22c831493e49cb45429bdf7b6bb0e261f271a15f084e5b08aaff939260405193849384611ae1565b0390a2388080808080611588565b83611be1368588611365565b916117df565b6040517f74c8cbe600000000000000000000000000000000000000000000000000000000815247600482015260248101849052604490fd5b604051631e055a2960e21b81526001600160a01b03919091166004820152602490fd5b90507f000000000000000000000000000000000000000000000000000000000000000016851438611b5f565b67ffffffffffffffff811161077a5760051b60200190565b805182101561132d5760209160051b010190565b611ca382611c6e565b916040611cb28151948561079b565b818452601f19611cc183611c6e565b019060005b828110611d1e5750505060005b818110611ce05750505090565b600190602080611cf183868861139c565b0135611cfb610beb565b30815291820152611d0c8287611c86565b52611d178186611c86565b5001611cd3565b6020908251611d2c8161077f565b6000815282600081830152828901015201611cc6565b15611d4957565b606460405162461bcd60e51b815260206004820152600e60248201527f736c6963655f6f766572666c6f770000000000000000000000000000000000006044820152fd5b15611d9457565b606460405162461bcd60e51b815260206004820152601160248201527f736c6963655f6f75744f66426f756e64730000000000000000000000000000006044820152fd5b611dec82611de5816113f2565b1015611d42565b611df98282511015611d8d565b81611e11575050604051600081526020810160405290565b60405191601f811691821560051b808486010193838501920101905b808410611e455750508252601f01601f191660405290565b9092835181526020809101930190611e2d565b91611e6681611de5816113f2565b611e7c8351611e758385611400565b1115611d8d565b80611e9557505050604051600081526020810160405290565b60405192601f821692831560051b80858701019484860193010101905b808410611eca5750508252601f01601f191660405290565b9092835181526020809101930190611eb256fea2646970667358221220d15c026976fd53c243c6efdc0dfa863262a5cf11ff35a677f18822467419481564736f6c6343000813003360a0806040523461002957336080526104c0908161002f823960805181818160ab015261037f0152f35b600080fdfe608080604052600436101561001357600080fd5b60003560e01c908163262d61521461036157506377fc3fa81461003557600080fd5b346102e85760403660031901126102e8576004356001600160a01b03811681036102e85767ffffffffffffffff602435116102e8573660236024350112156102e85767ffffffffffffffff60243560040135116102e85736602480356004013560061b81350101116102e8576001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633036103315760005b6024356004013581106100e357005b8060061b602435016001602482019201916001600160a01b03610105826103a3565b161561032a5761011c6001600160a01b03916103a3565b166044604051927f23b872dd0000000000000000000000000000000000000000000000000000000060208501526001600160a01b0386166024850152338285015201356064830152606482528160a081011067ffffffffffffffff60a0840111176102ed5760a0820160e083011067ffffffffffffffff60e0840111176102ed5760e08201604052602060a08301527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656460c083015260008083516020850182855af1913d1561031c573d9267ffffffffffffffff84116102ed5760405191601f199067ffffffffffffffff601f87018316603f0183168501908111908511176102ed578582603f60a094601f6102489a011601168501604052845283600060203d92013e5b01926103b7565b80519081159182156102c5575b50506100d457608460405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b81925090602091810103126102e8576020015180151581036102e8573880610255565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6102489260a0606092610241565b50506100d4565b60246040517f403e63e9000000000000000000000000000000000000000000000000000000008152336004820152fd5b346102e85760003660031901126102e8576020906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b356001600160a01b03811681036102e85790565b9192901561041857508151156103cb575090565b3b156103d45790565b606460405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b82519091501561042b5750805190602001fd5b6040519062461bcd60e51b82528160208060048301528251908160248401526000935b828510610471575050604492506000838284010152601f80199101168101030190fd5b848101820151868601604401529381019385935061044e56fea264697066735822122085fb7bebc57122badc26c5fa5acb3da0d80345cf1fa12b611c14bc938456608464736f6c63430008130033000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3
Deployed Bytecode
0x6080604052600436101561001b575b361561001957600080fd5b005b60003560e01c806312261ee7146100bb5780632a709b14146100b65780632e0af5e5146100b15780633f4ba83a146100ac5780635c975abb146100a7578063715018a6146100a25780638456cb591461009d5780638da5cb5b14610098578063f2fde38b146100935763f41b2db60361000e57610520565b610437565b6103f2565b610381565b61031a565b6102f4565b61024f565b6101c5565b610114565b6100d0565b60009103126100cb57565b600080fd5b346100cb5760003660031901126100cb5760206040516001600160a01b037f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3168152f35b346100cb5760003660031901126100cb5760206040516001600160a01b037f00000000000000000000000093b636d58656b2cca69c539e511c14eb3b71da2f168152f35b908160a09103126100cb5790565b9181601f840112156100cb5782359167ffffffffffffffff83116100cb57602083818601950101116100cb57565b9181601f840112156100cb5782359167ffffffffffffffff83116100cb576020808501948460051b0101116100cb57565b346100cb576003196080368201126100cb5760043567ffffffffffffffff918282116100cb5760609082360301126100cb576024358281116100cb5761020f903690600401610158565b906044358381116100cb57610228903690600401610166565b906064359485116100cb57610244610019953690600401610194565b9490936004016108e6565b346100cb576000806003193601126102f1576102696106b5565b805460ff8160a01c16156102ad5760ff60a01b191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa6020604051338152a180f35b606460405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152fd5b80fd5b346100cb5760003660031901126100cb57602060ff60005460a01c166040519015158152f35b346100cb576000806003193601126102f1576103346106b5565b806001600160a01b03815473ffffffffffffffffffffffffffffffffffffffff1981168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b346100cb576000806003193601126102f15761039b6106b5565b6103a361083e565b7401000000000000000000000000000000000000000060ff60a01b198254161781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586020604051338152a180f35b346100cb5760003660031901126100cb5760206001600160a01b0360005416604051908152f35b6001600160a01b038116036100cb57565b359061043582610419565b565b346100cb5760203660031901126100cb5760043561045481610419565b61045c6106b5565b6001600160a01b0380911680156104b65760009182548273ffffffffffffffffffffffffffffffffffffffff198216178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b608460405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152fd5b60403660031901126100cb5767ffffffffffffffff6004358181116100cb5761054d903690600401610158565b906024359081116100cb57610566903690600401610194565b9061056f610891565b61057761083e565b60608301926105946105888561070d565b6001600160a01b031690565b330361065f576105cd6001600160a01b037f00000000000000000000000093b636d58656b2cca69c539e511c14eb3b71da2f169461070d565b6105d7828061071a565b9095803b156100cb5761061e9660008094604051998a95869485937f77fc3fa8000000000000000000000000000000000000000000000000000000008552600485016107de565b03925af193841561065a5761063894610641575b50611012565b61001960018055565b8061064e61065492610766565b806100c0565b38610632565b610832565b6106b161066b8561070d565b6040517f16cece480000000000000000000000000000000000000000000000000000000081526001600160a01b0390911660048201523360248201529081906044820190565b0390fd5b6001600160a01b036000541633036106c957565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b3561071781610419565b90565b903590601e19813603018212156100cb570180359067ffffffffffffffff82116100cb57602001918160061b360383136100cb57565b634e487b7160e01b600052604160045260246000fd5b67ffffffffffffffff811161077a57604052565b610750565b6040810190811067ffffffffffffffff82111761077a57604052565b90601f8019910116810190811067ffffffffffffffff82111761077a57604052565b602080916001600160a01b0381356107d481610419565b1684520135910152565b60609093919293826040946001600160a01b03868401911683528560208401525201929160005b828110610813575050505090565b90919293828082610826600194896107bd565b01950193929101610805565b6040513d6000823e3d90fd5b60ff60005460a01c1661084d57565b606460405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152fd5b6002600154146108a2576002600155565b606460405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152fd5b94939290916108f3610891565b6108fb61083e565b6001600160a01b037f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba316610938610932858061071a565b90611c9a565b6109446060860161070d565b9260405160208101906109698161095b8a85610af6565b03601f19810183528261079b565b51902098610975610c14565b843b156100cb5760009687936109bb926040519d8e998a9889977ffe8ec1a700000000000000000000000000000000000000000000000000000000895260048901610e22565b03925af193841561065a576109d4946106415750611012565b61043560018055565b9035601e19823603018112156100cb57016020813591019167ffffffffffffffff82116100cb578160061b360383136100cb57565b9160209082815201919060005b818110610a2c5750505090565b90919280610a3c600192866107bd565b60409081019401929101610a1f565b9035605e19823603018112156100cb570190565b9035601e19823603018112156100cb57016020813591019167ffffffffffffffff82116100cb5781360383136100cb57565b908060209392818452848401376000828201840152601f01601f1916010190565b906060610ae6610717936001600160a01b038135610acf81610419565b168452602081013560208501526040810190610a5f565b9190928160408201520191610a91565b7fc709880ce3db9deadf408dae85548b37e4530edc88a93e955bd080b45f3255c28152604080602083015260e08201610b2f84806109dd565b60a0858501529182905261010084019160005b818110610bce57505050610bc06080610b9a610717959460c094610b8c610b83610b6f60208c018c6109dd565b603f198b8603810160608d01529491610a12565b928a018a610a4b565b908783030184880152610ab2565b95610bba610baa6060830161042a565b6001600160a01b031660a0870152565b0161042a565b6001600160a01b0316910152565b909192848082610be0600194886107bd565b019401929101610b42565b604051906104358261077f565b67ffffffffffffffff811161077a57601f01601f191660200190565b60405190610140820182811067ffffffffffffffff82111761077a5760405261010982527f3620616d6f756e74290000000000000000000000000000000000000000000000610120837f4f72646572206f72646572294f7264657228496e7075745b5d20696e7075747360208201527f2c4f75747075745b5d206f7574707574732c52656c61792072656c61792c616460408201527f647265737320757365722c6164647265737320726563697069656e7429496e7060608201527f7574286164647265737320746f6b656e2c75696e7432353620616d6f756e742960808201527f4f7574707574286164647265737320746f6b656e2c75696e74323536206d696e60a08201527f4f7574707574416d6f756e742952656c6179286164647265737320746172676560c08201527f742c75696e743235362076616c75652c6279746573206461746129546f6b656e60e08201527f5065726d697373696f6e73286164647265737320746f6b656e2c75696e7432356101008201520152565b90815180825260208080930193019160005b828110610db2575050505090565b835180516001600160a01b031686528201518583015260409094019392810192600101610da4565b60005b838110610ded5750506000910152565b8181015183820152602001610ddd565b90602091610e1681518092818552858086019101610dda565b601f01601f1916010190565b959391979694929760c08752610120870191610e3e81806109dd565b606060c08b01529384905261014089019360005b818110610ec357505050610e91610eb595936107179a9b95936040848c60e06020610ea398013591015201356101008c01528a820360208c0152610d92565b6001600160a01b039094166040890152565b60608701528582036080870152610dfd565b9260a0818503910152610a91565b90919480610ed3600192886107bd565b60409081019601929101610e52565b903590605e19813603018212156100cb570190565b90610f276040926001600160a01b038135610f1181610419565b1683526020810135602084015283810190610a5f565b8091848401376000828201840152601f01601f1916010190565b60408051918291610f5282806109dd565b8492919060005b818110610fed57505050610f7060208401846109dd565b60005b818110610fc8575050506080610fbb610f9e8594610f99610faa95610fc2980187610a4b565b610ef7565b610faa6060860161042a565b6001600160a01b0316815260200190565b920161042a565b03902090565b919495509192838082610fdd600194896107bd565b0195019101918695949392610f73565b919495509192838082611002600194896107bd565b0195019101918695949392610f59565b919060006001600160a01b0392837f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba316915b8181106110d757505050506110ab6110a56110956110a061109b8661106c602082018261071a565b9490608083019561107c8761070d565b90602061108d604087018097610ee2565b013592611843565b87610ee2565b611af8565b61070d565b92610f41565b91169033907f1ba5b6ed656994657175705961138c96bd8ec133c35817fa85903f450129e0b1600080a4565b6110e281838661130b565b6110eb8161070d565b9061111e6040916110fe83820182611332565b929061110d606084018461071a565b929091602080950135953691611365565b948b87168a81149081156112c9575b506112aa5791908551926000935b83851061117457505050505060008091845190850184875af19261115d61146e565b931561116f5750505050600101611044565b6117df565b90919293958d61118588878761139c565b9061119a886111938461070d565b93016113ac565b908216806111b55750505050600147965b019392919061113b565b85516370a0823160e01b8152306004820152939993908990829060249082905afa92831561065a578c91600094611277575b506111f391849161149e565b60030b90600082121561120b575b50506001906111ab565b9061126f916112698b611221846001979e611dd8565b936112488c61123a8b5196879283019190602083019252565b03601f19810186528561079b565b61126361125d611257836113df565b926113df565b8961140d565b91611e58565b9161141a565b979038611201565b6111f392945061129c908b3d8d116112a3575b611294818361079b565b8101906113ba565b93916111e7565b503d61128a565b51631e055a2960e21b81526001600160a01b0387166004820152602490fd5b90508c7f00000000000000000000000093b636d58656b2cca69c539e511c14eb3b71da2f16143861112d565b634e487b7160e01b600052603260045260246000fd5b919081101561132d5760051b81013590607e19813603018212156100cb570190565b6112f5565b903590601e19813603018212156100cb570180359067ffffffffffffffff82116100cb576020019181360383136100cb57565b92919261137182610bf8565b9161137f604051938461079b565b8294818452818301116100cb578281602093846000960137010152565b919081101561132d5760061b0190565b358060030b81036100cb5790565b908160209103126100cb575190565b634e487b7160e01b600052601160045260246000fd5b90602082018092116113ed57565b6113c9565b90601f82018092116113ed57565b919082018092116113ed57565b919082039182116113ed57565b61043591939293604051948591835161143b81602096878088019101610dda565b830161144f82518093878085019101610dda565b0161146282518093868085019101610dda565b0103808552018361079b565b3d15611499573d9061147f82610bf8565b9161148d604051938461079b565b82523d6000602084013e565b606090565b6040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03838116602483015292936020939290921691908381604481865afa90811561065a57600091611619575b501061150757505050565b6040517f095ea7b3000000000000000000000000000000000000000000000000000000008382018181526001600160a01b03861660248401526000196044808501919091528352601f199592949290600090819061156660648961079b565b87519082885af161157561146e565b816115e9575b50806115df575b15611590575b505050505050565b604051928301919091526001600160a01b0316602482015260006044820152606493840181526115d4936115cf91906115c9908261079b565b8261164e565b61164e565b388080808080611588565b50833b1515611582565b80518015925085908315611601575b5050503861157b565b6116119350820181019101611636565b3884816115f8565b6116309150843d86116112a357611294818361079b565b386114fc565b908160209103126100cb575180151581036100cb5790565b6040516116ac916001600160a01b03166116678261077f565b6000806020958685527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656487860152868151910182855af16116a661146e565b91611747565b80519082821592831561172f575b505050156116c55750565b6084906040519062461bcd60e51b82526004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152fd5b61173f9350820181019101611636565b3882816116ba565b919290156117a8575081511561175b575090565b3b156117645790565b606460405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152fd5b8251909150156117bb5750805190602001fd5b6106b19060405191829162461bcd60e51b8352602060048401526024830190610dfd565b91908351156117f057835160208501fd5b6001600160a01b0392916106b1916040519485947fe1eec8f10000000000000000000000000000000000000000000000000000000086521660048501526024840152606060448401526064830190610dfd565b919060005b818110611856575050505050565b61186181838661139c565b61186a8161070d565b6020809201356001600160a01b03821692831560001461196f5750479181831061193d575050868082116118dd575b50907feaf449319c042c9ba3474fa0c5329eb58cd1f23be110cdbf9d697b8d303dac156118d4600194935b6040519081529081906020820190565b0390a201611848565b6118e69161140d565b600080808084895af16118f761146e565b50156119035786611899565b6040517f464e254d0000000000000000000000000000000000000000000000000000000081526001600160a01b0386166004820152602490fd5b604051636a67a2d160e11b81526001600160a01b03919091166004820152602481019190915260448101829052606490fd5b9590946119a9979298939460409586516370a0823160e01b815289818060049d8e309083019190916001600160a01b036020820193169052565b0381855afa998a1561065a5760009a611a4e575b505088888a106000146119fd578751636a67a2d160e11b81526001600160a01b038d16818d01908152602081018b9052604081018c905281906060010390fd5b91959a509398506118d491965060019550877feaf449319c042c9ba3474fa0c5329eb58cd1f23be110cdbf9d697b8d303dac159398611a3d575b506118c4565b611a48908986611a6d565b38611a37565b611a65929a50803d106112a357611294818361079b565b9738806119bd565b916001600160a01b03604051927fa9059cbb000000000000000000000000000000000000000000000000000000006020850152166024830152604482015260448152608081019181831067ffffffffffffffff84111761077a576104359260405261164e565b908092918237016000815290565b604090610717949281528160208201520191610a91565b611b018161070d565b90611b156020820135916040810190611332565b6001600160a01b03929192938481169485611b3257505050505050565b807f000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3168614908115611c42575b50611c1f57824710611be75760008060405180611b7d81878a611ad3565b039086855af190611b8c61146e565b9115611bd557505090611bc77f6c936258f37a22c831493e49cb45429bdf7b6bb0e261f271a15f084e5b08aaff939260405193849384611ae1565b0390a2388080808080611588565b83611be1368588611365565b916117df565b6040517f74c8cbe600000000000000000000000000000000000000000000000000000000815247600482015260248101849052604490fd5b604051631e055a2960e21b81526001600160a01b03919091166004820152602490fd5b90507f00000000000000000000000093b636d58656b2cca69c539e511c14eb3b71da2f16851438611b5f565b67ffffffffffffffff811161077a5760051b60200190565b805182101561132d5760209160051b010190565b611ca382611c6e565b916040611cb28151948561079b565b818452601f19611cc183611c6e565b019060005b828110611d1e5750505060005b818110611ce05750505090565b600190602080611cf183868861139c565b0135611cfb610beb565b30815291820152611d0c8287611c86565b52611d178186611c86565b5001611cd3565b6020908251611d2c8161077f565b6000815282600081830152828901015201611cc6565b15611d4957565b606460405162461bcd60e51b815260206004820152600e60248201527f736c6963655f6f766572666c6f770000000000000000000000000000000000006044820152fd5b15611d9457565b606460405162461bcd60e51b815260206004820152601160248201527f736c6963655f6f75744f66426f756e64730000000000000000000000000000006044820152fd5b611dec82611de5816113f2565b1015611d42565b611df98282511015611d8d565b81611e11575050604051600081526020810160405290565b60405191601f811691821560051b808486010193838501920101905b808410611e455750508252601f01601f191660405290565b9092835181526020809101930190611e2d565b91611e6681611de5816113f2565b611e7c8351611e758385611400565b1115611d8d565b80611e9557505050604051600081526020810160405290565b60405192601f821692831560051b80858701019484860193010101905b808410611eca5750508252601f01601f191660405290565b9092835181526020809101930190611eb256fea2646970667358221220d15c026976fd53c243c6efdc0dfa863262a5cf11ff35a677f18822467419481564736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3
-----Decoded View---------------
Arg [0] : _permit2 (address): 0x000000000022D473030F116dDEE9F6B43aC78BA3
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000022d473030f116ddee9f6b43ac78ba3
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$8.69
Net Worth in ETH
Token Allocations
ETH
100.00%
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| ETH | 100.00% | $2,895.36 | 0.003 | $8.69 |
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.