Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
CrosschainForwarder
Compiler Version
v0.8.7+commit.e28d00a7
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.7;
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol";
import "./interfaces/IDeBridgeGate.sol";
import "./interfaces/ICrossChainForwarder.sol";
import "./libraries/SignatureUtil.sol";
import "./ForwarderBase.sol";
contract CrosschainForwarder is ForwarderBase, ICrossChainForwarder {
using SafeERC20Upgradeable for IERC20Upgradeable;
using SignatureUtil for bytes;
address public constant NATIVE_TOKEN = address(0);
IDeBridgeGate public deBridgeGate;
mapping(address => bool) public supportedRouters;
/* ========== Events ========== */
event SupportedRouter(address srcSwapRouter, bool isSupported);
/* ========== ERRORS ========== */
// swap router didn't put target tokens on this (forwarder's) address
error SwapEmptyResult(address srcTokenOut);
error SwapFailed(address srcRouter);
error NotEnoughSrcFundsIn(uint256 amount);
error NotSupportedRouter();
/* ========== INITIALIZERS ========== */
function initialize(IDeBridgeGate _deBridgeGate) external initializer {
ForwarderBase.initializeBase();
deBridgeGate = _deBridgeGate;
}
/* ========== PUBLIC METHODS ========== */
function sendV2(
address _srcTokenIn,
uint256 _srcAmountIn,
bytes memory _srcTokenInPermit,
GateParams memory _gateParams
) external payable override {
_obtainSrcTokenIn(_srcTokenIn, _srcAmountIn, _srcTokenInPermit);
_sendToBridge(_srcTokenIn, _srcAmountIn, msg.value, _gateParams);
}
function sendV3(
address _srcTokenIn,
uint256 _srcAmountIn,
bytes memory _srcTokenInPermit,
uint256 _affiliateFeeAmount,
address _affiliateFeeRecipient,
GateParams memory _gateParams
) external payable override {
_obtainSrcTokenIn(_srcTokenIn, _srcAmountIn, _srcTokenInPermit);
(uint256 srcAmountInAfterFee, uint256 msgValueAfterFee) = _distributeAffiliateFee(
_srcTokenIn,
_srcAmountIn,
_affiliateFeeAmount,
_affiliateFeeRecipient
);
_sendToBridge(_srcTokenIn, srcAmountInAfterFee, msgValueAfterFee, _gateParams);
}
function swapAndSendV3(
address _srcTokenIn,
uint256 _srcAmountIn,
bytes memory _srcTokenInPermit,
uint256 _affiliateFeeAmount,
address _affiliateFeeRecipient,
address _srcSwapRouter,
bytes calldata _srcSwapCalldata,
address _srcTokenOut,
GateParams memory _gateParams
) external payable override {
_obtainSrcTokenIn(_srcTokenIn, _srcAmountIn, _srcTokenInPermit);
(uint256 srcAmountInAfterFee, uint256 msgValueAfterFee) = _distributeAffiliateFee(
_srcTokenIn,
_srcAmountIn,
_affiliateFeeAmount,
_affiliateFeeRecipient
);
(uint256 srcAmountOut, uint256 msgValueAfterSwap) = _performSwap(
_srcTokenIn,
srcAmountInAfterFee,
msgValueAfterFee,
_srcSwapRouter,
_srcSwapCalldata,
_srcTokenOut
);
_sendToBridge(_srcTokenOut, srcAmountOut, msgValueAfterSwap, _gateParams);
}
function swapAndSendV2(
address _srcTokenIn,
uint256 _srcAmountIn,
bytes memory _srcTokenInPermit,
address _srcSwapRouter,
bytes calldata _srcSwapCalldata,
address _srcTokenOut,
GateParams memory _gateParams
) external payable override {
_obtainSrcTokenIn(_srcTokenIn, _srcAmountIn, _srcTokenInPermit);
(uint256 srcAmountOut, uint256 msgValueAfterSwap) = _performSwap(
_srcTokenIn,
_srcAmountIn,
msg.value,
_srcSwapRouter,
_srcSwapCalldata,
_srcTokenOut
);
_sendToBridge(_srcTokenOut, srcAmountOut, msgValueAfterSwap, _gateParams);
}
/* ========== INTERNAL METHODS ========== */
function _distributeAffiliateFee(
address _srcTokenIn,
uint256 _srcAmountIn,
uint256 _affiliateFeeAmount,
address _affiliateFeeRecipient
) internal returns (uint256 srcAmountInCleared, uint256 msgValueInCleared) {
srcAmountInCleared = _srcAmountIn;
msgValueInCleared = msg.value;
if (_affiliateFeeAmount > 0 && _affiliateFeeRecipient != address(0)) {
// cut off fee from srcAmountInCleared
srcAmountInCleared -= _affiliateFeeAmount;
if (_srcTokenIn == NATIVE_TOKEN) {
// reduce value as well!
msgValueInCleared -= _affiliateFeeAmount;
(bool success, ) = _affiliateFeeRecipient.call{
value: _affiliateFeeAmount
}("");
if (!success) {
revert AffiliateFeeDistributionFailed(
_affiliateFeeRecipient,
NATIVE_TOKEN,
_affiliateFeeAmount
);
}
} else {
IERC20Upgradeable(_srcTokenIn).safeTransfer(
_affiliateFeeRecipient,
_affiliateFeeAmount
);
}
}
}
function _obtainSrcTokenIn(
address _srcTokenIn,
uint256 _srcAmountIn,
bytes memory _srcTokenInPermit
) internal {
if (_srcTokenIn == NATIVE_TOKEN) {
if (!(address(this).balance > _srcAmountIn))
revert NotEnoughSrcFundsIn(_srcAmountIn);
} else {
uint256 srcAmountCleared = _collectSrcERC20In(
IERC20Upgradeable(_srcTokenIn),
_srcAmountIn,
_srcTokenInPermit
);
if (srcAmountCleared < _srcAmountIn)
revert NotEnoughSrcFundsIn(_srcAmountIn);
}
}
function _performSwap(
address _srcTokenIn,
uint256 _srcAmountIn,
uint256 _msgValue,
address _srcSwapRouter,
bytes calldata _srcSwapCalldata,
address _srcTokenOut
) internal returns (uint256 srcAmountOut, uint256 msgValueAfterSwap) {
if (!supportedRouters[_srcSwapRouter]) revert NotSupportedRouter();
uint256 ethBalanceBefore = address(this).balance - _msgValue;
if (_srcTokenIn == NATIVE_TOKEN) {
srcAmountOut = _swapToERC20Via(
_srcSwapRouter,
_srcSwapCalldata,
_srcAmountIn,
IERC20Upgradeable(_srcTokenOut)
);
} else {
IERC20Upgradeable(_srcTokenIn).safeApprove(
_srcSwapRouter,
_srcAmountIn
);
if (_srcTokenOut == NATIVE_TOKEN) {
srcAmountOut = _swapToETHVia(_srcSwapRouter, _srcSwapCalldata);
} else {
srcAmountOut = _swapToERC20Via(
_srcSwapRouter,
_srcSwapCalldata,
0, /*value*/
IERC20Upgradeable(_srcTokenOut)
);
}
IERC20Upgradeable(_srcTokenIn).safeApprove(_srcSwapRouter, 0);
}
msgValueAfterSwap = address(this).balance - ethBalanceBefore;
}
function _collectSrcERC20In(
IERC20Upgradeable _token,
uint256 _amount,
bytes memory _permit
) internal returns (uint256) {
// call permit before transferring token
if (_permit.length > 0) {
uint256 deadline = _permit.toUint256(0);
(bytes32 r, bytes32 s, uint8 v) = _permit.parseSignature(32);
IERC20Permit(address(_token)).permit(
msg.sender,
address(this),
_amount,
deadline,
v,
r,
s
);
}
uint256 balanceBefore = _token.balanceOf(address(this));
_token.safeTransferFrom(msg.sender, address(this), _amount);
uint256 balanceAfter = _token.balanceOf(address(this));
if (!(balanceAfter > balanceBefore))
revert NotEnoughSrcFundsIn(_amount);
return (balanceAfter - balanceBefore);
}
function _swapToETHVia(address _router, bytes calldata _calldata)
internal
returns (uint256)
{
uint256 balanceBefore = address(this).balance;
bool success = _externalCall(_router, _calldata, 0);
if (!success) {
revert SwapFailed(_router);
}
uint256 balanceAfter = address(this).balance;
if (balanceBefore >= balanceAfter) revert SwapEmptyResult(address(0));
uint256 swapDstTokenBalance = balanceAfter - balanceBefore;
return swapDstTokenBalance;
}
function _swapToERC20Via(
address _router,
bytes calldata _calldata,
uint256 _msgValue,
IERC20Upgradeable _targetToken
) internal returns (uint256) {
uint256 balanceBefore = _targetToken.balanceOf(address(this));
bool success = _externalCall(_router, _calldata, _msgValue);
if (!success) {
revert SwapFailed(_router);
}
uint256 balanceAfter = _targetToken.balanceOf(address(this));
if (balanceBefore >= balanceAfter)
revert SwapEmptyResult(address(_targetToken));
uint256 swapDstTokenBalance = balanceAfter - balanceBefore;
return swapDstTokenBalance;
}
function _sendToBridge(
address token,
uint256 amount,
uint256 _msgValue,
GateParams memory _gateParams
) internal {
// remember balance to correctly calc the change
uint256 ethBalanceBefore = address(this).balance - _msgValue;
if (token != NATIVE_TOKEN) {
// allow deBridge gate to take all these wrapped tokens
IERC20Upgradeable(token).safeApprove(address(deBridgeGate), amount);
}
// send to deBridge gate
deBridgeGate.send{value: _msgValue}(
token, // _tokenAddress
amount, // _amount
_gateParams.chainId, // _chainIdTo
abi.encodePacked(_gateParams.receiver), // _receiver
"", // _permit
_gateParams.useAssetFee, // _useAssetFee
_gateParams.referralCode, // _referralCode
_gateParams.autoParams // _autoParams
);
if (token != NATIVE_TOKEN) {
// turn off allowance
IERC20Upgradeable(token).safeApprove(address(deBridgeGate), 0);
}
// return change, if any
if (address(this).balance > ethBalanceBefore) {
_safeTransferETH(
msg.sender,
address(this).balance - ethBalanceBefore
);
}
}
function updateSupportedRouter(address _srcSwapRouter, bool _isSupported)
external
onlyAdmin
{
supportedRouters[_srcSwapRouter] = _isSupported;
emit SupportedRouter(_srcSwapRouter, _isSupported);
}
// ============ Version Control ============
/// @dev Get this contract's version
function version() external pure returns (uint256) {
return 131; // 1.3.1
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20Upgradeable {
/**
* @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.7.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20Upgradeable.sol";
import "../extensions/draft-IERC20PermitUpgradeable.sol";
import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {
using AddressUpgradeable for address;
function safeTransfer(
IERC20Upgradeable token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20Upgradeable 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(
IERC20Upgradeable token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20Upgradeable token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20Upgradeable token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safePermit(
IERC20PermitUpgradeable 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(IERC20Upgradeable token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
interface IDeBridgeGate {
/* ========== STRUCTS ========== */
struct TokenInfo {
uint256 nativeChainId;
bytes nativeAddress;
}
struct DebridgeInfo {
uint256 chainId; // native chain id
uint256 maxAmount; // maximum amount to transfer
uint256 balance; // total locked assets
uint256 lockedInStrategies; // total locked assets in strategy (AAVE, Compound, etc)
address tokenAddress; // asset address on the current chain
uint16 minReservesBps; // minimal hot reserves in basis points (1/10000)
bool exist;
}
struct DebridgeFeeInfo {
uint256 collectedFees; // total collected fees
uint256 withdrawnFees; // fees that already withdrawn
mapping(uint256 => uint256) getChainFee; // whether the chain for the asset is supported
}
struct ChainSupportInfo {
uint256 fixedNativeFee; // transfer fixed fee
bool isSupported; // whether the chain for the asset is supported
uint16 transferFeeBps; // transfer fee rate nominated in basis points (1/10000) of transferred amount
}
struct DiscountInfo {
uint16 discountFixBps; // fix discount in BPS
uint16 discountTransferBps; // transfer % discount in BPS
}
/// @param executionFee Fee paid to the transaction executor.
/// @param fallbackAddress Receiver of the tokens if the call fails.
struct SubmissionAutoParamsTo {
uint256 executionFee;
uint256 flags;
bytes fallbackAddress;
bytes data;
}
/// @param executionFee Fee paid to the transaction executor.
/// @param fallbackAddress Receiver of the tokens if the call fails.
struct SubmissionAutoParamsFrom {
uint256 executionFee;
uint256 flags;
address fallbackAddress;
bytes data;
bytes nativeSender;
}
struct FeeParams {
uint256 receivedAmount;
uint256 fixFee;
uint256 transferFee;
bool useAssetFee;
bool isNativeToken;
}
/* ========== PUBLIC VARS GETTERS ========== */
/// @dev Returns whether the transfer with the submissionId was claimed.
/// submissionId is generated in getSubmissionIdFrom
function isSubmissionUsed(bytes32 submissionId) external returns (bool);
/* ========== FUNCTIONS ========== */
function callProxy() external returns (address);
/// @dev This method is used for the transfer of assets [from the native chain](https://docs.debridge.finance/the-core-protocol/transfers#transfer-from-native-chain).
/// It locks an asset in the smart contract in the native chain and enables minting of deAsset on the secondary chain.
/// @param _tokenAddress Asset identifier.
/// @param _amount Amount to be transferred (note: the fee can be applied).
/// @param _chainIdTo Chain id of the target chain.
/// @param _receiver Receiver address.
/// @param _permit deadline + signature for approving the spender by signature.
/// @param _useAssetFee use assets fee for pay protocol fix (work only for specials token)
/// @param _referralCode Referral code
/// @param _autoParams Auto params for external call in target network
function send(
address _tokenAddress,
uint256 _amount,
uint256 _chainIdTo,
bytes memory _receiver,
bytes memory _permit,
bool _useAssetFee,
uint32 _referralCode,
bytes calldata _autoParams
) external payable;
/// @dev Is used for transfers [into the native chain](https://docs.debridge.finance/the-core-protocol/transfers#transfer-from-secondary-chain-to-native-chain)
/// to unlock the designated amount of asset from collateral and transfer it to the receiver.
/// @param _debridgeId Asset identifier.
/// @param _amount Amount of the transferred asset (note: the fee can be applied).
/// @param _chainIdFrom Chain where submission was sent
/// @param _receiver Receiver address.
/// @param _nonce Submission id.
/// @param _signatures Validators signatures to confirm
/// @param _autoParams Auto params for external call
function claim(
bytes32 _debridgeId,
uint256 _amount,
uint256 _chainIdFrom,
address _receiver,
uint256 _nonce,
bytes calldata _signatures,
bytes calldata _autoParams
) external;
/// @dev Get a flash loan, msg.sender must implement IFlashCallback
/// @param _tokenAddress An asset to loan
/// @param _receiver Where funds should be sent
/// @param _amount Amount to loan
/// @param _data Data to pass to sender's flashCallback function
function flash(
address _tokenAddress,
address _receiver,
uint256 _amount,
bytes memory _data
) external;
/// @dev Get reserves of a token available to use in defi
/// @param _tokenAddress Token address
function getDefiAvaliableReserves(address _tokenAddress)
external
view
returns (uint256);
/// @dev Request the assets to be used in DeFi protocol.
/// @param _tokenAddress Asset address.
/// @param _amount Amount of tokens to request.
function requestReserves(address _tokenAddress, uint256 _amount) external;
/// @dev Return the assets that were used in DeFi protocol.
/// @param _tokenAddress Asset address.
/// @param _amount Amount of tokens to claim.
function returnReserves(address _tokenAddress, uint256 _amount) external;
/// @dev Withdraw collected fees to feeProxy
/// @param _debridgeId Asset identifier.
function withdrawFee(bytes32 _debridgeId) external;
/// @dev Get native chain id and native address of a token
/// @param currentTokenAddress address of a token on the current chain
function getNativeTokenInfo(address currentTokenAddress)
external
view
returns (uint256 chainId, bytes memory nativeAddress);
/// @dev Returns asset fixed fee value for specified debridge and chainId.
/// @param _debridgeId Asset identifier.
/// @param _chainId Chain id.
function getDebridgeChainAssetFixedFee(
bytes32 _debridgeId,
uint256 _chainId
) external view returns (uint256);
/* ========== EVENTS ========== */
/// @dev Emitted once the tokens are sent from the original(native) chain to the other chain; the transfer tokens
/// are expected to be claimed by the users.
event Sent(
bytes32 submissionId,
bytes32 indexed debridgeId,
uint256 amount,
bytes receiver,
uint256 nonce,
uint256 indexed chainIdTo,
uint32 referralCode,
FeeParams feeParams,
bytes autoParams,
address nativeSender
// bool isNativeToken //added to feeParams
);
/// @dev Emitted once the tokens are transferred and withdrawn on a target chain
event Claimed(
bytes32 submissionId,
bytes32 indexed debridgeId,
uint256 amount,
address indexed receiver,
uint256 nonce,
uint256 indexed chainIdFrom,
bytes autoParams,
bool isNativeToken
);
/// @dev Emitted when new asset support is added.
event PairAdded(
bytes32 debridgeId,
address tokenAddress,
bytes nativeAddress,
uint256 indexed nativeChainId,
uint256 maxAmount,
uint16 minReservesBps
);
/// @dev Emitted when the asset is allowed/disallowed to be transferred to the chain.
event ChainSupportUpdated(
uint256 chainId,
bool isSupported,
bool isChainFrom
);
/// @dev Emitted when the supported chains are updated.
event ChainsSupportUpdated(
uint256 chainIds,
ChainSupportInfo chainSupportInfo,
bool isChainFrom
);
/// @dev Emitted when the new call proxy is set.
event CallProxyUpdated(address callProxy);
/// @dev Emitted when the transfer request is executed.
event AutoRequestExecuted(
bytes32 submissionId,
bool indexed success,
address callProxy
);
/// @dev Emitted when a submission is blocked.
event Blocked(bytes32 submissionId);
/// @dev Emitted when a submission is unblocked.
event Unblocked(bytes32 submissionId);
/// @dev Emitted when a flash loan is successfully returned.
event Flash(
address sender,
address indexed tokenAddress,
address indexed receiver,
uint256 amount,
uint256 paid
);
/// @dev Emitted when fee is withdrawn.
event WithdrawnFee(bytes32 debridgeId, uint256 fee);
/// @dev Emitted when globalFixedNativeFee and globalTransferFeeBps are updated.
event FixedNativeFeeUpdated(
uint256 globalFixedNativeFee,
uint256 globalTransferFeeBps
);
/// @dev Emitted when globalFixedNativeFee is updated by feeContractUpdater
event FixedNativeFeeAutoUpdated(uint256 globalFixedNativeFee);
}//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.7;
interface ICrossChainForwarder {
error AffiliateFeeDistributionFailed(
address recipient,
address token,
uint256 amount
);
struct GateParams {
uint256 chainId;
address receiver;
bool useAssetFee;
uint32 referralCode;
bytes autoParams;
}
/// @dev Takes `_srcTokenInAmount` of `_srcTokenIn` from the msg.sender (executing `_srcTokenInPermit` if given),
/// swaps `_srcTokenIn` to `_srcTokenOut` by `CALL`-ing `_srcSwapCalldata` against `_srcSwapRouter`,
/// and finally sends the result of a swap to deBridge gate using the given gateParams
/// @notice Since 1.2.0
function swapAndSendV2(
address _srcTokenIn,
uint256 _srcTokenInAmount,
bytes memory _srcTokenInPermit,
address _srcSwapRouter,
bytes calldata _srcSwapCalldata,
address _srcTokenOut,
GateParams memory _gateParams
) external payable;
/// @dev Takes `_srcTokenInAmount` of `_srcTokenIn` from the msg.sender (executing `_srcTokenInPermit` if given),
/// cuts off the `affiliateFeeAmount` of `_srcTokenIn` sending this fee to `affiliateFeeRecipient` (if given),
/// swaps `_srcTokenIn` to `_srcTokenOut` by `CALL`-ing `_srcSwapCalldata` against `_srcSwapRouter`,
/// and finally sends the result of a swap to deBridge gate using the given gateParams
/// @notice Since 1.3.0
function swapAndSendV3(
address _srcTokenIn,
uint256 _srcTokenInAmount,
bytes memory _srcTokenInPermit,
uint256 _affiliateFeeAmount,
address _affiliateFeeRecipient,
address _srcSwapRouter,
bytes calldata _srcSwapCalldata,
address _srcTokenOut,
GateParams memory _gateParams
) external payable;
/// @dev Takes `_srcTokenInAmount` of `_srcTokenIn` from the msg.sender (executing `_srcTokenInPermit` if given),
/// and finally sends the resulting amount to deBridge gate using the given gateParams
/// @notice Since 1.3.0
function sendV2(
address _srcTokenIn,
uint256 _srcTokenInAmount,
bytes memory _srcTokenInPermit,
GateParams memory _gateParams
) external payable;
/// @dev Takes `_srcTokenInAmount` of `_srcTokenIn` from the msg.sender (executing `_srcTokenInPermit` if given),
/// cuts off the `affiliateFeeAmount` of `_srcTokenIn` sending this fee to `affiliateFeeRecipient` (if given),
/// and finally sends the resulting amount to deBridge gate using the given gateParams
/// @notice Since 1.3.0
function sendV3(
address _srcTokenIn,
uint256 _srcTokenInAmount,
bytes memory _srcTokenInPermit,
uint256 _affiliateFeeAmount,
address _affiliateFeeRecipient,
GateParams memory _gateParams
) external payable;
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.7;
library SignatureUtil {
/* ========== ERRORS ========== */
error WrongArgumentLength();
error SignatureInvalidLength();
error SignatureInvalidV();
/// @dev Prepares raw msg that was signed by the oracle.
/// @param _submissionId Submission identifier.
function getUnsignedMsg(bytes32 _submissionId) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", _submissionId));
}
/// @dev Splits signature bytes to r,s,v components.
/// @param _signature Signature bytes in format r+s+v.
function splitSignature(bytes memory _signature)
internal
pure
returns (
bytes32 r,
bytes32 s,
uint8 v
)
{
if (_signature.length != 65) revert SignatureInvalidLength();
return parseSignature(_signature, 0);
}
function parseSignature(bytes memory _signatures, uint256 offset)
internal
pure
returns (
bytes32 r,
bytes32 s,
uint8 v
)
{
assembly {
r := mload(add(_signatures, add(32, offset)))
s := mload(add(_signatures, add(64, offset)))
v := and(mload(add(_signatures, add(65, offset))), 0xff)
}
if (v < 27) v += 27;
if (v != 27 && v != 28) revert SignatureInvalidV();
}
function toUint256(bytes memory _bytes, uint256 _offset)
internal
pure
returns (uint256 result)
{
if (_bytes.length < _offset + 32) revert WrongArgumentLength();
assembly {
result := mload(add(add(_bytes, 0x20), _offset))
}
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.7;
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
contract ForwarderBase is Initializable, AccessControlUpgradeable {
/* ========== ERRORS ========== */
error EthTransferFailed();
error AdminBadRole();
/* ========== MODIFIERS ========== */
modifier onlyAdmin() {
if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert AdminBadRole();
_;
}
/* ========== INITIALIZERS ========== */
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() {
_disableInitializers();
}
function initializeBase() internal initializer {
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
}
function _externalCall(
address _destination,
bytes memory _data,
uint256 _value
) internal returns (bool result) {
assembly {
result := call(
gas(),
_destination,
_value,
add(_data, 0x20),
mload(_data),
0,
0
)
}
}
/*
* @dev transfer ETH to an address, revert if it fails.
* @param to recipient of the transfer
* @param value the amount to send
*/
function _safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{value: value}(new bytes(0));
if (!success) revert EthTransferFailed();
}
receive() external payable {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20PermitUpgradeable {
/**
* @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.7.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
* initialization step. This is essential to configure modules that are added through upgrades and that require
* initialization.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized < type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it.
*/
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {
function __AccessControl_init() internal onlyInitializing {
}
function __AccessControl_init_unchained() internal onlyInitializing {
}
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
StringsUpgradeable.toHexString(uint160(account), 20),
" is missing role ",
StringsUpgradeable.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControlUpgradeable {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library StringsUpgradeable {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
function __ERC165_init() internal onlyInitializing {
}
function __ERC165_init_unchained() internal onlyInitializing {
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165Upgradeable).interfaceId;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165Upgradeable {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.7;
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import "./interfaces/IReceivingForwarder.sol";
import "./libraries/SwapCalldataUtils.sol";
import "./ForwarderBase.sol";
contract ReceivingForwarder is ForwarderBase, IReceivingForwarder {
using SwapCalldataUtils for bytes;
using AddressUpgradeable for address;
using SafeERC20Upgradeable for IERC20Upgradeable;
address public constant NATIVE_TOKEN = address(0);
/* ========== ERRORS ========== */
error SwapFailed(address dstRouter);
/* ========== INITIALIZERS ========== */
function initialize() external initializer {
ForwarderBase.initializeBase();
}
/* ========== FORWARDER METHOD ========== */
function forward(
address _dstTokenIn,
address _router,
bytes memory _routerCalldata,
address _dstTokenOut,
address _fallbackAddress
) external payable override {
if (_dstTokenIn == NATIVE_TOKEN) {
return _forwardFromETH(
_router,
_routerCalldata,
new uint16[](0),
_dstTokenOut,
_fallbackAddress
);
}
else {
return _forwardFromERC20(
IERC20Upgradeable(_dstTokenIn),
_router,
_routerCalldata,
new uint16[](0),
_dstTokenOut,
_fallbackAddress
);
}
}
function forwardUniversal(
address _dstTokenIn,
address _router,
bytes memory _routerCalldata,
uint16[] memory _routerAmountPositions,
address _dstTokenOut,
address _fallbackAddress
) external payable override {
if (_dstTokenIn == NATIVE_TOKEN) {
return _forwardFromETH(
_router,
_routerCalldata,
_routerAmountPositions,
_dstTokenOut,
_fallbackAddress
);
}
else {
return _forwardFromERC20(
IERC20Upgradeable(_dstTokenIn),
_router,
_routerCalldata,
_routerAmountPositions,
_dstTokenOut,
_fallbackAddress
);
}
}
/* ========== INTERNAL METHODS ========== */
function _forwardFromETH(
address _router,
bytes memory _routerCalldata,
uint16[] memory _routerAmountPositions,
address _dstTokenOut,
address _fallbackAddress
) internal {
uint correction = address(this).balance - msg.value;
uint dstTokenInAmount = msg.value;
_forward(
NATIVE_TOKEN,
dstTokenInAmount,
_router,
_routerCalldata,
_routerAmountPositions,
_dstTokenOut,
_fallbackAddress
);
if(address(this).balance > correction) {
_safeTransferETH(_fallbackAddress, address(this).balance - correction);
}
}
function _forwardFromERC20(
IERC20Upgradeable dstTokenIn,
address _router,
bytes memory _routerCalldata,
uint16[] memory _routerAmountPositions,
address _dstTokenOut,
address _fallbackAddress
) internal {
// 1. Grab tokens from the gate
uint correction = dstTokenIn.balanceOf(address(this));
uint dstTokenInAmount = dstTokenIn.balanceOf(msg.sender);
dstTokenIn.safeTransferFrom(
msg.sender,
address(this),
dstTokenInAmount
);
dstTokenInAmount = dstTokenIn.balanceOf(address(this)) - correction;
_customApprove(dstTokenIn, _router, dstTokenInAmount);
_forward(
address(dstTokenIn),
dstTokenInAmount,
_router,
_routerCalldata,
_routerAmountPositions,
_dstTokenOut,
_fallbackAddress
);
// finalize
dstTokenIn.safeApprove(_router, 0);
uint postBalance = dstTokenIn.balanceOf(address(this));
if (postBalance > correction) {
dstTokenIn.safeTransfer(_fallbackAddress, postBalance - correction);
}
}
function _customApprove(IERC20Upgradeable token, address spender, uint value) internal {
bytes memory returndata = address(token).functionCall(
abi.encodeWithSelector(token.approve.selector, spender, value),
"ERC20 approve failed"
);
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "ERC20 operation did not succeed");
}
}
function _forwardToETH(
address _router,
bytes memory _routerCalldata,
address _fallbackAddress
) internal {
uint balanceBefore = address(this).balance;
// value=0 because it's obvious that we won't need ETH to swap to ETH
// (i.e., impossible: dstTokenIn == dstTokenOut == address(0))
bool success = _externalCall(_router, _routerCalldata, 0);
if (!success) {
revert SwapFailed(_router);
}
uint balanceAfter = address(this).balance;
if (balanceAfter > balanceBefore) {
_safeTransferETH(_fallbackAddress, balanceAfter - balanceBefore);
}
}
function _forwardToERC20(
uint256 dstAmountIn,
address _router,
bytes memory _routerCalldata,
IERC20Upgradeable dstTokenOut,
address _fallbackAddress
) internal {
uint balanceBefore = dstTokenOut.balanceOf(address(this));
bool success = _externalCall(_router, _routerCalldata, dstAmountIn);
if (!success) {
revert SwapFailed(_router);
}
uint balanceAfter = dstTokenOut.balanceOf(address(this));
if (balanceAfter > balanceBefore) {
dstTokenOut.safeTransfer(
_fallbackAddress,
balanceAfter - balanceBefore
);
}
}
function _forward(
address _dstTokenIn,
uint256 _dstAmountIn,
address _router,
bytes memory _routerCalldata,
uint16[] memory _routerAmountPositions,
address _dstTokenOut,
address _fallbackAddress
) internal {
bytes memory patchedCalldata;
bool success;
if (_routerAmountPositions.length > 0) {
patchedCalldata = _routerCalldata;
for (
uint16 i = 0;
i < _routerAmountPositions.length;
i += 1
) {
(patchedCalldata, success) = patchedCalldata.patchAt(
_dstAmountIn,
_routerAmountPositions[i]
);
if (!success) break;
}
}
else {
(patchedCalldata, success) = _routerCalldata.patch(
_dstAmountIn
);
}
if (!success) {
return;
}
if (_dstTokenOut == NATIVE_TOKEN) {
return _forwardToETH(
_router,
patchedCalldata,
_fallbackAddress
);
}
else if (_dstTokenIn == NATIVE_TOKEN) {
return _forwardToERC20(
_dstAmountIn,
_router,
patchedCalldata,
IERC20Upgradeable(_dstTokenOut),
_fallbackAddress
);
}
else {
return _forwardToERC20(
0,
_router,
patchedCalldata,
IERC20Upgradeable(_dstTokenOut),
_fallbackAddress
);
}
}
// ============ Version Control ============
/// @dev Get this contract's version
function version() external pure returns (uint256) {
return 121; // 1.2.1
}
}//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.7;
interface IReceivingForwarder {
function forward(
address _dstTokenIn,
address _router,
bytes memory _routerCalldata,
address _dstTokenOut,
address _fallbackAddress
) external payable;
function forwardUniversal(
address _dstTokenIn,
address _router,
bytes memory _routerCalldata,
uint16[] memory _routerAmountPositions,
address _dstTokenOut,
address _fallbackAddress
) external payable;
}// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.7;
import "./CalldataUtils.sol";
library SwapCalldataUtils {
using CalldataUtils for bytes;
bytes4 public constant SWAP_SELECTOR = 0x7c025200;
bytes4 public constant UNOSWAP_SELECTOR = 0x2e95b6c8;
bytes4 public constant UNOSWAPV3_SELECTOR = 0xe449022e;
bytes4 public constant FILLORDERRFQ_SELECTOR = 0xd0a3b665;
bytes4 public constant CLIPPERSWAP_SELECTOR = 0xb0431182;
bytes4 public constant YY_SWAP_NO_SPLIT = 0x6bf2df86;
bytes4 public constant YY_SWAP_NO_SPLIT_FROM_AVAX = 0xfe38c5e6;
bytes4 public constant YY_SWAP_NO_SPLIT_TO_AVAX = 0xf0350382;
function patchAt(bytes memory _data, uint256 amount, uint16 pos)
internal
pure
returns (bytes memory patchedData, bool success)
{
if (_data.length >= pos + 32) {
success = true;
patchedData = bytes.concat(
_data.slice(0, pos), // _data[:pos],
abi.encodePacked(amount),
_data.slice(pos + 32, _data.length - (pos + 32)) //_data[pos+32:]
);
}
}
function patch(bytes memory _data, uint256 amount)
internal
pure
returns (bytes memory patchedData, bool success)
{
bytes4 sig = _data.getSig();
(uint256 pos, bool success_) = getAmountPos(sig);
if (success_ && _data.length >= pos + 32) {
success = true;
patchedData = bytes.concat(
_data.slice(0, pos), // _data[:pos],
abi.encodePacked(amount),
_data.slice(pos + 32, _data.length - (pos + 32)) //_data[pos+32:]
);
}
}
function getAmount(bytes memory _data)
internal
pure
returns (uint256 amount, bool success)
{
(uint256 pos, bool amountSuccess) = getAmountPos(_data.getSig());
if (!amountSuccess || _data.length < pos + 32) {
return (0, false);
}
assembly {
amount := mload(add(_data, add(0x20, pos)))
}
success = true;
}
function getAmountPos(bytes4 sig)
internal
pure
returns (uint256 pos, bool success)
{
success = true;
if (sig == SWAP_SELECTOR) {
// 456
pos = 228;
} else if (sig == UNOSWAP_SELECTOR) {
// 72
pos = 36;
} else if (sig == UNOSWAPV3_SELECTOR) {
// 8
pos = 4;
} else if (sig == FILLORDERRFQ_SELECTOR) {
// 584
pos = 292;
} else if (sig == CLIPPERSWAP_SELECTOR) {
//136
pos = 68;
} else if (sig == YY_SWAP_NO_SPLIT || sig == YY_SWAP_NO_SPLIT_FROM_AVAX || sig == YY_SWAP_NO_SPLIT_TO_AVAX) {
// 200
pos = 100;
} else {
success = false;
}
}
}// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.7;
// Gas efficient calldata parser
// https://github.com/ethereum/solidity/issues/9439#issuecomment-660134770
library CalldataUtils {
function getSig(bytes memory _data) internal pure returns (bytes4 sig) {
assembly {
sig := mload(add(_data, 32))
}
}
function slice(
bytes memory _bytes,
uint256 _start,
uint256 _length
) internal pure returns (bytes memory) {
require(_bytes.length >= (_start + _length));
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)
mstore(0x40, add(tempBytes, 0x20))
}
}
return tempBytes;
}
}//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../libraries/SwapCalldataUtils.sol";
contract TargetTokenHolder {
using SafeERC20 for IERC20;
using SwapCalldataUtils for bytes;
address targetToken;
constructor(address targetToken_) {
targetToken = targetToken_;
}
// called for any calldata (see SAMPLE_CALLDATA in src/SwapCalldataParser.js)
// thus emulating real-world pool/router behavior
fallback (bytes calldata _input) external returns (bytes memory) {
(uint256 amount, bool success) = _input.getAmount();
if (success) {
IERC20(targetToken).transferFrom(msg.sender, address(this), amount);
}
}
function obtain(address _wrappedToken) external {
IERC20 wrappedToken = IERC20(_wrappedToken);
wrappedToken.transferFrom(
msg.sender,
address(this),
wrappedToken.balanceOf(msg.sender)
);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev 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) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}pragma solidity ^0.8.7;
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../interfaces/ICurve.sol";
import "../libraries/SwapCalldataUtils.sol";
import "../libraries/Flags.sol";
contract DummyPool is ICurve {
using SwapCalldataUtils for bytes;
address public tokenA;
address public tokenB;
constructor(address _tokenA, address _tokenB) {
tokenA = _tokenA;
tokenB = _tokenB;
}
// called for any calldata (see SAMPLE_CALLDATA in src/SwapCalldataParser.js)
// thus emulating real-world pool/router behavior
fallback (bytes calldata _input) external returns (bytes memory) {
// pick token where msg.sender have positive balance
address token = IERC20(tokenA).balanceOf(msg.sender) > 0
? tokenA
: tokenB;
require(IERC20(token).balanceOf(msg.sender) > 0, "unexpected zeroes");
// extract amount from the calldata
(uint256 amount, bool success) = _input.getAmount();
if (success) {
(IERC20 srcToken, IERC20 dstToken) = _getSrcAndDst(token);
_swap(srcToken, dstToken, msg.sender, msg.sender, amount);
}
}
function swap(
address token,
address from,
address to,
uint256 amount
) external returns (uint256) {
(IERC20 srcToken, IERC20 dstToken) = _getSrcAndDst(token);
return _swap(srcToken, dstToken, from, to, amount);
}
function swap(
address token,
address from,
address to
) external returns (uint256) {
(IERC20 srcToken, IERC20 dstToken) = _getSrcAndDst(token);
uint256 amount = srcToken.balanceOf(from);
return _swap(srcToken, dstToken, from, to, amount);
}
function exchange_underlying(
int128 _i,
int128 _j,
uint256 _dx,
uint256 _min_dy
) external override returns (uint256) {
address token = _i == 0 ? tokenA : tokenB;
(IERC20 srcToken, IERC20 dstToken) = _getSrcAndDst(token);
return _swap(srcToken, dstToken, msg.sender, msg.sender, _dx);
}
function exchange_underlying(
address _pool,
int128 _i,
int128 _j,
uint256 _dx,
uint256 _min_dy,
address _receiver
) external override returns (uint256) {
address token = _i == 0 ? tokenA : tokenB;
(IERC20 srcToken, IERC20 dstToken) = _getSrcAndDst(token);
return _swap(srcToken, dstToken, msg.sender, _receiver, _dx);
// address token = _i == 0 ? tokenA : tokenB;
// (IERC20 srcToken, IERC20 dstToken) = _getSrcAndDst(token);
// srcToken.transferFrom(msg.sender, address(this), _dx);
// uint amount = ICurve(_pool).exchange_underlying(_i, _j, _dx, _min_dy);
// if (amount > 0) {
// dstToken.transfer(_receiver, amount);
// }
// else {
// srcToken.transfer(msg.sender, _dx);
// }
}
function _getSrcAndDst(address _srcToken)
internal
view
returns (IERC20 srcToken, IERC20 dstToken)
{
srcToken = IERC20(tokenA);
dstToken = IERC20(tokenB);
if (_srcToken == address(dstToken)) {
dstToken = srcToken;
srcToken = IERC20(_srcToken);
} else {
require(_srcToken == address(srcToken));
}
}
function _swap(
IERC20 srcToken,
IERC20 dstToken,
address from,
address to,
uint256 amount
) internal returns (uint256) {
uint256 amountOut = amount - amount / 100;
if (dstToken.balanceOf(address(this)) > amountOut) {
srcToken.transferFrom(from, address(this), amount);
dstToken.transfer(to, amount - amount / 100);
return amountOut;
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(
address from,
address to,
uint256 amount
) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
}
_balances[to] += amount;
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.7;
interface ICurve {
function exchange_underlying(
int128 _i,
int128 _j,
uint256 _dx,
uint256 _min_dy
) external returns (uint256);
// @external
// def exchange_underlying(
// _pool: address,
// _i: int128,
// _j: int128,
// _dx: uint256,
// _min_dy: uint256,
// _receiver: address = msg.sender,
// _use_underlying: bool = True
// ) -> uint256:
function exchange_underlying(
address _pool,
int128 _i,
int128 _j,
uint256 _dx,
uint256 _min_dy,
address _receiver
) external returns (uint256);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.7;
library Flags {
/* ========== FLAGS ========== */
/// @dev Flag to unwrap ETH
uint256 public constant UNWRAP_ETH = 0;
/// @dev Flag to revert if external call fails
uint256 public constant REVERT_IF_EXTERNAL_FAIL = 1;
/// @dev Flag to call proxy with a sender contract
uint256 public constant PROXY_WITH_SENDER = 2;
/// @dev Get flag
/// @param _packedFlags Flags packed to uint256
/// @param _flag Flag to check
function getFlag(uint256 _packedFlags, uint256 _flag)
internal
pure
returns (bool)
{
uint256 flag = (_packedFlags >> _flag) & uint256(1);
return flag == 1;
}
/// @dev Set flag
/// @param _packedFlags Flags packed to uint256
/// @param _flag Flag to set
/// @param _value Is set or not set
function setFlag(
uint256 _packedFlags,
uint256 _flag,
bool _value
) internal pure returns (uint256) {
if (_value) return _packedFlags | (uint256(1) << _flag);
else return _packedFlags & ~(uint256(1) << _flag);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}pragma solidity ^0.8.7;
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../libraries/Flags.sol";
contract DummyCallProxy {
using Flags for uint256;
using SafeERC20 for IERC20;
uint256 public submissionChainIdFrom;
bytes public submissionNativeSender;
error ExternalCallFailed();
function callERC20(
address _token,
address _reserveAddress,
address _receiver,
bytes memory _data,
uint256 _flags,
bytes memory _nativeSender,
uint256 _chainIdFrom
) external returns (bool _result) {
IERC20 token = IERC20(_token);
uint256 amount = token.balanceOf(address(this));
token.approve(_receiver, amount);
_result = externalCall(
_receiver,
0,
_data,
_nativeSender,
_chainIdFrom,
_flags.getFlag(Flags.PROXY_WITH_SENDER)
);
token.approve(_receiver, 0);
amount = token.balanceOf(address(this));
if (!_result && _flags.getFlag(Flags.REVERT_IF_EXTERNAL_FAIL)) {
revert ExternalCallFailed();
}
if (amount > 0) {
token.safeTransfer(_reserveAddress, amount);
}
}
function externalCall(
address destination,
uint256 value,
bytes memory data,
bytes memory _nativeSender,
uint256 _chainIdFrom,
bool storeSender
) internal returns (bool result) {
// Temporary write to a storage nativeSender and chainIdFrom variables.
// External contract can read them during a call if needed
if (storeSender) {
submissionChainIdFrom = _chainIdFrom;
submissionNativeSender = _nativeSender;
}
uint256 dataLength = data.length;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
result := call(
sub(gas(), 34710), // 34710 is the value that solidity is currently emitting
// It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
// callNewAccountGas (25000, in case the destination address does not exist and needs creating)
destination,
value,
d,
dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
}
// clear storage variables to get gas refund
if (storeSender) {
submissionChainIdFrom = 0;
submissionNativeSender = "";
}
}
}pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract DummyToken is ERC20 {
uint8 _decimals;
constructor(
string memory name_,
string memory symbol_,
uint8 decimals_
) ERC20(name_, symbol_) {
_decimals = decimals_;
}
function decimals() public view virtual override returns (uint8) {
return _decimals;
}
function mint(address recipient, uint256 amount) external {
_mint(recipient, amount);
}
}pragma solidity ^0.8.7;
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./DummyCallProxy.sol";
import "../interfaces/IDeBridgeGate.sol";
import "../libraries/Flags.sol";
contract DummyBridge {
using SafeERC20 for IERC20;
DummyCallProxy callProxy;
constructor(DummyCallProxy _callProxy) {
callProxy = _callProxy;
}
function getChainId() public view virtual returns (uint256 cid) {
assembly {
cid := chainid()
}
}
function send(
address _tokenAddress,
uint256 _amount,
uint256 _chainIdTo,
bytes memory _receiver,
bytes memory _permit,
bool _useAssetFee,
uint32 _referralCode,
bytes calldata _autoParams
) external {
IERC20 tokenAddress = IERC20(_tokenAddress);
IDeBridgeGate.SubmissionAutoParamsTo memory autoParams;
if (_autoParams.length > 0) {
autoParams = abi.decode(
_autoParams,
(IDeBridgeGate.SubmissionAutoParamsTo)
);
}
if (_amount > 0) {
tokenAddress.safeTransferFrom(msg.sender, address(this), _amount);
}
address receiver;
assembly {
receiver := mload(add(_receiver, 20))
}
address fallbackAddress;
bytes memory fb = autoParams.fallbackAddress;
assembly {
fallbackAddress := mload(add(fb, 20))
}
if (autoParams.data.length > 0) {
if (_amount > 0) {
uint256 fee = (_amount * 10) / 10000;
_amount -= fee;
tokenAddress.safeTransfer(address(callProxy), _amount);
}
callProxy.callERC20(
_tokenAddress,
fallbackAddress,
receiver,
autoParams.data,
autoParams.flags,
abi.encodePacked(msg.sender),
getChainId()
);
} else {
if (_amount > 0) {
uint256 fee = (_amount * 10) / 10000;
_amount -= fee;
tokenAddress.safeTransfer(receiver, _amount);
}
}
}
}// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.7;
import "../libraries/CalldataUtils.sol";
import "../libraries/SwapCalldataUtils.sol";
contract SwapCalldataMock {
using CalldataUtils for bytes;
using SwapCalldataUtils for bytes;
function patch(bytes calldata _data, uint256 amount)
external
pure
returns (bytes memory patchedData, bool success)
{
(patchedData, success) = _data.patch(amount);
}
}{
"optimizer": {
"enabled": true,
"runs": 999999
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"name":"AdminBadRole","type":"error"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AffiliateFeeDistributionFailed","type":"error"},{"inputs":[],"name":"EthTransferFailed","type":"error"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"NotEnoughSrcFundsIn","type":"error"},{"inputs":[],"name":"NotSupportedRouter","type":"error"},{"inputs":[],"name":"SignatureInvalidV","type":"error"},{"inputs":[{"internalType":"address","name":"srcTokenOut","type":"address"}],"name":"SwapEmptyResult","type":"error"},{"inputs":[{"internalType":"address","name":"srcRouter","type":"address"}],"name":"SwapFailed","type":"error"},{"inputs":[],"name":"WrongArgumentLength","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"srcSwapRouter","type":"address"},{"indexed":false,"internalType":"bool","name":"isSupported","type":"bool"}],"name":"SupportedRouter","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NATIVE_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deBridgeGate","outputs":[{"internalType":"contract IDeBridgeGate","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IDeBridgeGate","name":"_deBridgeGate","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_srcTokenIn","type":"address"},{"internalType":"uint256","name":"_srcAmountIn","type":"uint256"},{"internalType":"bytes","name":"_srcTokenInPermit","type":"bytes"},{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"bool","name":"useAssetFee","type":"bool"},{"internalType":"uint32","name":"referralCode","type":"uint32"},{"internalType":"bytes","name":"autoParams","type":"bytes"}],"internalType":"struct ICrossChainForwarder.GateParams","name":"_gateParams","type":"tuple"}],"name":"sendV2","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_srcTokenIn","type":"address"},{"internalType":"uint256","name":"_srcAmountIn","type":"uint256"},{"internalType":"bytes","name":"_srcTokenInPermit","type":"bytes"},{"internalType":"uint256","name":"_affiliateFeeAmount","type":"uint256"},{"internalType":"address","name":"_affiliateFeeRecipient","type":"address"},{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"bool","name":"useAssetFee","type":"bool"},{"internalType":"uint32","name":"referralCode","type":"uint32"},{"internalType":"bytes","name":"autoParams","type":"bytes"}],"internalType":"struct ICrossChainForwarder.GateParams","name":"_gateParams","type":"tuple"}],"name":"sendV3","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"supportedRouters","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_srcTokenIn","type":"address"},{"internalType":"uint256","name":"_srcAmountIn","type":"uint256"},{"internalType":"bytes","name":"_srcTokenInPermit","type":"bytes"},{"internalType":"address","name":"_srcSwapRouter","type":"address"},{"internalType":"bytes","name":"_srcSwapCalldata","type":"bytes"},{"internalType":"address","name":"_srcTokenOut","type":"address"},{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"bool","name":"useAssetFee","type":"bool"},{"internalType":"uint32","name":"referralCode","type":"uint32"},{"internalType":"bytes","name":"autoParams","type":"bytes"}],"internalType":"struct ICrossChainForwarder.GateParams","name":"_gateParams","type":"tuple"}],"name":"swapAndSendV2","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_srcTokenIn","type":"address"},{"internalType":"uint256","name":"_srcAmountIn","type":"uint256"},{"internalType":"bytes","name":"_srcTokenInPermit","type":"bytes"},{"internalType":"uint256","name":"_affiliateFeeAmount","type":"uint256"},{"internalType":"address","name":"_affiliateFeeRecipient","type":"address"},{"internalType":"address","name":"_srcSwapRouter","type":"address"},{"internalType":"bytes","name":"_srcSwapCalldata","type":"bytes"},{"internalType":"address","name":"_srcTokenOut","type":"address"},{"components":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"bool","name":"useAssetFee","type":"bool"},{"internalType":"uint32","name":"referralCode","type":"uint32"},{"internalType":"bytes","name":"autoParams","type":"bytes"}],"internalType":"struct ICrossChainForwarder.GateParams","name":"_gateParams","type":"tuple"}],"name":"swapAndSendV3","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_srcSwapRouter","type":"address"},{"internalType":"bool","name":"_isSupported","type":"bool"}],"name":"updateSupportedRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
60806040523480156200001157600080fd5b506200001c62000022565b620000e4565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e2576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b612a5c80620000f46000396000f3fe6080604052600436106101125760003560e01c80635dfd9bc3116100a5578063c4d66de811610074578063cbe5190211610059578063cbe519021461033f578063d33f532e14610352578063d547741f1461037257600080fd5b8063c4d66de8146102f2578063ca777fbf1461031257600080fd5b80635dfd9bc31461024757806391d148541461025a5780639879c48d146102ad578063a217fddf146102dd57600080fd5b806331f7d964116100e157806331f7d964146101c657806336568abe1461020057806354fd4d50146102205780635c5c57011461023457600080fd5b806301ffc9a71461011e5780631624eaf314610153578063248a9ca3146101685780632f2ff15d146101a657600080fd5b3661011957005b600080fd5b34801561012a57600080fd5b5061013e6101393660046126ac565b610392565b60405190151581526020015b60405180910390f35b61016661016136600461244c565b61042b565b005b34801561017457600080fd5b5061019861018336600461266e565b60009081526065602052604090206001015490565b60405190815260200161014a565b3480156101b257600080fd5b506101666101c1366004612687565b610448565b3480156101d257600080fd5b506101db600081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161014a565b34801561020c57600080fd5b5061016661021b366004612687565b610472565b34801561022c57600080fd5b506083610198565b6101666102423660046124cc565b61052a565b61016661025536600461237a565b61057a565b34801561026657600080fd5b5061013e610275366004612687565b600091825260656020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b3480156102b957600080fd5b5061013e6102c8366004612324565b60986020526000908152604090205460ff1681565b3480156102e957600080fd5b50610198600081565b3480156102fe57600080fd5b5061016661030d366004612324565b6105b3565b34801561031e57600080fd5b506097546101db9073ffffffffffffffffffffffffffffffffffffffff1681565b61016661034d3660046125b4565b610786565b34801561035e57600080fd5b5061016661036d366004612341565b6107ba565b34801561037e57600080fd5b5061016661038d366004612687565b6108a9565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061042557507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6104368484846108ce565b61044284843484610971565b50505050565b60008281526065602052604090206001015461046381610b37565b61046d8383610b44565b505050565b73ffffffffffffffffffffffffffffffffffffffff8116331461051c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6105268282610c38565b5050565b6105358a8a8a6108ce565b6000806105448c8c8b8b610cf3565b9150915060008061055a8e85858c8c8c8c610e41565b9150915061056a86838388610971565b5050505050505050505050505050565b6105858888886108ce565b6000806105978a8a348a8a8a8a610e41565b915091506105a784838386610971565b50505050505050505050565b600054610100900460ff16158080156105d35750600054600160ff909116105b806105ed5750303b1580156105ed575060005460ff166001145b610679576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610513565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156106d757600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b6106df610f79565b609780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416179055801561052657600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15050565b6107918686866108ce565b6000806107a088888787610cf3565b915091506107b088838386610971565b5050505050505050565b3360009081527fffdfc1249c027f9191656349feb0761381bb32c9f557e01f419fd08754bf5a1b602052604090205460ff16610822576040517fde8e41fa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821660008181526098602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515159081179091558251938452908301527f3fc30fe9d1afedc310e6ec6fd5f84b0ae3b800cdc1bcb04b65b986fdd35868f0910161077a565b6000828152606560205260409020600101546108c481610b37565b61046d8383610c38565b73ffffffffffffffffffffffffffffffffffffffff83166109255781471161046d576040517fc0159a6100000000000000000000000000000000000000000000000000000000815260048101839052602401610513565b600061093284848461110d565b905082811015610442576040517fc0159a6100000000000000000000000000000000000000000000000000000000815260048101849052602401610513565b600061097d83476128f1565b905073ffffffffffffffffffffffffffffffffffffffff8516156109c2576097546109c29073ffffffffffffffffffffffffffffffffffffffff8781169116866113a3565b609754825160208085015160405173ffffffffffffffffffffffffffffffffffffffff9094169363be2974769388938b938b93610a2a920160609190911b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016815260140190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152828252908a015160608b015160808c01517fffffffff0000000000000000000000000000000000000000000000000000000060e08b901b168552610a9e979695946004016127ee565b6000604051808303818588803b158015610ab757600080fd5b505af1158015610acb573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff8616159050610b1557609754610b159073ffffffffffffffffffffffffffffffffffffffff878116911660006113a3565b80471115610b3057610b3033610b2b83476128f1565b6115b2565b5050505050565b610b418133611666565b50565b600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1661052657600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610bda3390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff161561052657600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b82348315801590610d19575073ffffffffffffffffffffffffffffffffffffffff831615155b15610e3857610d2884836128f1565b915073ffffffffffffffffffffffffffffffffffffffff8616610e1757610d4f84826128f1565b905060008373ffffffffffffffffffffffffffffffffffffffff168560405160006040518083038185875af1925050503d8060008114610dab576040519150601f19603f3d011682016040523d82523d6000602084013e610db0565b606091505b5050905080610e11576040517f0579ec9400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526000602482015260448101869052606401610513565b50610e38565b610e3873ffffffffffffffffffffffffffffffffffffffff87168486611738565b94509492505050565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260986020526040812054819060ff16610ea2576040517f2a070fb400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610eae88476128f1565b905073ffffffffffffffffffffffffffffffffffffffff8a16610edf57610ed88787878c8861178e565b9250610f60565b610f0073ffffffffffffffffffffffffffffffffffffffff8b16888b6113a3565b73ffffffffffffffffffffffffffffffffffffffff8416610f2d57610f268787876119d4565b9250610f3e565b610f3b87878760008861178e565b92505b610f6073ffffffffffffffffffffffffffffffffffffffff8b168860006113a3565b610f6a81476128f1565b91505097509795505050505050565b600054610100900460ff1615808015610f995750600054600160ff909116105b80610fb35750303b158015610fb3575060005460ff166001145b61103f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610513565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055801561109d57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b6110a8600033611ac2565b8015610b4157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b8051600090156111eb5760006111238382611acc565b905060008080611134866020611b1c565b6040517fd505accf000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018b90526064810188905260ff8216608482015260a4810184905260c48101839052929550909350915073ffffffffffffffffffffffffffffffffffffffff89169063d505accf9060e401600060405180830381600087803b1580156111ce57600080fd5b505af11580156111e2573d6000803e3d6000fd5b50505050505050505b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8616906370a082319060240160206040518083038186803b15801561125357600080fd5b505afa158015611267573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128b91906126ee565b90506112af73ffffffffffffffffffffffffffffffffffffffff8616333087611ba2565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8716906370a082319060240160206040518083038186803b15801561131757600080fd5b505afa15801561132b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134f91906126ee565b905081811161138d576040517fc0159a6100000000000000000000000000000000000000000000000000000000815260048101869052602401610513565b61139782826128f1565b925050505b9392505050565b80158061145257506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561141857600080fd5b505afa15801561142c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145091906126ee565b155b6114de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610513565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261046d9084907f095ea7b300000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611c00565b6040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff84169083906040516115e99190612751565b60006040518083038185875af1925050503d8060008114611626576040519150601f19603f3d011682016040523d82523d6000602084013e61162b565b606091505b505090508061046d576040517f6d963f8800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610526576116be8173ffffffffffffffffffffffffffffffffffffffff166014611d0c565b6116c9836020611d0c565b6040516020016116da92919061276d565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a000000000000000000000000000000000000000000000000000000000825261051391600401612864565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261046d9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611530565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600090819073ffffffffffffffffffffffffffffffffffffffff8416906370a082319060240160206040518083038186803b1580156117f857600080fd5b505afa15801561180c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061183091906126ee565b905060006118768888888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250611f4f915050565b9050806118c7576040517f3b42210500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff89166004820152602401610513565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8616906370a082319060240160206040518083038186803b15801561192f57600080fd5b505afa158015611943573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196791906126ee565b90508083106119ba576040517f5743851400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86166004820152602401610513565b60006119c684836128f1565b9a9950505050505050505050565b6000804790506000611a1c8686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509250611f4f915050565b905080611a6d576040517f3b42210500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87166004820152602401610513565b47808310611aaa576040517f5743851400000000000000000000000000000000000000000000000000000000815260006004820152602401610513565b6000611ab684836128f1565b98975050505050505050565b6105268282610b44565b6000611ad9826020612877565b83511015611b13576040517f40f0f32900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50016020015190565b8181016020810151604082015160419092015190919060ff16601b811015611b4c57611b49601b8261288f565b90505b8060ff16601b14158015611b6457508060ff16601c14155b15611b9b576040517f18ce829400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9250925092565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526104429085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611530565b6000611c62826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611f669092919063ffffffff16565b80519091501561046d5780806020019051810190611c809190612651565b61046d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610513565b60606000611d1b8360026128b4565b611d26906002612877565b67ffffffffffffffff811115611d3e57611d3e6129c7565b6040519080825280601f01601f191660200182016040528015611d68576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611d9f57611d9f612998565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611e0257611e02612998565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611e3e8460026128b4565b611e49906001612877565b90505b6001811115611ee6577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611e8a57611e8a612998565b1a60f81b828281518110611ea057611ea0612998565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611edf81612934565b9050611e4c565b50831561139c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610513565b600080600084516020860185885af1949350505050565b6060611f758484600085611f7d565b949350505050565b60608247101561200f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610513565b73ffffffffffffffffffffffffffffffffffffffff85163b61208d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610513565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516120b69190612751565b60006040518083038185875af1925050503d80600081146120f3576040519150601f19603f3d011682016040523d82523d6000602084013e6120f8565b606091505b5091509150612108828286612113565b979650505050505050565b6060831561212257508161139c565b8251156121325782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105139190612864565b8035612171816129f6565b919050565b60008083601f84011261218857600080fd5b50813567ffffffffffffffff8111156121a057600080fd5b6020830191508360208285010111156121b857600080fd5b9250929050565b600082601f8301126121d057600080fd5b813567ffffffffffffffff808211156121eb576121eb6129c7565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715612231576122316129c7565b8160405283815286602085880101111561224a57600080fd5b836020870160208301376000602085830101528094505050505092915050565b600060a0828403121561227c57600080fd5b60405160a0810167ffffffffffffffff82821081831117156122a0576122a06129c7565b8160405282935084358352602085013591506122bb826129f6565b816020840152604085013591506122d182612a18565b8160408401526060850135915063ffffffff821682146122f057600080fd5b816060840152608085013591508082111561230a57600080fd5b50612317858286016121bf565b6080830152505092915050565b60006020828403121561233657600080fd5b813561139c816129f6565b6000806040838503121561235457600080fd5b823561235f816129f6565b9150602083013561236f81612a18565b809150509250929050565b60008060008060008060008060e0898b03121561239657600080fd5b88356123a1816129f6565b975060208901359650604089013567ffffffffffffffff808211156123c557600080fd5b6123d18c838d016121bf565b975060608b013591506123e3826129f6565b90955060808a013590808211156123f957600080fd5b6124058c838d01612176565b909650945084915061241960a08c01612166565b935060c08b013591508082111561242f57600080fd5b5061243c8b828c0161226a565b9150509295985092959890939650565b6000806000806080858703121561246257600080fd5b843561246d816129f6565b935060208501359250604085013567ffffffffffffffff8082111561249157600080fd5b61249d888389016121bf565b935060608701359150808211156124b357600080fd5b506124c08782880161226a565b91505092959194509250565b6000806000806000806000806000806101208b8d0312156124ec57600080fd5b6124f58b612166565b995060208b0135985060408b013567ffffffffffffffff8082111561251957600080fd5b6125258e838f016121bf565b995060608d0135985061253a60808e01612166565b975061254860a08e01612166565b965060c08d013591508082111561255e57600080fd5b61256a8e838f01612176565b909650945084915061257e60e08e01612166565b93506101008d013591508082111561259557600080fd5b506125a28d828e0161226a565b9150509295989b9194979a5092959850565b60008060008060008060c087890312156125cd57600080fd5b86356125d8816129f6565b955060208701359450604087013567ffffffffffffffff808211156125fc57600080fd5b6126088a838b016121bf565b95506060890135945060808901359150612621826129f6565b90925060a0880135908082111561263757600080fd5b5061264489828a0161226a565b9150509295509295509295565b60006020828403121561266357600080fd5b815161139c81612a18565b60006020828403121561268057600080fd5b5035919050565b6000806040838503121561269a57600080fd5b82359150602083013561236f816129f6565b6000602082840312156126be57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461139c57600080fd5b60006020828403121561270057600080fd5b5051919050565b6000815180845261271f816020860160208601612908565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60008251612763818460208701612908565b9190910192915050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516127a5816017850160208801612908565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516127e2816028840160208801612908565b01602801949350505050565b600061010073ffffffffffffffffffffffffffffffffffffffff8a16835288602084015287604084015280606084015261282a81840188612707565b90508281038060808501526000825286151560a085015263ffffffff861660c08501526020810160e0850152506119c66020820185612707565b60208152600061139c6020830184612707565b6000821982111561288a5761288a612969565b500190565b600060ff821660ff84168060ff038211156128ac576128ac612969565b019392505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156128ec576128ec612969565b500290565b60008282101561290357612903612969565b500390565b60005b8381101561292357818101518382015260200161290b565b838111156104425750506000910152565b60008161294357612943612969565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff81168114610b4157600080fd5b8015158114610b4157600080fdfea26469706673582212209ead8a1570b8111cab1afcb290a001cb4566badc69ed452f5315e9a9618b533564736f6c63430008070033
Deployed Bytecode
0x6080604052600436106101125760003560e01c80635dfd9bc3116100a5578063c4d66de811610074578063cbe5190211610059578063cbe519021461033f578063d33f532e14610352578063d547741f1461037257600080fd5b8063c4d66de8146102f2578063ca777fbf1461031257600080fd5b80635dfd9bc31461024757806391d148541461025a5780639879c48d146102ad578063a217fddf146102dd57600080fd5b806331f7d964116100e157806331f7d964146101c657806336568abe1461020057806354fd4d50146102205780635c5c57011461023457600080fd5b806301ffc9a71461011e5780631624eaf314610153578063248a9ca3146101685780632f2ff15d146101a657600080fd5b3661011957005b600080fd5b34801561012a57600080fd5b5061013e6101393660046126ac565b610392565b60405190151581526020015b60405180910390f35b61016661016136600461244c565b61042b565b005b34801561017457600080fd5b5061019861018336600461266e565b60009081526065602052604090206001015490565b60405190815260200161014a565b3480156101b257600080fd5b506101666101c1366004612687565b610448565b3480156101d257600080fd5b506101db600081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161014a565b34801561020c57600080fd5b5061016661021b366004612687565b610472565b34801561022c57600080fd5b506083610198565b6101666102423660046124cc565b61052a565b61016661025536600461237a565b61057a565b34801561026657600080fd5b5061013e610275366004612687565b600091825260656020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b3480156102b957600080fd5b5061013e6102c8366004612324565b60986020526000908152604090205460ff1681565b3480156102e957600080fd5b50610198600081565b3480156102fe57600080fd5b5061016661030d366004612324565b6105b3565b34801561031e57600080fd5b506097546101db9073ffffffffffffffffffffffffffffffffffffffff1681565b61016661034d3660046125b4565b610786565b34801561035e57600080fd5b5061016661036d366004612341565b6107ba565b34801561037e57600080fd5b5061016661038d366004612687565b6108a9565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b00000000000000000000000000000000000000000000000000000000148061042557507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6104368484846108ce565b61044284843484610971565b50505050565b60008281526065602052604090206001015461046381610b37565b61046d8383610b44565b505050565b73ffffffffffffffffffffffffffffffffffffffff8116331461051c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6105268282610c38565b5050565b6105358a8a8a6108ce565b6000806105448c8c8b8b610cf3565b9150915060008061055a8e85858c8c8c8c610e41565b9150915061056a86838388610971565b5050505050505050505050505050565b6105858888886108ce565b6000806105978a8a348a8a8a8a610e41565b915091506105a784838386610971565b50505050505050505050565b600054610100900460ff16158080156105d35750600054600160ff909116105b806105ed5750303b1580156105ed575060005460ff166001145b610679576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610513565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156106d757600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b6106df610f79565b609780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416179055801561052657600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498906020015b60405180910390a15050565b6107918686866108ce565b6000806107a088888787610cf3565b915091506107b088838386610971565b5050505050505050565b3360009081527fffdfc1249c027f9191656349feb0761381bb32c9f557e01f419fd08754bf5a1b602052604090205460ff16610822576040517fde8e41fa00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff821660008181526098602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168515159081179091558251938452908301527f3fc30fe9d1afedc310e6ec6fd5f84b0ae3b800cdc1bcb04b65b986fdd35868f0910161077a565b6000828152606560205260409020600101546108c481610b37565b61046d8383610c38565b73ffffffffffffffffffffffffffffffffffffffff83166109255781471161046d576040517fc0159a6100000000000000000000000000000000000000000000000000000000815260048101839052602401610513565b600061093284848461110d565b905082811015610442576040517fc0159a6100000000000000000000000000000000000000000000000000000000815260048101849052602401610513565b600061097d83476128f1565b905073ffffffffffffffffffffffffffffffffffffffff8516156109c2576097546109c29073ffffffffffffffffffffffffffffffffffffffff8781169116866113a3565b609754825160208085015160405173ffffffffffffffffffffffffffffffffffffffff9094169363be2974769388938b938b93610a2a920160609190911b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016815260140190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152828252908a015160608b015160808c01517fffffffff0000000000000000000000000000000000000000000000000000000060e08b901b168552610a9e979695946004016127ee565b6000604051808303818588803b158015610ab757600080fd5b505af1158015610acb573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff8616159050610b1557609754610b159073ffffffffffffffffffffffffffffffffffffffff878116911660006113a3565b80471115610b3057610b3033610b2b83476128f1565b6115b2565b5050505050565b610b418133611666565b50565b600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1661052657600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055610bda3390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff161561052657600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b82348315801590610d19575073ffffffffffffffffffffffffffffffffffffffff831615155b15610e3857610d2884836128f1565b915073ffffffffffffffffffffffffffffffffffffffff8616610e1757610d4f84826128f1565b905060008373ffffffffffffffffffffffffffffffffffffffff168560405160006040518083038185875af1925050503d8060008114610dab576040519150601f19603f3d011682016040523d82523d6000602084013e610db0565b606091505b5050905080610e11576040517f0579ec9400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526000602482015260448101869052606401610513565b50610e38565b610e3873ffffffffffffffffffffffffffffffffffffffff87168486611738565b94509492505050565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260986020526040812054819060ff16610ea2576040517f2a070fb400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610eae88476128f1565b905073ffffffffffffffffffffffffffffffffffffffff8a16610edf57610ed88787878c8861178e565b9250610f60565b610f0073ffffffffffffffffffffffffffffffffffffffff8b16888b6113a3565b73ffffffffffffffffffffffffffffffffffffffff8416610f2d57610f268787876119d4565b9250610f3e565b610f3b87878760008861178e565b92505b610f6073ffffffffffffffffffffffffffffffffffffffff8b168860006113a3565b610f6a81476128f1565b91505097509795505050505050565b600054610100900460ff1615808015610f995750600054600160ff909116105b80610fb35750303b158015610fb3575060005460ff166001145b61103f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610513565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055801561109d57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b6110a8600033611ac2565b8015610b4157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b8051600090156111eb5760006111238382611acc565b905060008080611134866020611b1c565b6040517fd505accf000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018b90526064810188905260ff8216608482015260a4810184905260c48101839052929550909350915073ffffffffffffffffffffffffffffffffffffffff89169063d505accf9060e401600060405180830381600087803b1580156111ce57600080fd5b505af11580156111e2573d6000803e3d6000fd5b50505050505050505b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8616906370a082319060240160206040518083038186803b15801561125357600080fd5b505afa158015611267573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061128b91906126ee565b90506112af73ffffffffffffffffffffffffffffffffffffffff8616333087611ba2565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8716906370a082319060240160206040518083038186803b15801561131757600080fd5b505afa15801561132b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134f91906126ee565b905081811161138d576040517fc0159a6100000000000000000000000000000000000000000000000000000000815260048101869052602401610513565b61139782826128f1565b925050505b9392505050565b80158061145257506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561141857600080fd5b505afa15801561142c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145091906126ee565b155b6114de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610513565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261046d9084907f095ea7b300000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611c00565b6040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff84169083906040516115e99190612751565b60006040518083038185875af1925050503d8060008114611626576040519150601f19603f3d011682016040523d82523d6000602084013e61162b565b606091505b505090508061046d576040517f6d963f8800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260656020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16610526576116be8173ffffffffffffffffffffffffffffffffffffffff166014611d0c565b6116c9836020611d0c565b6040516020016116da92919061276d565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a000000000000000000000000000000000000000000000000000000000825261051391600401612864565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261046d9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611530565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600090819073ffffffffffffffffffffffffffffffffffffffff8416906370a082319060240160206040518083038186803b1580156117f857600080fd5b505afa15801561180c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061183091906126ee565b905060006118768888888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250611f4f915050565b9050806118c7576040517f3b42210500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff89166004820152602401610513565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8616906370a082319060240160206040518083038186803b15801561192f57600080fd5b505afa158015611943573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061196791906126ee565b90508083106119ba576040517f5743851400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86166004820152602401610513565b60006119c684836128f1565b9a9950505050505050505050565b6000804790506000611a1c8686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052509250611f4f915050565b905080611a6d576040517f3b42210500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87166004820152602401610513565b47808310611aaa576040517f5743851400000000000000000000000000000000000000000000000000000000815260006004820152602401610513565b6000611ab684836128f1565b98975050505050505050565b6105268282610b44565b6000611ad9826020612877565b83511015611b13576040517f40f0f32900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50016020015190565b8181016020810151604082015160419092015190919060ff16601b811015611b4c57611b49601b8261288f565b90505b8060ff16601b14158015611b6457508060ff16601c14155b15611b9b576040517f18ce829400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9250925092565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526104429085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611530565b6000611c62826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16611f669092919063ffffffff16565b80519091501561046d5780806020019051810190611c809190612651565b61046d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610513565b60606000611d1b8360026128b4565b611d26906002612877565b67ffffffffffffffff811115611d3e57611d3e6129c7565b6040519080825280601f01601f191660200182016040528015611d68576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611d9f57611d9f612998565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611e0257611e02612998565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611e3e8460026128b4565b611e49906001612877565b90505b6001811115611ee6577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611e8a57611e8a612998565b1a60f81b828281518110611ea057611ea0612998565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611edf81612934565b9050611e4c565b50831561139c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610513565b600080600084516020860185885af1949350505050565b6060611f758484600085611f7d565b949350505050565b60608247101561200f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610513565b73ffffffffffffffffffffffffffffffffffffffff85163b61208d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610513565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516120b69190612751565b60006040518083038185875af1925050503d80600081146120f3576040519150601f19603f3d011682016040523d82523d6000602084013e6120f8565b606091505b5091509150612108828286612113565b979650505050505050565b6060831561212257508161139c565b8251156121325782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105139190612864565b8035612171816129f6565b919050565b60008083601f84011261218857600080fd5b50813567ffffffffffffffff8111156121a057600080fd5b6020830191508360208285010111156121b857600080fd5b9250929050565b600082601f8301126121d057600080fd5b813567ffffffffffffffff808211156121eb576121eb6129c7565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715612231576122316129c7565b8160405283815286602085880101111561224a57600080fd5b836020870160208301376000602085830101528094505050505092915050565b600060a0828403121561227c57600080fd5b60405160a0810167ffffffffffffffff82821081831117156122a0576122a06129c7565b8160405282935084358352602085013591506122bb826129f6565b816020840152604085013591506122d182612a18565b8160408401526060850135915063ffffffff821682146122f057600080fd5b816060840152608085013591508082111561230a57600080fd5b50612317858286016121bf565b6080830152505092915050565b60006020828403121561233657600080fd5b813561139c816129f6565b6000806040838503121561235457600080fd5b823561235f816129f6565b9150602083013561236f81612a18565b809150509250929050565b60008060008060008060008060e0898b03121561239657600080fd5b88356123a1816129f6565b975060208901359650604089013567ffffffffffffffff808211156123c557600080fd5b6123d18c838d016121bf565b975060608b013591506123e3826129f6565b90955060808a013590808211156123f957600080fd5b6124058c838d01612176565b909650945084915061241960a08c01612166565b935060c08b013591508082111561242f57600080fd5b5061243c8b828c0161226a565b9150509295985092959890939650565b6000806000806080858703121561246257600080fd5b843561246d816129f6565b935060208501359250604085013567ffffffffffffffff8082111561249157600080fd5b61249d888389016121bf565b935060608701359150808211156124b357600080fd5b506124c08782880161226a565b91505092959194509250565b6000806000806000806000806000806101208b8d0312156124ec57600080fd5b6124f58b612166565b995060208b0135985060408b013567ffffffffffffffff8082111561251957600080fd5b6125258e838f016121bf565b995060608d0135985061253a60808e01612166565b975061254860a08e01612166565b965060c08d013591508082111561255e57600080fd5b61256a8e838f01612176565b909650945084915061257e60e08e01612166565b93506101008d013591508082111561259557600080fd5b506125a28d828e0161226a565b9150509295989b9194979a5092959850565b60008060008060008060c087890312156125cd57600080fd5b86356125d8816129f6565b955060208701359450604087013567ffffffffffffffff808211156125fc57600080fd5b6126088a838b016121bf565b95506060890135945060808901359150612621826129f6565b90925060a0880135908082111561263757600080fd5b5061264489828a0161226a565b9150509295509295509295565b60006020828403121561266357600080fd5b815161139c81612a18565b60006020828403121561268057600080fd5b5035919050565b6000806040838503121561269a57600080fd5b82359150602083013561236f816129f6565b6000602082840312156126be57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461139c57600080fd5b60006020828403121561270057600080fd5b5051919050565b6000815180845261271f816020860160208601612908565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60008251612763818460208701612908565b9190910192915050565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516127a5816017850160208801612908565b7f206973206d697373696e6720726f6c652000000000000000000000000000000060179184019182015283516127e2816028840160208801612908565b01602801949350505050565b600061010073ffffffffffffffffffffffffffffffffffffffff8a16835288602084015287604084015280606084015261282a81840188612707565b90508281038060808501526000825286151560a085015263ffffffff861660c08501526020810160e0850152506119c66020820185612707565b60208152600061139c6020830184612707565b6000821982111561288a5761288a612969565b500190565b600060ff821660ff84168060ff038211156128ac576128ac612969565b019392505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156128ec576128ec612969565b500290565b60008282101561290357612903612969565b500390565b60005b8381101561292357818101518382015260200161290b565b838111156104425750506000910152565b60008161294357612943612969565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff81168114610b4157600080fd5b8015158114610b4157600080fdfea26469706673582212209ead8a1570b8111cab1afcb290a001cb4566badc69ed452f5315e9a9618b533564736f6c63430008070033
Deployed Bytecode Sourcemap
471:11004:18:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2903:213:0;;;;;;;;;;-1:-1:-1;2903:213:0;;;;;:::i;:::-;;:::i;:::-;;;14248:14:35;;14241:22;14223:41;;14211:2;14196:18;2903:213:0;;;;;;;;1435:340:18;;;;;;:::i;:::-;;:::i;:::-;;4721:129:0;;;;;;;;;;-1:-1:-1;4721:129:0;;;;;:::i;:::-;4795:7;4821:12;;;:6;:12;;;;;:22;;;;4721:129;;;;14421:25:35;;;14409:2;14394:18;4721:129:0;14275:177:35;5146:145:0;;;;;;;;;;-1:-1:-1;5146:145:0;;;;;:::i;:::-;;:::i;635:49:18:-;;;;;;;;;;;;682:1;635:49;;;;;10940:42:35;10928:55;;;10910:74;;10898:2;10883:18;635:49:18;10764:226:35;6255:214:0;;;;;;;;;;-1:-1:-1;6255:214:0;;;;;:::i;:::-;;:::i;11386:87:18:-;;;;;;;;;;-1:-1:-1;11454:3:18;11386:87;;2440:1015;;;;;;:::i;:::-;;:::i;3461:703::-;;;;;;:::i;:::-;;:::i;3203:145:0:-;;;;;;;;;;-1:-1:-1;3203:145:0;;;;;:::i;:::-;3289:4;3312:12;;;:6;:12;;;;;;;;:29;;;;;;;;;;;;;;;;3203:145;731:48:18;;;;;;;;;;-1:-1:-1;731:48:18;;;;;:::i;:::-;;;;;;;;;;;;;;;;2324:49:0;;;;;;;;;;-1:-1:-1;2324:49:0;2369:4;2324:49;;1226:155:18;;;;;;;;;;-1:-1:-1;1226:155:18;;;;;:::i;:::-;;:::i;691:33::-;;;;;;;;;;-1:-1:-1;691:33:18;;;;;;;;1781:653;;;;;;:::i;:::-;;:::i;11052:237::-;;;;;;;;;;-1:-1:-1;11052:237:18;;;;;:::i;:::-;;:::i;5571:147:0:-;;;;;;;;;;-1:-1:-1;5571:147:0;;;;;:::i;:::-;;:::i;2903:213::-;2988:4;3011:58;;;3026:43;3011:58;;:98;;-1:-1:-1;1183:36:9;1168:51;;;;3073:36:0;3004:105;2903:213;-1:-1:-1;;2903:213:0:o;1435:340:18:-;1631:63;1649:11;1662:12;1676:17;1631;:63::i;:::-;1704:64;1718:11;1731:12;1745:9;1756:11;1704:13;:64::i;:::-;1435:340;;;;:::o;5146:145:0:-;4795:7;4821:12;;;:6;:12;;;;;:22;;;2802:16;2813:4;2802:10;:16::i;:::-;5259:25:::1;5270:4;5276:7;5259:10;:25::i;:::-;5146:145:::0;;;:::o;6255:214::-;6350:23;;;929:10:7;6350:23:0;6342:83;;;;;;;17710:2:35;6342:83:0;;;17692:21:35;17749:2;17729:18;;;17722:30;17788:34;17768:18;;;17761:62;17859:17;17839:18;;;17832:45;17894:19;;6342:83:0;;;;;;;;;6436:26;6448:4;6454:7;6436:11;:26::i;:::-;6255:214;;:::o;2440:1015:18:-;2823:63;2841:11;2854:12;2868:17;2823;:63::i;:::-;2897:27;2926:24;2954:153;2991:11;3016:12;3042:19;3075:22;2954:23;:153::i;:::-;2896:211;;;;3119:20;3141:25;3170:194;3196:11;3221:19;3254:16;3284:14;3312:16;;3342:12;3170;:194::i;:::-;3118:246;;;;3375:73;3389:12;3403;3417:17;3436:11;3375:13;:73::i;:::-;2813:642;;;;2440:1015;;;;;;;;;;:::o;3461:703::-;3767:63;3785:11;3798:12;3812:17;3767;:63::i;:::-;3842:20;3864:25;3893:180;3919:11;3944:12;3970:9;3993:14;4021:16;;4051:12;3893;:180::i;:::-;3841:232;;;;4084:73;4098:12;4112;4126:17;4145:11;4084:13;:73::i;:::-;3757:407;;3461:703;;;;;;;;:::o;1226:155::-;3111:19:2;3134:13;;;;;;3133:14;;3179:34;;;;-1:-1:-1;3197:12:2;;3212:1;3197:12;;;;:16;3179:34;3178:108;;;-1:-1:-1;3258:4:2;1476:19:6;:23;;;3219:66:2;;-1:-1:-1;3268:12:2;;;;;:17;3219:66;3157:201;;;;;;;16103:2:35;3157:201:2;;;16085:21:35;16142:2;16122:18;;;16115:30;16181:34;16161:18;;;16154:62;16252:16;16232:18;;;16225:44;16286:19;;3157:201:2;15901:410:35;3157:201:2;3368:12;:16;;;;3383:1;3368:16;;;3394:65;;;;3428:13;:20;;;;;;;;3394:65;1306:30:18::1;:28;:30::i;:::-;1346:12;:28:::0;;;::::1;;::::0;::::1;;::::0;;3479:99:2;;;;3529:5;3513:21;;;;;;3553:14;;-1:-1:-1;14862:36:35;;3553:14:2;;14850:2:35;14835:18;3553:14:2;;;;;;;;3101:483;1226:155:18;:::o;1781:653::-;2054:63;2072:11;2085:12;2099:17;2054;:63::i;:::-;2128:27;2157:24;2185:153;2222:11;2247:12;2273:19;2306:22;2185:23;:153::i;:::-;2127:211;;;;2349:78;2363:11;2376:19;2397:16;2415:11;2349:13;:78::i;:::-;2044:390;;1781:653;;;;;;:::o;11052:237::-;498:10:19;2369:4:0;3312:29;;;:12;;:29;:12;:29;;;;;465:67:19;;518:14;;;;;;;;;;;;;;465:67;11175:32:18::1;::::0;::::1;;::::0;;;:16:::1;:32;::::0;;;;;;;;:47;;;::::1;::::0;::::1;;::::0;;::::1;::::0;;;11237:45;;12596:74:35;;;12686:18;;;12679:50;11237:45:18::1;::::0;12569:18:35;11237:45:18::1;12428:307:35::0;5571:147:0;4795:7;4821:12;;;:6;:12;;;;;:22;;;2802:16;2813:4;2802:10;:16::i;:::-;5685:26:::1;5697:4;5703:7;5685:11;:26::i;5502:626:18:-:0;5657:27;;;5653:469;;5730:12;5706:21;:36;5700:101;;5768:33;;;;;;;;14421:25:35;;;14394:18;;5768:33:18;14275:177:35;5653:469:18;5832:24;5859:145;5913:11;5943:12;5973:17;5859:18;:145::i;:::-;5832:172;;6041:12;6022:16;:31;6018:93;;;6078:33;;;;;;;;14421:25:35;;;14394:18;;6078:33:18;14275:177:35;9722:1324:18;9940:24;9967:33;9991:9;9967:21;:33;:::i;:::-;9940:60;-1:-1:-1;10015:21:18;;;;10011:187;;10165:12;;10120:67;;10165:12;10120:36;;;;10165:12;10180:6;10120:36;:67::i;:::-;10241:12;;10357:19;;10421:20;;;;;10404:38;;10241:12;;;;;:17;;10266:9;;10290:5;;10326:6;;10404:38;;;9364:2:35;9360:15;;;;9377:66;9356:88;9344:101;;9470:2;9461:12;;9215:264;10404:38:18;;;;;;;;;;;;;;10496:23;;;;10549:24;;;;10604:22;;;;10241:410;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;10666:21:18;;;;;-1:-1:-1;10662:148:18;;10782:12;;10737:62;;10782:12;10737:36;;;;10782:12;;10737:36;:62::i;:::-;10881:16;10857:21;:40;10853:187;;;10913:116;10947:10;10975:40;10999:16;10975:21;:40;:::i;:::-;10913:16;:116::i;:::-;9873:1173;9722:1324;;;;:::o;3642:103:0:-;3708:30;3719:4;929:10:7;3708::0;:30::i;:::-;3642:103;:::o;7804:233::-;3289:4;3312:12;;;:6;:12;;;;;;;;:29;;;;;;;;;;;;;7882:149;;7925:12;;;;:6;:12;;;;;;;;:29;;;;;;;;;;:36;;;;7957:4;7925:36;;;8007:12;929:10:7;;850:96;8007:12:0;7980:40;;7998:7;7980:40;;7992:4;7980:40;;;;;;;;;;7804:233;;:::o;8208:234::-;3289:4;3312:12;;;:6;:12;;;;;;;;:29;;;;;;;;;;;;;8287:149;;;8361:5;8329:12;;;:6;:12;;;;;;;;:29;;;;;;;;;;;:37;;;;;;8385:40;929:10:7;;8329:12:0;;8385:40;;8361:5;8385:40;8208:234;;:::o;4220:1276:18:-;4499:12;4541:9;4565:23;;;;;:63;;-1:-1:-1;4592:36:18;;;;;4565:63;4561:929;;;4695:41;4717:19;4695:41;;:::i;:::-;;-1:-1:-1;4755:27:18;;;4751:729;;4843:40;4864:19;4843:40;;:::i;:::-;;;4903:12;4921:22;:27;;4977:19;4921:97;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4902:116;;;5041:7;5036:245;;5079:183;;;;;11539:42:35;11608:15;;5079:183:18;;;11590:34:35;682:1:18;11640:18:35;;;11633:43;11692:18;;;11685:34;;;11502:18;;5079:183:18;11327:398:35;5036:245:18;4784:511;4751:729;;;5319:146;:43;;;5384:22;5428:19;5319:43;:146::i;:::-;4220:1276;;;;;;;:::o;6134:1379::-;6433:32;;;6369:20;6433:32;;;:16;:32;;;;;;6369:20;;6433:32;;6428:66;;6474:20;;;;;;;;;;;;;;6428:66;6505:24;6532:33;6556:9;6532:21;:33;:::i;:::-;6505:60;-1:-1:-1;6580:27:18;;;6576:860;;6638:174;6671:14;6703:16;;6737:12;6785;6638:15;:174::i;:::-;6623:189;;6576:860;;;6843:118;:42;;;6903:14;6935:12;6843:42;:118::i;:::-;6979:28;;;6975:376;;7042:47;7056:14;7072:16;;7042:13;:47::i;:::-;7027:62;;6975:376;;;7143:193;7180:14;7216:16;;7254:1;7305:12;7143:15;:193::i;:::-;7128:208;;6975:376;7364:61;:42;;;7407:14;7423:1;7364:42;:61::i;:::-;7466:40;7490:16;7466:21;:40;:::i;:::-;7446:60;;6418:1095;6134:1379;;;;;;;;;;:::o;714:106:19:-;3111:19:2;3134:13;;;;;;3133:14;;3179:34;;;;-1:-1:-1;3197:12:2;;3212:1;3197:12;;;;:16;3179:34;3178:108;;;-1:-1:-1;3258:4:2;1476:19:6;:23;;;3219:66:2;;-1:-1:-1;3268:12:2;;;;;:17;3219:66;3157:201;;;;;;;16103:2:35;3157:201:2;;;16085:21:35;16142:2;16122:18;;;16115:30;16181:34;16161:18;;;16154:62;16252:16;16232:18;;;16225:44;16286:19;;3157:201:2;15901:410:35;3157:201:2;3368:12;:16;;;;3383:1;3368:16;;;3394:65;;;;3428:13;:20;;;;;;;;3394:65;771:42:19::1;2369:4:0;802:10:19;771;:42::i;:::-;3483:14:2::0;3479:99;;;3529:5;3513:21;;;;;;3553:14;;-1:-1:-1;14862:36:35;;3553:14:2;;14850:2:35;14835:18;3553:14:2;;;;;;;3101:483;714:106:19:o;7519:950:18:-;7732:14;;7660:7;;7732:18;7728:393;;7766:16;7785:20;:7;7766:16;7785:17;:20::i;:::-;7766:39;-1:-1:-1;7820:9:18;;;7853:26;:7;7876:2;7853:22;:26::i;:::-;7893:217;;;;;7947:10;7893:217;;;12102:34:35;7983:4:18;12152:18:35;;;12145:43;12204:18;;;12197:34;;;12247:18;;;12240:34;;;12323:4;12311:17;;12290:19;;;12283:46;12345:19;;;12338:35;;;12389:19;;;12382:35;;;7819:60:18;;-1:-1:-1;7819:60:18;;-1:-1:-1;7819:60:18;-1:-1:-1;7893:36:18;;;;;;12013:19:35;;7893:217:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;7752:369;;;;7728:393;8155:31;;;;;8180:4;8155:31;;;10910:74:35;8131:21:18;;8155:16;;;;;;10883:18:35;;8155:31:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;8131:55;-1:-1:-1;8196:59:18;:23;;;8220:10;8240:4;8247:7;8196:23;:59::i;:::-;8288:31;;;;;8313:4;8288:31;;;10910:74:35;8265:20:18;;8288:16;;;;;;10883:18:35;;8288:31:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;8265:54;;8351:13;8336:12;:28;8330:84;;8386:28;;;;;;;;14421:25:35;;;14394:18;;8386:28:18;14275:177:35;8330:84:18;8433:28;8448:13;8433:12;:28;:::i;:::-;8425:37;;;;7519:950;;;;;;:::o;1552:614:5:-;1918:10;;;1917:62;;-1:-1:-1;1934:39:5;;;;;1958:4;1934:39;;;11230:34:35;1934:15:5;11300::35;;;11280:18;;;11273:43;1934:15:5;;;;;11142:18:35;;1934:39:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:44;1917:62;1896:163;;;;;;;17287:2:35;1896:163:5;;;17269:21:35;17326:2;17306:18;;;17299:30;17365:34;17345:18;;;17338:62;17436:24;17416:18;;;17409:52;17478:19;;1896:163:5;17085:418:35;1896:163:5;2096:62;;12944:42:35;12932:55;;2096:62:5;;;12914:74:35;13004:18;;;12997:34;;;2069:90:5;;2089:5;;2119:22;;12887:18:35;;2096:62:5;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2069:19;:90::i;1387:183:19:-;1500:12;;;1460;1500;;;;;;;;;1478:7;;;;1493:5;;1478:35;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1459:54;;;1528:7;1523:40;;1544:19;;;;;;;;;;;;;;4026:514:0;3289:4;3312:12;;;:6;:12;;;;;;;;:29;;;;;;;;;;;;;4109:425;;4297:52;4336:7;4297:52;;4346:2;4297:30;:52::i;:::-;4420:49;4459:4;4466:2;4420:30;:49::i;:::-;4204:287;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;4152:371;;;;;;;;:::i;818:216:5:-;968:58;;12944:42:35;12932:55;;968:58:5;;;12914:74:35;13004:18;;;12997:34;;;941:86:5;;961:5;;991:23;;12887:18:35;;968:58:5;12740:297:35;9032:684:18;9250:37;;;;;9281:4;9250:37;;;10910:74:35;9207:7:18;;;;9250:22;;;;;;10883:18:35;;9250:37:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;9226:61;;9298:12;9313:44;9327:7;9336:9;;9313:44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;9347:9:18;;-1:-1:-1;9313:13:18;;-1:-1:-1;;9313:44:18:i;:::-;9298:59;;9372:7;9367:65;;9402:19;;;;;10940:42:35;10928:55;;9402:19:18;;;10910:74:35;10883:18;;9402:19:18;10764:226:35;9367:65:18;9465:37;;;;;9496:4;9465:37;;;10910:74:35;9442:20:18;;9465:22;;;;;;10883:18:35;;9465:37:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;9442:60;;9533:12;9516:13;:29;9512:92;;9566:38;;;;;10940:42:35;10928:55;;9566:38:18;;;10910:74:35;10883:18;;9566:38:18;10764:226:35;9512:92:18;9615:27;9645:28;9660:13;9645:12;:28;:::i;:::-;9615:58;9032:684;-1:-1:-1;;;;;;;;;;9032:684:18:o;8475:551::-;8575:7;8598:21;8622;8598:45;;8654:12;8669:36;8683:7;8692:9;;8669:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;8669:36:18;-1:-1:-1;8669:13:18;;-1:-1:-1;;8669:36:18:i;:::-;8654:51;;8720:7;8715:65;;8750:19;;;;;10940:42:35;10928:55;;8750:19:18;;;10910:74:35;10883:18;;8750:19:18;10764:226:35;8715:65:18;8813:21;8849:29;;;8845:69;;8887:27;;;;;8911:1;8887:27;;;10910:74:35;10883:18;;8887:27:18;10764:226:35;8845:69:18;8925:27;8955:28;8970:13;8955:12;:28;:::i;:::-;8925:58;8475:551;-1:-1:-1;;;;;;;;8475:551:18:o;7154:110:0:-;7232:25;7243:4;7249:7;7232:10;:25::i;1463:294:27:-;1567:14;1617:12;:7;1627:2;1617:12;:::i;:::-;1601:6;:13;:28;1597:62;;;1638:21;;;;;;;;;;;;;;1597:62;-1:-1:-1;1709:31:27;1725:4;1709:31;1703:38;;1463:294::o;952:505::-;1190:33;;;1211:2;1190:33;;1184:40;1269:2;1248:33;;1242:40;1331:2;1310:33;;;1304:40;1184;;1242;1346:4;1300:51;1379:2;1375:6;;1371:19;;;1383:7;1388:2;1383:7;;:::i;:::-;;;1371:19;1404:1;:7;;1409:2;1404:7;;:18;;;;;1415:1;:7;;1420:2;1415:7;;1404:18;1400:50;;;1431:19;;;;;;;;;;;;;;1400:50;952:505;;;;;:::o;1040:252:5:-;1216:68;;11539:42:35;11608:15;;;1216:68:5;;;11590:34:35;11660:15;;11640:18;;;11633:43;11692:18;;;11685:34;;;1189:96:5;;1209:5;;1239:27;;11502:18:35;;1216:68:5;11327:398:35;3868:717:5;4298:23;4324:69;4352:4;4324:69;;;;;;;;;;;;;;;;;4332:5;4324:27;;;;:69;;;;;:::i;:::-;4407:17;;4298:95;;-1:-1:-1;4407:21:5;4403:176;;4502:10;4491:30;;;;;;;;;;;;:::i;:::-;4483:85;;;;;;;16876:2:35;4483:85:5;;;16858:21:35;16915:2;16895:18;;;16888:30;16954:34;16934:18;;;16927:62;17025:12;17005:18;;;16998:40;17055:19;;4483:85:5;16674:406:35;1663:441:8;1738:13;1763:19;1795:10;1799:6;1795:1;:10;:::i;:::-;:14;;1808:1;1795:14;:::i;:::-;1785:25;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1785:25:8;;1763:47;;1820:15;:6;1827:1;1820:9;;;;;;;;:::i;:::-;;;;:15;;;;;;;;;;;1845;:6;1852:1;1845:9;;;;;;;;:::i;:::-;;;;:15;;;;;;;;;;-1:-1:-1;1875:9:8;1887:10;1891:6;1887:1;:10;:::i;:::-;:14;;1900:1;1887:14;:::i;:::-;1875:26;;1870:132;1907:1;1903;:5;1870:132;;;1941:12;1954:5;1962:3;1954:11;1941:25;;;;;;;:::i;:::-;;;;1929:6;1936:1;1929:9;;;;;;;;:::i;:::-;;;;:37;;;;;;;;;;-1:-1:-1;1990:1:8;1980:11;;;;;1910:3;;;:::i;:::-;;;1870:132;;;-1:-1:-1;2019:10:8;;2011:55;;;;;;;15335:2:35;2011:55:8;;;15317:21:35;;;15354:18;;;15347:30;15413:34;15393:18;;;15386:62;15465:18;;2011:55:8;15133:356:35;826:398:19;955:11;1193:1;1174;1150:5;1144:12;1121:4;1114:5;1110:16;1086:6;1056:12;1033:5;1011:197;1001:207;826:398;-1:-1:-1;;;;826:398:19:o;3872:223:6:-;4005:12;4036:52;4058:6;4066:4;4072:1;4075:12;4036:21;:52::i;:::-;4029:59;3872:223;-1:-1:-1;;;;3872:223:6:o;4959:499::-;5124:12;5181:5;5156:21;:30;;5148:81;;;;;;;15696:2:35;5148:81:6;;;15678:21:35;15735:2;15715:18;;;15708:30;15774:34;15754:18;;;15747:62;15845:8;15825:18;;;15818:36;15871:19;;5148:81:6;15494:402:35;5148:81:6;1476:19;;;;5239:60;;;;;;;16518:2:35;5239:60:6;;;16500:21:35;16557:2;16537:18;;;16530:30;16596:31;16576:18;;;16569:59;16645:18;;5239:60:6;16316:353:35;5239:60:6;5311:12;5325:23;5352:6;:11;;5371:5;5378:4;5352:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5310:73;;;;5400:51;5417:7;5426:10;5438:12;5400:16;:51::i;:::-;5393:58;4959:499;-1:-1:-1;;;;;;;4959:499:6:o;6622:742::-;6768:12;6796:7;6792:566;;;-1:-1:-1;6826:10:6;6819:17;;6792:566;6937:17;;:21;6933:415;;7181:10;7175:17;7241:15;7228:10;7224:2;7220:19;7213:44;6933:415;7320:12;7313:20;;;;;;;;;;;:::i;14:134:35:-;82:20;;111:31;82:20;111:31;:::i;:::-;14:134;;;:::o;153:347::-;204:8;214:6;268:3;261:4;253:6;249:17;245:27;235:55;;286:1;283;276:12;235:55;-1:-1:-1;309:20:35;;352:18;341:30;;338:50;;;384:1;381;374:12;338:50;421:4;413:6;409:17;397:29;;473:3;466:4;457:6;449;445:19;441:30;438:39;435:59;;;490:1;487;480:12;435:59;153:347;;;;;:::o;505:777::-;547:5;600:3;593:4;585:6;581:17;577:27;567:55;;618:1;615;608:12;567:55;654:6;641:20;680:18;717:2;713;710:10;707:36;;;723:18;;:::i;:::-;857:2;851:9;919:4;911:13;;762:66;907:22;;;931:2;903:31;899:40;887:53;;;955:18;;;975:22;;;952:46;949:72;;;1001:18;;:::i;:::-;1041:10;1037:2;1030:22;1076:2;1068:6;1061:18;1122:3;1115:4;1110:2;1102:6;1098:15;1094:26;1091:35;1088:55;;;1139:1;1136;1129:12;1088:55;1203:2;1196:4;1188:6;1184:17;1177:4;1169:6;1165:17;1152:54;1250:1;1243:4;1238:2;1230:6;1226:15;1222:26;1215:37;1270:6;1261:15;;;;;;505:777;;;;:::o;1287:1055::-;1344:5;1392:4;1380:9;1375:3;1371:19;1367:30;1364:50;;;1410:1;1407;1400:12;1364:50;1443:2;1437:9;1485:4;1477:6;1473:17;1509:18;1577:6;1565:10;1562:22;1557:2;1545:10;1542:18;1539:46;1536:72;;;1588:18;;:::i;:::-;1628:10;1624:2;1617:22;1657:6;1648:15;;1700:9;1687:23;1679:6;1672:39;1763:2;1752:9;1748:18;1735:32;1720:47;;1776:33;1801:7;1776:33;:::i;:::-;1842:7;1837:2;1829:6;1825:15;1818:32;1902:2;1891:9;1887:18;1874:32;1859:47;;1915:30;1937:7;1915:30;:::i;:::-;1978:7;1973:2;1965:6;1961:15;1954:32;2038:2;2027:9;2023:18;2010:32;1995:47;;2086:10;2077:7;2073:24;2064:7;2061:37;2051:65;;2112:1;2109;2102:12;2051:65;2149:7;2144:2;2136:6;2132:15;2125:32;2208:3;2197:9;2193:19;2180:33;2166:47;;2236:2;2228:6;2225:14;2222:34;;;2252:1;2249;2242:12;2222:34;;2290:45;2331:3;2322:6;2311:9;2307:22;2290:45;:::i;:::-;2284:3;2276:6;2272:16;2265:71;;;1287:1055;;;;:::o;2347:247::-;2406:6;2459:2;2447:9;2438:7;2434:23;2430:32;2427:52;;;2475:1;2472;2465:12;2427:52;2514:9;2501:23;2533:31;2558:5;2533:31;:::i;2599:382::-;2664:6;2672;2725:2;2713:9;2704:7;2700:23;2696:32;2693:52;;;2741:1;2738;2731:12;2693:52;2780:9;2767:23;2799:31;2824:5;2799:31;:::i;:::-;2849:5;-1:-1:-1;2906:2:35;2891:18;;2878:32;2919:30;2878:32;2919:30;:::i;:::-;2968:7;2958:17;;;2599:382;;;;;:::o;2986:1279::-;3147:6;3155;3163;3171;3179;3187;3195;3203;3256:3;3244:9;3235:7;3231:23;3227:33;3224:53;;;3273:1;3270;3263:12;3224:53;3312:9;3299:23;3331:31;3356:5;3331:31;:::i;:::-;3381:5;-1:-1:-1;3433:2:35;3418:18;;3405:32;;-1:-1:-1;3488:2:35;3473:18;;3460:32;3511:18;3541:14;;;3538:34;;;3568:1;3565;3558:12;3538:34;3591:49;3632:7;3623:6;3612:9;3608:22;3591:49;:::i;:::-;3581:59;;3692:2;3681:9;3677:18;3664:32;3649:47;;3705:33;3730:7;3705:33;:::i;:::-;3757:7;;-1:-1:-1;3817:3:35;3802:19;;3789:33;;3834:16;;;3831:36;;;3863:1;3860;3853:12;3831:36;3902:60;3954:7;3943:8;3932:9;3928:24;3902:60;:::i;:::-;3981:8;;-1:-1:-1;3876:86:35;-1:-1:-1;3876:86:35;;-1:-1:-1;4035:39:35;4069:3;4054:19;;4035:39;:::i;:::-;4025:49;;4127:3;4116:9;4112:19;4099:33;4083:49;;4157:2;4147:8;4144:16;4141:36;;;4173:1;4170;4163:12;4141:36;;4196:63;4251:7;4240:8;4229:9;4225:24;4196:63;:::i;:::-;4186:73;;;2986:1279;;;;;;;;;;;:::o;4270:774::-;4393:6;4401;4409;4417;4470:3;4458:9;4449:7;4445:23;4441:33;4438:53;;;4487:1;4484;4477:12;4438:53;4526:9;4513:23;4545:31;4570:5;4545:31;:::i;:::-;4595:5;-1:-1:-1;4647:2:35;4632:18;;4619:32;;-1:-1:-1;4702:2:35;4687:18;;4674:32;4725:18;4755:14;;;4752:34;;;4782:1;4779;4772:12;4752:34;4805:49;4846:7;4837:6;4826:9;4822:22;4805:49;:::i;:::-;4795:59;;4907:2;4896:9;4892:18;4879:32;4863:48;;4936:2;4926:8;4923:16;4920:36;;;4952:1;4949;4942:12;4920:36;;4975:63;5030:7;5019:8;5008:9;5004:24;4975:63;:::i;:::-;4965:73;;;4270:774;;;;;;;:::o;5049:1295::-;5228:6;5236;5244;5252;5260;5268;5276;5284;5292;5300;5353:3;5341:9;5332:7;5328:23;5324:33;5321:53;;;5370:1;5367;5360:12;5321:53;5393:29;5412:9;5393:29;:::i;:::-;5383:39;;5469:2;5458:9;5454:18;5441:32;5431:42;;5524:2;5513:9;5509:18;5496:32;5547:18;5588:2;5580:6;5577:14;5574:34;;;5604:1;5601;5594:12;5574:34;5627:49;5668:7;5659:6;5648:9;5644:22;5627:49;:::i;:::-;5617:59;;5723:2;5712:9;5708:18;5695:32;5685:42;;5746:39;5780:3;5769:9;5765:19;5746:39;:::i;:::-;5736:49;;5804:39;5838:3;5827:9;5823:19;5804:39;:::i;:::-;5794:49;;5896:3;5885:9;5881:19;5868:33;5852:49;;5926:2;5916:8;5913:16;5910:36;;;5942:1;5939;5932:12;5910:36;5981:60;6033:7;6022:8;6011:9;6007:24;5981:60;:::i;:::-;6060:8;;-1:-1:-1;5955:86:35;-1:-1:-1;5955:86:35;;-1:-1:-1;6114:39:35;6148:3;6133:19;;6114:39;:::i;:::-;6104:49;;6206:3;6195:9;6191:19;6178:33;6162:49;;6236:2;6226:8;6223:16;6220:36;;;6252:1;6249;6242:12;6220:36;;6275:63;6330:7;6319:8;6308:9;6304:24;6275:63;:::i;:::-;6265:73;;;5049:1295;;;;;;;;;;;;;:::o;6349:985::-;6490:6;6498;6506;6514;6522;6530;6583:3;6571:9;6562:7;6558:23;6554:33;6551:53;;;6600:1;6597;6590:12;6551:53;6639:9;6626:23;6658:31;6683:5;6658:31;:::i;:::-;6708:5;-1:-1:-1;6760:2:35;6745:18;;6732:32;;-1:-1:-1;6815:2:35;6800:18;;6787:32;6838:18;6868:14;;;6865:34;;;6895:1;6892;6885:12;6865:34;6918:49;6959:7;6950:6;6939:9;6935:22;6918:49;:::i;:::-;6908:59;;7014:2;7003:9;6999:18;6986:32;6976:42;;7070:3;7059:9;7055:19;7042:33;7027:48;;7084:33;7109:7;7084:33;:::i;:::-;7136:7;;-1:-1:-1;7196:3:35;7181:19;;7168:33;;7213:16;;;7210:36;;;7242:1;7239;7232:12;7210:36;;7265:63;7320:7;7309:8;7298:9;7294:24;7265:63;:::i;:::-;7255:73;;;6349:985;;;;;;;;:::o;7339:245::-;7406:6;7459:2;7447:9;7438:7;7434:23;7430:32;7427:52;;;7475:1;7472;7465:12;7427:52;7507:9;7501:16;7526:28;7548:5;7526:28;:::i;7589:180::-;7648:6;7701:2;7689:9;7680:7;7676:23;7672:32;7669:52;;;7717:1;7714;7707:12;7669:52;-1:-1:-1;7740:23:35;;7589:180;-1:-1:-1;7589:180:35:o;7774:315::-;7842:6;7850;7903:2;7891:9;7882:7;7878:23;7874:32;7871:52;;;7919:1;7916;7909:12;7871:52;7955:9;7942:23;7932:33;;8015:2;8004:9;8000:18;7987:32;8028:31;8053:5;8028:31;:::i;8094:332::-;8152:6;8205:2;8193:9;8184:7;8180:23;8176:32;8173:52;;;8221:1;8218;8211:12;8173:52;8260:9;8247:23;8310:66;8303:5;8299:78;8292:5;8289:89;8279:117;;8392:1;8389;8382:12;8705:184;8775:6;8828:2;8816:9;8807:7;8803:23;8799:32;8796:52;;;8844:1;8841;8834:12;8796:52;-1:-1:-1;8867:16:35;;8705:184;-1:-1:-1;8705:184:35:o;8894:316::-;8935:3;8973:5;8967:12;9000:6;8995:3;8988:19;9016:63;9072:6;9065:4;9060:3;9056:14;9049:4;9042:5;9038:16;9016:63;:::i;:::-;9124:2;9112:15;9129:66;9108:88;9099:98;;;;9199:4;9095:109;;8894:316;-1:-1:-1;;8894:316:35:o;9484:274::-;9613:3;9651:6;9645:13;9667:53;9713:6;9708:3;9701:4;9693:6;9689:17;9667:53;:::i;:::-;9736:16;;;;;9484:274;-1:-1:-1;;9484:274:35:o;9973:786::-;10384:25;10379:3;10372:38;10354:3;10439:6;10433:13;10455:62;10510:6;10505:2;10500:3;10496:12;10489:4;10481:6;10477:17;10455:62;:::i;:::-;10581:19;10576:2;10536:16;;;10568:11;;;10561:40;10626:13;;10648:63;10626:13;10697:2;10689:11;;10682:4;10670:17;;10648:63;:::i;:::-;10731:17;10750:2;10727:26;;9973:786;-1:-1:-1;;;;9973:786:35:o;13042:1036::-;13430:4;13459:3;13501:42;13493:6;13489:55;13478:9;13471:74;13581:6;13576:2;13565:9;13561:18;13554:34;13624:6;13619:2;13608:9;13604:18;13597:34;13667:2;13662;13651:9;13647:18;13640:30;13693:44;13733:2;13722:9;13718:18;13710:6;13693:44;:::i;:::-;13679:58;;13768:9;13760:6;13756:22;13815:2;13809:3;13798:9;13794:19;13787:31;13842:1;13834:6;13827:17;13895:6;13888:14;13881:22;13875:3;13864:9;13860:19;13853:51;13953:10;13945:6;13941:23;13935:3;13924:9;13920:19;13913:52;14010:2;14006;14002:11;13996:3;13985:9;13981:19;13974:40;;14031:41;14068:2;14060:6;14056:15;14048:6;14031:41;:::i;14909:219::-;15058:2;15047:9;15040:21;15021:4;15078:44;15118:2;15107:9;15103:18;15095:6;15078:44;:::i;18106:128::-;18146:3;18177:1;18173:6;18170:1;18167:13;18164:39;;;18183:18;;:::i;:::-;-1:-1:-1;18219:9:35;;18106:128::o;18239:204::-;18277:3;18313:4;18310:1;18306:12;18345:4;18342:1;18338:12;18380:3;18374:4;18370:14;18365:3;18362:23;18359:49;;;18388:18;;:::i;:::-;18424:13;;18239:204;-1:-1:-1;;;18239:204:35:o;18448:228::-;18488:7;18614:1;18546:66;18542:74;18539:1;18536:81;18531:1;18524:9;18517:17;18513:105;18510:131;;;18621:18;;:::i;:::-;-1:-1:-1;18661:9:35;;18448:228::o;18681:125::-;18721:4;18749:1;18746;18743:8;18740:34;;;18754:18;;:::i;:::-;-1:-1:-1;18791:9:35;;18681:125::o;18811:258::-;18883:1;18893:113;18907:6;18904:1;18901:13;18893:113;;;18983:11;;;18977:18;18964:11;;;18957:39;18929:2;18922:10;18893:113;;;19024:6;19021:1;19018:13;19015:48;;;-1:-1:-1;;19059:1:35;19041:16;;19034:27;18811:258::o;19074:196::-;19113:3;19141:5;19131:39;;19150:18;;:::i;:::-;-1:-1:-1;19197:66:35;19186:78;;19074:196::o;19275:184::-;19327:77;19324:1;19317:88;19424:4;19421:1;19414:15;19448:4;19445:1;19438:15;19464:184;19516:77;19513:1;19506:88;19613:4;19610:1;19603:15;19637:4;19634:1;19627:15;19653:184;19705:77;19702:1;19695:88;19802:4;19799:1;19792:15;19826:4;19823:1;19816:15;19842:154;19928:42;19921:5;19917:54;19910:5;19907:65;19897:93;;19986:1;19983;19976:12;20001:118;20087:5;20080:13;20073:21;20066:5;20063:32;20053:60;;20109:1;20106;20099:12
Swarm Source
ipfs://9ead8a1570b8111cab1afcb290a001cb4566badc69ed452f5315e9a9618b5335
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.