Overview
APE Balance
0 APE
APE Value
$0.00More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
8564458 | 18 days ago | Contract Creation | 0 APE |
Loading...
Loading
Contract Name:
LiFiDEXAggregator
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
london EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.17; import { SafeERC20, IERC20, IERC20Permit } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { WithdrawablePeriphery } from "../Helpers/WithdrawablePeriphery.sol"; import { SafeTransferLib } from "solady/utils/SafeTransferLib.sol"; address constant NATIVE_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; address constant IMPOSSIBLE_POOL_ADDRESS = 0x0000000000000000000000000000000000000001; address constant INTERNAL_INPUT_SOURCE = 0x0000000000000000000000000000000000000000; uint8 constant LOCKED = 2; uint8 constant NOT_LOCKED = 1; uint8 constant PAUSED = 2; uint8 constant NOT_PAUSED = 1; /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK) uint160 constant MIN_SQRT_RATIO = 4295128739; /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK) uint160 constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342; /// @title LiFi DEX Aggregator /// @author Ilya Lyalin (contract copied from: https://github.com/sushiswap/sushiswap/blob/c8c80dec821003eb72eb77c7e0446ddde8ca9e1e/protocols/route-processor/contracts/RouteProcessor4.sol) /// @notice Processes calldata to swap using various DEXs /// @custom:version 1.6.0 contract LiFiDEXAggregator is WithdrawablePeriphery { using SafeERC20 for IERC20; using Approve for IERC20; using SafeERC20 for IERC20Permit; using InputStream for uint256; event Route( address indexed from, address to, address indexed tokenIn, address indexed tokenOut, uint256 amountIn, uint256 amountOutMin, uint256 amountOut ); error MinimalOutputBalanceViolation(uint256 amountOut); IBentoBoxMinimal public immutable bentoBox; mapping(address => bool) public priviledgedUsers; address private lastCalledPool; uint8 private unlocked = NOT_LOCKED; uint8 private paused = NOT_PAUSED; modifier lock() { require(unlocked == NOT_LOCKED, "RouteProcessor is locked"); require(paused == NOT_PAUSED, "RouteProcessor is paused"); unlocked = LOCKED; _; unlocked = NOT_LOCKED; } modifier onlyOwnerOrPriviledgedUser() { require( msg.sender == owner || priviledgedUsers[msg.sender], "RP: caller is not the owner or a privileged user" ); _; } constructor( address _bentoBox, address[] memory priviledgedUserList, address _owner ) WithdrawablePeriphery(_owner) { bentoBox = IBentoBoxMinimal(_bentoBox); lastCalledPool = IMPOSSIBLE_POOL_ADDRESS; for (uint256 i = 0; i < priviledgedUserList.length; i++) { priviledgedUsers[priviledgedUserList[i]] = true; } } function setPriviledge(address user, bool priviledge) external onlyOwner { priviledgedUsers[user] = priviledge; } function pause() external onlyOwnerOrPriviledgedUser { paused = PAUSED; } function resume() external onlyOwnerOrPriviledgedUser { paused = NOT_PAUSED; } /// @notice For native unwrapping receive() external payable {} /// @notice Processes the route generated off-chain. Has a lock /// @param tokenIn Address of the input token /// @param amountIn Amount of the input token /// @param tokenOut Address of the output token /// @param amountOutMin Minimum amount of the output token /// @return amountOut Actual amount of the output token function processRoute( address tokenIn, uint256 amountIn, address tokenOut, uint256 amountOutMin, address to, bytes memory route ) external payable lock returns (uint256 amountOut) { return processRouteInternal( tokenIn, amountIn, tokenOut, amountOutMin, to, route ); } /// @notice Transfers some value to <transferValueTo> and then processes the route /// @param transferValueTo Address where the value should be transferred /// @param amountValueTransfer How much value to transfer /// @param tokenIn Address of the input token /// @param amountIn Amount of the input token /// @param tokenOut Address of the output token /// @param amountOutMin Minimum amount of the output token /// @return amountOut Actual amount of the output token function transferValueAndprocessRoute( address payable transferValueTo, uint256 amountValueTransfer, address tokenIn, uint256 amountIn, address tokenOut, uint256 amountOutMin, address to, bytes memory route ) external payable lock returns (uint256 amountOut) { SafeTransferLib.safeTransferETH(transferValueTo, amountValueTransfer); return processRouteInternal( tokenIn, amountIn, tokenOut, amountOutMin, to, route ); } /// @notice Processes the route generated off-chain /// @param tokenIn Address of the input token /// @param amountIn Amount of the input token /// @param tokenOut Address of the output token /// @param amountOutMin Minimum amount of the output token /// @return amountOut Actual amount of the output token function processRouteInternal( address tokenIn, uint256 amountIn, address tokenOut, uint256 amountOutMin, address to, bytes memory route ) private returns (uint256 amountOut) { uint256 balanceInInitial = tokenIn == NATIVE_ADDRESS ? 0 : IERC20(tokenIn).balanceOf(msg.sender); uint256 balanceOutInitial = tokenOut == NATIVE_ADDRESS ? address(to).balance : IERC20(tokenOut).balanceOf(to); uint256 realAmountIn = amountIn; { uint256 step = 0; uint256 stream = InputStream.createStream(route); while (stream.isNotEmpty()) { uint8 commandCode = stream.readUint8(); if (commandCode == 1) { uint256 usedAmount = processMyERC20(stream); if (step == 0) realAmountIn = usedAmount; } else if (commandCode == 2) processUserERC20(stream, amountIn); else if (commandCode == 3) { uint256 usedAmount = processNative(stream); if (step == 0) realAmountIn = usedAmount; } else if (commandCode == 4) processOnePool(stream); else if (commandCode == 5) processInsideBento(stream); else if (commandCode == 6) applyPermit(tokenIn, stream); else revert("RouteProcessor: Unknown command code"); ++step; } } uint256 balanceInFinal = tokenIn == NATIVE_ADDRESS ? 0 : IERC20(tokenIn).balanceOf(msg.sender); require( balanceInFinal + amountIn >= balanceInInitial, "RouteProcessor: Minimal input balance violation" ); uint256 balanceOutFinal = tokenOut == NATIVE_ADDRESS ? address(to).balance : IERC20(tokenOut).balanceOf(to); if (balanceOutFinal < balanceOutInitial + amountOutMin) revert MinimalOutputBalanceViolation( balanceOutFinal - balanceOutInitial ); amountOut = balanceOutFinal - balanceOutInitial; emit Route( msg.sender, to, tokenIn, tokenOut, realAmountIn, amountOutMin, amountOut ); } /// @notice Applies ERC-2612 permit /// @param tokenIn permitted token /// @param stream Streamed program function applyPermit(address tokenIn, uint256 stream) private { uint256 value = stream.readUint(); uint256 deadline = stream.readUint(); uint8 v = stream.readUint8(); bytes32 r = stream.readBytes32(); bytes32 s = stream.readBytes32(); IERC20Permit(tokenIn).safePermit( msg.sender, address(this), value, deadline, v, r, s ); } /// @notice Processes native coin: call swap for all pools that swap from native coin /// @param stream Streamed program function processNative( uint256 stream ) private returns (uint256 amountTotal) { amountTotal = address(this).balance; distributeAndSwap(stream, address(this), NATIVE_ADDRESS, amountTotal); } /// @notice Processes ERC20 token from this contract balance: /// @notice Call swap for all pools that swap from this token /// @param stream Streamed program function processMyERC20( uint256 stream ) private returns (uint256 amountTotal) { address token = stream.readAddress(); amountTotal = IERC20(token).balanceOf(address(this)); unchecked { if (amountTotal > 0) amountTotal -= 1; // slot undrain protection } distributeAndSwap(stream, address(this), token, amountTotal); } /// @notice Processes ERC20 token from msg.sender balance: /// @notice Call swap for all pools that swap from this token /// @param stream Streamed program /// @param amountTotal Amount of tokens to take from msg.sender function processUserERC20(uint256 stream, uint256 amountTotal) private { address token = stream.readAddress(); distributeAndSwap(stream, msg.sender, token, amountTotal); } /// @notice Processes ERC20 token for cases when the token has only one output pool /// @notice In this case liquidity is already at pool balance. This is an optimization /// @notice Call swap for all pools that swap from this token /// @param stream Streamed program function processOnePool(uint256 stream) private { address token = stream.readAddress(); swap(stream, INTERNAL_INPUT_SOURCE, token, 0); } /// @notice Processes Bento tokens /// @notice Call swap for all pools that swap from this token /// @param stream Streamed program function processInsideBento(uint256 stream) private { address token = stream.readAddress(); uint256 amountTotal = bentoBox.balanceOf(token, address(this)); unchecked { if (amountTotal > 0) amountTotal -= 1; // slot undrain protection } distributeAndSwap(stream, address(this), token, amountTotal); } /// @notice Distributes amountTotal to several pools according to their shares and calls swap for each pool /// @param stream Streamed program /// @param from Where to take liquidity for swap /// @param tokenIn Input token /// @param amountTotal Total amount of tokenIn for swaps function distributeAndSwap( uint256 stream, address from, address tokenIn, uint256 amountTotal ) private { uint8 num = stream.readUint8(); unchecked { for (uint256 i = 0; i < num; ++i) { uint16 share = stream.readUint16(); uint256 amount = (amountTotal * share) / type(uint16).max /*65535*/; amountTotal -= amount; swap(stream, from, tokenIn, amount); } } } /// @notice Makes swap /// @param stream Streamed program /// @param from Where to take liquidity for swap /// @param tokenIn Input token /// @param amountIn Amount of tokenIn to take for swap function swap( uint256 stream, address from, address tokenIn, uint256 amountIn ) private { uint8 poolType = stream.readUint8(); if (poolType == 0) swapUniV2(stream, from, tokenIn, amountIn); else if (poolType == 1) swapUniV3(stream, from, tokenIn, amountIn); else if (poolType == 2) wrapNative(stream, from, tokenIn, amountIn); else if (poolType == 3) bentoBridge(stream, from, tokenIn, amountIn); else if (poolType == 4) swapTrident(stream, from, tokenIn, amountIn); else if (poolType == 5) swapCurve(stream, from, tokenIn, amountIn); else revert("RouteProcessor: Unknown pool type"); } /// @notice Wraps/unwraps native token /// @param stream [direction & fake, recipient, wrapToken?] /// @param from Where to take liquidity for swap /// @param tokenIn Input token /// @param amountIn Amount of tokenIn to take for swap function wrapNative( uint256 stream, address from, address tokenIn, uint256 amountIn ) private { uint8 directionAndFake = stream.readUint8(); address to = stream.readAddress(); if (directionAndFake & 1 == 1) { // wrap native address wrapToken = stream.readAddress(); if (directionAndFake & 2 == 0) IWETH(wrapToken).deposit{ value: amountIn }(); if (to != address(this)) IERC20(wrapToken).safeTransfer(to, amountIn); } else { // unwrap native if (directionAndFake & 2 == 0) { if (from == msg.sender) IERC20(tokenIn).safeTransferFrom( msg.sender, address(this), amountIn ); IWETH(tokenIn).withdraw(amountIn); } SafeTransferLib.safeTransferETH(to, amountIn); } } /// @notice Bridge/unbridge tokens to/from Bento /// @param stream [direction, recipient] /// @param from Where to take liquidity for swap /// @param tokenIn Input token /// @param amountIn Amount of tokenIn to take for swap function bentoBridge( uint256 stream, address from, address tokenIn, uint256 amountIn ) private { uint8 direction = stream.readUint8(); address to = stream.readAddress(); if (direction > 0) { // outside to Bento // deposit to arbitrary recipient is possible only from address(bentoBox) if (from == address(this)) IERC20(tokenIn).safeTransfer(address(bentoBox), amountIn); else if (from == msg.sender) IERC20(tokenIn).safeTransferFrom( msg.sender, address(bentoBox), amountIn ); else { // tokens already are at address(bentoBox) amountIn = IERC20(tokenIn).balanceOf(address(bentoBox)) + bentoBox.strategyData(tokenIn).balance - bentoBox.totals(tokenIn).elastic; } bentoBox.deposit(tokenIn, address(bentoBox), to, amountIn, 0); } else { // Bento to outside if (from != INTERNAL_INPUT_SOURCE) { bentoBox.transfer(tokenIn, from, address(this), amountIn); } else amountIn = bentoBox.balanceOf(tokenIn, address(this)); bentoBox.withdraw(tokenIn, address(this), to, 0, amountIn); } } /// @notice UniswapV2 pool swap /// @param stream [pool, direction, recipient, fee] /// @param from Where to take liquidity for swap /// @param tokenIn Input token /// @param amountIn Amount of tokenIn to take for swap function swapUniV2( uint256 stream, address from, address tokenIn, uint256 amountIn ) private { address pool = stream.readAddress(); uint8 direction = stream.readUint8(); address to = stream.readAddress(); uint24 fee = stream.readUint24(); // pool fee in 1/1_000_000 if (from == address(this)) IERC20(tokenIn).safeTransfer(pool, amountIn); else if (from == msg.sender) IERC20(tokenIn).safeTransferFrom(msg.sender, pool, amountIn); (uint256 r0, uint256 r1, ) = IUniswapV2Pair(pool).getReserves(); require(r0 > 0 && r1 > 0, "Wrong pool reserves"); (uint256 reserveIn, uint256 reserveOut) = direction == 1 ? (r0, r1) : (r1, r0); amountIn = IERC20(tokenIn).balanceOf(pool) - reserveIn; // tokens already were transferred uint256 amountInWithFee = amountIn * (1_000_000 - fee); uint256 amountOut = (amountInWithFee * reserveOut) / (reserveIn * 1_000_000 + amountInWithFee); (uint256 amount0Out, uint256 amount1Out) = direction == 1 ? (uint256(0), amountOut) : (amountOut, uint256(0)); IUniswapV2Pair(pool).swap(amount0Out, amount1Out, to, new bytes(0)); } /// @notice Trident pool swap /// @param stream [pool, swapData] /// @param from Where to take liquidity for swap /// @param tokenIn Input token /// @param amountIn Amount of tokenIn to take for swap function swapTrident( uint256 stream, address from, address tokenIn, uint256 amountIn ) private { address pool = stream.readAddress(); bytes memory swapData = stream.readBytes(); if (from != INTERNAL_INPUT_SOURCE) { bentoBox.transfer(tokenIn, from, pool, amountIn); } IPool(pool).swap(swapData); } /// @notice UniswapV3 pool swap /// @param stream [pool, direction, recipient] /// @param from Where to take liquidity for swap /// @param tokenIn Input token /// @param amountIn Amount of tokenIn to take for swap function swapUniV3( uint256 stream, address from, address tokenIn, uint256 amountIn ) private { address pool = stream.readAddress(); bool zeroForOne = stream.readUint8() > 0; address recipient = stream.readAddress(); if (from == msg.sender) IERC20(tokenIn).safeTransferFrom( msg.sender, address(this), uint256(amountIn) ); lastCalledPool = pool; IUniswapV3Pool(pool).swap( recipient, zeroForOne, int256(amountIn), zeroForOne ? MIN_SQRT_RATIO + 1 : MAX_SQRT_RATIO - 1, abi.encode(tokenIn) ); require( lastCalledPool == IMPOSSIBLE_POOL_ADDRESS, "RouteProcessor.swapUniV3: unexpected" ); // Just to be sure } /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory. /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call function uniswapV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) public { require( msg.sender == lastCalledPool, "RouteProcessor.uniswapV3SwapCallback: call from unknown source" ); int256 amount = amount0Delta > 0 ? amount0Delta : amount1Delta; require( amount > 0, "RouteProcessor.uniswapV3SwapCallback: not positive amount" ); lastCalledPool = IMPOSSIBLE_POOL_ADDRESS; address tokenIn = abi.decode(data, (address)); IERC20(tokenIn).safeTransfer(msg.sender, uint256(amount)); } /// @notice Called to `msg.sender` after executing a swap via IAlgebraPool#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// The caller of this method _must_ be checked to be a AlgebraPool deployed by the canonical AlgebraFactory. /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the IAlgebraPoolActions#swap call function algebraSwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external { uniswapV3SwapCallback(amount0Delta, amount1Delta, data); } /// @notice Called to `msg.sender` after executing a swap via PancakeV3Pool#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the PancakeV3Pool#swap call function pancakeV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external { uniswapV3SwapCallback(amount0Delta, amount1Delta, data); } /// @notice Called to `msg.sender` after executing a swap via RaExchangeV3#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the RaExchangeV3#swap call function ramsesV2SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external { uniswapV3SwapCallback(amount0Delta, amount1Delta, data); } /// @notice Called to `msg.sender` after executing a swap via XeiV3#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the XeiV3#swap call function xeiV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external { uniswapV3SwapCallback(amount0Delta, amount1Delta, data); } /// @notice Called to `msg.sender` after executing a swap via DragonSwapV2#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the DragonSwapV2#swap call function dragonswapV2SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external { uniswapV3SwapCallback(amount0Delta, amount1Delta, data); } /// @notice Called to `msg.sender` after executing a swap via AgniV3#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the AgniV3#swap call function agniSwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external { uniswapV3SwapCallback(amount0Delta, amount1Delta, data); } /// @notice Called to `msg.sender` after executing a swap via FusionXV3#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the FusionXV3#swap call function fusionXV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external { uniswapV3SwapCallback(amount0Delta, amount1Delta, data); } /// @notice Called to `msg.sender` after executing a swap via VVS FinanceV3#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the VVS Finance V3#swap call function vvsV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external { uniswapV3SwapCallback(amount0Delta, amount1Delta, data); } /// @notice Called to `msg.sender` after executing a swap via SupSwapV3#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the SupSwapV3#swap call function supV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external { uniswapV3SwapCallback(amount0Delta, amount1Delta, data); } /// @notice Called to `msg.sender` after executing a swap via ZebraV3#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the ZebraV3#swap call function zebraV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external { uniswapV3SwapCallback(amount0Delta, amount1Delta, data); } /// @notice Curve pool swap. Legacy pools that don't return amountOut and have native coins are not supported /// @param stream [pool, poolType, fromIndex, toIndex, recipient, output token] /// @param from Where to take liquidity for swap /// @param tokenIn Input token /// @param amountIn Amount of tokenIn to take for swap function swapCurve( uint256 stream, address from, address tokenIn, uint256 amountIn ) private { address pool = stream.readAddress(); uint8 poolType = stream.readUint8(); int128 fromIndex = int8(stream.readUint8()); int128 toIndex = int8(stream.readUint8()); address to = stream.readAddress(); address tokenOut = stream.readAddress(); uint256 amountOut; if (tokenIn == NATIVE_ADDRESS) { amountOut = ICurve(pool).exchange{ value: amountIn }( fromIndex, toIndex, amountIn, 0 ); } else { if (from == msg.sender) IERC20(tokenIn).safeTransferFrom( msg.sender, address(this), amountIn ); IERC20(tokenIn).approveSafe(pool, amountIn); if (poolType == 0) amountOut = ICurve(pool).exchange( fromIndex, toIndex, amountIn, 0 ); else { uint256 balanceBefore = IERC20(tokenOut).balanceOf( address(this) ); ICurveLegacy(pool).exchange(fromIndex, toIndex, amountIn, 0); uint256 balanceAfter = IERC20(tokenOut).balanceOf( address(this) ); amountOut = balanceAfter - balanceBefore; } } if (to != address(this)) { if (tokenOut == NATIVE_ADDRESS) { SafeTransferLib.safeTransferETH(to, amountOut); } else { IERC20(tokenOut).safeTransfer(to, amountOut); } } } } /// @notice Minimal BentoBox vault interface. /// @dev `token` is aliased as `address` from `IERC20` for simplicity. interface IBentoBoxMinimal { /// @notice Balance per ERC-20 token per account in shares. function balanceOf(address, address) external view returns (uint256); /// @dev Helper function to represent an `amount` of `token` in shares. /// @param token The ERC-20 token. /// @param amount The `token` amount. /// @param roundUp If the result `share` should be rounded up. /// @return share The token amount represented in shares. function toShare( address token, uint256 amount, bool roundUp ) external view returns (uint256 share); /// @dev Helper function to represent shares back into the `token` amount. /// @param token The ERC-20 token. /// @param share The amount of shares. /// @param roundUp If the result should be rounded up. /// @return amount The share amount back into native representation. function toAmount( address token, uint256 share, bool roundUp ) external view returns (uint256 amount); /// @notice Registers this contract so that users can approve it for BentoBox. function registerProtocol() external; /// @notice Deposit an amount of `token` represented in either `amount` or `share`. /// @param token The ERC-20 token to deposit. /// @param from which account to pull the tokens. /// @param to which account to push the tokens. /// @param amount Token amount in native representation to deposit. /// @param share Token amount represented in shares to deposit. Takes precedence over `amount`. /// @return amountOut The amount deposited. /// @return shareOut The deposited amount represented in shares. function deposit( address token, address from, address to, uint256 amount, uint256 share ) external payable returns (uint256 amountOut, uint256 shareOut); /// @notice Withdraws an amount of `token` from a user account. /// @param token_ The ERC-20 token to withdraw. /// @param from which user to pull the tokens. /// @param to which user to push the tokens. /// @param amount of tokens. Either one of `amount` or `share` needs to be supplied. /// @param share Like above, but `share` takes precedence over `amount`. function withdraw( address token_, address from, address to, uint256 amount, uint256 share ) external returns (uint256 amountOut, uint256 shareOut); /// @notice Transfer shares from a user account to another one. /// @param token The ERC-20 token to transfer. /// @param from which user to pull the tokens. /// @param to which user to push the tokens. /// @param share The amount of `token` in shares. function transfer( address token, address from, address to, uint256 share ) external; /// @dev Reads the Rebase `totals`from storage for a given token function totals(address token) external view returns (Rebase memory total); function strategyData( address token ) external view returns (StrategyData memory total); /// @dev Approves users' BentoBox assets to a "master" contract. function setMasterContractApproval( address user, address masterContract, bool approved, uint8 v, bytes32 r, bytes32 s ) external; function harvest( address token, bool balance, uint256 maxChangeAmount ) external; } interface ICurve { function exchange( int128 i, int128 j, uint256 dx, uint256 min_dy ) external payable returns (uint256); } interface ICurveLegacy { function exchange( int128 i, int128 j, uint256 dx, uint256 min_dy ) external payable; } /// @notice Trident pool interface. interface IPool { /// @notice Executes a swap from one token to another. /// @dev The input tokens must've already been sent to the pool. /// @param data ABI-encoded params that the pool requires. /// @return finalAmountOut The amount of output tokens that were sent to the user. function swap( bytes calldata data ) external returns (uint256 finalAmountOut); /// @notice Executes a swap from one token to another with a callback. /// @dev This function allows borrowing the output tokens and sending the input tokens in the callback. /// @param data ABI-encoded params that the pool requires. /// @return finalAmountOut The amount of output tokens that were sent to the user. function flashSwap( bytes calldata data ) external returns (uint256 finalAmountOut); /// @notice Mints liquidity tokens. /// @param data ABI-encoded params that the pool requires. /// @return liquidity The amount of liquidity tokens that were minted for the user. function mint(bytes calldata data) external returns (uint256 liquidity); /// @notice Burns liquidity tokens. /// @dev The input LP tokens must've already been sent to the pool. /// @param data ABI-encoded params that the pool requires. /// @return withdrawnAmounts The amount of various output tokens that were sent to the user. function burn( bytes calldata data ) external returns (TokenAmount[] memory withdrawnAmounts); /// @notice Burns liquidity tokens for a single output token. /// @dev The input LP tokens must've already been sent to the pool. /// @param data ABI-encoded params that the pool requires. /// @return amountOut The amount of output tokens that were sent to the user. function burnSingle( bytes calldata data ) external returns (uint256 amountOut); /// @return A unique identifier for the pool type. function poolIdentifier() external pure returns (bytes32); /// @return An array of tokens supported by the pool. function getAssets() external view returns (address[] memory); /// @notice Simulates a trade and returns the expected output. /// @dev The pool does not need to include a trade simulator directly in itself - it can use a library. /// @param data ABI-encoded params that the pool requires. /// @return finalAmountOut The amount of output tokens that will be sent to the user if the trade is executed. function getAmountOut( bytes calldata data ) external view returns (uint256 finalAmountOut); /// @notice Simulates a trade and returns the expected output. /// @dev The pool does not need to include a trade simulator directly in itself - it can use a library. /// @param data ABI-encoded params that the pool requires. /// @return finalAmountIn The amount of input tokens that are required from the user if the trade is executed. function getAmountIn( bytes calldata data ) external view returns (uint256 finalAmountIn); /// @dev This event must be emitted on all swaps. event Swap( address indexed recipient, address indexed tokenIn, address indexed tokenOut, uint256 amountIn, uint256 amountOut ); /// @dev This struct frames output tokens for burns. struct TokenAmount { address token; uint256 amount; } } interface ITridentCLPool { function token0() external returns (address); function token1() external returns (address); function swap( address recipient, bool zeroForOne, int256 amountSpecified, uint160 sqrtPriceLimitX96, bool unwrapBento, bytes calldata data ) external returns (int256 amount0, int256 amount1); } interface IUniswapV2Pair { event Approval(address indexed owner, address indexed spender, uint value); event Transfer(address indexed from, address indexed to, uint value); function name() external pure returns (string memory); function symbol() external pure returns (string memory); function decimals() external pure returns (uint8); function totalSupply() external view returns (uint); function balanceOf(address owner) external view returns (uint); function allowance( address owner, address spender ) external view returns (uint); function approve(address spender, uint value) external returns (bool); function transfer(address to, uint value) external returns (bool); function transferFrom( address from, address to, uint value ) external returns (bool); function DOMAIN_SEPARATOR() external view returns (bytes32); function PERMIT_TYPEHASH() external pure returns (bytes32); function nonces(address owner) external view returns (uint); function permit( address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s ) external; event Mint(address indexed sender, uint amount0, uint amount1); event Burn( address indexed sender, uint amount0, uint amount1, address indexed to ); event Swap( address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to ); event Sync(uint112 reserve0, uint112 reserve1); function MINIMUM_LIQUIDITY() external pure returns (uint); function factory() external view returns (address); function token0() external view returns (address); function token1() external view returns (address); function getReserves() external view returns ( uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast ); function price0CumulativeLast() external view returns (uint); function price1CumulativeLast() external view returns (uint); function kLast() external view returns (uint); function mint(address to) external returns (uint liquidity); function burn(address to) external returns (uint amount0, uint amount1); function swap( uint amount0Out, uint amount1Out, address to, bytes calldata data ) external; function skim(address to) external; function sync() external; function initialize(address, address) external; } interface IUniswapV3Pool { function token0() external returns (address); function token1() external returns (address); function swap( address recipient, bool zeroForOne, int256 amountSpecified, uint160 sqrtPriceLimitX96, bytes calldata data ) external returns (int256 amount0, int256 amount1); } interface IWETH { function deposit() external payable; function transfer(address to, uint256 value) external returns (bool); function withdraw(uint256) external; } /** @notice Simple read stream */ library InputStream { /** @notice Creates stream from data * @param data data */ function createStream( bytes memory data ) internal pure returns (uint256 stream) { assembly { stream := mload(0x40) mstore(0x40, add(stream, 64)) mstore(stream, data) let length := mload(data) mstore(add(stream, 32), add(data, length)) } } /** @notice Checks if stream is not empty * @param stream stream */ function isNotEmpty(uint256 stream) internal pure returns (bool) { uint256 pos; uint256 finish; assembly { pos := mload(stream) finish := mload(add(stream, 32)) } return pos < finish; } /** @notice Reads uint8 from the stream * @param stream stream */ function readUint8(uint256 stream) internal pure returns (uint8 res) { assembly { let pos := mload(stream) pos := add(pos, 1) res := mload(pos) mstore(stream, pos) } } /** @notice Reads uint16 from the stream * @param stream stream */ function readUint16(uint256 stream) internal pure returns (uint16 res) { assembly { let pos := mload(stream) pos := add(pos, 2) res := mload(pos) mstore(stream, pos) } } /** @notice Reads uint24 from the stream * @param stream stream */ function readUint24(uint256 stream) internal pure returns (uint24 res) { assembly { let pos := mload(stream) pos := add(pos, 3) res := mload(pos) mstore(stream, pos) } } /** @notice Reads uint32 from the stream * @param stream stream */ function readUint32(uint256 stream) internal pure returns (uint32 res) { assembly { let pos := mload(stream) pos := add(pos, 4) res := mload(pos) mstore(stream, pos) } } /** @notice Reads uint256 from the stream * @param stream stream */ function readUint(uint256 stream) internal pure returns (uint256 res) { assembly { let pos := mload(stream) pos := add(pos, 32) res := mload(pos) mstore(stream, pos) } } /** @notice Reads bytes32 from the stream * @param stream stream */ function readBytes32(uint256 stream) internal pure returns (bytes32 res) { assembly { let pos := mload(stream) pos := add(pos, 32) res := mload(pos) mstore(stream, pos) } } /** @notice Reads address from the stream * @param stream stream */ function readAddress(uint256 stream) internal pure returns (address res) { assembly { let pos := mload(stream) pos := add(pos, 20) res := mload(pos) mstore(stream, pos) } } /** @notice Reads bytes from the stream * @param stream stream */ function readBytes( uint256 stream ) internal pure returns (bytes memory res) { assembly { let pos := mload(stream) res := add(pos, 32) let length := mload(res) mstore(stream, add(res, length)) } } } library Approve { /** * @dev ERC20 approve that correct works with token.approve which returns bool or nothing (USDT for example) * @param token The token targeted by the call. * @param spender token spender * @param amount token amount */ function approveStable( IERC20 token, address spender, uint256 amount ) internal returns (bool) { (bool success, bytes memory data) = address(token).call( abi.encodeWithSelector(token.approve.selector, spender, amount) ); return success && (data.length == 0 || abi.decode(data, (bool))); } /** * @dev ERC20 approve that correct works with token.approve which reverts if amount and * current allowance are not zero simultaniously (USDT for example). * In second case it tries to set allowance to 0, and then back to amount. * @param token The token targeted by the call. * @param spender token spender * @param amount token amount */ function approveSafe( IERC20 token, address spender, uint256 amount ) internal returns (bool) { return approveStable(token, spender, amount) || (approveStable(token, spender, 0) && approveStable(token, spender, amount)); } } struct Rebase { uint128 elastic; uint128 base; } struct StrategyData { uint64 strategyStartDate; uint64 targetPercentage; uint128 balance; // the balance of the strategy that BentoBox thinks is in there } /// @notice A rebasing library library RebaseLibrary { /// @notice Calculates the base value in relationship to `elastic` and `total`. function toBase( Rebase memory total, uint256 elastic ) internal pure returns (uint256 base) { if (total.elastic == 0) { base = elastic; } else { base = (elastic * total.base) / total.elastic; } } /// @notice Calculates the elastic value in relationship to `base` and `total`. function toElastic( Rebase memory total, uint256 base ) internal pure returns (uint256 elastic) { if (total.base == 0) { elastic = base; } else { elastic = (base * total.elastic) / total.base; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (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. Compatible with tokens that require the approval to be set to * 0 before setting it to a non-zero value. */ 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 /// @custom:version 1.0.0 pragma solidity ^0.8.17; import { TransferrableOwnership } from "./TransferrableOwnership.sol"; import { LibAsset } from "../Libraries/LibAsset.sol"; import { ExternalCallFailed } from "../Errors/GenericErrors.sol"; import { SafeTransferLib } from "solady/utils/SafeTransferLib.sol"; abstract contract WithdrawablePeriphery is TransferrableOwnership { using SafeTransferLib for address; event TokensWithdrawn( address assetId, address payable receiver, uint256 amount ); constructor(address _owner) TransferrableOwnership(_owner) {} function withdrawToken( address assetId, address payable receiver, uint256 amount ) external onlyOwner { if (LibAsset.isNativeAsset(assetId)) { // solhint-disable-next-line avoid-low-level-calls (bool success, ) = receiver.call{ value: amount }(""); if (!success) revert ExternalCallFailed(); } else { assetId.safeTransfer(receiver, amount); } emit TokensWithdrawn(assetId, receiver, amount); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; /// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/utils/SafeTransferLib.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol) /// @author Permit2 operations from (https://github.com/Uniswap/permit2/blob/main/src/libraries/Permit2Lib.sol) /// /// @dev Note: /// - For ETH transfers, please use `forceSafeTransferETH` for DoS protection. /// - For ERC20s, this implementation won't check that a token has code, /// responsibility is delegated to the caller. library SafeTransferLib { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ETH transfer has failed. error ETHTransferFailed(); /// @dev The ERC20 `transferFrom` has failed. error TransferFromFailed(); /// @dev The ERC20 `transfer` has failed. error TransferFailed(); /// @dev The ERC20 `approve` has failed. error ApproveFailed(); /// @dev The Permit2 operation has failed. error Permit2Failed(); /// @dev The Permit2 amount must be less than `2**160 - 1`. error Permit2AmountOverflow(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Suggested gas stipend for contract receiving ETH that disallows any storage writes. uint256 internal constant GAS_STIPEND_NO_STORAGE_WRITES = 2300; /// @dev Suggested gas stipend for contract receiving ETH to perform a few /// storage reads and writes, but low enough to prevent griefing. uint256 internal constant GAS_STIPEND_NO_GRIEF = 100000; /// @dev The unique EIP-712 domain domain separator for the DAI token contract. bytes32 internal constant DAI_DOMAIN_SEPARATOR = 0xdbb8cf42e1ecb028be3f3dbc922e1d878b963f411dc388ced501601c60f7c6f7; /// @dev The address for the WETH9 contract on Ethereum mainnet. address internal constant WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; /// @dev The canonical Permit2 address. /// [Github](https://github.com/Uniswap/permit2) /// [Etherscan](https://etherscan.io/address/0x000000000022D473030F116dDEE9F6B43aC78BA3) address internal constant PERMIT2 = 0x000000000022D473030F116dDEE9F6B43aC78BA3; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ETH OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // If the ETH transfer MUST succeed with a reasonable gas budget, use the force variants. // // The regular variants: // - Forwards all remaining gas to the target. // - Reverts if the target reverts. // - Reverts if the current contract has insufficient balance. // // The force variants: // - Forwards with an optional gas stipend // (defaults to `GAS_STIPEND_NO_GRIEF`, which is sufficient for most cases). // - If the target reverts, or if the gas stipend is exhausted, // creates a temporary contract to force send the ETH via `SELFDESTRUCT`. // Future compatible with `SENDALL`: https://eips.ethereum.org/EIPS/eip-4758. // - Reverts if the current contract has insufficient balance. // // The try variants: // - Forwards with a mandatory gas stipend. // - Instead of reverting, returns whether the transfer succeeded. /// @dev Sends `amount` (in wei) ETH to `to`. function safeTransferETH(address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { if iszero(call(gas(), to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } } } /// @dev Sends all the ETH in the current contract to `to`. function safeTransferAllETH(address to) internal { /// @solidity memory-safe-assembly assembly { // Transfer all the ETH and check if it succeeded or not. if iszero(call(gas(), to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } } } /// @dev Force sends `amount` (in wei) ETH to `to`, with a `gasStipend`. function forceSafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal { /// @solidity memory-safe-assembly assembly { if lt(selfbalance(), amount) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } if iszero(call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends all the ETH in the current contract to `to`, with a `gasStipend`. function forceSafeTransferAllETH(address to, uint256 gasStipend) internal { /// @solidity memory-safe-assembly assembly { if iszero(call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends `amount` (in wei) ETH to `to`, with `GAS_STIPEND_NO_GRIEF`. function forceSafeTransferETH(address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { if lt(selfbalance(), amount) { mstore(0x00, 0xb12d13eb) // `ETHTransferFailed()`. revert(0x1c, 0x04) } if iszero(call(GAS_STIPEND_NO_GRIEF, to, amount, codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(amount, 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Force sends all the ETH in the current contract to `to`, with `GAS_STIPEND_NO_GRIEF`. function forceSafeTransferAllETH(address to) internal { /// @solidity memory-safe-assembly assembly { // forgefmt: disable-next-item if iszero(call(GAS_STIPEND_NO_GRIEF, to, selfbalance(), codesize(), 0x00, codesize(), 0x00)) { mstore(0x00, to) // Store the address in scratch space. mstore8(0x0b, 0x73) // Opcode `PUSH20`. mstore8(0x20, 0xff) // Opcode `SELFDESTRUCT`. if iszero(create(selfbalance(), 0x0b, 0x16)) { revert(codesize(), codesize()) } // For gas estimation. } } } /// @dev Sends `amount` (in wei) ETH to `to`, with a `gasStipend`. function trySafeTransferETH(address to, uint256 amount, uint256 gasStipend) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { success := call(gasStipend, to, amount, codesize(), 0x00, codesize(), 0x00) } } /// @dev Sends all the ETH in the current contract to `to`, with a `gasStipend`. function trySafeTransferAllETH(address to, uint256 gasStipend) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { success := call(gasStipend, to, selfbalance(), codesize(), 0x00, codesize(), 0x00) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC20 OPERATIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// Reverts upon failure. /// /// The `from` account must have at least `amount` approved for /// the current contract to manage. function safeTransferFrom(address token, address from, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x60, amount) // Store the `amount` argument. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// /// The `from` account must have at least `amount` approved for the current contract to manage. function trySafeTransferFrom(address token, address from, address to, uint256 amount) internal returns (bool success) { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x60, amount) // Store the `amount` argument. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x23b872dd000000000000000000000000) // `transferFrom(address,address,uint256)`. success := and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends all of ERC20 `token` from `from` to `to`. /// Reverts upon failure. /// /// The `from` account must have their entire balance approved for the current contract to manage. function safeTransferAllFrom(address token, address from, address to) internal returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) // Cache the free memory pointer. mstore(0x40, to) // Store the `to` argument. mstore(0x2c, shl(96, from)) // Store the `from` argument. mstore(0x0c, 0x70a08231000000000000000000000000) // `balanceOf(address)`. // Read the balance, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x1c, 0x24, 0x60, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x00, 0x23b872dd) // `transferFrom(address,address,uint256)`. amount := mload(0x60) // The `amount` is already at 0x60. We'll need to return it. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x1c, 0x64, 0x00, 0x20) ) ) { mstore(0x00, 0x7939f424) // `TransferFromFailed()`. revert(0x1c, 0x04) } mstore(0x60, 0) // Restore the zero slot to zero. mstore(0x40, m) // Restore the free memory pointer. } } /// @dev Sends `amount` of ERC20 `token` from the current contract to `to`. /// Reverts upon failure. function safeTransfer(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sends all of ERC20 `token` from the current contract to `to`. /// Reverts upon failure. function safeTransferAll(address token, address to) internal returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { mstore(0x00, 0x70a08231) // Store the function selector of `balanceOf(address)`. mstore(0x20, address()) // Store the address of the current contract. // Read the balance, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x1c, 0x24, 0x34, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x14, to) // Store the `to` argument. amount := mload(0x34) // The `amount` is already at 0x34. We'll need to return it. mstore(0x00, 0xa9059cbb000000000000000000000000) // `transfer(address,uint256)`. // Perform the transfer, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x90b8ec18) // `TransferFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. /// Reverts upon failure. function safeApprove(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. // Perform the approval, reverting upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. revert(0x1c, 0x04) } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Sets `amount` of ERC20 `token` for `to` to manage on behalf of the current contract. /// If the initial attempt to approve fails, attempts to reset the approved amount to zero, /// then retries the approval again (some tokens, e.g. USDT, requires this). /// Reverts upon failure. function safeApproveWithRetry(address token, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { mstore(0x14, to) // Store the `to` argument. mstore(0x34, amount) // Store the `amount` argument. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. // Perform the approval, retrying upon failure. if iszero( and( // The arguments of `and` are evaluated from right to left. or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x34, 0) // Store 0 for the `amount`. mstore(0x00, 0x095ea7b3000000000000000000000000) // `approve(address,uint256)`. pop(call(gas(), token, 0, 0x10, 0x44, codesize(), 0x00)) // Reset the approval. mstore(0x34, amount) // Store back the original `amount`. // Retry the approval, reverting upon failure. if iszero( and( or(eq(mload(0x00), 1), iszero(returndatasize())), // Returned 1 or nothing. call(gas(), token, 0, 0x10, 0x44, 0x00, 0x20) ) ) { mstore(0x00, 0x3e3f8f73) // `ApproveFailed()`. revert(0x1c, 0x04) } } mstore(0x34, 0) // Restore the part of the free memory pointer that was overwritten. } } /// @dev Returns the amount of ERC20 `token` owned by `account`. /// Returns zero if the `token` does not exist. function balanceOf(address token, address account) internal view returns (uint256 amount) { /// @solidity memory-safe-assembly assembly { mstore(0x14, account) // Store the `account` argument. mstore(0x00, 0x70a08231000000000000000000000000) // `balanceOf(address)`. amount := mul( // The arguments of `mul` are evaluated from right to left. mload(0x20), and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x1f), // At least 32 bytes returned. staticcall(gas(), token, 0x10, 0x24, 0x20, 0x20) ) ) } } /// @dev Sends `amount` of ERC20 `token` from `from` to `to`. /// If the initial attempt fails, try to use Permit2 to transfer the token. /// Reverts upon failure. /// /// The `from` account must have at least `amount` approved for the current contract to manage. function safeTransferFrom2(address token, address from, address to, uint256 amount) internal { if (!trySafeTransferFrom(token, from, to, amount)) { permit2TransferFrom(token, from, to, amount); } } /// @dev Sends `amount` of ERC20 `token` from `from` to `to` via Permit2. /// Reverts upon failure. function permit2TransferFrom(address token, address from, address to, uint256 amount) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) mstore(add(m, 0x74), shr(96, shl(96, token))) mstore(add(m, 0x54), amount) mstore(add(m, 0x34), to) mstore(add(m, 0x20), shl(96, from)) // `transferFrom(address,address,uint160,address)`. mstore(m, 0x36c78516000000000000000000000000) let p := PERMIT2 let exists := eq(chainid(), 1) if iszero(exists) { exists := iszero(iszero(extcodesize(p))) } if iszero(and(call(gas(), p, 0, add(m, 0x10), 0x84, codesize(), 0x00), exists)) { mstore(0x00, 0x7939f4248757f0fd) // `TransferFromFailed()` or `Permit2AmountOverflow()`. revert(add(0x18, shl(2, iszero(iszero(shr(160, amount))))), 0x04) } } } /// @dev Permit a user to spend a given amount of /// another user's tokens via native EIP-2612 permit if possible, falling /// back to Permit2 if native permit fails or is not implemented on the token. function permit2( address token, address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { bool success; /// @solidity memory-safe-assembly assembly { for {} shl(96, xor(token, WETH9)) {} { mstore(0x00, 0x3644e515) // `DOMAIN_SEPARATOR()`. if iszero( and( // The arguments of `and` are evaluated from right to left. lt(iszero(mload(0x00)), eq(returndatasize(), 0x20)), // Returns 1 non-zero word. // Gas stipend to limit gas burn for tokens that don't refund gas when // an non-existing function is called. 5K should be enough for a SLOAD. staticcall(5000, token, 0x1c, 0x04, 0x00, 0x20) ) ) { break } // After here, we can be sure that token is a contract. let m := mload(0x40) mstore(add(m, 0x34), spender) mstore(add(m, 0x20), shl(96, owner)) mstore(add(m, 0x74), deadline) if eq(mload(0x00), DAI_DOMAIN_SEPARATOR) { mstore(0x14, owner) mstore(0x00, 0x7ecebe00000000000000000000000000) // `nonces(address)`. mstore(add(m, 0x94), staticcall(gas(), token, 0x10, 0x24, add(m, 0x54), 0x20)) mstore(m, 0x8fcbaf0c000000000000000000000000) // `IDAIPermit.permit`. // `nonces` is already at `add(m, 0x54)`. // `1` is already stored at `add(m, 0x94)`. mstore(add(m, 0xb4), and(0xff, v)) mstore(add(m, 0xd4), r) mstore(add(m, 0xf4), s) success := call(gas(), token, 0, add(m, 0x10), 0x104, codesize(), 0x00) break } mstore(m, 0xd505accf000000000000000000000000) // `IERC20Permit.permit`. mstore(add(m, 0x54), amount) mstore(add(m, 0x94), and(0xff, v)) mstore(add(m, 0xb4), r) mstore(add(m, 0xd4), s) success := call(gas(), token, 0, add(m, 0x10), 0xe4, codesize(), 0x00) break } } if (!success) simplePermit2(token, owner, spender, amount, deadline, v, r, s); } /// @dev Simple permit on the Permit2 contract. function simplePermit2( address token, address owner, address spender, uint256 amount, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { /// @solidity memory-safe-assembly assembly { let m := mload(0x40) mstore(m, 0x927da105) // `allowance(address,address,address)`. { let addressMask := shr(96, not(0)) mstore(add(m, 0x20), and(addressMask, owner)) mstore(add(m, 0x40), and(addressMask, token)) mstore(add(m, 0x60), and(addressMask, spender)) mstore(add(m, 0xc0), and(addressMask, spender)) } let p := mul(PERMIT2, iszero(shr(160, amount))) if iszero( and( // The arguments of `and` are evaluated from right to left. gt(returndatasize(), 0x5f), // Returns 3 words: `amount`, `expiration`, `nonce`. staticcall(gas(), p, add(m, 0x1c), 0x64, add(m, 0x60), 0x60) ) ) { mstore(0x00, 0x6b836e6b8757f0fd) // `Permit2Failed()` or `Permit2AmountOverflow()`. revert(add(0x18, shl(2, iszero(p))), 0x04) } mstore(m, 0x2b67b570) // `Permit2.permit` (PermitSingle variant). // `owner` is already `add(m, 0x20)`. // `token` is already at `add(m, 0x40)`. mstore(add(m, 0x60), amount) mstore(add(m, 0x80), 0xffffffffffff) // `expiration = type(uint48).max`. // `nonce` is already at `add(m, 0xa0)`. // `spender` is already at `add(m, 0xc0)`. mstore(add(m, 0xe0), deadline) mstore(add(m, 0x100), 0x100) // `signature` offset. mstore(add(m, 0x120), 0x41) // `signature` length. mstore(add(m, 0x140), r) mstore(add(m, 0x160), s) mstore(add(m, 0x180), shl(248, v)) if iszero(call(gas(), p, 0, add(m, 0x1c), 0x184, codesize(), 0x00)) { mstore(0x00, 0x6b836e6b) // `Permit2Failed()`. revert(0x1c, 0x04) } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.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 /// @custom:version 1.0.0 pragma solidity ^0.8.17; import { IERC173 } from "../Interfaces/IERC173.sol"; import { LibAsset } from "../Libraries/LibAsset.sol"; contract TransferrableOwnership is IERC173 { address public owner; address public pendingOwner; /// Errors /// error UnAuthorized(); error NoNullOwner(); error NewOwnerMustNotBeSelf(); error NoPendingOwnershipTransfer(); error NotPendingOwner(); /// Events /// event OwnershipTransferRequested( address indexed _from, address indexed _to ); constructor(address initialOwner) { owner = initialOwner; } modifier onlyOwner() { if (msg.sender != owner) revert UnAuthorized(); _; } /// @notice Initiates transfer of ownership to a new address /// @param _newOwner the address to transfer ownership to function transferOwnership(address _newOwner) external onlyOwner { if (_newOwner == LibAsset.NULL_ADDRESS) revert NoNullOwner(); if (_newOwner == msg.sender) revert NewOwnerMustNotBeSelf(); pendingOwner = _newOwner; emit OwnershipTransferRequested(msg.sender, pendingOwner); } /// @notice Cancel transfer of ownership function cancelOwnershipTransfer() external onlyOwner { if (pendingOwner == LibAsset.NULL_ADDRESS) revert NoPendingOwnershipTransfer(); pendingOwner = LibAsset.NULL_ADDRESS; } /// @notice Confirms transfer of ownership to the calling address (msg.sender) function confirmOwnershipTransfer() external { address _pendingOwner = pendingOwner; if (msg.sender != _pendingOwner) revert NotPendingOwner(); emit OwnershipTransferred(owner, _pendingOwner); owner = _pendingOwner; pendingOwner = LibAsset.NULL_ADDRESS; } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.17; import { InsufficientBalance, NullAddrIsNotAnERC20Token, NullAddrIsNotAValidSpender, NoTransferToNullAddress, InvalidAmount, NativeAssetTransferFailed } from "../Errors/GenericErrors.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { LibSwap } from "./LibSwap.sol"; /// @title LibAsset /// @custom:version 1.0.2 /// @notice This library contains helpers for dealing with onchain transfers /// of assets, including accounting for the native asset `assetId` /// conventions and any noncompliant ERC20 transfers library LibAsset { uint256 private constant MAX_UINT = type(uint256).max; address internal constant NULL_ADDRESS = address(0); address internal constant NON_EVM_ADDRESS = 0x11f111f111f111F111f111f111F111f111f111F1; /// @dev All native assets use the empty address for their asset id /// by convention address internal constant NATIVE_ASSETID = NULL_ADDRESS; //address(0) /// @notice Gets the balance of the inheriting contract for the given asset /// @param assetId The asset identifier to get the balance of /// @return Balance held by contracts using this library function getOwnBalance(address assetId) internal view returns (uint256) { return isNativeAsset(assetId) ? address(this).balance : IERC20(assetId).balanceOf(address(this)); } /// @notice Transfers ether from the inheriting contract to a given /// recipient /// @param recipient Address to send ether to /// @param amount Amount to send to given recipient function transferNativeAsset( address payable recipient, uint256 amount ) private { if (recipient == NULL_ADDRESS) revert NoTransferToNullAddress(); if (amount > address(this).balance) revert InsufficientBalance(amount, address(this).balance); // solhint-disable-next-line avoid-low-level-calls (bool success, ) = recipient.call{ value: amount }(""); if (!success) revert NativeAssetTransferFailed(); } /// @notice If the current allowance is insufficient, the allowance for a given spender /// is set to MAX_UINT. /// @param assetId Token address to transfer /// @param spender Address to give spend approval to /// @param amount Amount to approve for spending function maxApproveERC20( IERC20 assetId, address spender, uint256 amount ) internal { if (isNativeAsset(address(assetId))) { return; } if (spender == NULL_ADDRESS) { revert NullAddrIsNotAValidSpender(); } if (assetId.allowance(address(this), spender) < amount) { SafeERC20.forceApprove(IERC20(assetId), spender, MAX_UINT); } } /// @notice Transfers tokens from the inheriting contract to a given /// recipient /// @param assetId Token address to transfer /// @param recipient Address to send token to /// @param amount Amount to send to given recipient function transferERC20( address assetId, address recipient, uint256 amount ) private { if (isNativeAsset(assetId)) { revert NullAddrIsNotAnERC20Token(); } if (recipient == NULL_ADDRESS) { revert NoTransferToNullAddress(); } uint256 assetBalance = IERC20(assetId).balanceOf(address(this)); if (amount > assetBalance) { revert InsufficientBalance(amount, assetBalance); } SafeERC20.safeTransfer(IERC20(assetId), recipient, amount); } /// @notice Transfers tokens from a sender to a given recipient /// @param assetId Token address to transfer /// @param from Address of sender/owner /// @param to Address of recipient/spender /// @param amount Amount to transfer from owner to spender function transferFromERC20( address assetId, address from, address to, uint256 amount ) internal { if (isNativeAsset(assetId)) { revert NullAddrIsNotAnERC20Token(); } if (to == NULL_ADDRESS) { revert NoTransferToNullAddress(); } IERC20 asset = IERC20(assetId); uint256 prevBalance = asset.balanceOf(to); SafeERC20.safeTransferFrom(asset, from, to, amount); if (asset.balanceOf(to) - prevBalance != amount) { revert InvalidAmount(); } } function depositAsset(address assetId, uint256 amount) internal { if (amount == 0) revert InvalidAmount(); if (isNativeAsset(assetId)) { if (msg.value < amount) revert InvalidAmount(); } else { uint256 balance = IERC20(assetId).balanceOf(msg.sender); if (balance < amount) revert InsufficientBalance(amount, balance); transferFromERC20(assetId, msg.sender, address(this), amount); } } function depositAssets(LibSwap.SwapData[] calldata swaps) internal { for (uint256 i = 0; i < swaps.length; ) { LibSwap.SwapData calldata swap = swaps[i]; if (swap.requiresDeposit) { depositAsset(swap.sendingAssetId, swap.fromAmount); } unchecked { i++; } } } /// @notice Determines whether the given assetId is the native asset /// @param assetId The asset identifier to evaluate /// @return Boolean indicating if the asset is the native asset function isNativeAsset(address assetId) internal pure returns (bool) { return assetId == NATIVE_ASSETID; } /// @notice Wrapper function to transfer a given asset (native or erc20) to /// some recipient. Should handle all non-compliant return value /// tokens as well by using the SafeERC20 contract by open zeppelin. /// @param assetId Asset id for transfer (address(0) for native asset, /// token address for erc20s) /// @param recipient Address to send asset to /// @param amount Amount to send to given recipient function transferAsset( address assetId, address payable recipient, uint256 amount ) internal { isNativeAsset(assetId) ? transferNativeAsset(recipient, amount) : transferERC20(assetId, recipient, amount); } /// @dev Checks whether the given address is a contract and contains code function isContract(address _contractAddr) internal view returns (bool) { uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(_contractAddr) } return size > 0; } }
// SPDX-License-Identifier: MIT /// @custom:version 1.0.0 pragma solidity ^0.8.17; error AlreadyInitialized(); error CannotAuthoriseSelf(); error CannotBridgeToSameNetwork(); error ContractCallNotAllowed(); error CumulativeSlippageTooHigh(uint256 minAmount, uint256 receivedAmount); error DiamondIsPaused(); error ExternalCallFailed(); error FunctionDoesNotExist(); error InformationMismatch(); error InsufficientBalance(uint256 required, uint256 balance); error InvalidAmount(); error InvalidCallData(); error InvalidConfig(); error InvalidContract(); error InvalidDestinationChain(); error InvalidFallbackAddress(); error InvalidReceiver(); error InvalidSendingToken(); error NativeAssetNotSupported(); error NativeAssetTransferFailed(); error NoSwapDataProvided(); error NoSwapFromZeroBalance(); error NotAContract(); error NotInitialized(); error NoTransferToNullAddress(); error NullAddrIsNotAnERC20Token(); error NullAddrIsNotAValidSpender(); error OnlyContractOwner(); error RecoveryAddressCannotBeZero(); error ReentrancyError(); error TokenNotSupported(); error UnAuthorized(); error UnsupportedChainId(uint256 chainId); error WithdrawFailed(); error ZeroAmount();
// SPDX-License-Identifier: MIT /// @custom:version 1.0.0 pragma solidity ^0.8.17; /// @title ERC-173 Contract Ownership Standard /// Note: the ERC-165 identifier for this interface is 0x7f5828d0 /* is ERC165 */ interface IERC173 { /// @dev This emits when ownership of a contract changes. event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /// @notice Get the address of the owner /// @return owner_ The address of the owner. function owner() external view returns (address owner_); /// @notice Set the address of the new owner of the contract /// @dev Set _newOwner to address(0) to renounce any ownership. /// @param _newOwner The address of the new owner of the contract function transferOwnership(address _newOwner) external; }
// SPDX-License-Identifier: MIT /// @custom:version 1.0.0 pragma solidity ^0.8.17; import { LibAsset } from "./LibAsset.sol"; import { LibUtil } from "./LibUtil.sol"; import { InvalidContract, NoSwapFromZeroBalance, InsufficientBalance } from "../Errors/GenericErrors.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; library LibSwap { struct SwapData { address callTo; address approveTo; address sendingAssetId; address receivingAssetId; uint256 fromAmount; bytes callData; bool requiresDeposit; } event AssetSwapped( bytes32 transactionId, address dex, address fromAssetId, address toAssetId, uint256 fromAmount, uint256 toAmount, uint256 timestamp ); function swap(bytes32 transactionId, SwapData calldata _swap) internal { if (!LibAsset.isContract(_swap.callTo)) revert InvalidContract(); uint256 fromAmount = _swap.fromAmount; if (fromAmount == 0) revert NoSwapFromZeroBalance(); uint256 nativeValue = LibAsset.isNativeAsset(_swap.sendingAssetId) ? _swap.fromAmount : 0; uint256 initialSendingAssetBalance = LibAsset.getOwnBalance( _swap.sendingAssetId ); uint256 initialReceivingAssetBalance = LibAsset.getOwnBalance( _swap.receivingAssetId ); if (nativeValue == 0) { LibAsset.maxApproveERC20( IERC20(_swap.sendingAssetId), _swap.approveTo, _swap.fromAmount ); } if (initialSendingAssetBalance < _swap.fromAmount) { revert InsufficientBalance( _swap.fromAmount, initialSendingAssetBalance ); } // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory res) = _swap.callTo.call{ value: nativeValue }(_swap.callData); if (!success) { LibUtil.revertWith(res); } uint256 newBalance = LibAsset.getOwnBalance(_swap.receivingAssetId); emit AssetSwapped( transactionId, _swap.callTo, _swap.sendingAssetId, _swap.receivingAssetId, _swap.fromAmount, newBalance > initialReceivingAssetBalance ? newBalance - initialReceivingAssetBalance : newBalance, block.timestamp ); } }
// SPDX-License-Identifier: MIT /// @custom:version 1.0.0 pragma solidity ^0.8.17; import "./LibBytes.sol"; library LibUtil { using LibBytes for bytes; function getRevertMsg( bytes memory _res ) internal pure returns (string memory) { // If the _res length is less than 68, then the transaction failed silently (without a revert message) if (_res.length < 68) return "Transaction reverted silently"; bytes memory revertData = _res.slice(4, _res.length - 4); // Remove the selector which is the first 4 bytes return abi.decode(revertData, (string)); // All that remains is the revert string } /// @notice Determines whether the given address is the zero address /// @param addr The address to verify /// @return Boolean indicating if the address is the zero address function isZeroAddress(address addr) internal pure returns (bool) { return addr == address(0); } function revertWith(bytes memory data) internal pure { assembly { let dataSize := mload(data) // Load the size of the data let dataPtr := add(data, 0x20) // Advance data pointer to the next word revert(dataPtr, dataSize) // Revert with the given data } } }
// SPDX-License-Identifier: MIT /// @custom:version 1.0.0 pragma solidity ^0.8.17; library LibBytes { // solhint-disable no-inline-assembly // LibBytes specific errors error SliceOverflow(); error SliceOutOfBounds(); error AddressOutOfBounds(); bytes16 private constant _SYMBOLS = "0123456789abcdef"; // ------------------------- function slice( bytes memory _bytes, uint256 _start, uint256 _length ) internal pure returns (bytes memory) { if (_length + 31 < _length) revert SliceOverflow(); if (_bytes.length < _start + _length) revert SliceOutOfBounds(); 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) { if (_bytes.length < _start + 20) { revert AddressOutOfBounds(); } address tempAddress; assembly { tempAddress := div( mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000 ) } return tempAddress; } /// Copied from OpenZeppelin's `Strings.sol` utility library. /// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/8335676b0e99944eef6a742e16dcd9ff6e68e609/contracts/utils/Strings.sol function toHexString( uint256 value, uint256 length ) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
{ "remappings": [ "@eth-optimism/=node_modules/@hop-protocol/sdk/node_modules/@eth-optimism/", "@uniswap/=node_modules/@uniswap/", "eth-gas-reporter/=node_modules/eth-gas-reporter/", "hardhat/=node_modules/hardhat/", "hardhat-deploy/=node_modules/hardhat-deploy/", "@openzeppelin/=lib/openzeppelin-contracts/", "celer-network/=lib/sgn-v2-contracts/", "create3-factory/=lib/create3-factory/src/", "solmate/=lib/solmate/src/", "solady/=lib/solady/src/", "permit2/=lib/Permit2/src/", "ds-test/=lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "lifi/=src/", "test/=test/", "Permit2/=lib/Permit2/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-gas-snapshot/=lib/Permit2/lib/forge-gas-snapshot/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "openzeppelin/=lib/openzeppelin-contracts/contracts/", "sgn-v2-contracts/=lib/sgn-v2-contracts/contracts/" ], "optimizer": { "enabled": true, "runs": 1000000 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_bentoBox","type":"address"},{"internalType":"address[]","name":"priviledgedUserList","type":"address[]"},{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ExternalCallFailed","type":"error"},{"inputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"MinimalOutputBalanceViolation","type":"error"},{"inputs":[],"name":"NewOwnerMustNotBeSelf","type":"error"},{"inputs":[],"name":"NoNullOwner","type":"error"},{"inputs":[],"name":"NoPendingOwnershipTransfer","type":"error"},{"inputs":[],"name":"NotPendingOwner","type":"error"},{"inputs":[],"name":"UnAuthorized","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"}],"name":"OwnershipTransferRequested","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":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":true,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"Route","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"assetId","type":"address"},{"indexed":false,"internalType":"address payable","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TokensWithdrawn","type":"event"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"agniSwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"algebraSwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"bentoBox","outputs":[{"internalType":"contract IBentoBoxMinimal","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cancelOwnershipTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"confirmOwnershipTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"dragonswapV2SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"fusionXV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"pancakeV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"priviledgedUsers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"route","type":"bytes"}],"name":"processRoute","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"ramsesV2SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resume","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bool","name":"priviledge","type":"bool"}],"name":"setPriviledge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"supV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"transferValueTo","type":"address"},{"internalType":"uint256","name":"amountValueTransfer","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountOutMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"route","type":"bytes"}],"name":"transferValueAndprocessRoute","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"uniswapV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"vvsV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"assetId","type":"address"},{"internalType":"address payable","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"xeiV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int256","name":"amount0Delta","type":"int256"},{"internalType":"int256","name":"amount1Delta","type":"int256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"zebraV3SwapCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60a06040526003805461ffff60a01b191661010160a01b1790553480156200002657600080fd5b506040516200429d3803806200429d833981016040819052620000499162000122565b600080546001600160a01b038084166001600160a01b031992831617835585166080526003805490911660011790555b8251811015620000e5576001600260008584815181106200009e576200009e6200021d565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580620000dc8162000233565b91505062000079565b505050506200025b565b80516001600160a01b03811681146200010757600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b6000806000606084860312156200013857600080fd5b6200014384620000ef565b602085810151919450906001600160401b03808211156200016357600080fd5b818701915087601f8301126200017857600080fd5b8151818111156200018d576200018d6200010c565b8060051b604051601f19603f83011681018181108582111715620001b557620001b56200010c565b60405291825284820192508381018501918a831115620001d457600080fd5b938501935b82851015620001fd57620001ed85620000ef565b84529385019392850192620001d9565b8097505050505050506200021460408501620000ef565b90509250925092565b634e487b7160e01b600052603260045260246000fd5b6000600182016200025457634e487b7160e01b600052601160045260246000fd5b5060010190565b608051613fd9620002c46000396000818161023f01528181611942015281816127d301528181612837015281816128a10152818161296601528181612a1301528181612af701528181612bfe01528181612caa01528181612d790152612e8b0152613fd96000f3fe60806040526004361061018f5760003560e01c806386cbcd52116100d6578063ae067e0f1161007f578063e30c397811610059578063e30c397814610350578063f2fde38b1461037d578063fa461e331461039d57600080fd5b8063ae067e0f146101e7578063be83e10f146101e7578063cd0fb7a71461031057600080fd5b80639a1f3406116100b05780639a1f3406146102f05780639feb758b146101e7578063a224ef83146101e757600080fd5b806386cbcd52146101e75780638da5cb5b146102b057806393b3774c146102dd57600080fd5b80635bee97a3116101385780636b2ace87116101125780636b2ace871461022d5780637200b829146102865780638456cb591461029b57600080fd5b80635bee97a3146101e75780636118b15d146101e7578063654b6487146101e757600080fd5b806323a69e751161016957806323a69e75146101e75780632646478b146102075780632c8958f6146101e757600080fd5b806301e336671461019b578063046f7da2146101bd57806323452b9c146101d257600080fd5b3661019657005b600080fd5b3480156101a757600080fd5b506101bb6101b6366004613829565b6103bd565b005b3480156101c957600080fd5b506101bb610547565b3480156101de57600080fd5b506101bb61064f565b3480156101f357600080fd5b506101bb61020236600461386a565b610719565b61021a6102153660046139c4565b61072b565b6040519081526020015b60405180910390f35b34801561023957600080fd5b506102617f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610224565b34801561029257600080fd5b506101bb6108d5565b3480156102a757600080fd5b506101bb6109bb565b3480156102bc57600080fd5b506000546102619073ffffffffffffffffffffffffffffffffffffffff1681565b61021a6102eb366004613a4b565b610abe565b3480156102fc57600080fd5b506101bb61030b366004613afe565b610c74565b34801561031c57600080fd5b5061034061032b366004613b37565b60026020526000908152604090205460ff1681565b6040519015158152602001610224565b34801561035c57600080fd5b506001546102619073ffffffffffffffffffffffffffffffffffffffff1681565b34801561038957600080fd5b506101bb610398366004613b37565b610d1b565b3480156103a957600080fd5b506101bb6103b836600461386a565b610e79565b60005473ffffffffffffffffffffffffffffffffffffffff16331461040e576040517fbe24598300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff83166104c95760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d8060008114610483576040519150601f19603f3d011682016040523d82523d6000602084013e610488565b606091505b50509050806104c3576040517f350c20f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506104ea565b6104ea73ffffffffffffffffffffffffffffffffffffffff84168383611027565b6040805173ffffffffffffffffffffffffffffffffffffffff8086168252841660208201529081018290527f6337ed398c0e8467698c581374fdce4db14922df487b5a39483079f5f59b60a49060600160405180910390a1505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633148061057c57503360009081526002602052604090205460ff165b61060d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f52503a2063616c6c6572206973206e6f7420746865206f776e6572206f72206160448201527f2070726976696c6567656420757365720000000000000000000000000000000060648201526084015b60405180910390fd5b600380547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167501000000000000000000000000000000000000000000179055565b60005473ffffffffffffffffffffffffffffffffffffffff1633146106a0576040517fbe24598300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60015473ffffffffffffffffffffffffffffffffffffffff166106ef576040517f75cdea1200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b61072584848484610e79565b50505050565b60035460009074010000000000000000000000000000000000000000900460ff166001146107b5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f72206973206c6f636b656400000000000000006044820152606401610604565b6003547501000000000000000000000000000000000000000000900460ff1660011461083d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f722069732070617573656400000000000000006044820152606401610604565b600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff167402000000000000000000000000000000000000000017905561088a878787878787611076565b9050600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790559695505050505050565b60015473ffffffffffffffffffffffffffffffffffffffff16338114610927576040517f1853971c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff9092167fffffffffffffffffffffffff0000000000000000000000000000000000000000928316179055600180549091169055565b60005473ffffffffffffffffffffffffffffffffffffffff163314806109f057503360009081526002602052604090205460ff165b610a7c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f52503a2063616c6c6572206973206e6f7420746865206f776e6572206f72206160448201527f2070726976696c656765642075736572000000000000000000000000000000006064820152608401610604565b600380547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167502000000000000000000000000000000000000000000179055565b60035460009074010000000000000000000000000000000000000000900460ff16600114610b48576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f72206973206c6f636b656400000000000000006044820152606401610604565b6003547501000000000000000000000000000000000000000000900460ff16600114610bd0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f722069732070617573656400000000000000006044820152606401610604565b600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674020000000000000000000000000000000000000000179055610c1989896116b9565b610c27878787878787611076565b9050600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000017905598975050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610cc5576040517fbe24598300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260026020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff163314610d6c576040517fbe24598300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116610db9576040517f1beca37400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff821603610e08576040517fbf1ea9fb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff831690811790915560405133907fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae127890600090a350565b60035473ffffffffffffffffffffffffffffffffffffffff163314610f20576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603e60248201527f526f75746550726f636573736f722e756e697377617056335377617043616c6c60448201527f6261636b3a2063616c6c2066726f6d20756e6b6e6f776e20736f7572636500006064820152608401610604565b6000808513610f2f5783610f31565b845b905060008113610fc3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603960248201527f526f75746550726f636573736f722e756e697377617056335377617043616c6c60448201527f6261636b3a206e6f7420706f73697469766520616d6f756e74000000000000006064820152608401610604565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001660011790556000610ffc83850185613b37565b905061101f73ffffffffffffffffffffffffffffffffffffffff821633846116d9565b505050505050565b81601452806034526fa9059cbb00000000000000000000000060005260206000604460106000875af13d15600160005114171661106c576390b8ec186000526004601cfd5b6000603452505050565b60008073ffffffffffffffffffffffffffffffffffffffff881673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1461113d576040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8916906370a0823190602401602060405180830381865afa158015611114573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111389190613b5b565b611140565b60005b9050600073ffffffffffffffffffffffffffffffffffffffff871673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1461120a576040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86811660048301528816906370a0823190602401602060405180830381865afa1580156111e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112059190613b5b565b611223565b8473ffffffffffffffffffffffffffffffffffffffff16315b90508760008061124787604080518082019091528181528151909101602082015290565b90505b80516020820151111561139a5760006112698280516001018051915290565b90508060ff16600103611295576000611281836117b2565b90508360000361128f578094505b50611389565b8060ff166002036112af576112aa828d611877565b611389565b8060ff166003036112c557600061128183611897565b8060ff166004036112d9576112aa826118bd565b8060ff166005036112ed576112aa826118df565b8060ff16600603611302576112aa8d836119e4565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f526f75746550726f636573736f723a20556e6b6e6f776e20636f6d6d616e642060448201527f636f6465000000000000000000000000000000000000000000000000000000006064820152608401610604565b61139283613ba3565b92505061124a565b506000905073ffffffffffffffffffffffffffffffffffffffff8b1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14611463576040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa15801561143a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145e9190613b5b565b611466565b60005b9050836114738b83613bdb565b1015611501576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f526f75746550726f636573736f723a204d696e696d616c20696e70757420626160448201527f6c616e63652076696f6c6174696f6e00000000000000000000000000000000006064820152608401610604565b600073ffffffffffffffffffffffffffffffffffffffff8a1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee146115c9576040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff89811660048301528b16906370a0823190602401602060405180830381865afa1580156115a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c49190613b5b565b6115e2565b8773ffffffffffffffffffffffffffffffffffffffff16315b90506115ee8985613bdb565b811015611634576115ff8482613bf4565b6040517f963b34a500000000000000000000000000000000000000000000000000000000815260040161060491815260200190565b61163e8482613bf4565b6040805173ffffffffffffffffffffffffffffffffffffffff8b81168252602082018790529181018c905260608101839052919750808c1691908e169033907f2db5ddd0b42bdbca0d69ea16f234a870a485854ae0d91f16643d6f317d8b89949060800160405180910390a450505050509695505050505050565b60003860003884865af16116d55763b12d13eb6000526004601cfd5b5050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526117ad9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611a77565b505050565b6000806117c58380516014018051915290565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290915073ffffffffffffffffffffffffffffffffffffffff8216906370a0823190602401602060405180830381865afa158015611832573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118569190613b5b565b91508115611865576001820391505b61187183308385611b86565b50919050565b60006118898380516014018051915290565b90506117ad83338385611b86565b476118b8823073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee84611b86565b919050565b60006118cf8280516014018051915290565b90506116d5826000836000611be1565b60006118f18280516014018051915290565b6040517ff7888aec00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff80831660048301523060248301529192506000917f0000000000000000000000000000000000000000000000000000000000000000169063f7888aec90604401602060405180830381865afa158015611989573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ad9190613b5b565b905080156119d8577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff015b6117ad83308484611b86565b60006119f68280516020018051915290565b90506000611a0a8380516020018051915290565b90506000611a1e8480516001018051915290565b90506000611a328580516020018051915290565b90506000611a468680516020018051915290565b9050611a6e73ffffffffffffffffffffffffffffffffffffffff881633308888888888611d13565b50505050505050565b6000611ad9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611f939092919063ffffffff16565b9050805160001480611afa575080806020019051810190611afa9190613c07565b6117ad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610604565b6000611b988580516001018051915290565b905060005b8160ff1681101561101f576000611bba8780516002018051915290565b61ffff8082168602049485900394909150611bd788888884611be1565b5050600101611b9d565b6000611bf38580516001018051915290565b90508060ff16600003611c1157611c0c85858585611faa565b611d0c565b8060ff16600103611c2857611c0c8585858561235d565b8060ff16600203611c3f57611c0c8585858561259c565b8060ff16600303611c5657611c0c85858585612769565b8060ff16600403611c6d57611c0c85858585612def565b8060ff16600503611c8457611c0c85858585612f7d565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f526f75746550726f636573736f723a20556e6b6e6f776e20706f6f6c2074797060448201527f65000000000000000000000000000000000000000000000000000000000000006064820152608401610604565b5050505050565b6040517f7ecebe0000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8881166004830152600091908a1690637ecebe0090602401602060405180830381865afa158015611d83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611da79190613b5b565b6040517fd505accf00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a811660048301528981166024830152604482018990526064820188905260ff8716608483015260a4820186905260c48201859052919250908a169063d505accf9060e401600060405180830381600087803b158015611e4157600080fd5b505af1158015611e55573d6000803e3d6000fd5b50506040517f7ecebe0000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b81166004830152600093508c169150637ecebe0090602401602060405180830381865afa158015611ec8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eec9190613b5b565b9050611ef9826001613bdb565b8114611f87576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f5361666545524332303a207065726d697420646964206e6f742073756363656560448201527f64000000000000000000000000000000000000000000000000000000000000006064820152608401610604565b50505050505050505050565b6060611fa28484600085613469565b949350505050565b6000611fbc8580516014018051915290565b90506000611fd08680516001018051915290565b90506000611fe48780516014018051915290565b90506000611ff88880516003018051915290565b90503073ffffffffffffffffffffffffffffffffffffffff88160361203d5761203873ffffffffffffffffffffffffffffffffffffffff871685876116d9565b61207c565b3373ffffffffffffffffffffffffffffffffffffffff88160361207c5761207c73ffffffffffffffffffffffffffffffffffffffff8716338688613582565b6000808573ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156120ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120ee9190613c42565b506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff1691506000821180156121235750600081115b612189576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f57726f6e6720706f6f6c207265736572766573000000000000000000000000006044820152606401610604565b6000808660ff1660011461219e5782846121a1565b83835b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b8116600483015292945090925083918c16906370a0823190602401602060405180830381865afa158015612215573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122399190613b5b565b6122439190613bf4565b9850600061225486620f4240613c92565b6122639062ffffff168b613cb5565b905060008161227585620f4240613cb5565b61227f9190613bdb565b6122898484613cb5565b6122939190613ccc565b90506000808a60ff166001146122ab578260006122af565b6000835b604080516000815260208101918290527f022c0d9f00000000000000000000000000000000000000000000000000000000909152919350915073ffffffffffffffffffffffffffffffffffffffff8d169063022c0d9f9061231990859085908f9060248101613d75565b600060405180830381600087803b15801561233357600080fd5b505af1158015612347573d6000803e3d6000fd5b5050505050505050505050505050505050505050565b600061236f8580516014018051915290565b90506000806123848780516001018051915290565b60ff16119050600061239c8780516014018051915290565b90503373ffffffffffffffffffffffffffffffffffffffff8716036123dd576123dd73ffffffffffffffffffffffffffffffffffffffff8616333087613582565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff851690811790915563128acb08828487816124515761244c600173fffd8963efd1fc6a506488495d951d5263988d26613db0565b612461565b6124616401000276a36001613ddd565b6040805173ffffffffffffffffffffffffffffffffffffffff8d166020820152016040516020818303038152906040526040518663ffffffff1660e01b81526004016124b1959493929190613e0a565b60408051808303816000875af11580156124cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f39190613e51565b505060035473ffffffffffffffffffffffffffffffffffffffff16600114611a6e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f526f75746550726f636573736f722e73776170556e6956333a20756e6578706560448201527f63746564000000000000000000000000000000000000000000000000000000006064820152608401610604565b60006125ae8580516001018051915290565b905060006125c28680516014018051915290565b9050600180831690036126945760006125e18780516014018051915290565b905060028316600003612650578073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b15801561263657600080fd5b505af115801561264a573d6000803e3d6000fd5b50505050505b73ffffffffffffffffffffffffffffffffffffffff8216301461268e5761268e73ffffffffffffffffffffffffffffffffffffffff821683866116d9565b5061101f565b6002821660000361275f573373ffffffffffffffffffffffffffffffffffffffff8616036126de576126de73ffffffffffffffffffffffffffffffffffffffff8516333086613582565b6040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff851690632e1a7d4d90602401600060405180830381600087803b15801561274657600080fd5b505af115801561275a573d6000803e3d6000fd5b505050505b61101f81846116b9565b600061277b8580516001018051915290565b9050600061278f8680516014018051915290565b905060ff821615612b88573073ffffffffffffffffffffffffffffffffffffffff8616036127fd576127f873ffffffffffffffffffffffffffffffffffffffff85167f0000000000000000000000000000000000000000000000000000000000000000856116d9565b612ab2565b3373ffffffffffffffffffffffffffffffffffffffff86160361285c576127f873ffffffffffffffffffffffffffffffffffffffff8516337f000000000000000000000000000000000000000000000000000000000000000086613582565b6040517f4ffe34db00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301527f00000000000000000000000000000000000000000000000000000000000000001690634ffe34db906024016040805180830381865afa1580156128e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061290b9190613e95565b516040517fdf23b45b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86811660048301526fffffffffffffffffffffffffffffffff909216917f0000000000000000000000000000000000000000000000000000000000000000169063df23b45b90602401606060405180830381865afa1580156129ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129d19190613f08565b60409081015190517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811660048301526fffffffffffffffffffffffffffffffff909216918716906370a0823190602401602060405180830381865afa158015612a77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a9b9190613b5b565b612aa59190613bdb565b612aaf9190613bf4565b92505b6040517f02b9446c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301527f000000000000000000000000000000000000000000000000000000000000000081166024830181905290831660448301526064820185905260006084830152906302b9446c9060a40160408051808303816000875af1158015612b5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b819190613e51565b505061101f565b73ffffffffffffffffffffffffffffffffffffffff851615612c5f576040517ff18d03cc00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301528681166024830152306044830152606482018590527f0000000000000000000000000000000000000000000000000000000000000000169063f18d03cc90608401600060405180830381600087803b158015612c4257600080fd5b505af1158015612c56573d6000803e3d6000fd5b50505050612d18565b6040517ff7888aec00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301523060248301527f0000000000000000000000000000000000000000000000000000000000000000169063f7888aec90604401602060405180830381865afa158015612cf1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d159190613b5b565b92505b6040517f97da6d3000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152306024830152828116604483015260006064830152608482018590527f000000000000000000000000000000000000000000000000000000000000000016906397da6d309060a40160408051808303816000875af1158015612dc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612de59190613e51565b5050505050505050565b6000612e018580516014018051915290565b85516020808201805190920101875290915073ffffffffffffffffffffffffffffffffffffffff851615612ee8576040517ff18d03cc00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015286811660248301528381166044830152606482018590527f0000000000000000000000000000000000000000000000000000000000000000169063f18d03cc90608401600060405180830381600087803b158015612ecf57600080fd5b505af1158015612ee3573d6000803e3d6000fd5b505050505b6040517f627dd56a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83169063627dd56a90612f3a908490600401613f74565b6020604051808303816000875af1158015612f59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6e9190613b5b565b6000612f8f8580516014018051915290565b90506000612fa38680516001018051915290565b90506000612fb78780516001018051915290565b60000b90506000612fce8880516001018051915290565b60000b90506000612fe58980516014018051915290565b90506000612ff98a80516014018051915290565b905060007fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff8a16016130ed576040517f3df02124000000000000000000000000000000000000000000000000000000008152600f86810b600483015285900b6024820152604481018990526000606482015273ffffffffffffffffffffffffffffffffffffffff881690633df02124908a9060840160206040518083038185885af11580156130c1573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906130e69190613b5b565b90506133d2565b3373ffffffffffffffffffffffffffffffffffffffff8b160361312c5761312c73ffffffffffffffffffffffffffffffffffffffff8a1633308b613582565b61314d73ffffffffffffffffffffffffffffffffffffffff8a16888a6135e0565b508560ff16600003613203576040517f3df02124000000000000000000000000000000000000000000000000000000008152600f86810b600483015285900b6024820152604481018990526000606482015273ffffffffffffffffffffffffffffffffffffffff881690633df02124906084016020604051808303816000875af11580156131df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130e69190613b5b565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015613270573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132949190613b5b565b6040517f3df02124000000000000000000000000000000000000000000000000000000008152600f88810b600483015287900b6024820152604481018b90526000606482015290915073ffffffffffffffffffffffffffffffffffffffff891690633df0212490608401600060405180830381600087803b15801561331857600080fd5b505af115801561332c573d6000803e3d6000fd5b50506040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000925073ffffffffffffffffffffffffffffffffffffffff861691506370a0823190602401602060405180830381865afa15801561339d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133c19190613b5b565b90506133cd8282613bf4565b925050505b73ffffffffffffffffffffffffffffffffffffffff8316301461345c577fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff83160161343b5761343683826116b9565b61345c565b61345c73ffffffffffffffffffffffffffffffffffffffff831684836116d9565b5050505050505050505050565b6060824710156134fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610604565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516135249190613f87565b60006040518083038185875af1925050503d8060008114613561576040519150601f19603f3d011682016040523d82523d6000602084013e613566565b606091505b509150915061357787838387613611565b979650505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526107259085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161172b565b60006135ed8484846136b1565b80611fa257506135ff848460006136b1565b8015611fa25750611fa28484846136b1565b606083156136a75782516000036136a05773ffffffffffffffffffffffffffffffffffffffff85163b6136a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610604565b5081611fa2565b611fa283836137c0565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b3000000000000000000000000000000000000000000000000000000001790529151600092839283929188169161374a9190613f87565b6000604051808303816000865af19150503d8060008114613787576040519150601f19603f3d011682016040523d82523d6000602084013e61378c565b606091505b50915091508180156137b65750805115806137b65750808060200190518101906137b69190613c07565b9695505050505050565b8151156137d05781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106049190613f74565b73ffffffffffffffffffffffffffffffffffffffff8116811461382657600080fd5b50565b60008060006060848603121561383e57600080fd5b833561384981613804565b9250602084013561385981613804565b929592945050506040919091013590565b6000806000806060858703121561388057600080fd5b8435935060208501359250604085013567ffffffffffffffff808211156138a657600080fd5b818701915087601f8301126138ba57600080fd5b8135818111156138c957600080fd5b8860208285010111156138db57600080fd5b95989497505060200194505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261392a57600080fd5b813567ffffffffffffffff80821115613945576139456138ea565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171561398b5761398b6138ea565b816040528381528660208588010111156139a457600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060008060c087890312156139dd57600080fd5b86356139e881613804565b95506020870135945060408701356139ff81613804565b9350606087013592506080870135613a1681613804565b915060a087013567ffffffffffffffff811115613a3257600080fd5b613a3e89828a01613919565b9150509295509295509295565b600080600080600080600080610100898b031215613a6857600080fd5b8835613a7381613804565b9750602089013596506040890135613a8a81613804565b9550606089013594506080890135613aa181613804565b935060a0890135925060c0890135613ab881613804565b915060e089013567ffffffffffffffff811115613ad457600080fd5b613ae08b828c01613919565b9150509295985092959890939650565b801515811461382657600080fd5b60008060408385031215613b1157600080fd5b8235613b1c81613804565b91506020830135613b2c81613af0565b809150509250929050565b600060208284031215613b4957600080fd5b8135613b5481613804565b9392505050565b600060208284031215613b6d57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613bd457613bd4613b74565b5060010190565b80820180821115613bee57613bee613b74565b92915050565b81810381811115613bee57613bee613b74565b600060208284031215613c1957600080fd5b8151613b5481613af0565b80516dffffffffffffffffffffffffffff811681146118b857600080fd5b600080600060608486031215613c5757600080fd5b613c6084613c24565b9250613c6e60208501613c24565b9150604084015163ffffffff81168114613c8757600080fd5b809150509250925092565b62ffffff828116828216039080821115613cae57613cae613b74565b5092915050565b8082028115828204841417613bee57613bee613b74565b600082613d02577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60005b83811015613d22578181015183820152602001613d0a565b50506000910152565b60008151808452613d43816020860160208601613d07565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b84815283602082015273ffffffffffffffffffffffffffffffffffffffff831660408201526080606082015260006137b66080830184613d2b565b73ffffffffffffffffffffffffffffffffffffffff828116828216039080821115613cae57613cae613b74565b73ffffffffffffffffffffffffffffffffffffffff818116838216019080821115613cae57613cae613b74565b600073ffffffffffffffffffffffffffffffffffffffff8088168352861515602084015285604084015280851660608401525060a0608083015261357760a0830184613d2b565b60008060408385031215613e6457600080fd5b505080516020909101519092909150565b80516fffffffffffffffffffffffffffffffff811681146118b857600080fd5b600060408284031215613ea757600080fd5b6040516040810181811067ffffffffffffffff82111715613eca57613eca6138ea565b604052613ed683613e75565b8152613ee460208401613e75565b60208201529392505050565b805167ffffffffffffffff811681146118b857600080fd5b600060608284031215613f1a57600080fd5b6040516060810181811067ffffffffffffffff82111715613f3d57613f3d6138ea565b604052613f4983613ef0565b8152613f5760208401613ef0565b6020820152613f6860408401613e75565b60408201529392505050565b602081526000613b546020830184613d2b565b60008251613f99818460208701613d07565b919091019291505056fea2646970667358221220ca37125863973a770450bc3cef5f6a327d9deb030920bce38f913b20e10fbdfe64736f6c6343000811003300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000156cebba59deb2cb23742f70dcb0a11cc775591f0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000d38743b48d26743c0ec6898d699394fbc94657ee
Deployed Bytecode
0x60806040526004361061018f5760003560e01c806386cbcd52116100d6578063ae067e0f1161007f578063e30c397811610059578063e30c397814610350578063f2fde38b1461037d578063fa461e331461039d57600080fd5b8063ae067e0f146101e7578063be83e10f146101e7578063cd0fb7a71461031057600080fd5b80639a1f3406116100b05780639a1f3406146102f05780639feb758b146101e7578063a224ef83146101e757600080fd5b806386cbcd52146101e75780638da5cb5b146102b057806393b3774c146102dd57600080fd5b80635bee97a3116101385780636b2ace87116101125780636b2ace871461022d5780637200b829146102865780638456cb591461029b57600080fd5b80635bee97a3146101e75780636118b15d146101e7578063654b6487146101e757600080fd5b806323a69e751161016957806323a69e75146101e75780632646478b146102075780632c8958f6146101e757600080fd5b806301e336671461019b578063046f7da2146101bd57806323452b9c146101d257600080fd5b3661019657005b600080fd5b3480156101a757600080fd5b506101bb6101b6366004613829565b6103bd565b005b3480156101c957600080fd5b506101bb610547565b3480156101de57600080fd5b506101bb61064f565b3480156101f357600080fd5b506101bb61020236600461386a565b610719565b61021a6102153660046139c4565b61072b565b6040519081526020015b60405180910390f35b34801561023957600080fd5b506102617f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610224565b34801561029257600080fd5b506101bb6108d5565b3480156102a757600080fd5b506101bb6109bb565b3480156102bc57600080fd5b506000546102619073ffffffffffffffffffffffffffffffffffffffff1681565b61021a6102eb366004613a4b565b610abe565b3480156102fc57600080fd5b506101bb61030b366004613afe565b610c74565b34801561031c57600080fd5b5061034061032b366004613b37565b60026020526000908152604090205460ff1681565b6040519015158152602001610224565b34801561035c57600080fd5b506001546102619073ffffffffffffffffffffffffffffffffffffffff1681565b34801561038957600080fd5b506101bb610398366004613b37565b610d1b565b3480156103a957600080fd5b506101bb6103b836600461386a565b610e79565b60005473ffffffffffffffffffffffffffffffffffffffff16331461040e576040517fbe24598300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff83166104c95760008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d8060008114610483576040519150601f19603f3d011682016040523d82523d6000602084013e610488565b606091505b50509050806104c3576040517f350c20f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b506104ea565b6104ea73ffffffffffffffffffffffffffffffffffffffff84168383611027565b6040805173ffffffffffffffffffffffffffffffffffffffff8086168252841660208201529081018290527f6337ed398c0e8467698c581374fdce4db14922df487b5a39483079f5f59b60a49060600160405180910390a1505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633148061057c57503360009081526002602052604090205460ff165b61060d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f52503a2063616c6c6572206973206e6f7420746865206f776e6572206f72206160448201527f2070726976696c6567656420757365720000000000000000000000000000000060648201526084015b60405180910390fd5b600380547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167501000000000000000000000000000000000000000000179055565b60005473ffffffffffffffffffffffffffffffffffffffff1633146106a0576040517fbe24598300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60015473ffffffffffffffffffffffffffffffffffffffff166106ef576040517f75cdea1200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b61072584848484610e79565b50505050565b60035460009074010000000000000000000000000000000000000000900460ff166001146107b5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f72206973206c6f636b656400000000000000006044820152606401610604565b6003547501000000000000000000000000000000000000000000900460ff1660011461083d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f722069732070617573656400000000000000006044820152606401610604565b600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff167402000000000000000000000000000000000000000017905561088a878787878787611076565b9050600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790559695505050505050565b60015473ffffffffffffffffffffffffffffffffffffffff16338114610927576040517f1853971c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff9092167fffffffffffffffffffffffff0000000000000000000000000000000000000000928316179055600180549091169055565b60005473ffffffffffffffffffffffffffffffffffffffff163314806109f057503360009081526002602052604090205460ff165b610a7c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f52503a2063616c6c6572206973206e6f7420746865206f776e6572206f72206160448201527f2070726976696c656765642075736572000000000000000000000000000000006064820152608401610604565b600380547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167502000000000000000000000000000000000000000000179055565b60035460009074010000000000000000000000000000000000000000900460ff16600114610b48576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f72206973206c6f636b656400000000000000006044820152606401610604565b6003547501000000000000000000000000000000000000000000900460ff16600114610bd0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f526f75746550726f636573736f722069732070617573656400000000000000006044820152606401610604565b600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674020000000000000000000000000000000000000000179055610c1989896116b9565b610c27878787878787611076565b9050600380547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff167401000000000000000000000000000000000000000017905598975050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610cc5576040517fbe24598300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260026020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60005473ffffffffffffffffffffffffffffffffffffffff163314610d6c576040517fbe24598300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116610db9576040517f1beca37400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff821603610e08576040517fbf1ea9fb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff831690811790915560405133907fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae127890600090a350565b60035473ffffffffffffffffffffffffffffffffffffffff163314610f20576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603e60248201527f526f75746550726f636573736f722e756e697377617056335377617043616c6c60448201527f6261636b3a2063616c6c2066726f6d20756e6b6e6f776e20736f7572636500006064820152608401610604565b6000808513610f2f5783610f31565b845b905060008113610fc3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603960248201527f526f75746550726f636573736f722e756e697377617056335377617043616c6c60448201527f6261636b3a206e6f7420706f73697469766520616d6f756e74000000000000006064820152608401610604565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001660011790556000610ffc83850185613b37565b905061101f73ffffffffffffffffffffffffffffffffffffffff821633846116d9565b505050505050565b81601452806034526fa9059cbb00000000000000000000000060005260206000604460106000875af13d15600160005114171661106c576390b8ec186000526004601cfd5b6000603452505050565b60008073ffffffffffffffffffffffffffffffffffffffff881673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1461113d576040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8916906370a0823190602401602060405180830381865afa158015611114573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111389190613b5b565b611140565b60005b9050600073ffffffffffffffffffffffffffffffffffffffff871673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1461120a576040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86811660048301528816906370a0823190602401602060405180830381865afa1580156111e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112059190613b5b565b611223565b8473ffffffffffffffffffffffffffffffffffffffff16315b90508760008061124787604080518082019091528181528151909101602082015290565b90505b80516020820151111561139a5760006112698280516001018051915290565b90508060ff16600103611295576000611281836117b2565b90508360000361128f578094505b50611389565b8060ff166002036112af576112aa828d611877565b611389565b8060ff166003036112c557600061128183611897565b8060ff166004036112d9576112aa826118bd565b8060ff166005036112ed576112aa826118df565b8060ff16600603611302576112aa8d836119e4565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f526f75746550726f636573736f723a20556e6b6e6f776e20636f6d6d616e642060448201527f636f6465000000000000000000000000000000000000000000000000000000006064820152608401610604565b61139283613ba3565b92505061124a565b506000905073ffffffffffffffffffffffffffffffffffffffff8b1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14611463576040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa15801561143a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145e9190613b5b565b611466565b60005b9050836114738b83613bdb565b1015611501576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f526f75746550726f636573736f723a204d696e696d616c20696e70757420626160448201527f6c616e63652076696f6c6174696f6e00000000000000000000000000000000006064820152608401610604565b600073ffffffffffffffffffffffffffffffffffffffff8a1673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee146115c9576040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff89811660048301528b16906370a0823190602401602060405180830381865afa1580156115a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c49190613b5b565b6115e2565b8773ffffffffffffffffffffffffffffffffffffffff16315b90506115ee8985613bdb565b811015611634576115ff8482613bf4565b6040517f963b34a500000000000000000000000000000000000000000000000000000000815260040161060491815260200190565b61163e8482613bf4565b6040805173ffffffffffffffffffffffffffffffffffffffff8b81168252602082018790529181018c905260608101839052919750808c1691908e169033907f2db5ddd0b42bdbca0d69ea16f234a870a485854ae0d91f16643d6f317d8b89949060800160405180910390a450505050509695505050505050565b60003860003884865af16116d55763b12d13eb6000526004601cfd5b5050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526117ad9084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611a77565b505050565b6000806117c58380516014018051915290565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290915073ffffffffffffffffffffffffffffffffffffffff8216906370a0823190602401602060405180830381865afa158015611832573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118569190613b5b565b91508115611865576001820391505b61187183308385611b86565b50919050565b60006118898380516014018051915290565b90506117ad83338385611b86565b476118b8823073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee84611b86565b919050565b60006118cf8280516014018051915290565b90506116d5826000836000611be1565b60006118f18280516014018051915290565b6040517ff7888aec00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff80831660048301523060248301529192506000917f0000000000000000000000000000000000000000000000000000000000000000169063f7888aec90604401602060405180830381865afa158015611989573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119ad9190613b5b565b905080156119d8577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff015b6117ad83308484611b86565b60006119f68280516020018051915290565b90506000611a0a8380516020018051915290565b90506000611a1e8480516001018051915290565b90506000611a328580516020018051915290565b90506000611a468680516020018051915290565b9050611a6e73ffffffffffffffffffffffffffffffffffffffff881633308888888888611d13565b50505050505050565b6000611ad9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611f939092919063ffffffff16565b9050805160001480611afa575080806020019051810190611afa9190613c07565b6117ad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610604565b6000611b988580516001018051915290565b905060005b8160ff1681101561101f576000611bba8780516002018051915290565b61ffff8082168602049485900394909150611bd788888884611be1565b5050600101611b9d565b6000611bf38580516001018051915290565b90508060ff16600003611c1157611c0c85858585611faa565b611d0c565b8060ff16600103611c2857611c0c8585858561235d565b8060ff16600203611c3f57611c0c8585858561259c565b8060ff16600303611c5657611c0c85858585612769565b8060ff16600403611c6d57611c0c85858585612def565b8060ff16600503611c8457611c0c85858585612f7d565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f526f75746550726f636573736f723a20556e6b6e6f776e20706f6f6c2074797060448201527f65000000000000000000000000000000000000000000000000000000000000006064820152608401610604565b5050505050565b6040517f7ecebe0000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8881166004830152600091908a1690637ecebe0090602401602060405180830381865afa158015611d83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611da79190613b5b565b6040517fd505accf00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a811660048301528981166024830152604482018990526064820188905260ff8716608483015260a4820186905260c48201859052919250908a169063d505accf9060e401600060405180830381600087803b158015611e4157600080fd5b505af1158015611e55573d6000803e3d6000fd5b50506040517f7ecebe0000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b81166004830152600093508c169150637ecebe0090602401602060405180830381865afa158015611ec8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611eec9190613b5b565b9050611ef9826001613bdb565b8114611f87576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f5361666545524332303a207065726d697420646964206e6f742073756363656560448201527f64000000000000000000000000000000000000000000000000000000000000006064820152608401610604565b50505050505050505050565b6060611fa28484600085613469565b949350505050565b6000611fbc8580516014018051915290565b90506000611fd08680516001018051915290565b90506000611fe48780516014018051915290565b90506000611ff88880516003018051915290565b90503073ffffffffffffffffffffffffffffffffffffffff88160361203d5761203873ffffffffffffffffffffffffffffffffffffffff871685876116d9565b61207c565b3373ffffffffffffffffffffffffffffffffffffffff88160361207c5761207c73ffffffffffffffffffffffffffffffffffffffff8716338688613582565b6000808573ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156120ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120ee9190613c42565b506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff1691506000821180156121235750600081115b612189576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f57726f6e6720706f6f6c207265736572766573000000000000000000000000006044820152606401610604565b6000808660ff1660011461219e5782846121a1565b83835b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b8116600483015292945090925083918c16906370a0823190602401602060405180830381865afa158015612215573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122399190613b5b565b6122439190613bf4565b9850600061225486620f4240613c92565b6122639062ffffff168b613cb5565b905060008161227585620f4240613cb5565b61227f9190613bdb565b6122898484613cb5565b6122939190613ccc565b90506000808a60ff166001146122ab578260006122af565b6000835b604080516000815260208101918290527f022c0d9f00000000000000000000000000000000000000000000000000000000909152919350915073ffffffffffffffffffffffffffffffffffffffff8d169063022c0d9f9061231990859085908f9060248101613d75565b600060405180830381600087803b15801561233357600080fd5b505af1158015612347573d6000803e3d6000fd5b5050505050505050505050505050505050505050565b600061236f8580516014018051915290565b90506000806123848780516001018051915290565b60ff16119050600061239c8780516014018051915290565b90503373ffffffffffffffffffffffffffffffffffffffff8716036123dd576123dd73ffffffffffffffffffffffffffffffffffffffff8616333087613582565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff851690811790915563128acb08828487816124515761244c600173fffd8963efd1fc6a506488495d951d5263988d26613db0565b612461565b6124616401000276a36001613ddd565b6040805173ffffffffffffffffffffffffffffffffffffffff8d166020820152016040516020818303038152906040526040518663ffffffff1660e01b81526004016124b1959493929190613e0a565b60408051808303816000875af11580156124cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124f39190613e51565b505060035473ffffffffffffffffffffffffffffffffffffffff16600114611a6e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f526f75746550726f636573736f722e73776170556e6956333a20756e6578706560448201527f63746564000000000000000000000000000000000000000000000000000000006064820152608401610604565b60006125ae8580516001018051915290565b905060006125c28680516014018051915290565b9050600180831690036126945760006125e18780516014018051915290565b905060028316600003612650578073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b15801561263657600080fd5b505af115801561264a573d6000803e3d6000fd5b50505050505b73ffffffffffffffffffffffffffffffffffffffff8216301461268e5761268e73ffffffffffffffffffffffffffffffffffffffff821683866116d9565b5061101f565b6002821660000361275f573373ffffffffffffffffffffffffffffffffffffffff8616036126de576126de73ffffffffffffffffffffffffffffffffffffffff8516333086613582565b6040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff851690632e1a7d4d90602401600060405180830381600087803b15801561274657600080fd5b505af115801561275a573d6000803e3d6000fd5b505050505b61101f81846116b9565b600061277b8580516001018051915290565b9050600061278f8680516014018051915290565b905060ff821615612b88573073ffffffffffffffffffffffffffffffffffffffff8616036127fd576127f873ffffffffffffffffffffffffffffffffffffffff85167f0000000000000000000000000000000000000000000000000000000000000000856116d9565b612ab2565b3373ffffffffffffffffffffffffffffffffffffffff86160361285c576127f873ffffffffffffffffffffffffffffffffffffffff8516337f000000000000000000000000000000000000000000000000000000000000000086613582565b6040517f4ffe34db00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301527f00000000000000000000000000000000000000000000000000000000000000001690634ffe34db906024016040805180830381865afa1580156128e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061290b9190613e95565b516040517fdf23b45b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86811660048301526fffffffffffffffffffffffffffffffff909216917f0000000000000000000000000000000000000000000000000000000000000000169063df23b45b90602401606060405180830381865afa1580156129ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129d19190613f08565b60409081015190517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000811660048301526fffffffffffffffffffffffffffffffff909216918716906370a0823190602401602060405180830381865afa158015612a77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a9b9190613b5b565b612aa59190613bdb565b612aaf9190613bf4565b92505b6040517f02b9446c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301527f000000000000000000000000000000000000000000000000000000000000000081166024830181905290831660448301526064820185905260006084830152906302b9446c9060a40160408051808303816000875af1158015612b5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b819190613e51565b505061101f565b73ffffffffffffffffffffffffffffffffffffffff851615612c5f576040517ff18d03cc00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301528681166024830152306044830152606482018590527f0000000000000000000000000000000000000000000000000000000000000000169063f18d03cc90608401600060405180830381600087803b158015612c4257600080fd5b505af1158015612c56573d6000803e3d6000fd5b50505050612d18565b6040517ff7888aec00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301523060248301527f0000000000000000000000000000000000000000000000000000000000000000169063f7888aec90604401602060405180830381865afa158015612cf1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d159190613b5b565b92505b6040517f97da6d3000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152306024830152828116604483015260006064830152608482018590527f000000000000000000000000000000000000000000000000000000000000000016906397da6d309060a40160408051808303816000875af1158015612dc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612de59190613e51565b5050505050505050565b6000612e018580516014018051915290565b85516020808201805190920101875290915073ffffffffffffffffffffffffffffffffffffffff851615612ee8576040517ff18d03cc00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015286811660248301528381166044830152606482018590527f0000000000000000000000000000000000000000000000000000000000000000169063f18d03cc90608401600060405180830381600087803b158015612ecf57600080fd5b505af1158015612ee3573d6000803e3d6000fd5b505050505b6040517f627dd56a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83169063627dd56a90612f3a908490600401613f74565b6020604051808303816000875af1158015612f59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6e9190613b5b565b6000612f8f8580516014018051915290565b90506000612fa38680516001018051915290565b90506000612fb78780516001018051915290565b60000b90506000612fce8880516001018051915290565b60000b90506000612fe58980516014018051915290565b90506000612ff98a80516014018051915290565b905060007fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff8a16016130ed576040517f3df02124000000000000000000000000000000000000000000000000000000008152600f86810b600483015285900b6024820152604481018990526000606482015273ffffffffffffffffffffffffffffffffffffffff881690633df02124908a9060840160206040518083038185885af11580156130c1573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906130e69190613b5b565b90506133d2565b3373ffffffffffffffffffffffffffffffffffffffff8b160361312c5761312c73ffffffffffffffffffffffffffffffffffffffff8a1633308b613582565b61314d73ffffffffffffffffffffffffffffffffffffffff8a16888a6135e0565b508560ff16600003613203576040517f3df02124000000000000000000000000000000000000000000000000000000008152600f86810b600483015285900b6024820152604481018990526000606482015273ffffffffffffffffffffffffffffffffffffffff881690633df02124906084016020604051808303816000875af11580156131df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130e69190613b5b565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015613270573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132949190613b5b565b6040517f3df02124000000000000000000000000000000000000000000000000000000008152600f88810b600483015287900b6024820152604481018b90526000606482015290915073ffffffffffffffffffffffffffffffffffffffff891690633df0212490608401600060405180830381600087803b15801561331857600080fd5b505af115801561332c573d6000803e3d6000fd5b50506040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000925073ffffffffffffffffffffffffffffffffffffffff861691506370a0823190602401602060405180830381865afa15801561339d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133c19190613b5b565b90506133cd8282613bf4565b925050505b73ffffffffffffffffffffffffffffffffffffffff8316301461345c577fffffffffffffffffffffffff111111111111111111111111111111111111111273ffffffffffffffffffffffffffffffffffffffff83160161343b5761343683826116b9565b61345c565b61345c73ffffffffffffffffffffffffffffffffffffffff831684836116d9565b5050505050505050505050565b6060824710156134fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610604565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516135249190613f87565b60006040518083038185875af1925050503d8060008114613561576040519150601f19603f3d011682016040523d82523d6000602084013e613566565b606091505b509150915061357787838387613611565b979650505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526107259085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161172b565b60006135ed8484846136b1565b80611fa257506135ff848460006136b1565b8015611fa25750611fa28484846136b1565b606083156136a75782516000036136a05773ffffffffffffffffffffffffffffffffffffffff85163b6136a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610604565b5081611fa2565b611fa283836137c0565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b3000000000000000000000000000000000000000000000000000000001790529151600092839283929188169161374a9190613f87565b6000604051808303816000865af19150503d8060008114613787576040519150601f19603f3d011682016040523d82523d6000602084013e61378c565b606091505b50915091508180156137b65750805115806137b65750808060200190518101906137b69190613c07565b9695505050505050565b8151156137d05781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106049190613f74565b73ffffffffffffffffffffffffffffffffffffffff8116811461382657600080fd5b50565b60008060006060848603121561383e57600080fd5b833561384981613804565b9250602084013561385981613804565b929592945050506040919091013590565b6000806000806060858703121561388057600080fd5b8435935060208501359250604085013567ffffffffffffffff808211156138a657600080fd5b818701915087601f8301126138ba57600080fd5b8135818111156138c957600080fd5b8860208285010111156138db57600080fd5b95989497505060200194505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261392a57600080fd5b813567ffffffffffffffff80821115613945576139456138ea565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190828211818310171561398b5761398b6138ea565b816040528381528660208588010111156139a457600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060008060c087890312156139dd57600080fd5b86356139e881613804565b95506020870135945060408701356139ff81613804565b9350606087013592506080870135613a1681613804565b915060a087013567ffffffffffffffff811115613a3257600080fd5b613a3e89828a01613919565b9150509295509295509295565b600080600080600080600080610100898b031215613a6857600080fd5b8835613a7381613804565b9750602089013596506040890135613a8a81613804565b9550606089013594506080890135613aa181613804565b935060a0890135925060c0890135613ab881613804565b915060e089013567ffffffffffffffff811115613ad457600080fd5b613ae08b828c01613919565b9150509295985092959890939650565b801515811461382657600080fd5b60008060408385031215613b1157600080fd5b8235613b1c81613804565b91506020830135613b2c81613af0565b809150509250929050565b600060208284031215613b4957600080fd5b8135613b5481613804565b9392505050565b600060208284031215613b6d57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613bd457613bd4613b74565b5060010190565b80820180821115613bee57613bee613b74565b92915050565b81810381811115613bee57613bee613b74565b600060208284031215613c1957600080fd5b8151613b5481613af0565b80516dffffffffffffffffffffffffffff811681146118b857600080fd5b600080600060608486031215613c5757600080fd5b613c6084613c24565b9250613c6e60208501613c24565b9150604084015163ffffffff81168114613c8757600080fd5b809150509250925092565b62ffffff828116828216039080821115613cae57613cae613b74565b5092915050565b8082028115828204841417613bee57613bee613b74565b600082613d02577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60005b83811015613d22578181015183820152602001613d0a565b50506000910152565b60008151808452613d43816020860160208601613d07565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b84815283602082015273ffffffffffffffffffffffffffffffffffffffff831660408201526080606082015260006137b66080830184613d2b565b73ffffffffffffffffffffffffffffffffffffffff828116828216039080821115613cae57613cae613b74565b73ffffffffffffffffffffffffffffffffffffffff818116838216019080821115613cae57613cae613b74565b600073ffffffffffffffffffffffffffffffffffffffff8088168352861515602084015285604084015280851660608401525060a0608083015261357760a0830184613d2b565b60008060408385031215613e6457600080fd5b505080516020909101519092909150565b80516fffffffffffffffffffffffffffffffff811681146118b857600080fd5b600060408284031215613ea757600080fd5b6040516040810181811067ffffffffffffffff82111715613eca57613eca6138ea565b604052613ed683613e75565b8152613ee460208401613e75565b60208201529392505050565b805167ffffffffffffffff811681146118b857600080fd5b600060608284031215613f1a57600080fd5b6040516060810181811067ffffffffffffffff82111715613f3d57613f3d6138ea565b604052613f4983613ef0565b8152613f5760208401613ef0565b6020820152613f6860408401613e75565b60408201529392505050565b602081526000613b546020830184613d2b565b60008251613f99818460208701613d07565b919091019291505056fea2646970667358221220ca37125863973a770450bc3cef5f6a327d9deb030920bce38f913b20e10fbdfe64736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000156cebba59deb2cb23742f70dcb0a11cc775591f0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000d38743b48d26743c0ec6898d699394fbc94657ee
-----Decoded View---------------
Arg [0] : _bentoBox (address): 0x0000000000000000000000000000000000000000
Arg [1] : priviledgedUserList (address[]): 0xd38743b48d26743C0Ec6898d699394FBc94657Ee
Arg [2] : _owner (address): 0x156CeBba59DEB2cB23742F70dCb0a11cC775591F
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [2] : 000000000000000000000000156cebba59deb2cb23742f70dcb0a11cc775591f
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [4] : 000000000000000000000000d38743b48d26743c0ec6898d699394fbc94657ee
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ 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.