Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 4084950 | 939 days ago | Contract Creation | 0 ETH |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
RangoAcrossFacet
Compiler Version
v0.8.16+commit.07a7930e
Optimization Enabled:
Yes with 10000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.16;
import "../../interfaces/IAcrossSpokePool.sol";
import "../../interfaces/IRangoAcross.sol";
import "../../interfaces/IRango.sol";
import "../../utils/ReentrancyGuard.sol";
import "../../libraries/LibSwapper.sol";
import "../../libraries/LibDiamond.sol";
import "../../interfaces/Interchain.sol";
import "@openzeppelin/contracts/interfaces/IERC1271.sol";
import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol";
/// @title The root contract that handles Rango's interaction with Across bridge
/// @author Thinking Particle & AMA
/// @dev This is deployed as a facet for RangoDiamond
contract RangoAcrossFacet is IRango, ReentrancyGuard, IRangoAcross, IERC1271 {
/// Storage ///
/// @dev keccak256("exchange.rango.facets.across")
bytes32 internal constant ACROSS_NAMESPACE = hex"4e63b982873f293633572d65fbc8b8e979949d7d2e57c548af3c9d5fc8844dbb";
struct AcrossStorage {
/// @notice List of whitelisted Across spoke pools in the current chain
mapping(address => bool) acrossSpokePools;
mapping(bytes32 => bool) refundHashes;
mapping(uint32 => address) depositIdToAddress;
bytes acrossRewardBytes;
/// @notice This is used to prevent malicious signature validation for a different spoke pool.
address temporarySpokeForSignatureVerification;
}
/// Events ///
/// @notice Notifies that some new spoke pool addresses are whitelisted
/// @param _addresses The newly whitelisted addresses
event AcrossSpokePoolsAdded(address[] _addresses);
/// @notice Notifies that reward bytes are updated
/// @param rewardBytes The newly set rewardBytes
event AcrossRewardBytesUpdated(bytes rewardBytes);
/// @notice Notifies that some spoke pool addresses are blacklisted
/// @param _addresses The addresses that are removed
event AcrossSpokePoolsRemoved(address[] _addresses);
/// Initialization ///
/// @notice Initialize the contract.
/// @param _addresses The contract address of the spoke pool on the source chain.
/// @param acrossRewardBytes The rewardBytes passed to across pool
function initAcross(address[] calldata _addresses, bytes calldata acrossRewardBytes) external {
LibDiamond.enforceIsContractOwner();
addAcrossSpokePoolsInternal(_addresses);
setAcrossRewardBytesInternal(acrossRewardBytes);
}
/// @notice Enables the contract to receive native ETH token from other contracts including WETH contract
receive() external payable {}
/// @notice Adds a list of new addresses to the whitelisted Across spokePools
/// @param _addresses The list of new routers
function addAcrossSpokePools(address[] calldata _addresses) public {
LibDiamond.enforceIsContractOwner();
addAcrossSpokePoolsInternal(_addresses);
}
/// @notice Removes a list of routers from the whitelisted addresses
/// @param _addresses The list of addresses that should be deprecated
function removeAcrossSpokePools(address[] calldata _addresses) external {
LibDiamond.enforceIsContractOwner();
AcrossStorage storage s = getAcrossStorage();
for (uint i = 0; i < _addresses.length; i++) {
delete s.acrossSpokePools[_addresses[i]];
}
emit AcrossSpokePoolsRemoved(_addresses);
}
/// @notice Adds a list of new addresses to the whitelisted Across spokePools
/// @param acrossRewardBytes The rewardBytes passed to across contract
function setAcrossRewardBytes(bytes calldata acrossRewardBytes) public {
LibDiamond.enforceIsContractOwner();
setAcrossRewardBytesInternal(acrossRewardBytes);
}
/// @notice Executes a DEX (arbitrary) call + a Across bridge call
/// @dev request.toToken can be address(0) for native deposits and will be replaced in doAcrossBridge
/// @param request The general swap request containing from/to token and fee/affiliate rewards
/// @param calls The list of DEX calls, if this list is empty, it means that there is no DEX call and we are only bridging
/// @param bridgeRequest required data for the bridging step, including the destination chain and recipient wallet address
function acrossSwapAndBridge(
LibSwapper.SwapRequest memory request,
LibSwapper.Call[] calldata calls,
AcrossBridgeRequest memory bridgeRequest
) external payable nonReentrant {
uint out = LibSwapper.onChainSwapsPreBridge(request, calls, 0);
doAcrossBridge(bridgeRequest, request.toToken, out);
bool hasInterchainMessage = bridgeRequest.message.length > 0;
bool hasDestSwap = false;
if (hasInterchainMessage == true) {
Interchain.RangoInterChainMessage memory imMessage = abi.decode((bridgeRequest.message), (Interchain.RangoInterChainMessage));
hasDestSwap = imMessage.actionType != Interchain.ActionType.NO_ACTION;
}
// event emission
emit RangoBridgeInitiated(
request.requestId,
request.toToken,
out,
bridgeRequest.recipient,
bridgeRequest.destinationChainId,
hasInterchainMessage,
hasDestSwap,
uint8(BridgeType.Across),
request.dAppTag);
}
/// @notice starts bridging through Across bridge
/// @dev request.toToken can be address(0) for native deposits and will be replaced in doAcrossBridge
function acrossBridge(
AcrossBridgeRequest memory request,
IRango.RangoBridgeRequest memory bridgeRequest
) external payable nonReentrant {
uint amount = bridgeRequest.amount;
address token = bridgeRequest.token;
uint amountWithFee = amount + LibSwapper.sumFees(bridgeRequest);
// transfer tokens if necessary
if (token == LibSwapper.ETH) {
require(
msg.value >= amountWithFee, "Insufficient ETH sent for bridging and fees");
} else {
SafeERC20.safeTransferFrom(IERC20(token), msg.sender, address(this), amountWithFee);
}
LibSwapper.collectFees(bridgeRequest);
doAcrossBridge(request, token, amount);
bool hasInterchainMessage = request.message.length > 0;
bool hasDestSwap = false;
if (hasInterchainMessage == true) {
Interchain.RangoInterChainMessage memory imMessage = abi.decode((request.message), (Interchain.RangoInterChainMessage));
hasDestSwap = imMessage.actionType != Interchain.ActionType.NO_ACTION;
}
// event emission
emit RangoBridgeInitiated(
bridgeRequest.requestId,
token,
amount,
request.recipient,
request.destinationChainId,
hasInterchainMessage,
hasDestSwap,
uint8(BridgeType.Across),
bridgeRequest.dAppTag
);
}
/// @notice Executes an Across bridge call
/// @dev bridgeRequest.originToken can be address(0) for native deposits
/// @param request The other required fields for across bridge contract
/// @param amount Amount of tokens to deposit. Will be amount of tokens to receive less fees.
function doAcrossBridge(
AcrossBridgeRequest memory request,
address token,
uint amount
) internal {
AcrossStorage storage s = getAcrossStorage();
require(s.acrossSpokePools[request.spokePoolAddress], "Requested spokePool address not whitelisted");
if (token != LibSwapper.ETH)
LibSwapper.approveMax(token, request.spokePoolAddress, amount);
address bridgeToken = token;
if (token == LibSwapper.ETH) bridgeToken = LibSwapper.getBaseSwapperStorage().WETH;
bytes memory acrossCallData = encodeWithSignature(
request.recipient,
bridgeToken,
amount,
request.destinationChainId,
request.relayerFeePct,
request.quoteTimestamp,
request.message,
request.maxCount
);
bytes memory callData = concat(acrossCallData, s.acrossRewardBytes);
// store depositId to use later for refunds if necessary
uint32 depositId = IAcrossSpokePool(request.spokePoolAddress).numberOfDeposits();
s.depositIdToAddress[depositId] = msg.sender;
(bool success, bytes memory ret) = request.spokePoolAddress.call{value : token == LibSwapper.ETH ? amount : 0}(callData);
if (!success)
revert(LibSwapper._getRevertMsg(ret));
}
/// @notice Speed up or update an Across bridge call for unstuck
/// @dev This can be used to unstuck transactions on destination by changing recipient or message
function speedUpAcrossDeposit(
address spokePoolAddress,
int64 updatedRelayerFeePct,
uint32 depositId,
address updatedRecipient,
bytes memory updatedMessage,
bytes memory depositorSignature
) external nonReentrant {
AcrossStorage storage s = getAcrossStorage();
require(s.acrossSpokePools[spokePoolAddress] == true);
address _owner = LibDiamond.contractOwner();
if (msg.sender != _owner && s.depositIdToAddress[depositId] != msg.sender) {
revert("Sender should be owner or the original depositor");
}
// register refund hash
bytes32 _hash = getTypedDataV4Hash(
depositId,
block.chainid,
updatedRelayerFeePct,
updatedRecipient,
updatedMessage
);
s.refundHashes[_hash] = true;
s.temporarySpokeForSignatureVerification = spokePoolAddress;
IAcrossSpokePool(spokePoolAddress).speedUpDeposit(
address(this),
updatedRelayerFeePct,
depositId,
updatedRecipient,
updatedMessage,
depositorSignature
);
s.refundHashes[_hash] = false;
s.temporarySpokeForSignatureVerification = address(0);
}
/// @notice Speed up or update an Across bridge call for unstuck
/// @dev This can be used to unstuck transactions on destination by changing recipient or message
function speedUpAcrossDepositWithHash(
address spokePoolAddress,
bytes32 hash,
int64 updatedRelayerFeePct,
uint32 depositId,
address updatedRecipient,
bytes memory updatedMessage,
bytes memory depositorSignature
) external nonReentrant {
AcrossStorage storage s = getAcrossStorage();
address _owner = LibDiamond.contractOwner();
if (msg.sender != _owner && s.depositIdToAddress[depositId] != msg.sender) {
revert("Sender should be owner or the original depositor");
}
require(s.acrossSpokePools[spokePoolAddress] == true);
// register refund hash
s.refundHashes[hash] = true;
s.temporarySpokeForSignatureVerification = spokePoolAddress;
IAcrossSpokePool(spokePoolAddress).speedUpDeposit(
address(this),
updatedRelayerFeePct,
depositId,
updatedRecipient,
updatedMessage,
depositorSignature
);
s.refundHashes[hash] = false;
s.temporarySpokeForSignatureVerification = address(0);
}
// @dev Important Note: If any facets needs to support EIP1271 in future, we should have a function that supports EIP1271 for all facets. Otherwise, only one facet will have isValidSignature and others will be left out
function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4){
AcrossStorage storage s = getAcrossStorage();
bytes4 MAGICVALUE = 0x1626ba7e;
// handle eip1271 for across bridge
if (s.temporarySpokeForSignatureVerification == msg.sender) {
if (s.refundHashes[hash] == true) {
return MAGICVALUE;
}
}
// sender is not across bridge. We can handle other cases here later if needed.
return 0xffffffff;
}
/// @dev This function is based on Across SpokePool and _hashTypedDataV4, to get the hashed of data.
function getTypedDataV4Hash(
uint32 depositId,
uint256 originChainId,
int64 updatedRelayerFeePct,
address updatedRecipient,
bytes memory updatedMessage
) public pure returns (bytes32){
bytes32 hashedName = keccak256(bytes("ACROSS-V2"));
bytes32 hashedVersion = keccak256(bytes("1.0.0"));
bytes32 _HASHED_NAME = hashedName;
bytes32 _HASHED_VERSION = hashedVersion;
bytes32 _TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId)");
bytes32 domainSep = keccak256(abi.encode(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION, originChainId));
bytes32 UPDATE_DEPOSIT_DETAILS_HASH = keccak256(
"UpdateDepositDetails(uint32 depositId,uint256 originChainId,int64 updatedRelayerFeePct,address updatedRecipient,bytes updatedMessage)"
);
bytes32 structHash = keccak256(
abi.encode(
UPDATE_DEPOSIT_DETAILS_HASH,
depositId,
originChainId,
updatedRelayerFeePct,
updatedRecipient,
keccak256(updatedMessage)
)
);
return ECDSAUpgradeable.toTypedDataHash(domainSep, structHash);
}
function concat(bytes memory a, bytes memory b) internal pure returns (bytes memory) {
return abi.encodePacked(a, b);
}
function encodeWithSignature(
address recipient,
address originToken,
uint256 amount,
uint256 destinationChainId,
int64 relayerFeePct,
uint32 quoteTimestamp,
bytes memory message,
uint256 maxCount
) public pure returns (bytes memory) {
return abi.encodeWithSignature("deposit(address,address,uint256,uint256,int64,uint32,bytes,uint256)",
recipient, originToken, amount, destinationChainId, relayerFeePct, quoteTimestamp, message, maxCount
);
}
function addAcrossSpokePoolsInternal(address[] calldata _addresses) private {
AcrossStorage storage s = getAcrossStorage();
address tmpAddr;
for (uint i = 0; i < _addresses.length; i++) {
tmpAddr = _addresses[i];
require(tmpAddr != address(0), "Invalid SpokePool Address");
s.acrossSpokePools[tmpAddr] = true;
}
emit AcrossSpokePoolsAdded(_addresses);
}
function setAcrossRewardBytesInternal(bytes calldata acrossRewardBytes) private {
AcrossStorage storage s = getAcrossStorage();
s.acrossRewardBytes = acrossRewardBytes;
emit AcrossRewardBytesUpdated(acrossRewardBytes);
}
/// @dev fetch local storage
function getAcrossStorage() private pure returns (AcrossStorage storage s) {
bytes32 namespace = ACROSS_NAMESPACE;
// solhint-disable-next-line no-inline-assembly
assembly {
s.slot := namespace
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../StringsUpgradeable.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSAUpgradeable {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV // Deprecated in v4.8
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", StringsUpgradeable.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library MathUpgradeable {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator,
Rounding rounding
) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10**64) {
value /= 10**64;
result += 64;
}
if (value >= 10**32) {
value /= 10**32;
result += 32;
}
if (value >= 10**16) {
value /= 10**16;
result += 16;
}
if (value >= 10**8) {
value /= 10**8;
result += 8;
}
if (value >= 10**4) {
value /= 10**4;
result += 4;
}
if (value >= 10**2) {
value /= 10**2;
result += 2;
}
if (value >= 10**1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/MathUpgradeable.sol";
/**
* @dev String operations.
*/
library StringsUpgradeable {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = MathUpgradeable.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, MathUpgradeable.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC1271 standard signature validation method for
* contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
*
* _Available since v4.1._
*/
interface IERC1271 {
/**
* @dev Should return whether the signature provided is valid for the provided data
* @param hash Hash of the data to be signed
* @param signature Signature byte array associated with _data
*/
function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.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");
}
}
}// 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: LGPL-3.0-only
pragma solidity 0.8.16;
/// @title The root contract that handles Rango's interaction with Across bridge
/// @author George
abstract contract IAcrossSpokePool {
address public wrappedNativeToken;
uint32 public numberOfDeposits;
/// Note that this deposit function is not used in our contract directly because we concat a custom calldata
/**
* @notice Called by user to bridge funds from origin to destination chain. Depositor will effectively lock
* tokens in this contract and receive a destination token on the destination chain. The origin => destination
* token mapping is stored on the L1 HubPool.
* @notice The caller must first approve this contract to spend amount of originToken.
* @notice The originToken => destinationChainId must be enabled.
* @notice This method is payable because the caller is able to deposit native token if the originToken is
* wrappedNativeToken and this function will handle wrapping the native token to wrappedNativeToken.
* @param recipient Address to receive funds at on destination chain.
* @param originToken Token to lock into this contract to initiate deposit.
* @param amount Amount of tokens to deposit. Will be amount of tokens to receive less fees.
* @param destinationChainId Denotes network where user will receive funds from SpokePool by a relayer.
* @param relayerFeePct % of deposit amount taken out to incentivize a fast relayer.
* @param quoteTimestamp Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid
* to LP pool on HubPool.
* @param message Arbitrary data that can be used to pass additional information to the recipient along with the tokens.
* Note: this is intended to be used to pass along instructions for how a contract should use or allocate the tokens.
* @param maxCount used to protect the depositor from frontrunning to guarantee their quote remains valid.
*/
function deposit(
address recipient,
address originToken,
uint256 amount,
uint256 destinationChainId,
int64 relayerFeePct,
uint32 quoteTimestamp,
bytes memory message,
uint256 maxCount
) external virtual payable;
/**
* @notice Convenience method that depositor can use to signal to relayer to use updated fee.
* @notice Relayer should only use events emitted by this function to submit fills with updated fees, otherwise they
* risk their fills getting disputed for being invalid, for example if the depositor never actually signed the
* update fee message.
* @notice This function will revert if the depositor did not sign a message containing the updated fee for the
* deposit ID stored in this contract. If the deposit ID is for another contract, or the depositor address is
* incorrect, or the updated fee is incorrect, then the signature will not match and this function will revert.
* @notice This function is not subject to a deposit pause on the off chance that deposits sent before all deposits
* are paused have very low fees and the user wants to entice a relayer to fill them with a higher fee.
* @param depositor Signer of the update fee message who originally submitted the deposit. If the deposit doesn't
* exist, then the relayer will not be able to fill any relay, so the caller should validate that the depositor
* did in fact submit a relay.
* @param updatedRelayerFeePct New relayer fee that relayers can use.
* @param depositId Deposit to update fee for that originated in this contract.
* @param updatedRecipient New recipient address that should receive the tokens.
* @param updatedMessage New message that should be provided to the recipient.
* @param depositorSignature Signed message containing the depositor address, this contract chain ID, the updated
* relayer fee %, and the deposit ID. This signature is produced by signing a hash of data according to the
* EIP-712 standard. See more in the _verifyUpdateRelayerFeeMessage() comments.
*/
function speedUpDeposit(
address depositor,
int64 updatedRelayerFeePct,
uint32 depositId,
address updatedRecipient,
bytes memory updatedMessage,
bytes memory depositorSignature
) external virtual payable;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;
interface IDiamondCut {
enum FacetCutAction {
Add,
Replace,
Remove
}
// Add=0, Replace=1, Remove=2
struct FacetCut {
address facetAddress;
FacetCutAction action;
bytes4[] functionSelectors;
}
/// @notice Add/replace/remove any number of functions and optionally execute
/// a function with delegatecall
/// @param _diamondCut Contains the facet addresses and function selectors
/// @param _init The address of the contract or facet to execute _calldata
/// @param _calldata A function call, including function selector and arguments
/// _calldata is executed with delegatecall on _init
function diamondCut(
FacetCut[] calldata _diamondCut,
address _init,
bytes calldata _calldata
) external;
event DiamondCut(FacetCut[] _diamondCut, address _init, bytes _calldata);
}// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.16;
/// @title An interface to interchain message types
/// @author Uchiha Sasuke
interface Interchain {
enum ActionType { NO_ACTION, UNI_V2, UNI_V3, CALL }
enum CallSubActionType { WRAP, UNWRAP, NO_ACTION }
struct RangoInterChainMessage {
address requestId;
uint64 dstChainId;
// @dev bridgeRealOutput is only used to disambiguate receipt of WETH and ETH and SHOULD NOT be used anywhere else!
address bridgeRealOutput;
address toToken;
address originalSender;
address recipient;
ActionType actionType;
bytes action;
CallSubActionType postAction;
uint16 dAppTag;
// Extra message
bytes dAppMessage;
address dAppSourceContract;
address dAppDestContract;
}
struct UniswapV2Action {
address dexAddress;
uint amountOutMin;
address[] path;
uint deadline;
}
struct UniswapV3ActionExactInputSingleParams {
address dexAddress;
address tokenIn;
address tokenOut;
uint24 fee;
uint256 deadline;
uint256 amountOutMinimum;
uint160 sqrtPriceLimitX96;
}
/// @notice The requested call data which is computed off-chain and passed to the contract
/// @param target The dex contract address that should be called
/// @param callData The required data field that should be give to the dex contract to perform swap
struct CallAction {
address tokenIn;
address spender;
CallSubActionType preAction;
address payable target;
bytes callData;
}
}// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.16;
interface IRango {
struct RangoBridgeRequest {
address requestId;
address token;
uint amount;
uint platformFee;
uint affiliateFee;
address payable affiliatorAddress;
uint destinationExecutorFee;
uint16 dAppTag;
}
enum BridgeType {Across, CBridge, Hop, Hyphen, Multichain, Stargate, Synapse, Thorchain, Symbiosis, Axelar, Voyager, Poly, OptimismBridge, ArbitrumBridge, Wormhole, AllBridge}
/// @notice Status of cross-chain swap
/// @param Succeeded The whole process is success and end-user received the desired token in the destination
/// @param RefundInSource Bridge was out of liquidity and middle asset (ex: USDC) is returned to user on source chain
/// @param RefundInDestination Our handler on dest chain this.executeMessageWithTransfer failed and we send middle asset (ex: USDC) to user on destination chain
/// @param SwapFailedInDestination Everything was ok, but the final DEX on destination failed (ex: Market price change and slippage)
enum CrossChainOperationStatus {
Succeeded,
RefundInSource,
RefundInDestination,
SwapFailedInDestination
}
event RangoBridgeInitiated(
address indexed requestId,
address bridgeToken,
uint256 bridgeAmount,
address receiver,
uint destinationChainId,
bool hasInterchainMessage,
bool hasDestinationSwap,
uint8 indexed bridgeId,
uint16 indexed dAppTag
);
event RangoBridgeCompleted(
address indexed requestId,
address indexed token,
address indexed originalSender,
address receiver,
uint amount,
CrossChainOperationStatus status,
uint16 dAppTag
);
}// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.16;
import "../libraries/LibSwapper.sol";
import "./IRango.sol";
/// @title An interface to RangoAcross.sol contract to improve type hinting
/// @author George
interface IRangoAcross {
/// @notice The request object for Across bridge call
/// @param spokePoolAddress The address of Across spoke pool that deposit should be done to
/// @param recipient Address to receive funds at on destination chain.
/// @param originToken Token to lock into this contract to initiate deposit. Can be address(0)
/// @param destinationChainId Denotes network where user will receive funds from SpokePool by a relayer.
/// @param relayerFeePct % of deposit amount taken out to incentivize a fast relayer.
/// @param quoteTimestamp Timestamp used by relayers to compute this deposit's realizedLPFeePct which is paid to LP pool on HubPool.
/// @param message message that will be passed to destination chain. Can be empty.
/// @param maxCount used as a form of front-running protection. If we pass maxCount of 90 and when the tx is submitted the spoke has count of 100, the tx will revert. Default can be set to type(uint).max
struct AcrossBridgeRequest {
address spokePoolAddress;
address recipient;
uint256 destinationChainId;
int64 relayerFeePct;
uint32 quoteTimestamp;
bytes message;
uint256 maxCount;
}
function acrossSwapAndBridge(
LibSwapper.SwapRequest memory request,
LibSwapper.Call[] calldata calls,
AcrossBridgeRequest memory bridgeRequest
) external payable;
function acrossBridge(
AcrossBridgeRequest memory request,
IRango.RangoBridgeRequest memory bridgeRequest
) external payable;
}// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.16;
interface IWETH {
function deposit() external payable;
function withdraw(uint256) external;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;
import { IDiamondCut } from "../interfaces/IDiamondCut.sol";
/// Implementation of EIP-2535 Diamond Standard
/// https://eips.ethereum.org/EIPS/eip-2535
library LibDiamond {
/// @dev keccak256("diamond.standard.diamond.storage");
bytes32 internal constant DIAMOND_STORAGE_POSITION = hex"c8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c";
// Diamond specific errors
error IncorrectFacetCutAction();
error NoSelectorsInFacet();
error FunctionAlreadyExists();
error FacetAddressIsZero();
error FacetAddressIsNotZero();
error FacetContainsNoCode();
error FunctionDoesNotExist();
error FunctionIsImmutable();
error InitZeroButCalldataNotEmpty();
error CalldataEmptyButInitNotZero();
error InitReverted();
// ----------------
struct FacetAddressAndPosition {
address facetAddress;
uint96 functionSelectorPosition; // position in facetFunctionSelectors.functionSelectors array
}
struct FacetFunctionSelectors {
bytes4[] functionSelectors;
uint256 facetAddressPosition; // position of facetAddress in facetAddresses array
}
struct DiamondStorage {
// maps function selector to the facet address and
// the position of the selector in the facetFunctionSelectors.selectors array
mapping(bytes4 => FacetAddressAndPosition) selectorToFacetAndPosition;
// maps facet addresses to function selectors
mapping(address => FacetFunctionSelectors) facetFunctionSelectors;
// facet addresses
address[] facetAddresses;
// Used to query if a contract implements an interface.
// Used to implement ERC-165.
mapping(bytes4 => bool) supportedInterfaces;
// owner of the contract
address contractOwner;
}
function diamondStorage() internal pure returns (DiamondStorage storage ds) {
bytes32 position = DIAMOND_STORAGE_POSITION;
// solhint-disable-next-line no-inline-assembly
assembly {
ds.slot := position
}
}
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function setContractOwner(address _newOwner) internal {
DiamondStorage storage ds = diamondStorage();
address previousOwner = ds.contractOwner;
ds.contractOwner = _newOwner;
emit OwnershipTransferred(previousOwner, _newOwner);
}
function contractOwner() internal view returns (address contractOwner_) {
contractOwner_ = diamondStorage().contractOwner;
}
function enforceIsContractOwner() internal view {
require(msg.sender == diamondStorage().contractOwner, "LibDiamond: Must be contract owner");
}
event DiamondCut(IDiamondCut.FacetCut[] _diamondCut, address _init, bytes _calldata);
// Internal function version of diamondCut
function diamondCut(
IDiamondCut.FacetCut[] memory _diamondCut,
address _init,
bytes memory _calldata
) internal {
for (uint256 facetIndex; facetIndex < _diamondCut.length; ) {
IDiamondCut.FacetCutAction action = _diamondCut[facetIndex].action;
if (action == IDiamondCut.FacetCutAction.Add) {
addFunctions(_diamondCut[facetIndex].facetAddress, _diamondCut[facetIndex].functionSelectors);
} else if (action == IDiamondCut.FacetCutAction.Replace) {
replaceFunctions(_diamondCut[facetIndex].facetAddress, _diamondCut[facetIndex].functionSelectors);
} else if (action == IDiamondCut.FacetCutAction.Remove) {
removeFunctions(_diamondCut[facetIndex].facetAddress, _diamondCut[facetIndex].functionSelectors);
} else {
revert IncorrectFacetCutAction();
}
unchecked {
++facetIndex;
}
}
emit DiamondCut(_diamondCut, _init, _calldata);
initializeDiamondCut(_init, _calldata);
}
function addFunctions(address _facetAddress, bytes4[] memory _functionSelectors) internal {
if (_facetAddress == address(0)) {
revert FacetAddressIsZero();
}
if (_functionSelectors.length == 0) {
revert NoSelectorsInFacet();
}
DiamondStorage storage ds = diamondStorage();
uint96 selectorPosition = uint96(ds.facetFunctionSelectors[_facetAddress].functionSelectors.length);
// add new facet address if it does not exist
if (selectorPosition == 0) {
addFacet(ds, _facetAddress);
}
for (uint256 selectorIndex; selectorIndex < _functionSelectors.length; ) {
bytes4 selector = _functionSelectors[selectorIndex];
address oldFacetAddress = ds.selectorToFacetAndPosition[selector].facetAddress;
if (oldFacetAddress != address(0)) {
revert FunctionAlreadyExists();
}
addFunction(ds, selector, selectorPosition, _facetAddress);
unchecked {
++selectorPosition;
++selectorIndex;
}
}
}
function replaceFunctions(address _facetAddress, bytes4[] memory _functionSelectors) internal {
if (_functionSelectors.length == 0) {
revert NoSelectorsInFacet();
}
if (_facetAddress == address(0)) {
revert FacetAddressIsZero();
}
DiamondStorage storage ds = diamondStorage();
uint96 selectorPosition = uint96(ds.facetFunctionSelectors[_facetAddress].functionSelectors.length);
// add new facet address if it does not exist
if (selectorPosition == 0) {
addFacet(ds, _facetAddress);
}
for (uint256 selectorIndex; selectorIndex < _functionSelectors.length; ) {
bytes4 selector = _functionSelectors[selectorIndex];
address oldFacetAddress = ds.selectorToFacetAndPosition[selector].facetAddress;
if (oldFacetAddress == _facetAddress) {
revert FunctionAlreadyExists();
}
removeFunction(ds, oldFacetAddress, selector);
addFunction(ds, selector, selectorPosition, _facetAddress);
unchecked {
++selectorPosition;
++selectorIndex;
}
}
}
function removeFunctions(address _facetAddress, bytes4[] memory _functionSelectors) internal {
if (_functionSelectors.length == 0) {
revert NoSelectorsInFacet();
}
DiamondStorage storage ds = diamondStorage();
// if function does not exist then do nothing and return
if (_facetAddress != address(0)) {
revert FacetAddressIsNotZero();
}
for (uint256 selectorIndex; selectorIndex < _functionSelectors.length; ) {
bytes4 selector = _functionSelectors[selectorIndex];
address oldFacetAddress = ds.selectorToFacetAndPosition[selector].facetAddress;
removeFunction(ds, oldFacetAddress, selector);
unchecked {
++selectorIndex;
}
}
}
function addFacet(DiamondStorage storage ds, address _facetAddress) internal {
enforceHasContractCode(_facetAddress);
ds.facetFunctionSelectors[_facetAddress].facetAddressPosition = ds.facetAddresses.length;
ds.facetAddresses.push(_facetAddress);
}
function addFunction(
DiamondStorage storage ds,
bytes4 _selector,
uint96 _selectorPosition,
address _facetAddress
) internal {
ds.selectorToFacetAndPosition[_selector].functionSelectorPosition = _selectorPosition;
ds.facetFunctionSelectors[_facetAddress].functionSelectors.push(_selector);
ds.selectorToFacetAndPosition[_selector].facetAddress = _facetAddress;
}
function removeFunction(
DiamondStorage storage ds,
address _facetAddress,
bytes4 _selector
) internal {
if (_facetAddress == address(0)) {
revert FunctionDoesNotExist();
}
// an immutable function is a function defined directly in a diamond
if (_facetAddress == address(this)) {
revert FunctionIsImmutable();
}
// replace selector with last selector, then delete last selector
uint256 selectorPosition = ds.selectorToFacetAndPosition[_selector].functionSelectorPosition;
uint256 lastSelectorPosition = ds.facetFunctionSelectors[_facetAddress].functionSelectors.length - 1;
// if not the same then replace _selector with lastSelector
if (selectorPosition != lastSelectorPosition) {
bytes4 lastSelector = ds.facetFunctionSelectors[_facetAddress].functionSelectors[lastSelectorPosition];
ds.facetFunctionSelectors[_facetAddress].functionSelectors[selectorPosition] = lastSelector;
ds.selectorToFacetAndPosition[lastSelector].functionSelectorPosition = uint96(selectorPosition);
}
// delete the last selector
ds.facetFunctionSelectors[_facetAddress].functionSelectors.pop();
delete ds.selectorToFacetAndPosition[_selector];
// if no more selectors for facet address then delete the facet address
if (lastSelectorPosition == 0) {
// replace facet address with last facet address and delete last facet address
uint256 lastFacetAddressPosition = ds.facetAddresses.length - 1;
uint256 facetAddressPosition = ds.facetFunctionSelectors[_facetAddress].facetAddressPosition;
if (facetAddressPosition != lastFacetAddressPosition) {
address lastFacetAddress = ds.facetAddresses[lastFacetAddressPosition];
ds.facetAddresses[facetAddressPosition] = lastFacetAddress;
ds.facetFunctionSelectors[lastFacetAddress].facetAddressPosition = facetAddressPosition;
}
ds.facetAddresses.pop();
delete ds.facetFunctionSelectors[_facetAddress].facetAddressPosition;
}
}
function initializeDiamondCut(address _init, bytes memory _calldata) internal {
if (_init == address(0)) {
if (_calldata.length != 0) {
revert InitZeroButCalldataNotEmpty();
}
} else {
if (_calldata.length == 0) {
revert CalldataEmptyButInitNotZero();
}
if (_init != address(this)) {
enforceHasContractCode(_init);
}
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory error) = _init.delegatecall(_calldata);
if (!success) {
if (error.length > 0) {
// bubble up the error
revert(string(error));
} else {
revert InitReverted();
}
}
}
}
function enforceHasContractCode(address _contract) internal view {
uint256 contractSize;
// solhint-disable-next-line no-inline-assembly
assembly {
contractSize := extcodesize(_contract)
}
if (contractSize == 0) {
revert FacetContainsNoCode();
}
}
}// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.16;
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../interfaces/IWETH.sol";
import "../interfaces/IRango.sol";
/// @title BaseSwapper
/// @author 0xiden
/// @notice library to provide swap functionality
library LibSwapper {
/// @dev keccak256("exchange.rango.library.swapper")
bytes32 internal constant BASE_SWAPPER_NAMESPACE = hex"43da06808a8e54e76a41d6f7b48ddfb23969b1387a8710ef6241423a5aefe64a";
address payable constant ETH = payable(0x0000000000000000000000000000000000000000);
struct BaseSwapperStorage {
address payable feeContractAddress;
address WETH;
mapping(address => bool) whitelistContracts;
mapping(address => mapping(bytes4 => bool)) whitelistMethods;
}
/// @notice Emitted if any fee transfer was required
/// @param token The address of received token, address(0) for native
/// @param affiliatorAddress The address of affiliate wallet
/// @param platformFee The amount received as platform fee
/// @param destinationExecutorFee The amount received to execute transaction on destination (only for cross chain txs)
/// @param affiliateFee The amount received by affiliate
/// @param dAppTag Optional identifier to make tracking easier.
event FeeInfo(
address token,
address indexed affiliatorAddress,
uint platformFee,
uint destinationExecutorFee,
uint affiliateFee,
uint16 indexed dAppTag
);
/// @notice A call to another dex or contract done and here is the result
/// @param target The address of dex or contract that is called
/// @param success A boolean indicating that the call was success or not
/// @param returnData The response of function call
event CallResult(address target, bool success, bytes returnData);
/// @notice A swap request is done and we also emit the output
/// @param requestId Optional parameter to make tracking of transaction easier
/// @param fromToken Input token address to be swapped from
/// @param toToken Output token address to be swapped to
/// @param amountIn Input amount of fromToken that is being swapped
/// @param dAppTag Optional identifier to make tracking easier
/// @param outputAmount The output amount of the swap, measured by the balance change before and after the swap
/// @param receiver The address to receive the output of swap. Can be address(0) when swap is before a bridge action
event RangoSwap(
address indexed requestId,
address fromToken,
address toToken,
uint amountIn,
uint minimumAmountExpected,
uint16 indexed dAppTag,
uint outputAmount,
address receiver
);
/// @notice Output amount of a dex calls is logged
/// @param _token The address of output token, ZERO address for native
/// @param amount The amount of output
event DexOutput(address _token, uint amount);
/// @notice The output money (ERC20/Native) is sent to a wallet
/// @param _token The token that is sent to a wallet, ZERO address for native
/// @param _amount The sent amount
/// @param _receiver The receiver wallet address
event SendToken(address _token, uint256 _amount, address _receiver);
/// @notice Notifies that Rango's fee receiver address updated
/// @param _oldAddress The previous fee wallet address
/// @param _newAddress The new fee wallet address
event FeeContractAddressUpdated(address _oldAddress, address _newAddress);
/// @notice Notifies that WETH address is updated
/// @param _oldAddress The previous weth address
/// @param _newAddress The new weth address
event WethContractAddressUpdated(address _oldAddress, address _newAddress);
/// @notice Notifies that admin manually refunded some money
/// @param _token The address of refunded token, 0x000..00 address for native token
/// @param _amount The amount that is refunded
event Refunded(address _token, uint _amount);
/// @notice The requested call data which is computed off-chain and passed to the contract
/// @dev swapFromToken and amount parameters are only helper params and the actual amount and
/// token are set in callData
/// @param spender The contract which the approval is given to if swapFromToken is not native.
/// @param target The dex contract address that should be called
/// @param swapFromToken Token address of to be used in the swap.
/// @param amount The amount to be approved or native amount sent.
/// @param callData The required data field that should be give to the dex contract to perform swap
struct Call {
address spender;
address payable target;
address swapFromToken;
address swapToToken;
bool needsTransferFromUser;
uint amount;
bytes callData;
}
/// @notice General swap request which is given to us in all relevant functions
/// @param requestId The request id passed to make tracking transactions easier
/// @param fromToken The source token that is going to be swapped (in case of simple swap or swap + bridge) or the briding token (in case of solo bridge)
/// @param toToken The output token of swapping. This is the output of DEX step and is also input of bridging step
/// @param amountIn The amount of input token to be swapped
/// @param platformFee The amount of fee charged by platform
/// @param destinationExecutorFee The amount of fee required for relayer execution on the destination
/// @param affiliateFee The amount of fee charged by affiliator dApp
/// @param affiliatorAddress The wallet address that the affiliator fee should be sent to
/// @param minimumAmountExpected The minimum amount of toToken expected after executing Calls
/// @param dAppTag An optional parameter
struct SwapRequest {
address requestId;
address fromToken;
address toToken;
uint amountIn;
uint platformFee;
uint destinationExecutorFee;
uint affiliateFee;
address payable affiliatorAddress;
uint minimumAmountExpected;
uint16 dAppTag;
}
/// @notice initializes the base swapper and sets the init params (such as Wrapped token address)
/// @param _weth Address of wrapped token (WETH, WBNB, etc.) on the current chain
function setWeth(address _weth) internal {
BaseSwapperStorage storage baseStorage = getBaseSwapperStorage();
address oldAddress = baseStorage.WETH;
baseStorage.WETH = _weth;
require(_weth != address(0), "Invalid WETH!");
emit WethContractAddressUpdated(oldAddress, _weth);
}
/// @notice Sets the wallet that receives Rango's fees from now on
/// @param _address The receiver wallet address
function updateFeeContractAddress(address payable _address) internal {
BaseSwapperStorage storage baseSwapperStorage = getBaseSwapperStorage();
address oldAddress = baseSwapperStorage.feeContractAddress;
baseSwapperStorage.feeContractAddress = _address;
emit FeeContractAddressUpdated(oldAddress, _address);
}
/// Whitelist ///
/// @notice Adds a contract to the whitelisted DEXes that can be called
/// @param contractAddress The address of the DEX
function addWhitelist(address contractAddress) internal {
BaseSwapperStorage storage baseStorage = getBaseSwapperStorage();
baseStorage.whitelistContracts[contractAddress] = true;
}
/// @notice Adds a method of contract to the whitelisted DEXes that can be called
/// @param contractAddress The address of the DEX
/// @param methodIds The method of the DEX
function addMethodWhitelists(address contractAddress, bytes4[] calldata methodIds) internal {
BaseSwapperStorage storage baseStorage = getBaseSwapperStorage();
baseStorage.whitelistContracts[contractAddress] = true;
for (uint i = 0; i < methodIds.length; i++)
baseStorage.whitelistMethods[contractAddress][methodIds[i]] = true;
}
/// @notice Adds a method of contract to the whitelisted DEXes that can be called
/// @param contractAddress The address of the DEX
/// @param methodId The method of the DEX
function addMethodWhitelist(address contractAddress, bytes4 methodId) internal {
BaseSwapperStorage storage baseStorage = getBaseSwapperStorage();
baseStorage.whitelistContracts[contractAddress] = true;
baseStorage.whitelistMethods[contractAddress][methodId] = true;
}
/// @notice Removes a contract from the whitelisted DEXes
/// @param contractAddress The address of the DEX or dApp
function removeWhitelist(address contractAddress) internal {
BaseSwapperStorage storage baseStorage = getBaseSwapperStorage();
delete baseStorage.whitelistContracts[contractAddress];
}
/// @notice Removes a method of contract from the whitelisted DEXes
/// @param contractAddress The address of the DEX or dApp
/// @param methodId The method of the DEX
function removeMethodWhitelist(address contractAddress, bytes4 methodId) internal {
BaseSwapperStorage storage baseStorage = getBaseSwapperStorage();
delete baseStorage.whitelistMethods[contractAddress][methodId];
}
function onChainSwapsPreBridge(
SwapRequest memory request,
Call[] calldata calls,
uint extraFee
) internal returns (uint out) {
bool isNative = request.fromToken == ETH;
uint minimumRequiredValue = (isNative ? request.platformFee + request.affiliateFee + request.amountIn + request.destinationExecutorFee : 0) + extraFee;
require(msg.value >= minimumRequiredValue, 'Send more ETH to cover input amount + fee');
(, out) = onChainSwapsInternal(request, calls, extraFee);
// when there is a bridge after swap, set the receiver in swap event to address(0)
emitSwapEvent(request, out, ETH);
return out;
}
/// @notice Internal function to compute output amount of DEXes
/// @param request The general swap request containing from/to token and fee/affiliate rewards
/// @param calls The list of DEX calls
/// @param extraNativeFee The amount of native tokens to keep and not return to user as excess amount.
/// @return The response of all DEX calls and the output amount of the whole process
function onChainSwapsInternal(
SwapRequest memory request,
Call[] calldata calls,
uint256 extraNativeFee
) internal returns (bytes[] memory, uint) {
uint toBalanceBefore = getBalanceOf(request.toToken);
uint fromBalanceBefore = getBalanceOf(request.fromToken);
uint256[] memory initialBalancesList = getInitialBalancesList(calls);
// transfer tokens from user for SwapRequest and Calls that require transfer from user.
transferTokensFromUserForSwapRequest(request);
transferTokensFromUserForCalls(calls);
bytes[] memory result = callSwapsAndFees(request, calls);
// check if any extra tokens were taken from contract and return excess tokens if any.
returnExcessAmounts(request, calls, initialBalancesList);
// get balance after returning excesses.
uint fromBalanceAfter = getBalanceOf(request.fromToken);
// check over-expense of fromToken and return excess if any.
if (request.fromToken != ETH) {
require(fromBalanceAfter >= fromBalanceBefore, "Source token balance on contract must not decrease after swap");
if (fromBalanceAfter > fromBalanceBefore)
_sendToken(request.fromToken, fromBalanceAfter - fromBalanceBefore, msg.sender);
}
else {
require(fromBalanceAfter >= fromBalanceBefore - msg.value, "Source token balance on contract must not decrease after swap");
// When we are keeping extraNativeFee for bridgingFee, we should consider it in calculations.
if (fromBalanceAfter > fromBalanceBefore - msg.value + extraNativeFee)
_sendToken(request.fromToken, fromBalanceAfter + msg.value - fromBalanceBefore - extraNativeFee, msg.sender);
}
uint toBalanceAfter = getBalanceOf(request.toToken);
uint secondaryBalance = toBalanceAfter - toBalanceBefore;
require(secondaryBalance >= request.minimumAmountExpected, "Output is less than minimum expected");
return (result, secondaryBalance);
}
/// @notice Private function to handle fetching money from wallet to contract, reduce fee/affiliate, perform DEX calls
/// @param request The general swap request containing from/to token and fee/affiliate rewards
/// @param calls The list of DEX calls
/// @dev It checks the whitelisting of all DEX addresses + having enough msg.value as input
/// @return The bytes of all DEX calls response
function callSwapsAndFees(SwapRequest memory request, Call[] calldata calls) private returns (bytes[] memory) {
bool isSourceNative = request.fromToken == ETH;
BaseSwapperStorage storage baseSwapperStorage = getBaseSwapperStorage();
for (uint256 i = 0; i < calls.length; i++) {
require(baseSwapperStorage.whitelistContracts[calls[i].spender], "Contract spender not whitelisted");
require(baseSwapperStorage.whitelistContracts[calls[i].target], "Contract target not whitelisted");
bytes4 sig = bytes4(calls[i].callData[: 4]);
require(baseSwapperStorage.whitelistMethods[calls[i].target][sig], "Unauthorized call data!");
}
// Get Platform fee
bool hasPlatformFee = request.platformFee > 0;
bool hasDestExecutorFee = request.destinationExecutorFee > 0;
bool hasAffiliateFee = request.affiliateFee > 0;
if (hasPlatformFee || hasDestExecutorFee) {
require(baseSwapperStorage.feeContractAddress != ETH, "Fee contract address not set");
_sendToken(request.fromToken, request.platformFee + request.destinationExecutorFee, baseSwapperStorage.feeContractAddress, isSourceNative, false);
}
// Get affiliate fee
if (hasAffiliateFee) {
require(request.affiliatorAddress != ETH, "Invalid affiliatorAddress");
_sendToken(request.fromToken, request.affiliateFee, request.affiliatorAddress, isSourceNative, false);
}
// emit Fee event
if (hasPlatformFee || hasDestExecutorFee || hasAffiliateFee) {
emit FeeInfo(
request.fromToken,
request.affiliatorAddress,
request.platformFee,
request.destinationExecutorFee,
request.affiliateFee,
request.dAppTag
);
}
// Execute swap Calls
bytes[] memory returnData = new bytes[](calls.length);
address tmpSwapFromToken;
for (uint256 i = 0; i < calls.length; i++) {
tmpSwapFromToken = calls[i].swapFromToken;
bool isTokenNative = tmpSwapFromToken == ETH;
if (isTokenNative == false)
approveMax(tmpSwapFromToken, calls[i].spender, calls[i].amount);
(bool success, bytes memory ret) = isTokenNative
? calls[i].target.call{value : calls[i].amount}(calls[i].callData)
: calls[i].target.call(calls[i].callData);
emit CallResult(calls[i].target, success, ret);
if (!success)
revert(_getRevertMsg(ret));
returnData[i] = ret;
}
return returnData;
}
/// @notice Approves an ERC20 token to a contract to transfer from the current contract
/// @param token The address of an ERC20 token
/// @param spender The contract address that should be approved
/// @param value The amount that should be approved
function approve(address token, address spender, uint value) internal {
SafeERC20.safeApprove(IERC20(token), spender, 0);
SafeERC20.safeIncreaseAllowance(IERC20(token), spender, value);
}
/// @notice Approves an ERC20 token to a contract to transfer from the current contract, approves for inf value
/// @param token The address of an ERC20 token
/// @param spender The contract address that should be approved
/// @param value The desired allowance. If current allowance is less than this value, infinite allowance will be given
function approveMax(address token, address spender, uint value) internal {
uint256 currentAllowance = IERC20(token).allowance(address(this), spender);
if (currentAllowance < value) {
if (currentAllowance != 0) {
// We set allowance to 0 if not already. tokens such as USDT require zero allowance first.
SafeERC20.safeApprove(IERC20(token), spender, 0);
}
SafeERC20.safeIncreaseAllowance(IERC20(token), spender, type(uint256).max);
}
}
function _sendToken(address _token, uint256 _amount, address _receiver) internal {
(_token == ETH) ? _sendNative(_receiver, _amount) : SafeERC20.safeTransfer(IERC20(_token), _receiver, _amount);
}
function sumFees(IRango.RangoBridgeRequest memory request) internal pure returns (uint256) {
return request.platformFee + request.affiliateFee + request.destinationExecutorFee;
}
function sumFees(SwapRequest memory request) internal pure returns (uint256) {
return request.platformFee + request.affiliateFee + request.destinationExecutorFee;
}
function collectFees(IRango.RangoBridgeRequest memory request) internal {
// Get Platform fee
bool hasPlatformFee = request.platformFee > 0;
bool hasDestExecutorFee = request.destinationExecutorFee > 0;
bool hasAffiliateFee = request.affiliateFee > 0;
bool hasAnyFee = hasPlatformFee || hasDestExecutorFee || hasAffiliateFee;
if (!hasAnyFee) {
return;
}
bool isSourceNative = request.token == ETH;
BaseSwapperStorage storage baseSwapperStorage = getBaseSwapperStorage();
if (hasPlatformFee || hasDestExecutorFee) {
require(baseSwapperStorage.feeContractAddress != ETH, "Fee contract address not set");
_sendToken(request.token, request.platformFee + request.destinationExecutorFee, baseSwapperStorage.feeContractAddress, isSourceNative, false);
}
// Get affiliate fee
if (hasAffiliateFee) {
require(request.affiliatorAddress != ETH, "Invalid affiliatorAddress");
_sendToken(request.token, request.affiliateFee, request.affiliatorAddress, isSourceNative, false);
}
// emit Fee event
emit FeeInfo(
request.token,
request.affiliatorAddress,
request.platformFee,
request.destinationExecutorFee,
request.affiliateFee,
request.dAppTag
);
}
function collectFeesFromSender(IRango.RangoBridgeRequest memory request) internal {
// Get Platform fee
bool hasPlatformFee = request.platformFee > 0;
bool hasDestExecutorFee = request.destinationExecutorFee > 0;
bool hasAffiliateFee = request.affiliateFee > 0;
bool hasAnyFee = hasPlatformFee || hasDestExecutorFee || hasAffiliateFee;
if (!hasAnyFee) {
return;
}
bool isSourceNative = request.token == ETH;
BaseSwapperStorage storage baseSwapperStorage = getBaseSwapperStorage();
if (hasPlatformFee || hasDestExecutorFee) {
require(baseSwapperStorage.feeContractAddress != ETH, "Fee contract address not set");
if (isSourceNative)
_sendToken(request.token, request.platformFee + request.destinationExecutorFee, baseSwapperStorage.feeContractAddress, isSourceNative, false);
else
SafeERC20.safeTransferFrom(
IERC20(request.token),
msg.sender,
baseSwapperStorage.feeContractAddress,
request.platformFee + request.destinationExecutorFee
);
}
// Get affiliate fee
if (hasAffiliateFee) {
require(request.affiliatorAddress != ETH, "Invalid affiliatorAddress");
if (isSourceNative)
_sendToken(request.token, request.affiliateFee, request.affiliatorAddress, isSourceNative, false);
else
SafeERC20.safeTransferFrom(
IERC20(request.token),
msg.sender,
request.affiliatorAddress,
request.affiliateFee
);
}
// emit Fee event
emit FeeInfo(
request.token,
request.affiliatorAddress,
request.platformFee,
request.destinationExecutorFee,
request.affiliateFee,
request.dAppTag
);
}
/// @notice An internal function to send a token from the current contract to another contract or wallet
/// @dev This function also can convert WETH to ETH before sending if _withdraw flat is set to true
/// @dev To send native token _nativeOut param should be set to true, otherwise we assume it's an ERC20 transfer
/// @param _token The token that is going to be sent to a wallet, ZERO address for native
/// @param _amount The sent amount
/// @param _receiver The receiver wallet address or contract
/// @param _nativeOut means the output is native token
/// @param _withdraw If true, indicates that we should swap WETH to ETH before sending the money and _nativeOut must also be true
function _sendToken(
address _token,
uint256 _amount,
address _receiver,
bool _nativeOut,
bool _withdraw
) internal {
BaseSwapperStorage storage baseStorage = getBaseSwapperStorage();
emit SendToken(_token, _amount, _receiver);
if (_nativeOut) {
if (_withdraw) {
require(_token == baseStorage.WETH, "token mismatch");
IWETH(baseStorage.WETH).withdraw(_amount);
}
_sendNative(_receiver, _amount);
} else {
SafeERC20.safeTransfer(IERC20(_token), _receiver, _amount);
}
}
/// @notice An internal function to send native token to a contract or wallet
/// @param _receiver The address that will receive the native token
/// @param _amount The amount of the native token that should be sent
function _sendNative(address _receiver, uint _amount) internal {
(bool sent,) = _receiver.call{value : _amount}("");
require(sent, "failed to send native");
}
/// @notice A utility function to fetch storage from a predefined random slot using assembly
/// @return s The storage object
function getBaseSwapperStorage() internal pure returns (BaseSwapperStorage storage s) {
bytes32 namespace = BASE_SWAPPER_NAMESPACE;
// solhint-disable-next-line no-inline-assembly
assembly {
s.slot := namespace
}
}
/// @notice To extract revert message from a DEX/contract call to represent to the end-user in the blockchain
/// @param _returnData The resulting bytes of a failed call to a DEX or contract
/// @return A string that describes what was the error
function _getRevertMsg(bytes memory _returnData) internal pure returns (string memory) {
// If the _res length is less than 68, then the transaction failed silently (without a revert message)
if (_returnData.length < 68) return 'Transaction reverted silently';
assembly {
// Slice the sighash.
_returnData := add(_returnData, 0x04)
}
return abi.decode(_returnData, (string));
// All that remains is the revert string
}
function getBalanceOf(address token) internal view returns (uint) {
return token == ETH ? address(this).balance : IERC20(token).balanceOf(address(this));
}
/// @notice Fetches the balances of swapToTokens.
/// @dev this fetches the balances for swapToToken of swap Calls. If native eth is received, the balance has already increased so we subtract msg.value.
function getInitialBalancesList(Call[] calldata calls) internal view returns (uint256[] memory) {
uint callsLength = calls.length;
uint256[] memory balancesList = new uint256[](callsLength);
address token;
for (uint256 i = 0; i < callsLength; i++) {
token = calls[i].swapToToken;
balancesList[i] = getBalanceOf(token);
if (token == ETH)
balancesList[i] -= msg.value;
}
return balancesList;
}
/// This function transfers tokens from users based on the SwapRequest, it transfers amountIn + fees.
function transferTokensFromUserForSwapRequest(SwapRequest memory request) private {
uint transferAmount = request.amountIn + sumFees(request);
if (request.fromToken != ETH)
SafeERC20.safeTransferFrom(IERC20(request.fromToken), msg.sender, address(this), transferAmount);
else
require(msg.value >= transferAmount);
}
/// This function iterates on calls and if needsTransferFromUser, transfers tokens from user
function transferTokensFromUserForCalls(Call[] calldata calls) private {
uint callsLength = calls.length;
Call calldata call;
address token;
for (uint256 i = 0; i < callsLength; i++) {
call = calls[i];
token = call.swapFromToken;
if (call.needsTransferFromUser && token != ETH)
SafeERC20.safeTransferFrom(IERC20(call.swapFromToken), msg.sender, address(this), call.amount);
}
}
/// @dev returns any excess token left by the contract.
/// We iterate over `swapToToken`s because each swapToToken is either the request.toToken or is the output of
/// another `Call` in the list of swaps which itself either has transferred tokens from user,
/// or is a middle token that is the output of another `Call`.
function returnExcessAmounts(
SwapRequest memory request,
Call[] calldata calls,
uint256[] memory initialBalancesList) internal {
uint excessAmountToToken;
address tmpSwapToToken;
uint currentBalanceTo;
for (uint256 i = 0; i < calls.length; i++) {
tmpSwapToToken = calls[i].swapToToken;
currentBalanceTo = getBalanceOf(tmpSwapToToken);
excessAmountToToken = currentBalanceTo - initialBalancesList[i];
if (excessAmountToToken > 0 && tmpSwapToToken != request.toToken) {
_sendToken(tmpSwapToToken, excessAmountToToken, msg.sender);
}
}
}
function emitSwapEvent(SwapRequest memory request, uint output, address receiver) internal {
emit RangoSwap(
request.requestId,
request.fromToken,
request.toToken,
request.amountIn,
request.minimumAmountExpected,
request.dAppTag,
output,
receiver
);
}
}// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity 0.8.16;
/// @title Reentrancy Guard
/// @author
/// @notice Abstract contract to provide protection against reentrancy
abstract contract ReentrancyGuard {
/// Storage ///
/// @dev keccak256("exchange.rango.reentrancyguard");
bytes32 private constant NAMESPACE = hex"4fe94118b1030ac5f570795d403ee5116fd91b8f0b5d11f2487377c2b0ab2559";
/// Types ///
struct ReentrancyStorage {
uint256 status;
}
/// Errors ///
error ReentrancyError();
/// Constants ///
uint256 private constant _NOT_ENTERED = 0;
uint256 private constant _ENTERED = 1;
/// Modifiers ///
modifier nonReentrant() {
ReentrancyStorage storage s = reentrancyStorage();
if (s.status == _ENTERED) revert ReentrancyError();
s.status = _ENTERED;
_;
s.status = _NOT_ENTERED;
}
/// Private Methods ///
/// @dev fetch local storage
function reentrancyStorage() private pure returns (ReentrancyStorage storage data) {
bytes32 position = NAMESPACE;
// solhint-disable-next-line no-inline-assembly
assembly {
data.slot := position
}
}
}{
"optimizer": {
"enabled": true,
"runs": 10000
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"name":"ReentrancyError","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"rewardBytes","type":"bytes"}],"name":"AcrossRewardBytesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"_addresses","type":"address[]"}],"name":"AcrossSpokePoolsAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"_addresses","type":"address[]"}],"name":"AcrossSpokePoolsRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"requestId","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"originalSender","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"enum IRango.CrossChainOperationStatus","name":"status","type":"uint8"},{"indexed":false,"internalType":"uint16","name":"dAppTag","type":"uint16"}],"name":"RangoBridgeCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"requestId","type":"address"},{"indexed":false,"internalType":"address","name":"bridgeToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"bridgeAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"indexed":false,"internalType":"bool","name":"hasInterchainMessage","type":"bool"},{"indexed":false,"internalType":"bool","name":"hasDestinationSwap","type":"bool"},{"indexed":true,"internalType":"uint8","name":"bridgeId","type":"uint8"},{"indexed":true,"internalType":"uint16","name":"dAppTag","type":"uint16"}],"name":"RangoBridgeInitiated","type":"event"},{"inputs":[{"components":[{"internalType":"address","name":"spokePoolAddress","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"int64","name":"relayerFeePct","type":"int64"},{"internalType":"uint32","name":"quoteTimestamp","type":"uint32"},{"internalType":"bytes","name":"message","type":"bytes"},{"internalType":"uint256","name":"maxCount","type":"uint256"}],"internalType":"struct IRangoAcross.AcrossBridgeRequest","name":"request","type":"tuple"},{"components":[{"internalType":"address","name":"requestId","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"platformFee","type":"uint256"},{"internalType":"uint256","name":"affiliateFee","type":"uint256"},{"internalType":"address payable","name":"affiliatorAddress","type":"address"},{"internalType":"uint256","name":"destinationExecutorFee","type":"uint256"},{"internalType":"uint16","name":"dAppTag","type":"uint16"}],"internalType":"struct IRango.RangoBridgeRequest","name":"bridgeRequest","type":"tuple"}],"name":"acrossBridge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"requestId","type":"address"},{"internalType":"address","name":"fromToken","type":"address"},{"internalType":"address","name":"toToken","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"platformFee","type":"uint256"},{"internalType":"uint256","name":"destinationExecutorFee","type":"uint256"},{"internalType":"uint256","name":"affiliateFee","type":"uint256"},{"internalType":"address payable","name":"affiliatorAddress","type":"address"},{"internalType":"uint256","name":"minimumAmountExpected","type":"uint256"},{"internalType":"uint16","name":"dAppTag","type":"uint16"}],"internalType":"struct LibSwapper.SwapRequest","name":"request","type":"tuple"},{"components":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"address payable","name":"target","type":"address"},{"internalType":"address","name":"swapFromToken","type":"address"},{"internalType":"address","name":"swapToToken","type":"address"},{"internalType":"bool","name":"needsTransferFromUser","type":"bool"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct LibSwapper.Call[]","name":"calls","type":"tuple[]"},{"components":[{"internalType":"address","name":"spokePoolAddress","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"int64","name":"relayerFeePct","type":"int64"},{"internalType":"uint32","name":"quoteTimestamp","type":"uint32"},{"internalType":"bytes","name":"message","type":"bytes"},{"internalType":"uint256","name":"maxCount","type":"uint256"}],"internalType":"struct IRangoAcross.AcrossBridgeRequest","name":"bridgeRequest","type":"tuple"}],"name":"acrossSwapAndBridge","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"}],"name":"addAcrossSpokePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"originToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"destinationChainId","type":"uint256"},{"internalType":"int64","name":"relayerFeePct","type":"int64"},{"internalType":"uint32","name":"quoteTimestamp","type":"uint32"},{"internalType":"bytes","name":"message","type":"bytes"},{"internalType":"uint256","name":"maxCount","type":"uint256"}],"name":"encodeWithSignature","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint32","name":"depositId","type":"uint32"},{"internalType":"uint256","name":"originChainId","type":"uint256"},{"internalType":"int64","name":"updatedRelayerFeePct","type":"int64"},{"internalType":"address","name":"updatedRecipient","type":"address"},{"internalType":"bytes","name":"updatedMessage","type":"bytes"}],"name":"getTypedDataV4Hash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"},{"internalType":"bytes","name":"acrossRewardBytes","type":"bytes"}],"name":"initAcross","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"hash","type":"bytes32"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"isValidSignature","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"}],"name":"removeAcrossSpokePools","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"acrossRewardBytes","type":"bytes"}],"name":"setAcrossRewardBytes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spokePoolAddress","type":"address"},{"internalType":"int64","name":"updatedRelayerFeePct","type":"int64"},{"internalType":"uint32","name":"depositId","type":"uint32"},{"internalType":"address","name":"updatedRecipient","type":"address"},{"internalType":"bytes","name":"updatedMessage","type":"bytes"},{"internalType":"bytes","name":"depositorSignature","type":"bytes"}],"name":"speedUpAcrossDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spokePoolAddress","type":"address"},{"internalType":"bytes32","name":"hash","type":"bytes32"},{"internalType":"int64","name":"updatedRelayerFeePct","type":"int64"},{"internalType":"uint32","name":"depositId","type":"uint32"},{"internalType":"address","name":"updatedRecipient","type":"address"},{"internalType":"bytes","name":"updatedMessage","type":"bytes"},{"internalType":"bytes","name":"depositorSignature","type":"bytes"}],"name":"speedUpAcrossDepositWithHash","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
608060405234801561001057600080fd5b50614294806100206000396000f3fe6080604052600436106100c05760003560e01c806379e4bf1311610074578063c064fbe21161004e578063c064fbe2146103d1578063cb7a0b4b146103f1578063ea0522801461040457600080fd5b806379e4bf13146101975780637daed652146103915780639a1fca88146103b157600080fd5b80636629ed7a116100a55780636629ed7a146101375780636d2cf5c2146101575780636e2241b81461017757600080fd5b80631626ba7e146100cc5780634e42d6d61461012257600080fd5b366100c757005b600080fd5b3480156100d857600080fd5b506100ec6100e73660046132f6565b610431565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020015b60405180910390f35b61013561013036600461349b565b6104fe565b005b34801561014357600080fd5b506101356101523660046135ab565b61065e565b34801561016357600080fd5b50610135610172366004613661565b610908565b34801561018357600080fd5b50610135610192366004613661565b6109d8565b3480156101a357600080fd5b506103836101b23660046136a3565b604080518082018252600981527f4143524f53532d5632000000000000000000000000000000000000000000000060209182015281518083018352600581527f312e302e300000000000000000000000000000000000000000000000000000009082015281517fc2f8787176b8ac6bf7215b4adcc1e069bf4ab82d9ab1df05a57a91d425935b6e818301527fec4e9f157c7c27788e0dfbb20798d3f8c8066985256c4d077bdccf4022c0eb66818401527f06c015bd22b4c69690933c1058878ebdfef31f9aaae40bbe86d8a09fe1b2972c606082015260808082018890528351808303909101815260a0820184528051908301208451948301949094207f0e058f05b73c62ee68329d2c67c067aaae9a06503cc306378d144d0f0177882b60c083015263ffffffff9890981660e082015261010081019690965260079490940b6101208601526001600160a01b03929092166101408501526101608085019590955281518085039095018552610180840182528451948301949094207f19010000000000000000000000000000000000000000000000000000000000006101a08501526101a28401949094526101c280840194909452805180840390940184526101e2909201909152815191012090565b604051908152602001610119565b34801561039d57600080fd5b506101356103ac366004613762565b6109ee565b3480156103bd57600080fd5b506101356103cc3660046137ce565b610a10565b3480156103dd57600080fd5b506101356103ec366004613804565b610a22565b6101356103ff3660046138af565b610e8f565b34801561041057600080fd5b5061042461041f36600461397e565b611093565b6040516101199190613a71565b7f4e63b982873f293633572d65fbc8b8e979949d7d2e57c548af3c9d5fc8844dbf546000907f4e63b982873f293633572d65fbc8b8e979949d7d2e57c548af3c9d5fc8844dbb907f1626ba7e0000000000000000000000000000000000000000000000000000000090336001600160a01b03909116036104d2576000858152600180840160205260409091205460ff16151590036104d25791506104f89050565b507fffffffff000000000000000000000000000000000000000000000000000000009150505b92915050565b7f4fe94118b1030ac5f570795d403ee5116fd91b8f0b5d11f2487377c2b0ab255980546000190161055b576040517f29f745a700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018155600061056d8686868461111a565b905061057e83876040015183611214565b60a0830151511515600060018290036105cb5760008560a001518060200190518101906105ab9190613b20565b905060008160c0015160038111156105c5576105c5613c79565b14159150505b61012088015188516040808b01516020898101518a84015184516001600160a01b0394851681529283018a9052908316828501526060820152861515608082015285151560a0820152915161ffff9094169360009391909116917fa551f5e7134cc110651fa6eb8a0423535b3ea90eedb01463af70e6798a75d426919081900360c00190a4505060009091555050505050565b7f4fe94118b1030ac5f570795d403ee5116fd91b8f0b5d11f2487377c2b0ab25598054600019016106bb576040517f29f745a700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600181557f4e63b982873f293633572d65fbc8b8e979949d7d2e57c548af3c9d5fc8844dbb60006107137fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c1320546001600160a01b031690565b9050336001600160a01b0382161480159061074e575063ffffffff871660009081526002830160205260409020546001600160a01b03163314155b156107c65760405162461bcd60e51b815260206004820152603060248201527f53656e6465722073686f756c64206265206f776e6572206f7220746865206f7260448201527f6967696e616c206465706f7369746f720000000000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b038a1660009081526020839052604090205460ff1615156001146107f057600080fd5b60008981526001838101602052604091829020805460ff19169091179055600480840180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038e1690811790915591517f7e688bba000000000000000000000000000000000000000000000000000000008152637e688bba916108889130918d918d918d918d918d9101613ca8565b600060405180830381600087803b1580156108a257600080fd5b505af11580156108b6573d6000803e3d6000fd5b5050506000998a5250506001810160205260408820805460ff1916905560040180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905595909555505050505050565b610910611538565b7f4e63b982873f293633572d65fbc8b8e979949d7d2e57c548af3c9d5fc8844dbb60005b828110156109995781600085858481811061095157610951613d08565b90506020020160208101906109669190613d37565b6001600160a01b031681526020810191909152604001600020805460ff191690558061099181613d83565b915050610934565b507f742412c0a9b12d3e5fac09159eae18cea14f2c0bfba2edb1785d0270d0f5b86083836040516109cb929190613d9d565b60405180910390a1505050565b6109e0611538565b6109ea82826115dc565b5050565b6109f6611538565b610a0084846115dc565b610a0a82826116fd565b50505050565b610a18611538565b6109ea82826116fd565b7f4fe94118b1030ac5f570795d403ee5116fd91b8f0b5d11f2487377c2b0ab2559805460001901610a7f576040517f29f745a700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001815560007f4e63b982873f293633572d65fbc8b8e979949d7d2e57c548af3c9d5fc8844dbb6001600160a01b03891660009081526020829052604090205490915060ff161515600114610ad357600080fd5b6000610b067fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c1320546001600160a01b031690565b9050336001600160a01b03821614801590610b41575063ffffffff871660009081526002830160205260409020546001600160a01b03163314155b15610bb45760405162461bcd60e51b815260206004820152603060248201527f53656e6465722073686f756c64206265206f776e6572206f7220746865206f7260448201527f6967696e616c206465706f7369746f720000000000000000000000000000000060648201526084016107bd565b604080518082018252600981527f4143524f53532d5632000000000000000000000000000000000000000000000060209182015281518083018352600581527f312e302e300000000000000000000000000000000000000000000000000000009082015281517fc2f8787176b8ac6bf7215b4adcc1e069bf4ab82d9ab1df05a57a91d425935b6e818301527fec4e9f157c7c27788e0dfbb20798d3f8c8066985256c4d077bdccf4022c0eb66818401527f06c015bd22b4c69690933c1058878ebdfef31f9aaae40bbe86d8a09fe1b2972c60608201524660808083018290528451808403909101815260a08301855280519084012089518a8501207f0e058f05b73c62ee68329d2c67c067aaae9a06503cc306378d144d0f0177882b60c085015263ffffffff8d1660e085015261010084019290925260078d900b6101208401526001600160a01b038b81166101408501526101608085019390935285518085039093018352610180840186528251928501929092207f19010000000000000000000000000000000000000000000000000000000000006101a08501526101a28401919091526101c280840191909152845180840390910181526101e283018086528151918501919091206000818152600189810190965295909520805460ff19169094179093556004860180547fffffffffffffffffffffffff000000000000000000000000000000000000000016918e1691821790557f7e688bba00000000000000000000000000000000000000000000000000000000909252637e688bba90610e0f9030908d908d908d908d908d906101e601613ca8565b600060405180830381600087803b158015610e2957600080fd5b505af1158015610e3d573d6000803e3d6000fd5b5050506000918252506001830160205260408120805460ff19169055600490920180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055509055505050505050565b7f4fe94118b1030ac5f570795d403ee5116fd91b8f0b5d11f2487377c2b0ab2559805460001901610eec576040517f29f745a700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018155604082015160208301516000610f058561177c565b610f0f9084613deb565b90506001600160a01b038216610f9a5780341015610f955760405162461bcd60e51b815260206004820152602b60248201527f496e73756666696369656e74204554482073656e7420666f722062726964676960448201527f6e6720616e64206665657300000000000000000000000000000000000000000060648201526084016107bd565b610fa6565b610fa6823330846117a1565b610faf85611852565b610fba868385611214565b60a0860151511515600060018290036110075760008860a00151806020019051810190610fe79190613b20565b905060008160c00151600381111561100157611001613c79565b14159150505b60e0870151875160208a8101516040808d015181516001600160a01b038b811682529481018c9052928416838301526060830152861515608083015285151560a08301525161ffff9094169360009392909216917fa551f5e7134cc110651fa6eb8a0423535b3ea90eedb01463af70e6798a75d4269181900360c00190a4505060009093555050505050565b606088888888888888886040516024016110b4989796959493929190613dfe565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1186ec3300000000000000000000000000000000000000000000000000000000179052905098975050505050505050565b60208401516000906001600160a01b03161581838261113a57600061116c565b8760a0015188606001518960c001518a608001516111589190613deb565b6111629190613deb565b61116c9190613deb565b6111769190613deb565b9050803410156111ee5760405162461bcd60e51b815260206004820152602960248201527f53656e64206d6f72652045544820746f20636f76657220696e70757420616d6f60448201527f756e74202b20666565000000000000000000000000000000000000000000000060648201526084016107bd565b6111fa87878787611a58565b935061120a905087846000611cea565b5050949350505050565b82516001600160a01b031660009081527f4e63b982873f293633572d65fbc8b8e979949d7d2e57c548af3c9d5fc8844dbb602081905260409091205460ff166112c55760405162461bcd60e51b815260206004820152602b60248201527f5265717565737465642073706f6b65506f6f6c2061646472657373206e6f742060448201527f77686974656c697374656400000000000000000000000000000000000000000060648201526084016107bd565b6001600160a01b038316156112e3576112e383856000015184611d8c565b826001600160a01b03811661131f57507f43da06808a8e54e76a41d6f7b48ddfb23969b1387a8710ef6241423a5aefe64b546001600160a01b03165b60006113498660200151838689604001518a606001518b608001518c60a001518d60c00151611093565b905060006113e38285600301805461136090613e62565b80601f016020809104026020016040519081016040528092919081815260200182805461138c90613e62565b80156113d95780601f106113ae576101008083540402835291602001916113d9565b820191906000526020600020905b8154815290600101906020018083116113bc57829003601f168201915b5050505050611e42565b9050600087600001516001600160a01b031663a1244c676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611429573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144d9190613eb5565b63ffffffff81166000908152600287016020526040812080547fffffffffffffffffffffffff0000000000000000000000000000000000000000163317905589519192509081906001600160a01b03908116908a16156114ae5760006114b0565b885b856040516114be9190613ed2565b60006040518083038185875af1925050503d80600081146114fb576040519150601f19603f3d011682016040523d82523d6000602084013e611500565b606091505b50915091508161152c5761151381611e6e565b60405162461bcd60e51b81526004016107bd9190613a71565b50505050505050505050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c600401546001600160a01b031633146115da5760405162461bcd60e51b815260206004820152602260248201527f4c69624469616d6f6e643a204d75737420626520636f6e7472616374206f776e60448201527f657200000000000000000000000000000000000000000000000000000000000060648201526084016107bd565b565b7f4e63b982873f293633572d65fbc8b8e979949d7d2e57c548af3c9d5fc8844dbb6000805b838110156116bd5784848281811061161b5761161b613d08565b90506020020160208101906116309190613d37565b91506001600160a01b0382166116885760405162461bcd60e51b815260206004820152601960248201527f496e76616c69642053706f6b65506f6f6c20416464726573730000000000000060448201526064016107bd565b6001600160a01b0382166000908152602084905260409020805460ff19166001179055806116b581613d83565b915050611601565b507f582b079c313c12210d017af811111c00df441d7ad74b7b474a9ae81131f7319384846040516116ef929190613d9d565b60405180910390a150505050565b7f4e63b982873f293633572d65fbc8b8e979949d7d2e57c548af3c9d5fc8844dbb7f4e63b982873f293633572d65fbc8b8e979949d7d2e57c548af3c9d5fc8844dbe61174a838583613f34565b507f5e716f57c6e19831a3621ab4b843d399557f4fbc1e0b7ff73fb69a9fba62ee0183836040516109cb929190613ff5565b60008160c00151826080015183606001516117979190613deb565b6104f89190613deb565b6040516001600160a01b0380851660248301528316604482015260648101829052610a0a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611ecd565b606081015160c0820151608083015191151591901515901515600083806118765750825b8061187e5750815b90508061188c575050505050565b60208501516001600160a01b0316157f43da06808a8e54e76a41d6f7b48ddfb23969b1387a8710ef6241423a5aefe64a85806118c55750845b156119505780546001600160a01b03166119215760405162461bcd60e51b815260206004820152601c60248201527f46656520636f6e74726163742061646472657373206e6f74207365740000000060448201526064016107bd565b61195087602001518860c00151896060015161193d9190613deb565b83546001600160a01b0316856000611fb7565b83156119ca5760a08701516001600160a01b03166119b05760405162461bcd60e51b815260206004820152601960248201527f496e76616c696420616666696c6961746f72416464726573730000000000000060448201526064016107bd565b6119ca876020015188608001518960a00151856000611fb7565b8660e0015161ffff168760a001516001600160a01b03167ff14fbd8b6e3ad3ae34babfa1f3b6a099f57643662f4cfc24eb335ae8718f534b89602001518a606001518b60c001518c60800151604051611a4794939291906001600160a01b0394909416845260208401929092526040830152606082015260800190565b60405180910390a350505050505050565b6060600080611a6a876040015161212b565b90506000611a7b886020015161212b565b90506000611a8988886121c9565b9050611a94896122d2565b611a9e888861231f565b6000611aab8a8a8a6123bf565b9050611ab98a8a8a85612bc5565b6000611ac88b6020015161212b565b60208c01519091506001600160a01b031615611b7a5783811015611b545760405162461bcd60e51b815260206004820152603d60248201527f536f7572636520746f6b656e2062616c616e6365206f6e20636f6e747261637460448201527f206d757374206e6f74206465637265617365206166746572207377617000000060648201526084016107bd565b83811115611b755760208b0151611b7590611b6f8684614024565b33612c8e565b611c3e565b611b843485614024565b811015611bf95760405162461bcd60e51b815260206004820152603d60248201527f536f7572636520746f6b656e2062616c616e6365206f6e20636f6e747261637460448201527f206d757374206e6f74206465637265617365206166746572207377617000000060648201526084016107bd565b87611c043486614024565b611c0e9190613deb565b811115611c3e5760208b0151611c3e908986611c2a3486613deb565b611c349190614024565b611b6f9190614024565b6000611c4d8c6040015161212b565b90506000611c5b8783614024565b90508c6101000151811015611cd75760405162461bcd60e51b8152602060048201526024808201527f4f7574707574206973206c657373207468616e206d696e696d756d206578706560448201527f637465640000000000000000000000000000000000000000000000000000000060648201526084016107bd565b929c929b50919950505050505050505050565b82610120015161ffff1683600001516001600160a01b03167fc9ca33b4e1816939874cee596ae23410b4f3b26f345e8a93d5779a213ed5ab878560200151866040015187606001518861010001518888604051611d7f969594939291906001600160a01b039687168152948616602086015260408501939093526060840191909152608083015290911660a082015260c00190565b60405180910390a3505050565b6040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611df5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e199190614037565b905081811015610a0a578015611e3557611e3584846000612cb2565b610a0a8484600019612e00565b60608282604051602001611e57929190614050565b604051602081830303815290604052905092915050565b6060604482511015611eb357505060408051808201909152601d81527f5472616e73616374696f6e2072657665727465642073696c656e746c79000000602082015290565b600482019150818060200190518101906104f8919061407f565b6000611f22826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612ee49092919063ffffffff16565b805190915015611fb25780806020019051810190611f4091906140d6565b611fb25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016107bd565b505050565b604080516001600160a01b0387811682526020820187905285168183015290517f43da06808a8e54e76a41d6f7b48ddfb23969b1387a8710ef6241423a5aefe64a917fdf4363408b2d9811d1e5c23efdb5bae0b7a68bd9de2de1cbae18a11be3e67ef5919081900360600190a182156121185781156121095760018101546001600160a01b0387811691161461208f5760405162461bcd60e51b815260206004820152600e60248201527f746f6b656e206d69736d6174636800000000000000000000000000000000000060448201526064016107bd565b60018101546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018790526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b1580156120f057600080fd5b505af1158015612104573d6000803e3d6000fd5b505050505b6121138486612efb565b612123565b612123868587612f9e565b505050505050565b60006001600160a01b038216156121c2576040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038316906370a0823190602401602060405180830381865afa158015612199573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121bd9190614037565b6104f8565b4792915050565b60608160008167ffffffffffffffff8111156121e7576121e7613183565b604051908082528060200260200182016040528015612210578160200160208202803683370190505b5090506000805b838110156122c75786868281811061223157612231613d08565b905060200281019061224391906140f3565b612254906080810190606001613d37565b915061225f8261212b565b83828151811061227157612271613d08565b60209081029190910101526001600160a01b0382166122b5573483828151811061229d5761229d613d08565b602002602001018181516122b19190614024565b9052505b806122bf81613d83565b915050612217565b509095945050505050565b60006122dd82612fe7565b82606001516122ec9190613deb565b60208301519091506001600160a01b031615612312576109ea82602001513330846117a1565b803410156109ea57600080fd5b80366000805b838110156121235785858281811061233f5761233f613d08565b905060200281019061235191906140f3565b92506123636060840160408501613d37565b915061237560a0840160808501614127565b801561238957506001600160a01b03821615155b156123ad576123ad6123a16060850160408601613d37565b33308660a001356117a1565b806123b781613d83565b915050612325565b60208301516060906001600160a01b0316157f43da06808a8e54e76a41d6f7b48ddfb23969b1387a8710ef6241423a5aefe64a60005b848110156126765781600201600087878481811061241557612415613d08565b905060200281019061242791906140f3565b612435906020810190613d37565b6001600160a01b0316815260208101919091526040016000205460ff1661249e5760405162461bcd60e51b815260206004820181905260248201527f436f6e7472616374207370656e646572206e6f742077686974656c697374656460448201526064016107bd565b8160020160008787848181106124b6576124b6613d08565b90506020028101906124c891906140f3565b6124d9906040810190602001613d37565b6001600160a01b0316815260208101919091526040016000205460ff166125425760405162461bcd60e51b815260206004820152601f60248201527f436f6e747261637420746172676574206e6f742077686974656c69737465640060448201526064016107bd565b600086868381811061255657612556613d08565b905060200281019061256891906140f3565b6125769060c0810190614144565b612585916004916000916141a9565b61258e916141d3565b90508260030160008888858181106125a8576125a8613d08565b90506020028101906125ba91906140f3565b6125cb906040810190602001613d37565b6001600160a01b03168152602080820192909252604090810160009081207fffffffff000000000000000000000000000000000000000000000000000000008516825290925290205460ff166126635760405162461bcd60e51b815260206004820152601760248201527f556e617574686f72697a65642063616c6c20646174612100000000000000000060448201526064016107bd565b508061266e81613d83565b9150506123f5565b50608086015160a087015160c08801519115159190151590151582806126995750815b156127245783546001600160a01b03166126f55760405162461bcd60e51b815260206004820152601c60248201527f46656520636f6e74726163742061646472657373206e6f74207365740000000060448201526064016107bd565b61272489602001518a60a001518b608001516127119190613deb565b86546001600160a01b0316886000611fb7565b801561279e5760e08901516001600160a01b03166127845760405162461bcd60e51b815260206004820152601960248201527f496e76616c696420616666696c6961746f72416464726573730000000000000060448201526064016107bd565b61279e89602001518a60c001518b60e00151886000611fb7565b82806127a75750815b806127af5750805b1561283b5788610120015161ffff168960e001516001600160a01b03167ff14fbd8b6e3ad3ae34babfa1f3b6a099f57643662f4cfc24eb335ae8718f534b8b602001518c608001518d60a001518e60c0015160405161283294939291906001600160a01b0394909416845260208401929092526040830152606082015260800190565b60405180910390a35b60008767ffffffffffffffff81111561285657612856613183565b60405190808252806020026020018201604052801561288957816020015b60608152602001906001900390816128745790505b5090506000805b89811015612bb3578a8a828181106128aa576128aa613d08565b90506020028101906128bc91906140f3565b6128cd906060810190604001613d37565b91506001600160a01b03821615600081900361294657612946838d8d858181106128f9576128f9613d08565b905060200281019061290b91906140f3565b612919906020810190613d37565b8e8e8681811061292b5761292b613d08565b905060200281019061293d91906140f3565b60a00135611d8c565b60008082612a14578d8d8581811061296057612960613d08565b905060200281019061297291906140f3565b612983906040810190602001613d37565b6001600160a01b03168e8e8681811061299e5761299e613d08565b90506020028101906129b091906140f3565b6129be9060c0810190614144565b6040516129cc92919061421b565b6000604051808303816000865af19150503d8060008114612a09576040519150601f19603f3d011682016040523d82523d6000602084013e612a0e565b606091505b50612afe565b8d8d85818110612a2657612a26613d08565b9050602002810190612a3891906140f3565b612a49906040810190602001613d37565b6001600160a01b03168e8e86818110612a6457612a64613d08565b9050602002810190612a7691906140f3565b60a001358f8f87818110612a8c57612a8c613d08565b9050602002810190612a9e91906140f3565b612aac9060c0810190614144565b604051612aba92919061421b565b60006040518083038185875af1925050503d8060008114612af7576040519150601f19603f3d011682016040523d82523d6000602084013e612afc565b606091505b505b915091507f2fc0d44e6ef6b3e7707cacd3cc326511198c3d1598c65dd54be5a9e37ce02f128e8e86818110612b3557612b35613d08565b9050602002810190612b4791906140f3565b612b58906040810190602001613d37565b8383604051612b699392919061422b565b60405180910390a181612b7f5761151381611e6e565b80868581518110612b9257612b92613d08565b60200260200101819052505050508080612bab90613d83565b915050612890565b509096505050505050505b9392505050565b60008080805b85811015612c8457868682818110612be557612be5613d08565b9050602002810190612bf791906140f3565b612c08906080810190606001613d37565b9250612c138361212b565b9150848181518110612c2757612c27613d08565b602002602001015182612c3a9190614024565b9350600084118015612c62575087604001516001600160a01b0316836001600160a01b031614155b15612c7257612c72838533612c8e565b80612c7c81613d83565b915050612bcb565b5050505050505050565b6001600160a01b03831615612ca857611fb2838284612f9e565b611fb28183612efb565b801580612d4557506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612d1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d439190614037565b155b612db75760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e63650000000000000000000060648201526084016107bd565b6040516001600160a01b038316602482015260448101829052611fb29084907f095ea7b300000000000000000000000000000000000000000000000000000000906064016117ee565b6040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612e6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e8e9190614037565b612e989190613deb565b6040516001600160a01b038516602482015260448101829052909150610a0a9085907f095ea7b300000000000000000000000000000000000000000000000000000000906064016117ee565b6060612ef38484600085613002565b949350505050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612f48576040519150601f19603f3d011682016040523d82523d6000602084013e612f4d565b606091505b5050905080611fb25760405162461bcd60e51b815260206004820152601560248201527f6661696c656420746f2073656e64206e6174697665000000000000000000000060448201526064016107bd565b6040516001600160a01b038316602482015260448101829052611fb29084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064016117ee565b60008160a001518260c0015183608001516117979190613deb565b60608247101561307a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016107bd565b6001600160a01b0385163b6130d15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107bd565b600080866001600160a01b031685876040516130ed9190613ed2565b60006040518083038185875af1925050503d806000811461312a576040519150601f19603f3d011682016040523d82523d6000602084013e61312f565b606091505b509150915061313f82828661314a565b979650505050505050565b60608315613159575081612bbe565b8251156131695782518084602001fd5b8160405162461bcd60e51b81526004016107bd9190613a71565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160e0810167ffffffffffffffff811182821017156131d5576131d5613183565b60405290565b604051610140810167ffffffffffffffff811182821017156131d5576131d5613183565b604051610100810167ffffffffffffffff811182821017156131d5576131d5613183565b6040516101a0810167ffffffffffffffff811182821017156131d5576131d5613183565b604051601f8201601f1916810167ffffffffffffffff8111828210171561327057613270613183565b604052919050565b600067ffffffffffffffff82111561329257613292613183565b50601f01601f191660200190565b600082601f8301126132b157600080fd5b81356132c46132bf82613278565b613247565b8181528460208386010111156132d957600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561330957600080fd5b82359150602083013567ffffffffffffffff81111561332757600080fd5b613333858286016132a0565b9150509250929050565b6001600160a01b038116811461335257600080fd5b50565b80356133608161333d565b919050565b61ffff8116811461335257600080fd5b803561336081613365565b60008083601f84011261339257600080fd5b50813567ffffffffffffffff8111156133aa57600080fd5b6020830191508360208260051b85010111156133c557600080fd5b9250929050565b8035600781900b811461336057600080fd5b63ffffffff8116811461335257600080fd5b8035613360816133de565b600060e0828403121561340d57600080fd5b6134156131b2565b905061342082613355565b815261342e60208301613355565b602082015260408201356040820152613449606083016133cc565b606082015261345a608083016133f0565b608082015260a082013567ffffffffffffffff81111561347957600080fd5b613485848285016132a0565b60a08301525060c082013560c082015292915050565b6000806000808486036101808112156134b357600080fd5b610140808212156134c357600080fd5b6134cb6131db565b91506134d687613355565b82526134e460208801613355565b60208301526134f560408801613355565b6040830152606087013560608301526080870135608083015260a087013560a083015260c087013560c083015261352e60e08801613355565b60e0830152610100878101359083015261012061354c818901613375565b9083015290945085013567ffffffffffffffff8082111561356c57600080fd5b61357888838901613380565b909550935061016087013591508082111561359257600080fd5b5061359f878288016133fb565b91505092959194509250565b600080600080600080600060e0888a0312156135c657600080fd5b87356135d18161333d565b9650602088013595506135e6604089016133cc565b945060608801356135f6816133de565b935060808801356136068161333d565b925060a088013567ffffffffffffffff8082111561362357600080fd5b61362f8b838c016132a0565b935060c08a013591508082111561364557600080fd5b506136528a828b016132a0565b91505092959891949750929550565b6000806020838503121561367457600080fd5b823567ffffffffffffffff81111561368b57600080fd5b61369785828601613380565b90969095509350505050565b600080600080600060a086880312156136bb57600080fd5b85356136c6816133de565b9450602086013593506136db604087016133cc565b925060608601356136eb8161333d565b9150608086013567ffffffffffffffff81111561370757600080fd5b613713888289016132a0565b9150509295509295909350565b60008083601f84011261373257600080fd5b50813567ffffffffffffffff81111561374a57600080fd5b6020830191508360208285010111156133c557600080fd5b6000806000806040858703121561377857600080fd5b843567ffffffffffffffff8082111561379057600080fd5b61379c88838901613380565b909650945060208701359150808211156137b557600080fd5b506137c287828801613720565b95989497509550505050565b600080602083850312156137e157600080fd5b823567ffffffffffffffff8111156137f857600080fd5b61369785828601613720565b60008060008060008060c0878903121561381d57600080fd5b86356138288161333d565b9550613836602088016133cc565b94506040870135613846816133de565b935060608701356138568161333d565b9250608087013567ffffffffffffffff8082111561387357600080fd5b61387f8a838b016132a0565b935060a089013591508082111561389557600080fd5b506138a289828a016132a0565b9150509295509295509295565b6000808284036101208112156138c457600080fd5b833567ffffffffffffffff8111156138db57600080fd5b6138e7868287016133fb565b93505061010080601f19830112156138fe57600080fd5b6139066131ff565b915060208501356139168161333d565b825261392460408601613355565b6020830152606085013560408301526080850135606083015260a0850135608083015261395360c08601613355565b60a083015260e085013560c083015261396d818601613375565b60e083015250809150509250929050565b600080600080600080600080610100898b03121561399b57600080fd5b88356139a68161333d565b975060208901356139b68161333d565b965060408901359550606089013594506139d260808a016133cc565b935060a08901356139e2816133de565b925060c089013567ffffffffffffffff8111156139fe57600080fd5b613a0a8b828c016132a0565b92505060e089013590509295985092959890939650565b60005b83811015613a3c578181015183820152602001613a24565b50506000910152565b60008151808452613a5d816020860160208601613a21565b601f01601f19169290920160200192915050565b602081526000612bbe6020830184613a45565b80516133608161333d565b805167ffffffffffffffff8116811461336057600080fd5b80516004811061336057600080fd5b6000613ac46132bf84613278565b9050828152838383011115613ad857600080fd5b612bbe836020830184613a21565b600082601f830112613af757600080fd5b612bbe83835160208501613ab6565b80516003811061336057600080fd5b805161336081613365565b600060208284031215613b3257600080fd5b815167ffffffffffffffff80821115613b4a57600080fd5b908301906101a08286031215613b5f57600080fd5b613b67613223565b613b7083613a84565b8152613b7e60208401613a8f565b6020820152613b8f60408401613a84565b6040820152613ba060608401613a84565b6060820152613bb160808401613a84565b6080820152613bc260a08401613a84565b60a0820152613bd360c08401613aa7565b60c082015260e083015182811115613bea57600080fd5b613bf687828601613ae6565b60e083015250610100613c0a818501613b06565b90820152610120613c1c848201613b15565b908201526101408381015183811115613c3457600080fd5b613c4088828701613ae6565b8284015250506101609150613c56828401613a84565b828201526101809150613c6a828401613a84565b91810191909152949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60006001600160a01b0380891683528760070b602084015263ffffffff8716604084015280861660608401525060c06080830152613ce960c0830185613a45565b82810360a0840152613cfb8185613a45565b9998505050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215613d4957600080fd5b8135612bbe8161333d565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006000198203613d9657613d96613d54565b5060010190565b60208082528181018390526000908460408401835b86811015613de0578235613dc58161333d565b6001600160a01b031682529183019190830190600101613db2565b509695505050505050565b808201808211156104f8576104f8613d54565b60006101006001600160a01b03808c168452808b166020850152508860408401528760608401528660070b608084015263ffffffff861660a08401528060c0840152613e4c81840186613a45565b9150508260e08301529998505050505050505050565b600181811c90821680613e7657607f821691505b602082108103613eaf577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600060208284031215613ec757600080fd5b8151612bbe816133de565b60008251613ee4818460208701613a21565b9190910192915050565b601f821115611fb257600081815260208120601f850160051c81016020861015613f155750805b601f850160051c820191505b8181101561212357828155600101613f21565b67ffffffffffffffff831115613f4c57613f4c613183565b613f6083613f5a8354613e62565b83613eee565b6000601f841160018114613f945760008515613f7c5750838201355b600019600387901b1c1916600186901b178355613fee565b600083815260209020601f19861690835b82811015613fc55786850135825560209485019460019092019101613fa5565b5086821015613fe25760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b818103818111156104f8576104f8613d54565b60006020828403121561404957600080fd5b5051919050565b60008351614062818460208801613a21565b835190830190614076818360208801613a21565b01949350505050565b60006020828403121561409157600080fd5b815167ffffffffffffffff8111156140a857600080fd5b8201601f810184136140b957600080fd5b612ef384825160208401613ab6565b801515811461335257600080fd5b6000602082840312156140e857600080fd5b8151612bbe816140c8565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff21833603018112613ee457600080fd5b60006020828403121561413957600080fd5b8135612bbe816140c8565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261417957600080fd5b83018035915067ffffffffffffffff82111561419457600080fd5b6020019150368190038213156133c557600080fd5b600080858511156141b957600080fd5b838611156141c657600080fd5b5050820193919092039150565b7fffffffff0000000000000000000000000000000000000000000000000000000081358181169160048510156142135780818660040360031b1b83161692505b505092915050565b8183823760009101908152919050565b6001600160a01b038416815282151560208201526060604082015260006142556060830184613a45565b9594505050505056fea2646970667358221220c30806a8af24848338e2076f355ae018db10e261e3d2823b1d637e348e74c97064736f6c63430008100033
Deployed Bytecode
0x6080604052600436106100c05760003560e01c806379e4bf1311610074578063c064fbe21161004e578063c064fbe2146103d1578063cb7a0b4b146103f1578063ea0522801461040457600080fd5b806379e4bf13146101975780637daed652146103915780639a1fca88146103b157600080fd5b80636629ed7a116100a55780636629ed7a146101375780636d2cf5c2146101575780636e2241b81461017757600080fd5b80631626ba7e146100cc5780634e42d6d61461012257600080fd5b366100c757005b600080fd5b3480156100d857600080fd5b506100ec6100e73660046132f6565b610431565b6040517fffffffff0000000000000000000000000000000000000000000000000000000090911681526020015b60405180910390f35b61013561013036600461349b565b6104fe565b005b34801561014357600080fd5b506101356101523660046135ab565b61065e565b34801561016357600080fd5b50610135610172366004613661565b610908565b34801561018357600080fd5b50610135610192366004613661565b6109d8565b3480156101a357600080fd5b506103836101b23660046136a3565b604080518082018252600981527f4143524f53532d5632000000000000000000000000000000000000000000000060209182015281518083018352600581527f312e302e300000000000000000000000000000000000000000000000000000009082015281517fc2f8787176b8ac6bf7215b4adcc1e069bf4ab82d9ab1df05a57a91d425935b6e818301527fec4e9f157c7c27788e0dfbb20798d3f8c8066985256c4d077bdccf4022c0eb66818401527f06c015bd22b4c69690933c1058878ebdfef31f9aaae40bbe86d8a09fe1b2972c606082015260808082018890528351808303909101815260a0820184528051908301208451948301949094207f0e058f05b73c62ee68329d2c67c067aaae9a06503cc306378d144d0f0177882b60c083015263ffffffff9890981660e082015261010081019690965260079490940b6101208601526001600160a01b03929092166101408501526101608085019590955281518085039095018552610180840182528451948301949094207f19010000000000000000000000000000000000000000000000000000000000006101a08501526101a28401949094526101c280840194909452805180840390940184526101e2909201909152815191012090565b604051908152602001610119565b34801561039d57600080fd5b506101356103ac366004613762565b6109ee565b3480156103bd57600080fd5b506101356103cc3660046137ce565b610a10565b3480156103dd57600080fd5b506101356103ec366004613804565b610a22565b6101356103ff3660046138af565b610e8f565b34801561041057600080fd5b5061042461041f36600461397e565b611093565b6040516101199190613a71565b7f4e63b982873f293633572d65fbc8b8e979949d7d2e57c548af3c9d5fc8844dbf546000907f4e63b982873f293633572d65fbc8b8e979949d7d2e57c548af3c9d5fc8844dbb907f1626ba7e0000000000000000000000000000000000000000000000000000000090336001600160a01b03909116036104d2576000858152600180840160205260409091205460ff16151590036104d25791506104f89050565b507fffffffff000000000000000000000000000000000000000000000000000000009150505b92915050565b7f4fe94118b1030ac5f570795d403ee5116fd91b8f0b5d11f2487377c2b0ab255980546000190161055b576040517f29f745a700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018155600061056d8686868461111a565b905061057e83876040015183611214565b60a0830151511515600060018290036105cb5760008560a001518060200190518101906105ab9190613b20565b905060008160c0015160038111156105c5576105c5613c79565b14159150505b61012088015188516040808b01516020898101518a84015184516001600160a01b0394851681529283018a9052908316828501526060820152861515608082015285151560a0820152915161ffff9094169360009391909116917fa551f5e7134cc110651fa6eb8a0423535b3ea90eedb01463af70e6798a75d426919081900360c00190a4505060009091555050505050565b7f4fe94118b1030ac5f570795d403ee5116fd91b8f0b5d11f2487377c2b0ab25598054600019016106bb576040517f29f745a700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600181557f4e63b982873f293633572d65fbc8b8e979949d7d2e57c548af3c9d5fc8844dbb60006107137fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c1320546001600160a01b031690565b9050336001600160a01b0382161480159061074e575063ffffffff871660009081526002830160205260409020546001600160a01b03163314155b156107c65760405162461bcd60e51b815260206004820152603060248201527f53656e6465722073686f756c64206265206f776e6572206f7220746865206f7260448201527f6967696e616c206465706f7369746f720000000000000000000000000000000060648201526084015b60405180910390fd5b6001600160a01b038a1660009081526020839052604090205460ff1615156001146107f057600080fd5b60008981526001838101602052604091829020805460ff19169091179055600480840180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b038e1690811790915591517f7e688bba000000000000000000000000000000000000000000000000000000008152637e688bba916108889130918d918d918d918d918d9101613ca8565b600060405180830381600087803b1580156108a257600080fd5b505af11580156108b6573d6000803e3d6000fd5b5050506000998a5250506001810160205260408820805460ff1916905560040180547fffffffffffffffffffffffff000000000000000000000000000000000000000016905595909555505050505050565b610910611538565b7f4e63b982873f293633572d65fbc8b8e979949d7d2e57c548af3c9d5fc8844dbb60005b828110156109995781600085858481811061095157610951613d08565b90506020020160208101906109669190613d37565b6001600160a01b031681526020810191909152604001600020805460ff191690558061099181613d83565b915050610934565b507f742412c0a9b12d3e5fac09159eae18cea14f2c0bfba2edb1785d0270d0f5b86083836040516109cb929190613d9d565b60405180910390a1505050565b6109e0611538565b6109ea82826115dc565b5050565b6109f6611538565b610a0084846115dc565b610a0a82826116fd565b50505050565b610a18611538565b6109ea82826116fd565b7f4fe94118b1030ac5f570795d403ee5116fd91b8f0b5d11f2487377c2b0ab2559805460001901610a7f576040517f29f745a700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001815560007f4e63b982873f293633572d65fbc8b8e979949d7d2e57c548af3c9d5fc8844dbb6001600160a01b03891660009081526020829052604090205490915060ff161515600114610ad357600080fd5b6000610b067fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c1320546001600160a01b031690565b9050336001600160a01b03821614801590610b41575063ffffffff871660009081526002830160205260409020546001600160a01b03163314155b15610bb45760405162461bcd60e51b815260206004820152603060248201527f53656e6465722073686f756c64206265206f776e6572206f7220746865206f7260448201527f6967696e616c206465706f7369746f720000000000000000000000000000000060648201526084016107bd565b604080518082018252600981527f4143524f53532d5632000000000000000000000000000000000000000000000060209182015281518083018352600581527f312e302e300000000000000000000000000000000000000000000000000000009082015281517fc2f8787176b8ac6bf7215b4adcc1e069bf4ab82d9ab1df05a57a91d425935b6e818301527fec4e9f157c7c27788e0dfbb20798d3f8c8066985256c4d077bdccf4022c0eb66818401527f06c015bd22b4c69690933c1058878ebdfef31f9aaae40bbe86d8a09fe1b2972c60608201524660808083018290528451808403909101815260a08301855280519084012089518a8501207f0e058f05b73c62ee68329d2c67c067aaae9a06503cc306378d144d0f0177882b60c085015263ffffffff8d1660e085015261010084019290925260078d900b6101208401526001600160a01b038b81166101408501526101608085019390935285518085039093018352610180840186528251928501929092207f19010000000000000000000000000000000000000000000000000000000000006101a08501526101a28401919091526101c280840191909152845180840390910181526101e283018086528151918501919091206000818152600189810190965295909520805460ff19169094179093556004860180547fffffffffffffffffffffffff000000000000000000000000000000000000000016918e1691821790557f7e688bba00000000000000000000000000000000000000000000000000000000909252637e688bba90610e0f9030908d908d908d908d908d906101e601613ca8565b600060405180830381600087803b158015610e2957600080fd5b505af1158015610e3d573d6000803e3d6000fd5b5050506000918252506001830160205260408120805460ff19169055600490920180547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055509055505050505050565b7f4fe94118b1030ac5f570795d403ee5116fd91b8f0b5d11f2487377c2b0ab2559805460001901610eec576040517f29f745a700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018155604082015160208301516000610f058561177c565b610f0f9084613deb565b90506001600160a01b038216610f9a5780341015610f955760405162461bcd60e51b815260206004820152602b60248201527f496e73756666696369656e74204554482073656e7420666f722062726964676960448201527f6e6720616e64206665657300000000000000000000000000000000000000000060648201526084016107bd565b610fa6565b610fa6823330846117a1565b610faf85611852565b610fba868385611214565b60a0860151511515600060018290036110075760008860a00151806020019051810190610fe79190613b20565b905060008160c00151600381111561100157611001613c79565b14159150505b60e0870151875160208a8101516040808d015181516001600160a01b038b811682529481018c9052928416838301526060830152861515608083015285151560a08301525161ffff9094169360009392909216917fa551f5e7134cc110651fa6eb8a0423535b3ea90eedb01463af70e6798a75d4269181900360c00190a4505060009093555050505050565b606088888888888888886040516024016110b4989796959493929190613dfe565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1186ec3300000000000000000000000000000000000000000000000000000000179052905098975050505050505050565b60208401516000906001600160a01b03161581838261113a57600061116c565b8760a0015188606001518960c001518a608001516111589190613deb565b6111629190613deb565b61116c9190613deb565b6111769190613deb565b9050803410156111ee5760405162461bcd60e51b815260206004820152602960248201527f53656e64206d6f72652045544820746f20636f76657220696e70757420616d6f60448201527f756e74202b20666565000000000000000000000000000000000000000000000060648201526084016107bd565b6111fa87878787611a58565b935061120a905087846000611cea565b5050949350505050565b82516001600160a01b031660009081527f4e63b982873f293633572d65fbc8b8e979949d7d2e57c548af3c9d5fc8844dbb602081905260409091205460ff166112c55760405162461bcd60e51b815260206004820152602b60248201527f5265717565737465642073706f6b65506f6f6c2061646472657373206e6f742060448201527f77686974656c697374656400000000000000000000000000000000000000000060648201526084016107bd565b6001600160a01b038316156112e3576112e383856000015184611d8c565b826001600160a01b03811661131f57507f43da06808a8e54e76a41d6f7b48ddfb23969b1387a8710ef6241423a5aefe64b546001600160a01b03165b60006113498660200151838689604001518a606001518b608001518c60a001518d60c00151611093565b905060006113e38285600301805461136090613e62565b80601f016020809104026020016040519081016040528092919081815260200182805461138c90613e62565b80156113d95780601f106113ae576101008083540402835291602001916113d9565b820191906000526020600020905b8154815290600101906020018083116113bc57829003601f168201915b5050505050611e42565b9050600087600001516001600160a01b031663a1244c676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611429573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144d9190613eb5565b63ffffffff81166000908152600287016020526040812080547fffffffffffffffffffffffff0000000000000000000000000000000000000000163317905589519192509081906001600160a01b03908116908a16156114ae5760006114b0565b885b856040516114be9190613ed2565b60006040518083038185875af1925050503d80600081146114fb576040519150601f19603f3d011682016040523d82523d6000602084013e611500565b606091505b50915091508161152c5761151381611e6e565b60405162461bcd60e51b81526004016107bd9190613a71565b50505050505050505050565b7fc8fcad8db84d3cc18b4c41d551ea0ee66dd599cde068d998e57d5e09332c131c600401546001600160a01b031633146115da5760405162461bcd60e51b815260206004820152602260248201527f4c69624469616d6f6e643a204d75737420626520636f6e7472616374206f776e60448201527f657200000000000000000000000000000000000000000000000000000000000060648201526084016107bd565b565b7f4e63b982873f293633572d65fbc8b8e979949d7d2e57c548af3c9d5fc8844dbb6000805b838110156116bd5784848281811061161b5761161b613d08565b90506020020160208101906116309190613d37565b91506001600160a01b0382166116885760405162461bcd60e51b815260206004820152601960248201527f496e76616c69642053706f6b65506f6f6c20416464726573730000000000000060448201526064016107bd565b6001600160a01b0382166000908152602084905260409020805460ff19166001179055806116b581613d83565b915050611601565b507f582b079c313c12210d017af811111c00df441d7ad74b7b474a9ae81131f7319384846040516116ef929190613d9d565b60405180910390a150505050565b7f4e63b982873f293633572d65fbc8b8e979949d7d2e57c548af3c9d5fc8844dbb7f4e63b982873f293633572d65fbc8b8e979949d7d2e57c548af3c9d5fc8844dbe61174a838583613f34565b507f5e716f57c6e19831a3621ab4b843d399557f4fbc1e0b7ff73fb69a9fba62ee0183836040516109cb929190613ff5565b60008160c00151826080015183606001516117979190613deb565b6104f89190613deb565b6040516001600160a01b0380851660248301528316604482015260648101829052610a0a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611ecd565b606081015160c0820151608083015191151591901515901515600083806118765750825b8061187e5750815b90508061188c575050505050565b60208501516001600160a01b0316157f43da06808a8e54e76a41d6f7b48ddfb23969b1387a8710ef6241423a5aefe64a85806118c55750845b156119505780546001600160a01b03166119215760405162461bcd60e51b815260206004820152601c60248201527f46656520636f6e74726163742061646472657373206e6f74207365740000000060448201526064016107bd565b61195087602001518860c00151896060015161193d9190613deb565b83546001600160a01b0316856000611fb7565b83156119ca5760a08701516001600160a01b03166119b05760405162461bcd60e51b815260206004820152601960248201527f496e76616c696420616666696c6961746f72416464726573730000000000000060448201526064016107bd565b6119ca876020015188608001518960a00151856000611fb7565b8660e0015161ffff168760a001516001600160a01b03167ff14fbd8b6e3ad3ae34babfa1f3b6a099f57643662f4cfc24eb335ae8718f534b89602001518a606001518b60c001518c60800151604051611a4794939291906001600160a01b0394909416845260208401929092526040830152606082015260800190565b60405180910390a350505050505050565b6060600080611a6a876040015161212b565b90506000611a7b886020015161212b565b90506000611a8988886121c9565b9050611a94896122d2565b611a9e888861231f565b6000611aab8a8a8a6123bf565b9050611ab98a8a8a85612bc5565b6000611ac88b6020015161212b565b60208c01519091506001600160a01b031615611b7a5783811015611b545760405162461bcd60e51b815260206004820152603d60248201527f536f7572636520746f6b656e2062616c616e6365206f6e20636f6e747261637460448201527f206d757374206e6f74206465637265617365206166746572207377617000000060648201526084016107bd565b83811115611b755760208b0151611b7590611b6f8684614024565b33612c8e565b611c3e565b611b843485614024565b811015611bf95760405162461bcd60e51b815260206004820152603d60248201527f536f7572636520746f6b656e2062616c616e6365206f6e20636f6e747261637460448201527f206d757374206e6f74206465637265617365206166746572207377617000000060648201526084016107bd565b87611c043486614024565b611c0e9190613deb565b811115611c3e5760208b0151611c3e908986611c2a3486613deb565b611c349190614024565b611b6f9190614024565b6000611c4d8c6040015161212b565b90506000611c5b8783614024565b90508c6101000151811015611cd75760405162461bcd60e51b8152602060048201526024808201527f4f7574707574206973206c657373207468616e206d696e696d756d206578706560448201527f637465640000000000000000000000000000000000000000000000000000000060648201526084016107bd565b929c929b50919950505050505050505050565b82610120015161ffff1683600001516001600160a01b03167fc9ca33b4e1816939874cee596ae23410b4f3b26f345e8a93d5779a213ed5ab878560200151866040015187606001518861010001518888604051611d7f969594939291906001600160a01b039687168152948616602086015260408501939093526060840191909152608083015290911660a082015260c00190565b60405180910390a3505050565b6040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611df5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e199190614037565b905081811015610a0a578015611e3557611e3584846000612cb2565b610a0a8484600019612e00565b60608282604051602001611e57929190614050565b604051602081830303815290604052905092915050565b6060604482511015611eb357505060408051808201909152601d81527f5472616e73616374696f6e2072657665727465642073696c656e746c79000000602082015290565b600482019150818060200190518101906104f8919061407f565b6000611f22826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612ee49092919063ffffffff16565b805190915015611fb25780806020019051810190611f4091906140d6565b611fb25760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016107bd565b505050565b604080516001600160a01b0387811682526020820187905285168183015290517f43da06808a8e54e76a41d6f7b48ddfb23969b1387a8710ef6241423a5aefe64a917fdf4363408b2d9811d1e5c23efdb5bae0b7a68bd9de2de1cbae18a11be3e67ef5919081900360600190a182156121185781156121095760018101546001600160a01b0387811691161461208f5760405162461bcd60e51b815260206004820152600e60248201527f746f6b656e206d69736d6174636800000000000000000000000000000000000060448201526064016107bd565b60018101546040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018790526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b1580156120f057600080fd5b505af1158015612104573d6000803e3d6000fd5b505050505b6121138486612efb565b612123565b612123868587612f9e565b505050505050565b60006001600160a01b038216156121c2576040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038316906370a0823190602401602060405180830381865afa158015612199573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121bd9190614037565b6104f8565b4792915050565b60608160008167ffffffffffffffff8111156121e7576121e7613183565b604051908082528060200260200182016040528015612210578160200160208202803683370190505b5090506000805b838110156122c75786868281811061223157612231613d08565b905060200281019061224391906140f3565b612254906080810190606001613d37565b915061225f8261212b565b83828151811061227157612271613d08565b60209081029190910101526001600160a01b0382166122b5573483828151811061229d5761229d613d08565b602002602001018181516122b19190614024565b9052505b806122bf81613d83565b915050612217565b509095945050505050565b60006122dd82612fe7565b82606001516122ec9190613deb565b60208301519091506001600160a01b031615612312576109ea82602001513330846117a1565b803410156109ea57600080fd5b80366000805b838110156121235785858281811061233f5761233f613d08565b905060200281019061235191906140f3565b92506123636060840160408501613d37565b915061237560a0840160808501614127565b801561238957506001600160a01b03821615155b156123ad576123ad6123a16060850160408601613d37565b33308660a001356117a1565b806123b781613d83565b915050612325565b60208301516060906001600160a01b0316157f43da06808a8e54e76a41d6f7b48ddfb23969b1387a8710ef6241423a5aefe64a60005b848110156126765781600201600087878481811061241557612415613d08565b905060200281019061242791906140f3565b612435906020810190613d37565b6001600160a01b0316815260208101919091526040016000205460ff1661249e5760405162461bcd60e51b815260206004820181905260248201527f436f6e7472616374207370656e646572206e6f742077686974656c697374656460448201526064016107bd565b8160020160008787848181106124b6576124b6613d08565b90506020028101906124c891906140f3565b6124d9906040810190602001613d37565b6001600160a01b0316815260208101919091526040016000205460ff166125425760405162461bcd60e51b815260206004820152601f60248201527f436f6e747261637420746172676574206e6f742077686974656c69737465640060448201526064016107bd565b600086868381811061255657612556613d08565b905060200281019061256891906140f3565b6125769060c0810190614144565b612585916004916000916141a9565b61258e916141d3565b90508260030160008888858181106125a8576125a8613d08565b90506020028101906125ba91906140f3565b6125cb906040810190602001613d37565b6001600160a01b03168152602080820192909252604090810160009081207fffffffff000000000000000000000000000000000000000000000000000000008516825290925290205460ff166126635760405162461bcd60e51b815260206004820152601760248201527f556e617574686f72697a65642063616c6c20646174612100000000000000000060448201526064016107bd565b508061266e81613d83565b9150506123f5565b50608086015160a087015160c08801519115159190151590151582806126995750815b156127245783546001600160a01b03166126f55760405162461bcd60e51b815260206004820152601c60248201527f46656520636f6e74726163742061646472657373206e6f74207365740000000060448201526064016107bd565b61272489602001518a60a001518b608001516127119190613deb565b86546001600160a01b0316886000611fb7565b801561279e5760e08901516001600160a01b03166127845760405162461bcd60e51b815260206004820152601960248201527f496e76616c696420616666696c6961746f72416464726573730000000000000060448201526064016107bd565b61279e89602001518a60c001518b60e00151886000611fb7565b82806127a75750815b806127af5750805b1561283b5788610120015161ffff168960e001516001600160a01b03167ff14fbd8b6e3ad3ae34babfa1f3b6a099f57643662f4cfc24eb335ae8718f534b8b602001518c608001518d60a001518e60c0015160405161283294939291906001600160a01b0394909416845260208401929092526040830152606082015260800190565b60405180910390a35b60008767ffffffffffffffff81111561285657612856613183565b60405190808252806020026020018201604052801561288957816020015b60608152602001906001900390816128745790505b5090506000805b89811015612bb3578a8a828181106128aa576128aa613d08565b90506020028101906128bc91906140f3565b6128cd906060810190604001613d37565b91506001600160a01b03821615600081900361294657612946838d8d858181106128f9576128f9613d08565b905060200281019061290b91906140f3565b612919906020810190613d37565b8e8e8681811061292b5761292b613d08565b905060200281019061293d91906140f3565b60a00135611d8c565b60008082612a14578d8d8581811061296057612960613d08565b905060200281019061297291906140f3565b612983906040810190602001613d37565b6001600160a01b03168e8e8681811061299e5761299e613d08565b90506020028101906129b091906140f3565b6129be9060c0810190614144565b6040516129cc92919061421b565b6000604051808303816000865af19150503d8060008114612a09576040519150601f19603f3d011682016040523d82523d6000602084013e612a0e565b606091505b50612afe565b8d8d85818110612a2657612a26613d08565b9050602002810190612a3891906140f3565b612a49906040810190602001613d37565b6001600160a01b03168e8e86818110612a6457612a64613d08565b9050602002810190612a7691906140f3565b60a001358f8f87818110612a8c57612a8c613d08565b9050602002810190612a9e91906140f3565b612aac9060c0810190614144565b604051612aba92919061421b565b60006040518083038185875af1925050503d8060008114612af7576040519150601f19603f3d011682016040523d82523d6000602084013e612afc565b606091505b505b915091507f2fc0d44e6ef6b3e7707cacd3cc326511198c3d1598c65dd54be5a9e37ce02f128e8e86818110612b3557612b35613d08565b9050602002810190612b4791906140f3565b612b58906040810190602001613d37565b8383604051612b699392919061422b565b60405180910390a181612b7f5761151381611e6e565b80868581518110612b9257612b92613d08565b60200260200101819052505050508080612bab90613d83565b915050612890565b509096505050505050505b9392505050565b60008080805b85811015612c8457868682818110612be557612be5613d08565b9050602002810190612bf791906140f3565b612c08906080810190606001613d37565b9250612c138361212b565b9150848181518110612c2757612c27613d08565b602002602001015182612c3a9190614024565b9350600084118015612c62575087604001516001600160a01b0316836001600160a01b031614155b15612c7257612c72838533612c8e565b80612c7c81613d83565b915050612bcb565b5050505050505050565b6001600160a01b03831615612ca857611fb2838284612f9e565b611fb28183612efb565b801580612d4557506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612d1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d439190614037565b155b612db75760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e63650000000000000000000060648201526084016107bd565b6040516001600160a01b038316602482015260448101829052611fb29084907f095ea7b300000000000000000000000000000000000000000000000000000000906064016117ee565b6040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612e6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e8e9190614037565b612e989190613deb565b6040516001600160a01b038516602482015260448101829052909150610a0a9085907f095ea7b300000000000000000000000000000000000000000000000000000000906064016117ee565b6060612ef38484600085613002565b949350505050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612f48576040519150601f19603f3d011682016040523d82523d6000602084013e612f4d565b606091505b5050905080611fb25760405162461bcd60e51b815260206004820152601560248201527f6661696c656420746f2073656e64206e6174697665000000000000000000000060448201526064016107bd565b6040516001600160a01b038316602482015260448101829052611fb29084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064016117ee565b60008160a001518260c0015183608001516117979190613deb565b60608247101561307a5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016107bd565b6001600160a01b0385163b6130d15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016107bd565b600080866001600160a01b031685876040516130ed9190613ed2565b60006040518083038185875af1925050503d806000811461312a576040519150601f19603f3d011682016040523d82523d6000602084013e61312f565b606091505b509150915061313f82828661314a565b979650505050505050565b60608315613159575081612bbe565b8251156131695782518084602001fd5b8160405162461bcd60e51b81526004016107bd9190613a71565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160e0810167ffffffffffffffff811182821017156131d5576131d5613183565b60405290565b604051610140810167ffffffffffffffff811182821017156131d5576131d5613183565b604051610100810167ffffffffffffffff811182821017156131d5576131d5613183565b6040516101a0810167ffffffffffffffff811182821017156131d5576131d5613183565b604051601f8201601f1916810167ffffffffffffffff8111828210171561327057613270613183565b604052919050565b600067ffffffffffffffff82111561329257613292613183565b50601f01601f191660200190565b600082601f8301126132b157600080fd5b81356132c46132bf82613278565b613247565b8181528460208386010111156132d957600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561330957600080fd5b82359150602083013567ffffffffffffffff81111561332757600080fd5b613333858286016132a0565b9150509250929050565b6001600160a01b038116811461335257600080fd5b50565b80356133608161333d565b919050565b61ffff8116811461335257600080fd5b803561336081613365565b60008083601f84011261339257600080fd5b50813567ffffffffffffffff8111156133aa57600080fd5b6020830191508360208260051b85010111156133c557600080fd5b9250929050565b8035600781900b811461336057600080fd5b63ffffffff8116811461335257600080fd5b8035613360816133de565b600060e0828403121561340d57600080fd5b6134156131b2565b905061342082613355565b815261342e60208301613355565b602082015260408201356040820152613449606083016133cc565b606082015261345a608083016133f0565b608082015260a082013567ffffffffffffffff81111561347957600080fd5b613485848285016132a0565b60a08301525060c082013560c082015292915050565b6000806000808486036101808112156134b357600080fd5b610140808212156134c357600080fd5b6134cb6131db565b91506134d687613355565b82526134e460208801613355565b60208301526134f560408801613355565b6040830152606087013560608301526080870135608083015260a087013560a083015260c087013560c083015261352e60e08801613355565b60e0830152610100878101359083015261012061354c818901613375565b9083015290945085013567ffffffffffffffff8082111561356c57600080fd5b61357888838901613380565b909550935061016087013591508082111561359257600080fd5b5061359f878288016133fb565b91505092959194509250565b600080600080600080600060e0888a0312156135c657600080fd5b87356135d18161333d565b9650602088013595506135e6604089016133cc565b945060608801356135f6816133de565b935060808801356136068161333d565b925060a088013567ffffffffffffffff8082111561362357600080fd5b61362f8b838c016132a0565b935060c08a013591508082111561364557600080fd5b506136528a828b016132a0565b91505092959891949750929550565b6000806020838503121561367457600080fd5b823567ffffffffffffffff81111561368b57600080fd5b61369785828601613380565b90969095509350505050565b600080600080600060a086880312156136bb57600080fd5b85356136c6816133de565b9450602086013593506136db604087016133cc565b925060608601356136eb8161333d565b9150608086013567ffffffffffffffff81111561370757600080fd5b613713888289016132a0565b9150509295509295909350565b60008083601f84011261373257600080fd5b50813567ffffffffffffffff81111561374a57600080fd5b6020830191508360208285010111156133c557600080fd5b6000806000806040858703121561377857600080fd5b843567ffffffffffffffff8082111561379057600080fd5b61379c88838901613380565b909650945060208701359150808211156137b557600080fd5b506137c287828801613720565b95989497509550505050565b600080602083850312156137e157600080fd5b823567ffffffffffffffff8111156137f857600080fd5b61369785828601613720565b60008060008060008060c0878903121561381d57600080fd5b86356138288161333d565b9550613836602088016133cc565b94506040870135613846816133de565b935060608701356138568161333d565b9250608087013567ffffffffffffffff8082111561387357600080fd5b61387f8a838b016132a0565b935060a089013591508082111561389557600080fd5b506138a289828a016132a0565b9150509295509295509295565b6000808284036101208112156138c457600080fd5b833567ffffffffffffffff8111156138db57600080fd5b6138e7868287016133fb565b93505061010080601f19830112156138fe57600080fd5b6139066131ff565b915060208501356139168161333d565b825261392460408601613355565b6020830152606085013560408301526080850135606083015260a0850135608083015261395360c08601613355565b60a083015260e085013560c083015261396d818601613375565b60e083015250809150509250929050565b600080600080600080600080610100898b03121561399b57600080fd5b88356139a68161333d565b975060208901356139b68161333d565b965060408901359550606089013594506139d260808a016133cc565b935060a08901356139e2816133de565b925060c089013567ffffffffffffffff8111156139fe57600080fd5b613a0a8b828c016132a0565b92505060e089013590509295985092959890939650565b60005b83811015613a3c578181015183820152602001613a24565b50506000910152565b60008151808452613a5d816020860160208601613a21565b601f01601f19169290920160200192915050565b602081526000612bbe6020830184613a45565b80516133608161333d565b805167ffffffffffffffff8116811461336057600080fd5b80516004811061336057600080fd5b6000613ac46132bf84613278565b9050828152838383011115613ad857600080fd5b612bbe836020830184613a21565b600082601f830112613af757600080fd5b612bbe83835160208501613ab6565b80516003811061336057600080fd5b805161336081613365565b600060208284031215613b3257600080fd5b815167ffffffffffffffff80821115613b4a57600080fd5b908301906101a08286031215613b5f57600080fd5b613b67613223565b613b7083613a84565b8152613b7e60208401613a8f565b6020820152613b8f60408401613a84565b6040820152613ba060608401613a84565b6060820152613bb160808401613a84565b6080820152613bc260a08401613a84565b60a0820152613bd360c08401613aa7565b60c082015260e083015182811115613bea57600080fd5b613bf687828601613ae6565b60e083015250610100613c0a818501613b06565b90820152610120613c1c848201613b15565b908201526101408381015183811115613c3457600080fd5b613c4088828701613ae6565b8284015250506101609150613c56828401613a84565b828201526101809150613c6a828401613a84565b91810191909152949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60006001600160a01b0380891683528760070b602084015263ffffffff8716604084015280861660608401525060c06080830152613ce960c0830185613a45565b82810360a0840152613cfb8185613a45565b9998505050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215613d4957600080fd5b8135612bbe8161333d565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006000198203613d9657613d96613d54565b5060010190565b60208082528181018390526000908460408401835b86811015613de0578235613dc58161333d565b6001600160a01b031682529183019190830190600101613db2565b509695505050505050565b808201808211156104f8576104f8613d54565b60006101006001600160a01b03808c168452808b166020850152508860408401528760608401528660070b608084015263ffffffff861660a08401528060c0840152613e4c81840186613a45565b9150508260e08301529998505050505050505050565b600181811c90821680613e7657607f821691505b602082108103613eaf577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600060208284031215613ec757600080fd5b8151612bbe816133de565b60008251613ee4818460208701613a21565b9190910192915050565b601f821115611fb257600081815260208120601f850160051c81016020861015613f155750805b601f850160051c820191505b8181101561212357828155600101613f21565b67ffffffffffffffff831115613f4c57613f4c613183565b613f6083613f5a8354613e62565b83613eee565b6000601f841160018114613f945760008515613f7c5750838201355b600019600387901b1c1916600186901b178355613fee565b600083815260209020601f19861690835b82811015613fc55786850135825560209485019460019092019101613fa5565b5086821015613fe25760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b818103818111156104f8576104f8613d54565b60006020828403121561404957600080fd5b5051919050565b60008351614062818460208801613a21565b835190830190614076818360208801613a21565b01949350505050565b60006020828403121561409157600080fd5b815167ffffffffffffffff8111156140a857600080fd5b8201601f810184136140b957600080fd5b612ef384825160208401613ab6565b801515811461335257600080fd5b6000602082840312156140e857600080fd5b8151612bbe816140c8565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff21833603018112613ee457600080fd5b60006020828403121561413957600080fd5b8135612bbe816140c8565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261417957600080fd5b83018035915067ffffffffffffffff82111561419457600080fd5b6020019150368190038213156133c557600080fd5b600080858511156141b957600080fd5b838611156141c657600080fd5b5050820193919092039150565b7fffffffff0000000000000000000000000000000000000000000000000000000081358181169160048510156142135780818660040360031b1b83161692505b505092915050565b8183823760009101908152919050565b6001600160a01b038416815282151560208201526060604082015260006142556060830184613a45565b9594505050505056fea2646970667358221220c30806a8af24848338e2076f355ae018db10e261e3d2823b1d637e348e74c97064736f6c63430008100033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 32 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.