Source Code
Latest 19 from a total of 19 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Set Rate | 30143757 | 31 days ago | IN | 0 FRAX | 0.00006996 | ||||
| Set Base Fee | 30143753 | 31 days ago | IN | 0 FRAX | 0.00006724 | ||||
| Set Threshold | 30102369 | 32 days ago | IN | 0 FRAX | 0.00000395 | ||||
| Update Bridges P... | 29932521 | 36 days ago | IN | 0 FRAX | 0.00001947 | ||||
| Set Threshold | 29932515 | 36 days ago | IN | 0 FRAX | 0.00001052 | ||||
| Register Protoco... | 29932498 | 36 days ago | IN | 0 FRAX | 0.00000338 | ||||
| Set Executor | 29932494 | 36 days ago | IN | 0 FRAX | 0.00000311 | ||||
| Set Rate | 29929479 | 36 days ago | IN | 0 FRAX | 0.00002323 | ||||
| Set Base Fee | 29929475 | 36 days ago | IN | 0 FRAX | 0.0000227 | ||||
| Set Discount | 29926556 | 36 days ago | IN | 0 FRAX | 0.0000025 | ||||
| Set Rate | 28723157 | 64 days ago | IN | 0 FRAX | 0.00002668 | ||||
| Set Base Fee | 28723155 | 64 days ago | IN | 0 FRAX | 0.00002646 | ||||
| Update Bridge Re... | 28723057 | 64 days ago | IN | 0 FRAX | 0.00000502 | ||||
| Update Bridge Re... | 28722902 | 64 days ago | IN | 0 FRAX | 0.00000587 | ||||
| Update Bridge Re... | 28722828 | 64 days ago | IN | 0 FRAX | 0.00000615 | ||||
| Grant Role | 28707840 | 64 days ago | IN | 0 FRAX | 0.00000433 | ||||
| Grant Role | 28707838 | 64 days ago | IN | 0 FRAX | 0.00000417 | ||||
| Revoke Role | 28587728 | 67 days ago | IN | 0 FRAX | 0.00000673 | ||||
| Grant Role | 28587724 | 67 days ago | IN | 0 FRAX | 0.00000657 |
Advanced mode: Intended for advanced users or developers and will display all Internal Transactions including zero value transfers.
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Block | From | To | ||||
|---|---|---|---|---|---|---|---|
| 31432542 | 36 hrs ago | 0 FRAX | |||||
| 31432542 | 36 hrs ago | 0 FRAX | |||||
| 31432542 | 36 hrs ago | 0 FRAX | |||||
| 31432542 | 36 hrs ago | 0 FRAX | |||||
| 31432542 | 36 hrs ago | 0.10853545 FRAX | |||||
| 31432542 | 36 hrs ago | 0.10853545 FRAX | |||||
| 31432542 | 36 hrs ago | 0 FRAX | |||||
| 31432542 | 36 hrs ago | 0 FRAX | |||||
| 31432542 | 36 hrs ago | 0.00007944 FRAX | |||||
| 31432542 | 36 hrs ago | 0.00007944 FRAX | |||||
| 31432542 | 36 hrs ago | 0 FRAX | |||||
| 31432542 | 36 hrs ago | 0 FRAX | |||||
| 31432542 | 36 hrs ago | 0 FRAX | |||||
| 31277030 | 5 days ago | 0 FRAX | |||||
| 31277030 | 5 days ago | 0 FRAX | |||||
| 31277030 | 5 days ago | 0 FRAX | |||||
| 31277030 | 5 days ago | 0 FRAX | |||||
| 31277030 | 5 days ago | 0.11075265 FRAX | |||||
| 31277030 | 5 days ago | 0.11075265 FRAX | |||||
| 31277030 | 5 days ago | 0 FRAX | |||||
| 31277030 | 5 days ago | 0 FRAX | |||||
| 31277030 | 5 days ago | 0.00018197 FRAX | |||||
| 31277030 | 5 days ago | 0.00018197 FRAX | |||||
| 31277030 | 5 days ago | 0 FRAX | |||||
| 31277030 | 5 days ago | 0 FRAX |
Cross-Chain Transactions
Loading...
Loading
Contract Name:
GateKeeper
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED
// Copyright (c) Eywa.Fi, 2021-2025 - all rights reserved
pragma solidity ^0.8.20;
import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import { AccessControlEnumerable } from "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import { IERC20, SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { IGateKeeper } from "../interfaces/IGateKeeper.sol";
import { IBridge } from "../interfaces/IBridge.sol";
import { IExecutorFeeManager } from "../interfaces/IExecutorFeeManager.sol";
import { IValidatedDataReceiver } from "../interfaces/IValidatedDataReceiver.sol";
import { INativeTreasuryFactory } from '../interfaces/INativeTreasuryFactory.sol';
import { INativeTreasury } from "../interfaces/INativeTreasury.sol";
import { NativeTreasury } from './NativeTreasury.sol';
import { Typecast } from "../utils/Typecast.sol";
import { RequestIdLib } from "../utils/RequestIdLib.sol";
contract GateKeeper is IGateKeeper, AccessControlEnumerable, Typecast, ReentrancyGuard {
struct BaseFee {
/// @dev chainId The ID of the chain for which the base fee is being set
uint64 chainId;
/// @dev bridge
address bridge;
/// @dev fee The amount of the base fee being set
uint256 fee;
}
struct Rate {
/// @dev chainId The ID of the chain for which the base fee is being set
uint64 chainId;
/// @dev bridge
address bridge;
/// @dev rate The rate being set
uint256 rate;
}
/// @dev operator role id
bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");
/// @dev treasury admin role
bytes32 public constant TREASURY_ADMIN_ROLE = keccak256("TREASURY_ADMIN_ROLE");
/// @dev max discount for additional fee
uint256 public constant MAX_DISCOUNT = 10000;
/// @dev receiver contract
address public receiver;
/// @dev bridge Eywa contract
address public bridgeEywa;
/// @dev treasury address
address public treasury;
/// @dev bridge => is registered
mapping(address => bool) public registeredBridges;
/// @dev chainId => bridge => base fees
mapping(uint64 => mapping(address => uint256)) public baseFees;
/// @dev chainId => pay token => rate (per byte)
mapping(uint64 => mapping(address => uint256)) public rates;
/// @dev protocol => treasury
mapping(address => address) public treasuries;
/// @dev protocol -> threshold
mapping(bytes32 => uint8) public threshold;
/// @dev array of sorted by priorities bridges. Bytes32 = protocol address + chainIdTo
mapping(bytes32 => address[]) public bridgesByPriority;
/// @dev protocol => discounts, [0, 10000]
mapping(address => uint256) public discounts;
/// @dev msg.sender -> executor
mapping(address => address) public executors;
/// @dev requestId -> hash of data
mapping(bytes32 => bytes32) public sentDataHash;
event ReceiverSet(address receiver);
event BridgeEywaSet(address bridgeEywa);
event TreasurySet(address treasury);
event BridgeRegistered(address bridge, bool status);
event BaseFeeSet(uint64 chainId, address bridge, uint256 fee);
event RateSet(uint64 chainId, address bridge, uint256 rate);
event ThresholdSet(address sender, uint64[] chainIds, uint8[] threshold);
event BridgesPriorityUpdated(address protocol, uint64[] chainIds, address[][] bridges);
event DiscountSet(address protocol, uint256 discount);
event ExecutorSet(address protocol, address executor);
event FeesWithdrawn(address token, uint256 amount, address to);
event DataSent(
address[] selectedBridges,
bytes32 requestId,
bytes collectedData,
bytes32 to,
uint64 chainIdTo,
uint256 nonce,
address sender
);
event RetrySent(
address bridge,
IBridge.SendParams params,
uint256 nonce,
address sender
);
event ExecutionPaid(
bytes32 requestId,
uint64 chainIdTo,
bytes options,
uint256 executeGasFee,
address sender,
address treasury,
address executor
);
constructor(address receiver_) {
require(receiver_ != address(0), "GateKeeper: zero address");
receiver = receiver_;
_grantRole(DEFAULT_ADMIN_ROLE, _msgSender());
}
receive() external payable { }
/**
* @notice Sets the address of the Receiver contract.
*
* @dev Only the contract admin is allowed to call this function.
*
* @param receiver_ the address of the new Receiver contract to be set.
*/
function setReceiver(address receiver_) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(receiver_ != address(0), "GateKeeper: zero address");
receiver = receiver_;
emit ReceiverSet(receiver_);
}
/**
* @notice Sets the address of the Eywa BridgeV3 contract.
*
* @dev Only the contract admin is allowed to call this function.
*
* @param bridgeEywa_ the address of the new Eywa BridgeV3 contract to be set.
*/
function setBridgeEywa(address bridgeEywa_) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(bridgeEywa_ != address(0), "GateKeeper: zero address");
bridgeEywa = bridgeEywa_;
emit BridgeEywaSet(bridgeEywa_);
}
/**
* @notice Sets the address of the treasury contract.
*
* @dev Only the contract owner is allowed to call this function.
*
* @param treasury_ the address of the new BridgeV2 contract to be set.
*/
function setTreasury(address treasury_) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(treasury_ != address(0), "GateKeeper: zero address");
treasury = treasury_;
emit TreasurySet(treasury_);
}
/**
* @dev Set bridge registration
*
* @param bridge bridge address
* @param status new status
*/
function updateBridgeRegistration(address bridge, bool status) external onlyRole(OPERATOR_ROLE) {
require(bridge != address(0), "GateKeeper: zero address");
registeredBridges[bridge] = status;
emit BridgeRegistered(bridge, status);
}
/**
* @dev Sets the base fee for a given chain ID and token address.
* The base fee represents the minimum amount of pay {TOKEN} required as transaction fee.
*
* @param baseFees_ The array of the BaseFee structs.
*/
function setBaseFee(BaseFee[] memory baseFees_) external onlyRole(OPERATOR_ROLE) {
for (uint256 i = 0; i < baseFees_.length; ++i) {
BaseFee memory baseFee = baseFees_[i];
baseFees[baseFee.chainId][baseFee.bridge] = baseFee.fee;
emit BaseFeeSet(baseFee.chainId, baseFee.bridge, baseFee.fee);
}
}
/**
* @dev Sets the rate for a given chain ID and token address.
* The rate will be applied based on the length of the data being transmitted between the chains.
*
* @param rates_ The array of the Rate structs.
*/
function setRate(Rate[] memory rates_) external onlyRole(OPERATOR_ROLE) {
for (uint256 i = 0; i < rates_.length; ++i) {
Rate memory rate = rates_[i];
rates[rate.chainId][rate.bridge] = rate.rate;
emit RateSet(rate.chainId, rate.bridge, rate.rate);
}
}
/**
* @dev Register protocol, deploy trasury for it
*
* @param treasuryAdmin_ admin of treasury, which can withdraw
* @param protocol_ Protocol address who will use treasury
*/
function registerProtocol(address treasuryAdmin_, address protocol_) external onlyRole(TREASURY_ADMIN_ROLE) {
require(treasuries[protocol_] == address(0), "GateKeeper: protocol registered");
treasuries[protocol_] = address(new NativeTreasury(treasuryAdmin_));
}
/**
* @dev Sets protocol's threshold. Must be the same on the receiver's side.
*
* @param protocol The protocol protocol contract address;
* @param threshold_ The threshold for the given contract address.
*/
function setThreshold(address protocol, uint64[] memory chainIdTo, uint8[] memory threshold_) external onlyRole(OPERATOR_ROLE) {
uint256 length = chainIdTo.length;
require(length == threshold_.length, "GateKeeper: wrong lengths");
for (uint256 i; i < length; ++i) {
require(threshold_[i] >= 1, "GateKeeper: wrong threshold");
threshold[_packKey(protocol, chainIdTo[i])] = threshold_[i];
}
emit ThresholdSet(protocol, chainIdTo, threshold_);
}
/**
* @dev Updates bridge priority.
*
* @param protocol_ protocol address
* @param chainIds_ List of chainIds for each pair protocol + chainId may be different bridge priority
* @param bridges_ sorted by priority array for each chainId. First elem higher priority, then last
*/
function updateBridgesPriority(address protocol_, uint64[] memory chainIds_, address[][] memory bridges_) external onlyRole(OPERATOR_ROLE) {
uint256 length = chainIds_.length;
require(length == bridges_.length, "GateKeeper: wrong lengths");
for (uint256 i; i < length; ++i) {
bridgesByPriority[_packKey(protocol_, chainIds_[i])] = bridges_[i];
}
emit BridgesPriorityUpdated(protocol_, chainIds_, bridges_);
}
/**
* @dev Sets the discount for a given protocol. Have to be in [0, 10000], where 10000 is 100%.
*
* @param protocol The address of the protocol for which the discount is being set;
* @param discount The discount being set.
*/
function setDiscount(address protocol, uint256 discount) external onlyRole(OPERATOR_ROLE) {
require(discount <= MAX_DISCOUNT, "GateKeeper: wrong discount");
discounts[protocol] = discount;
emit DiscountSet(protocol, discount);
}
/**
* @notice Sets the address of the ExecutorFeeManager contract.
*
* @dev Only the contract operator is allowed to call this function.
*
* @param protocol The address of the protocol
* @param executor The address of the executor for protocol
*/
function setExecutor(address protocol, address executor) external onlyRole(OPERATOR_ROLE) {
require(protocol != address(0), "GateKeeper: zero address");
require(executor != address(0), "GateKeeper: zero address");
executors[protocol] = executor;
emit ExecutorSet(protocol, executor);
}
/**
* @dev Sends data to a destination contract
*
* @param data The data (encoded with selector) which would be send to the destination contract;
* @param to The address of the destination contract;
* @param chainIdTo The ID of the chain where the destination contract resides;
* @param currentOptions Additional options for bridges and executors.
* Params must be sorted by priority
* bridge_1 - bridge with priority 1, bridge_2 - bridge with priority 2
* [bridge_1_options, bridge_2_options, bridge_3_options, executor_options, external nonce\salt]
*/
function sendData(
bytes calldata data,
bytes32 to,
uint64 chainIdTo,
bytes[] memory currentOptions
) external nonReentrant returns(uint256 fee) {
uint256 executeFee;
(uint256 sendFee, bytes32 requestId) = _sendData(data, to, chainIdTo, currentOptions);
if (threshold[_packKey(msg.sender, chainIdTo)] > 1) {
executeFee = _payForExecute(requestId, chainIdTo, currentOptions[currentOptions.length - 2]);
}
return sendFee + executeFee;
}
/**
* @dev Retry transaction, that was send. Send it only with same params
*
* @param params send params. params.data must be collectedData
* @param nonce nonce
* @param protocol protocol address
* @param bridge bridge to retry send
* @param currentOptions options of current call. Can be differ from first call
* @param isHash flag for choose send data or hash
*/
function retry(
IBridge.SendParams memory params,
uint256 nonce,
address protocol,
address bridge,
bytes memory currentOptions,
bool isHash
) external payable {
require(registeredBridges[bridge], "GateKeeper: bridge not registered");
require(sentDataHash[params.requestId] == keccak256(abi.encode(
params,
nonce,
protocol
)), "GateKeeper: wrong data");
bool isBridgeFound;
address[] memory protocolBridges = bridgesByPriority[_packKey(protocol, uint64(params.chainIdTo))];
for (uint256 i; i < protocolBridges.length; ++i) {
if (protocolBridges[i] == bridge) {
isBridgeFound = true;
}
}
require (isBridgeFound, "GateKeeper: wrong bridge");
bytes32 requestId = RequestIdLib.prepareRequestId(
params.to,
params.chainIdTo,
castToBytes32(protocol),
block.chainid,
nonce
);
if (isHash) {
params.data = _encodeOut(params.data, protocol, requestId, true);
} else {
params.data = _encodeOut(params.data, protocol, requestId, false);
}
(, uint256 gasFee) = _sendCustomBridge(
bridge,
params,
nonce,
protocol,
currentOptions,
discounts[address(0)]
);
require(msg.value >= gasFee, "GateKeeper: not enough value");
(bool success, ) = treasuries[protocol].call{value: gasFee}("");
require(success, "GateKeeper: failed to send Ether");
if (msg.value > gasFee) {
(success, ) = msg.sender.call{value: msg.value - gasFee}("");
require(success, "GateKeeper: failed to send Ether");
}
emit RetrySent(bridge, params, nonce, msg.sender);
}
/**
* @dev Allows the owner to withdraw collected fees from the contract. Use address(0) to
* withdraw native asset.
*
* @param token The token address from which the fees need to be withdrawn;
* @param amount The amount of fees to be withdrawn;
*/
function withdrawFees(address token, uint256 amount) external nonReentrant {
require(treasury != address(0), "GateKeeper: treasury not set");
if (token == address(0)) {
(bool sent,) = treasury.call{value: amount}("");
require(sent, "GateKeeper: failed to send Ether");
} else {
SafeERC20.safeTransfer(IERC20(token), treasury, amount);
}
emit FeesWithdrawn(token, amount, treasury);
}
/**
* @dev Returns the address of the part of the bridge that delivers to the destination chain.
* In this case this is receiver contract
* NOTE: to support legacy
*/
function bridge() external view returns(address) {
return receiver;
}
/**
* @dev Select bridge by priority and by threshold
*
* @param protocol protocol, which uses bridge
* @param chainIdTo chain id to send
*/
function selectBridgesByPriority(address protocol, uint64 chainIdTo) public view returns(address[] memory) {
bytes32 key = _packKey(protocol, chainIdTo);
uint8 threshold_ = threshold[key];
require(threshold_ > 0, "GateKeeper: zero threshold");
require(threshold_ <= bridgesByPriority[key].length, "GateKeeper: not enough bridges");
address[] memory selectedBridges = new address[](threshold_);
for (uint8 i; i < threshold_; ++i) {
address currentBridge = bridgesByPriority[key][i];
require(registeredBridges[currentBridge], "GateKeeper: bridge not registered");
selectedBridges[i] = currentBridge;
}
return selectedBridges;
}
/**
* @dev Sends data to a destination contract
*
* @param data The data (encoded with selector) which would be send to the destination contract;
* @param to The address of the destination contract;
* @param chainIdTo The ID of the chain where the destination contract resides;
* @param currentOptions Additional options for bridges.
* Params must be sorted by priority
* bridge_1 - bridge with priority 1, bridge_2 - bridge with priority 2
* [bridge_1_options, bridge_2_options, bridge_3_options, executor_options, external nonce\salt]
*/
function estimateGasFee(
bytes calldata data,
bytes32 to,
uint64 chainIdTo,
bytes[] memory currentOptions
) public view returns (uint256, uint256) {
bytes32 requestId;
uint256 nonce = abi.decode(currentOptions[currentOptions.length - 1], (uint256));
bytes memory collectedData;
(requestId, collectedData) = _buildData(to, chainIdTo, data, nonce);
address[] memory selectedBridges = selectBridgesByPriority(msg.sender, uint64(chainIdTo));
bytes memory out;
uint256 sendFee;
for (uint8 i; i < selectedBridges.length; ++i) {
if (i == 0) {
out = _encodeOut(collectedData, msg.sender, requestId, false);
} else if (i == 1) {
out = _encodeOut(collectedData, msg.sender, requestId, true);
}
sendFee += _quoteCustomBridge(
selectedBridges[i],
IBridge.SendParams({
requestId: requestId,
data: out,
to: to,
chainIdTo: chainIdTo
}),
msg.sender,
currentOptions[i],
discounts[msg.sender]
);
}
uint256 executeFee = 0;
if (threshold[_packKey(msg.sender, chainIdTo)] > 1) {
address executor = executors[msg.sender];
require(executor != address(0), "GateKeeper: no executor configured");
executeFee = IExecutorFeeManager(executor).estimateExecutorGasFee(chainIdTo, currentOptions[currentOptions.length - 2]);
}
uint256 totalFee = sendFee + executeFee;
return (totalFee, executeFee);
}
/**
* @dev Calculates the cost for a cross-chain operation in the specified token.
*
* @param dataLength The length of the data being transmitted in the cross-chain operation;
* @param chainIdTo The ID of the destination chain;
* @param discountPersentage The discount for protocol;
* @param bridge The use bridge;
* @return additionalFee The fee amount to be paid for the cross-chain operation.
*/
function calculateAdditionalFee(
uint256 dataLength,
uint64 chainIdTo,
address bridge,
uint256 discountPersentage
) public view returns (uint256 additionalFee) {
if (bridge == bridgeEywa && discountPersentage < MAX_DISCOUNT) {
uint256 baseFee = baseFees[chainIdTo][bridge];
uint256 rate = rates[chainIdTo][bridge];
require(baseFee != 0, "GateKeeper: base fee not set");
require(rate != 0, "GateKeeper: rate not set");
additionalFee = baseFee + (dataLength * rate);
require(additionalFee >= 10, "GateKeeper: additionalFee is too small");
additionalFee -= additionalFee * discountPersentage / MAX_DISCOUNT;
}
}
/**
* @dev Sends data to a destination contract
*/
function _sendData(
bytes calldata data,
bytes32 to,
uint64 chainIdTo,
bytes[] memory currentOptions
) internal returns(uint256 sendFee, bytes32 requestId) {
bytes memory out;
uint256 nonce = abi.decode(currentOptions[currentOptions.length - 1], (uint256));
bytes memory collectedData;
{
(requestId, collectedData) = _buildData(to, chainIdTo, data, nonce);
require(sentDataHash[requestId] == 0, "GateKeeper: requestId already used");
sentDataHash[requestId] = keccak256(abi.encode(
IBridge.SendParams({
requestId: requestId,
data: collectedData,
to: to,
chainIdTo: chainIdTo
}),
nonce,
msg.sender
));
}
address[] memory selectedBridges = selectBridgesByPriority(msg.sender, chainIdTo);
require(selectedBridges.length > 0, "GateKeeper: zero selected bridges");
require(selectedBridges.length == (currentOptions.length - 2), "GateKeeper: options incorrect");
{
for (uint8 i; i < selectedBridges.length; ++i) {
if (i == 0) {
out = _encodeOut(collectedData, msg.sender, requestId, false);
} else if (i == 1) {
out = _encodeOut(collectedData, msg.sender, requestId, true);
}
(uint256 totalFee,) = _sendCustomBridge(
selectedBridges[i],
IBridge.SendParams({
requestId: requestId,
data: out,
to: to,
chainIdTo: chainIdTo
}),
nonce,
msg.sender,
currentOptions[i],
discounts[msg.sender]
);
sendFee += totalFee;
}
}
emit DataSent(selectedBridges, requestId, collectedData, to, chainIdTo, nonce, msg.sender);
return (sendFee, requestId);
}
/**
* @dev Send data by custom bridge
*
* @param bridge_ bridge address
* @param params params to send
* @param nonce nonce
* @param protocol protocol address
* @param options additional options for bridge call
*/
function _sendCustomBridge(
address bridge_,
IBridge.SendParams memory params,
uint256 nonce,
address protocol,
bytes memory options,
uint256 discountPersentage
) internal returns(uint256, uint256) {
uint256 gasFee;
uint256 totalFee;
(totalFee, gasFee) = _calculateGasFee(
bridge_,
params,
protocol,
options,
discountPersentage
);
INativeTreasury(treasuries[protocol]).getValue(totalFee);
IBridge(bridge_).sendV3{value: bridge_ == bridgeEywa ? 0 : gasFee}(
params,
protocol,
nonce,
options
);
return (totalFee, gasFee);
}
function _payForExecute(bytes32 requestId, uint64 chainIdTo, bytes memory options) internal returns(uint256) {
address executor = executors[msg.sender];
address treasury = treasuries[msg.sender];
uint256 executeGasFee = IExecutorFeeManager(executor).estimateExecutorGasFee(chainIdTo, options);
INativeTreasury(treasury).getValue(executeGasFee);
IExecutorFeeManager(executor).payExecutorGasFee{value: executeGasFee}(requestId, chainIdTo, options, treasury);
emit ExecutionPaid(requestId, chainIdTo, options, executeGasFee, msg.sender, treasury, executor);
return executeGasFee;
}
/**
* @dev Build data, requestId and nonce
*
* @param to address to send
* @param chainIdTo chain id to send
* @param data data to send
*/
function _buildData(bytes32 to, uint64 chainIdTo, bytes calldata data, uint256 nonce) internal view returns(bytes32, bytes memory) {
bytes32 requestId;
bytes memory collectedData;
{
requestId = RequestIdLib.prepareRequestId(
to,
chainIdTo,
castToBytes32(msg.sender),
block.chainid,
nonce
);
bytes memory info = abi.encodeWithSelector(
IValidatedDataReceiver.receiveValidatedData.selector,
bytes4(data[:4]),
castToBytes32(msg.sender),
block.chainid
);
collectedData = abi.encode(
data,
info,
nonce,
to
);
}
return (requestId, collectedData);
}
/**
* @dev Encode out data, add isHash bytes to end
*
* @param collectedData collected data
* @param sender protocol address
* @param requestId request id
* @param isHash is hash flag
*/
function _encodeOut(
bytes memory collectedData,
address sender,
bytes32 requestId,
bool isHash
) internal view returns(bytes memory newOut) {
bytes memory out;
bytes1 isHashByte;
if (isHash) {
out = abi.encode(keccak256(collectedData), castToBytes32(sender), block.chainid, requestId);
isHashByte = 0x01;
} else {
out = abi.encode(collectedData, castToBytes32(sender), block.chainid, requestId);
isHashByte = 0x00;
}
uint256 length = out.length;
newOut = new bytes(length + 1);
for (uint j; j < length; ++j) {
newOut[j] = out[j];
}
newOut[length] = isHashByte;
}
/**
* @dev Calculate fees for send
*
* @param bridge_ bridge address
* @param params params to send
* @param protocol protocol address
* @param options additional options for bridge call
* @param discountPersentage discount persentage
*/
function _calculateGasFee(
address bridge_,
IBridge.SendParams memory params,
address protocol,
bytes memory options,
uint256 discountPersentage
) internal view returns(uint256, uint256) {
uint256 gasFee = IBridge(bridge_).estimateGasFee(
params,
protocol,
options
);
uint256 totalFee = gasFee;
if (bridge_ == bridgeEywa) {
totalFee += calculateAdditionalFee(params.data.length, uint64(params.chainIdTo), bridge_, discountPersentage);
}
return (totalFee, gasFee);
}
/**
* @dev Quote fee for send
*
* @param bridge_ bridge address
* @param params params to send
* @param protocol protocol address
* @param options additional options for bridge call
* @param discountPersentage discount persentage
*/
function _quoteCustomBridge(
address bridge_,
IBridge.SendParams memory params,
address protocol,
bytes memory options,
uint256 discountPersentage
) internal view returns (uint256) {
(uint256 totalFee, ) = _calculateGasFee(
bridge_,
params,
protocol,
options,
discountPersentage
);
return totalFee;
}
/**
* @dev Pack address and uint64 to bytes32 as a key
*
* @param addr address
* @param number number
*/
function _packKey(address addr, uint64 number) internal pure returns(bytes32) {
bytes32 packedKey = bytes32(uint256(uint160(addr)) << 64);
packedKey |= bytes32(uint256(number));
return packedKey;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(account),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControlEnumerable.sol";
import "./AccessControl.sol";
import "../utils/structs/EnumerableSet.sol";
/**
* @dev Extension of {AccessControl} that allows enumerating the members of each role.
*/
abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {
using EnumerableSet for EnumerableSet.AddressSet;
mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {
return _roleMembers[role].at(index);
}
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {
return _roleMembers[role].length();
}
/**
* @dev Overload {_grantRole} to track enumerable memberships
*/
function _grantRole(bytes32 role, address account) internal virtual override {
super._grantRole(role, account);
_roleMembers[role].add(account);
}
/**
* @dev Overload {_revokeRole} to track enumerable memberships
*/
function _revokeRole(bytes32 role, address account) internal virtual override {
super._revokeRole(role, account);
_roleMembers[role].remove(account);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)
pragma solidity ^0.8.0;
import "./IAccessControl.sol";
/**
* @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
*/
interface IAccessControlEnumerable is IAccessControl {
/**
* @dev Returns one of the accounts that have `role`. `index` must be a
* value between 0 and {getRoleMemberCount}, non-inclusive.
*
* Role bearers are not sorted in any particular way, and their ordering may
* change at any point.
*
* WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
* you perform all queries on the same block. See the following
* https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
* for more information.
*/
function getRoleMember(bytes32 role, uint256 index) external view returns (address);
/**
* @dev Returns the number of accounts that have `role`. Can be used
* together with {getRoleMember} to enumerate all bearers of a role.
*/
function getRoleMemberCount(bytes32 role) external view returns (uint256);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 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 256, 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 << 3) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
import "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastValue;
// Update the index for the moved value
set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}// SPDX-License-Identifier: UNLICENSED
// Copyright (c) Eywa.Fi, 2021-2025 - all rights reserved
pragma solidity ^0.8.20;
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import "../interfaces/INativeTreasury.sol";
contract NativeTreasury is INativeTreasury, Ownable {
address public immutable gateKeeper;
event ValueSent(uint256 value, address to);
constructor(address admin_) {
require(admin_ != address(0), "NativeTreasury: zero address");
_transferOwnership(admin_);
gateKeeper = msg.sender;
}
receive() external payable {}
/**
* @dev Get value for msg.sender
*
* @param value_ value to transfer
*/
function getValue(uint256 value_) external {
require(msg.sender == gateKeeper || msg.sender == owner(), "NativeTreasury: only admin or gatekeeper");
(bool success, ) = msg.sender.call{value: value_}("");
require(success, "NativeTreasury: failed to send Ether");
emit ValueSent(value_, msg.sender);
}
}// SPDX-License-Identifier: UNLICENSED
// Copyright (c) Eywa.Fi, 2021-2025 - all rights reserved
pragma solidity ^0.8.20;
interface IBridge {
enum State {
Active, // data send and receive possible
Inactive, // data send and receive impossible
Limited // only data receive possible
}
struct SendParams {
/// @param requestId unique request ID
bytes32 requestId;
/// @param data call data
bytes data;
/// @param to receiver contract address
bytes32 to;
/// @param chainIdTo destination chain ID
uint64 chainIdTo;
}
function sendV3(
SendParams calldata params,
address sender,
uint256 nonce,
bytes memory options
) external payable;
function estimateGasFee(
SendParams memory params,
address sender,
bytes memory options
) external view returns (uint256);
}// SPDX-License-Identifier: UNLICENSED
// Copyright (c) Eywa.Fi, 2021-2025 - all rights reserved
pragma solidity ^0.8.20;
interface IExecutorFeeManager {
function estimateExecutorGasFee(uint64 chainIdTo, bytes memory options) external view returns(uint256);
function payExecutorGasFee(bytes32 sentHash, uint64 chainIdTo, bytes memory options, address refundTarget) external payable;
}// SPDX-License-Identifier: UNLICENSED
// Copyright (c) Eywa.Fi, 2021-2025 - all rights reserved
pragma solidity ^0.8.20;
interface IGateKeeper {
function sendData(
bytes calldata data,
bytes32 to,
uint64 chainIdTo,
bytes[] memory options
) external returns(uint256);
function estimateGasFee(
bytes calldata data,
bytes32 to,
uint64 chainIdTo,
bytes[] memory options
) external view returns(uint256, uint256);
function calculateAdditionalFee(
uint256 dataLength,
uint64 chainIdTo,
address bridge,
uint256 discountPersentage
) external view returns (uint256 amountToPay);
function treasuries(address protocol) external view returns (address treasury);
function bridge() external view returns(address);
}// SPDX-License-Identifier: UNLICENSED
// Copyright (c) Eywa.Fi, 2021-2023 - all rights reserved
pragma solidity ^0.8.17;
interface INativeTreasury {
function getValue(uint256 value_) external;
}// SPDX-License-Identifier: UNLICENSED
// Copyright (c) Eywa.Fi, 2021-2024 - all rights reserved
pragma solidity ^0.8.20;
interface INativeTreasuryFactory {
function createNativeTreasury(
address admin
) external returns (address);
}// SPDX-License-Identifier: UNLICENSED
// Copyright (c) Eywa.Fi, 2021-2025 - all rights reserved
pragma solidity ^0.8.20;
interface IValidatedDataReceiver {
/**
* @notice Function which will be called by desination bridge.
*
* @dev Receiver contract must ensure that's from and chainIdFrom correct.
*
* @param selector selector which will be called;
* @param from sender address in source chain;
* @param chainIdFrom source chain id.
*/
function receiveValidatedData(bytes4 selector, bytes32 from, uint64 chainIdFrom) external returns (bool);
}// SPDX-License-Identifier: UNLICENSED
// Copyright (c) Eywa.Fi, 2021-2025 - all rights reserved
pragma solidity ^0.8.20;
library RequestIdLib {
bytes32 private constant TYPEHASH = keccak256(
"CrosschainRequest/v1(uint256 chainIdFrom,bytes32 from,uint256 chainIdTo,bytes32 to,bytes32 salt)"
);
function prepareRequestId(
bytes32 to,
uint256 chainIdTo,
bytes32 from,
uint256 chainIdFrom,
uint256 salt
) internal pure returns (bytes32) {
return keccak256(abi.encode(TYPEHASH, chainIdFrom, from, chainIdTo, to, salt));
}
}// SPDX-License-Identifier: UNLICENSED
// Copyright (c) Eywa.Fi, 2021-2023 - all rights reserved
pragma solidity ^0.8.20;
abstract contract Typecast {
function castToAddress(bytes32 x) public pure returns (address) {
return address(uint160(uint256(x)));
}
function castToBytes32(address a) public pure returns (bytes32) {
return bytes32(uint256(uint160(a)));
}
}{
"evmVersion": "shanghai",
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"remappings": [
"project/:@openzeppelin/contracts/=npm/@openzeppelin/[email protected]/",
"project/:@openzeppelin/contracts/=npm/@openzeppelin/[email protected]/",
"project/:@openzeppelin/contracts/=npm/@openzeppelin/[email protected]/",
"project/:@openzeppelin/contracts/=npm/@openzeppelin/[email protected]/"
]
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"receiver_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"chainId","type":"uint64"},{"indexed":false,"internalType":"address","name":"bridge","type":"address"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"BaseFeeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"bridgeEywa","type":"address"}],"name":"BridgeEywaSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"bridge","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"BridgeRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"protocol","type":"address"},{"indexed":false,"internalType":"uint64[]","name":"chainIds","type":"uint64[]"},{"indexed":false,"internalType":"address[][]","name":"bridges","type":"address[][]"}],"name":"BridgesPriorityUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"selectedBridges","type":"address[]"},{"indexed":false,"internalType":"bytes32","name":"requestId","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"collectedData","type":"bytes"},{"indexed":false,"internalType":"bytes32","name":"to","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"chainIdTo","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"DataSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"protocol","type":"address"},{"indexed":false,"internalType":"uint256","name":"discount","type":"uint256"}],"name":"DiscountSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"requestId","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"chainIdTo","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"options","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"executeGasFee","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"treasury","type":"address"},{"indexed":false,"internalType":"address","name":"executor","type":"address"}],"name":"ExecutionPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"protocol","type":"address"},{"indexed":false,"internalType":"address","name":"executor","type":"address"}],"name":"ExecutorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"FeesWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"chainId","type":"uint64"},{"indexed":false,"internalType":"address","name":"bridge","type":"address"},{"indexed":false,"internalType":"uint256","name":"rate","type":"uint256"}],"name":"RateSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"receiver","type":"address"}],"name":"ReceiverSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"bridge","type":"address"},{"components":[{"internalType":"bytes32","name":"requestId","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes32","name":"to","type":"bytes32"},{"internalType":"uint64","name":"chainIdTo","type":"uint64"}],"indexed":false,"internalType":"struct IBridge.SendParams","name":"params","type":"tuple"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"}],"name":"RetrySent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint64[]","name":"chainIds","type":"uint64[]"},{"indexed":false,"internalType":"uint8[]","name":"threshold","type":"uint8[]"}],"name":"ThresholdSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"treasury","type":"address"}],"name":"TreasurySet","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_DISCOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TREASURY_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"","type":"uint64"},{"internalType":"address","name":"","type":"address"}],"name":"baseFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bridge","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bridgeEywa","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"bridgesByPriority","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"dataLength","type":"uint256"},{"internalType":"uint64","name":"chainIdTo","type":"uint64"},{"internalType":"address","name":"bridge","type":"address"},{"internalType":"uint256","name":"discountPersentage","type":"uint256"}],"name":"calculateAdditionalFee","outputs":[{"internalType":"uint256","name":"additionalFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"x","type":"bytes32"}],"name":"castToAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"a","type":"address"}],"name":"castToBytes32","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"discounts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes32","name":"to","type":"bytes32"},{"internalType":"uint64","name":"chainIdTo","type":"uint64"},{"internalType":"bytes[]","name":"currentOptions","type":"bytes[]"}],"name":"estimateGasFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"executors","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"","type":"uint64"},{"internalType":"address","name":"","type":"address"}],"name":"rates","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"receiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"treasuryAdmin_","type":"address"},{"internalType":"address","name":"protocol_","type":"address"}],"name":"registerProtocol","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"registeredBridges","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes32","name":"requestId","type":"bytes32"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes32","name":"to","type":"bytes32"},{"internalType":"uint64","name":"chainIdTo","type":"uint64"}],"internalType":"struct IBridge.SendParams","name":"params","type":"tuple"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"address","name":"protocol","type":"address"},{"internalType":"address","name":"bridge","type":"address"},{"internalType":"bytes","name":"currentOptions","type":"bytes"},{"internalType":"bool","name":"isHash","type":"bool"}],"name":"retry","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"protocol","type":"address"},{"internalType":"uint64","name":"chainIdTo","type":"uint64"}],"name":"selectBridgesByPriority","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes32","name":"to","type":"bytes32"},{"internalType":"uint64","name":"chainIdTo","type":"uint64"},{"internalType":"bytes[]","name":"currentOptions","type":"bytes[]"}],"name":"sendData","outputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"sentDataHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint64","name":"chainId","type":"uint64"},{"internalType":"address","name":"bridge","type":"address"},{"internalType":"uint256","name":"fee","type":"uint256"}],"internalType":"struct GateKeeper.BaseFee[]","name":"baseFees_","type":"tuple[]"}],"name":"setBaseFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"bridgeEywa_","type":"address"}],"name":"setBridgeEywa","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"protocol","type":"address"},{"internalType":"uint256","name":"discount","type":"uint256"}],"name":"setDiscount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"protocol","type":"address"},{"internalType":"address","name":"executor","type":"address"}],"name":"setExecutor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint64","name":"chainId","type":"uint64"},{"internalType":"address","name":"bridge","type":"address"},{"internalType":"uint256","name":"rate","type":"uint256"}],"internalType":"struct GateKeeper.Rate[]","name":"rates_","type":"tuple[]"}],"name":"setRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"receiver_","type":"address"}],"name":"setReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"protocol","type":"address"},{"internalType":"uint64[]","name":"chainIdTo","type":"uint64[]"},{"internalType":"uint8[]","name":"threshold_","type":"uint8[]"}],"name":"setThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"treasury_","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"threshold","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"treasuries","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"bridge","type":"address"},{"internalType":"bool","name":"status","type":"bool"}],"name":"updateBridgeRegistration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"protocol_","type":"address"},{"internalType":"uint64[]","name":"chainIds_","type":"uint64[]"},{"internalType":"address[][]","name":"bridges_","type":"address[][]"}],"name":"updateBridgesPriority","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]Contract Creation Code
608060405234801562000010575f80fd5b5060405162004cd838038062004cd88339810160408190526200003391620001ff565b60016002556001600160a01b038116620000935760405162461bcd60e51b815260206004820152601860248201527f476174654b65657065723a207a65726f20616464726573730000000000000000604482015260640160405180910390fd5b600380546001600160a01b0319166001600160a01b038316179055620000c15f620000bb3390565b620000c8565b506200022e565b620000d48282620000f2565b5f828152600160205260409020620000ed908262000191565b505050565b5f828152602081815260408083206001600160a01b038516845290915290205460ff166200018d575f828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556200014c3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b5f620001a7836001600160a01b038416620001b0565b90505b92915050565b5f818152600183016020526040812054620001f757508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155620001aa565b505f620001aa565b5f6020828403121562000210575f80fd5b81516001600160a01b038116811462000227575f80fd5b9392505050565b614a9c806200023c5f395ff3fe60806040526004361062000296575f3560e01c80635ab83031116200015a578063ad3b1b4711620000c2578063e34955691162000082578063e349556914620008e9578063e78cea921462000900578063eb8ebd88146200091f578063f0f442601462000951578063f5b541a61462000975578063f7260d3e1462000998575f80fd5b8063ad3b1b471462000835578063b9058f2d1462000859578063ca15c873146200087d578063d547741f14620008a1578063dce4b72c14620008c5575f80fd5b80638e9ba159116200011a5780638e9ba159146200073e5780639010d07c146200076d57806391d1485414620007915780639ac2a01114620007b5578063a217fddf14620007ed578063a29880231462000802575f80fd5b80635ab83031146200068d5780636001427c14620006b157806361d027b314620006d5578063718da7ee14620006f65780638d398797146200071a575f80fd5b806328a09ba011620001fe578063420c02b911620001be578063420c02b914620005765780634364b3c2146200059a5780634c9ade3114620005bb57806352f62b1414620005f557806356847eed1462000619578063569459161462000653575f80fd5b806328a09ba014620004bc5780632de481e314620004e05780632f2ff15d146200050457806336568abe14620005285780633e7e25c1146200054c575f80fd5b80630d10907011620002565780630d109070146200038d5780630e03e49014620003d15780630fff447414620003f25780631e92ffe51462000421578063248a9ca3146200044557806325605b6d1462000477575f80fd5b806301ffc9a714620002a257806302560c5b14620002db57806305c4c75f1462000301578063078f8fde14620003185780630849b234146200033c575f80fd5b366200029e57005b5f80fd5b348015620002ae575f80fd5b50620002c6620002c036600462003404565b620009b9565b60405190151581526020015b60405180910390f35b348015620002e7575f80fd5b50620002ff620002f9366004620035b1565b620009e6565b005b620002ff6200031236600462003687565b62000ae1565b34801562000324575f80fd5b50620002ff6200033636600462003782565b62000f20565b34801562000348575f80fd5b50620003746200035a366004620037b8565b60096020525f90815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001620002d2565b34801562000399575f80fd5b50620003c27f4ba1c0b393f1850d2175b0f2d7c2d42c3f898b0037de3434dbcee26a67c6df6681565b604051908152602001620002d2565b348015620003dd575f80fd5b5062000374620003ef366004620037d4565b90565b348015620003fe575f80fd5b50620003c262000410366004620037b8565b600c6020525f908152604090205481565b3480156200042d575f80fd5b50620002ff6200043f366004620037ec565b62000ff8565b34801562000451575f80fd5b50620003c262000463366004620037d4565b5f9081526020819052604090206001015490565b34801562000483575f80fd5b50620004a962000495366004620037d4565b600a6020525f908152604090205460ff1681565b60405160ff9091168152602001620002d2565b348015620004c8575f80fd5b50620002ff620004da36600462003782565b620010b7565b348015620004ec575f80fd5b50620002ff620004fe366004620035b1565b620011b6565b34801562000510575f80fd5b50620002ff6200052236600462003817565b620012ac565b34801562000534575f80fd5b50620002ff6200054636600462003817565b620012d4565b34801562000558575f80fd5b50620003c26200056a366004620037b8565b6001600160a01b031690565b34801562000582575f80fd5b50620002ff62000594366004620038ae565b62001356565b348015620005a6575f80fd5b5060045462000374906001600160a01b031681565b348015620005c7575f80fd5b50620005df620005d936600462003a13565b620014fe565b60408051928352602083019190915201620002d2565b34801562000601575f80fd5b50620002ff62000613366004620037b8565b620017d7565b34801562000625575f80fd5b50620003c26200063736600462003ac3565b600760209081525f928352604080842090915290825290205481565b3480156200065f575f80fd5b50620003c26200067136600462003ac3565b600860209081525f928352604080842090915290825290205481565b34801562000699575f80fd5b50620003c2620006ab36600462003a13565b62001862565b348015620006bd575f80fd5b50620002ff620006cf36600462003ae0565b6200190e565b348015620006e1575f80fd5b5060055462000374906001600160a01b031681565b34801562000702575f80fd5b50620002ff62000714366004620037b8565b62001a29565b34801562000726575f80fd5b50620002ff6200073836600462003c33565b62001aad565b3480156200074a575f80fd5b50620003c26200075c366004620037d4565b600e6020525f908152604090205481565b34801562000779575f80fd5b50620003746200078b36600462003c6d565b62001b4c565b3480156200079d575f80fd5b50620002c6620007af36600462003817565b62001b6c565b348015620007c1575f80fd5b5062000374620007d3366004620037b8565b600d6020525f90815260409020546001600160a01b031681565b348015620007f9575f80fd5b50620003c25f81565b3480156200080e575f80fd5b50620008266200082036600462003c8e565b62001b94565b604051620002d2919062003cff565b34801562000841575f80fd5b50620002ff62000853366004620037ec565b62001d82565b34801562000865575f80fd5b50620003746200087736600462003c6d565b62001ee3565b34801562000889575f80fd5b50620003c26200089b366004620037d4565b62001f18565b348015620008ad575f80fd5b50620002ff620008bf36600462003817565b62001f30565b348015620008d1575f80fd5b50620003c2620008e336600462003d13565b62001f58565b348015620008f5575f80fd5b50620003c261271081565b3480156200090c575f80fd5b506003546001600160a01b031662000374565b3480156200092b575f80fd5b50620002c66200093d366004620037b8565b60066020525f908152604090205460ff1681565b3480156200095d575f80fd5b50620002ff6200096f366004620037b8565b62002113565b34801562000981575f80fd5b50620003c25f8051602062004a4783398151915281565b348015620009a4575f80fd5b5060035462000374906001600160a01b031681565b5f6001600160e01b03198216635a05180f60e01b1480620009e05750620009e08262002197565b92915050565b5f8051602062004a4783398151915262000a0081620021cd565b5f5b825181101562000adc575f83828151811062000a225762000a2262003d59565b6020908102919091018101516040808201805183516001600160401b03165f9081526008865283812085870180516001600160a01b0316835296528390205582519351905191519294507f0adecf987f53689a164e57450038e59d9ebbd56448b098f9f90664b03ded7bec9362000ac0939092906001600160401b039390931683526001600160a01b03919091166020830152604082015260600190565b60405180910390a15062000ad48162003d81565b905062000a02565b505050565b6001600160a01b0383165f9081526006602052604090205460ff1662000b245760405162461bcd60e51b815260040162000b1b9062003d9c565b60405180910390fd5b85858560405160200162000b3b9392919062003e77565b60408051601f19818403018152918152815160209283012088515f908152600e9093529120541462000ba95760405162461bcd60e51b8152602060048201526016602482015275476174654b65657065723a2077726f6e67206461746160501b604482015260640162000b1b565b5f80600b5f62000bbe888b60600151620021dc565b81526020019081526020015f2080548060200260200160405190810160405280929190818152602001828054801562000c1f57602002820191905f5260205f20905b81546001600160a01b0316815260019091019060200180831162000c00575b505050505090505f5b815181101562000c8057856001600160a01b031682828151811062000c515762000c5162003d59565b60200260200101516001600160a01b03160362000c6d57600192505b62000c788162003d81565b905062000c28565b508162000cd05760405162461bcd60e51b815260206004820152601860248201527f476174654b65657065723a2077726f6e67206272696467650000000000000000604482015260640162000b1b565b5f62000d0189604001518a606001516001600160401b031662000cf98a6001600160a01b031690565b468c62002203565b9050831562000d285762000d1d89602001518883600162002275565b60208a015262000d40565b62000d3a896020015188835f62002275565b60208a01525b5f808052600c6020527f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116e85462000d809088908c908c908c908b90620023ff565b9150508034101562000dd55760405162461bcd60e51b815260206004820152601c60248201527f476174654b65657065723a206e6f7420656e6f7567682076616c756500000000604482015260640162000b1b565b6001600160a01b038881165f908152600960205260408082205490519192169083908381818185875af1925050503d805f811462000e2f576040519150601f19603f3d011682016040523d82523d5f602084013e62000e34565b606091505b505090508062000e585760405162461bcd60e51b815260040162000b1b9062003eab565b8134111562000ed4573362000e6e833462003ee0565b6040515f81818185875af1925050503d805f811462000ea9576040519150601f19603f3d011682016040523d82523d5f602084013e62000eae565b606091505b5050809150508062000ed45760405162461bcd60e51b815260040162000b1b9062003eab565b7f9e5a15be9c5533e4856b81845fef972d2e4bf9a7209a918a9aaea0702b96625a888c8c3360405162000f0b949392919062003ef6565b60405180910390a15050505050505050505050565b5f8051602062004a4783398151915262000f3a81620021cd565b6001600160a01b03831662000f635760405162461bcd60e51b815260040162000b1b9062003f32565b6001600160a01b03821662000f8c5760405162461bcd60e51b815260040162000b1b9062003f32565b6001600160a01b038381165f818152600d602090815260409182902080546001600160a01b031916948716948517905581519283528201929092527ffb9f0b64a386bfdab88dc9625b782778e7f8eea8cf15b7fe829cdbc603fd479491015b60405180910390a1505050565b5f8051602062004a478339815191526200101281620021cd565b612710821115620010665760405162461bcd60e51b815260206004820152601a60248201527f476174654b65657065723a2077726f6e6720646973636f756e74000000000000604482015260640162000b1b565b6001600160a01b0383165f818152600c6020908152604091829020859055815192835282018490527f637bd656a37735385d7cdf9d178f011d76219f7bce376e3b4af724f636ccaba7910162000feb565b7f4ba1c0b393f1850d2175b0f2d7c2d42c3f898b0037de3434dbcee26a67c6df66620010e381620021cd565b6001600160a01b038281165f9081526009602052604090205416156200114c5760405162461bcd60e51b815260206004820152601f60248201527f476174654b65657065723a2070726f746f636f6c207265676973746572656400604482015260640162000b1b565b826040516200115b9062003378565b6001600160a01b039091168152602001604051809103905ff08015801562001185573d5f803e3d5ffd5b506001600160a01b039283165f90815260096020526040902080546001600160a01b03191691909316179091555050565b5f8051602062004a47833981519152620011d081620021cd565b5f5b825181101562000adc575f838281518110620011f257620011f262003d59565b6020908102919091018101516040808201805183516001600160401b03165f9081526007865283812085870180516001600160a01b0316835296528390205582519351905191519294507ff01d94c0ef9a14a0739f8de5ca2a540864c4a6a10c3b7961cb89ffaf2e1226329362001290939092906001600160401b039390931683526001600160a01b03919091166020830152604082015260600190565b60405180910390a150620012a48162003d81565b9050620011d2565b5f82815260208190526040902060010154620012c881620021cd565b62000adc83836200250e565b6001600160a01b0381163314620013465760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840162000b1b565b62001352828262002533565b5050565b5f8051602062004a478339815191526200137081620021cd565b825182518114620013c05760405162461bcd60e51b8152602060048201526019602482015278476174654b65657065723a2077726f6e67206c656e6774687360381b604482015260640162000b1b565b5f5b81811015620014b9576001848281518110620013e257620013e262003d59565b602002602001015160ff1610156200143d5760405162461bcd60e51b815260206004820152601b60248201527f476174654b65657065723a2077726f6e67207468726573686f6c640000000000604482015260640162000b1b565b83818151811062001452576200145262003d59565b6020026020010151600a5f620014858989868151811062001477576200147762003d59565b6020026020010151620021dc565b815260208101919091526040015f20805460ff191660ff92909216919091179055620014b18162003d81565b9050620013c2565b507f3f5883b75fe729a211e46068ed4a8704cbe2451b6dfe9662ec4a04f6c2dd19e6858585604051620014ef9392919062003fa2565b60405180910390a15050505050565b5f805f80846001865162001513919062003ee0565b8151811062001526576200152662003d59565b60200260200101518060200190518101906200154391906200400d565b905060606200155688888c8c8662002558565b90935090505f62001568338962001b94565b905060605f805b83518160ff16101562001675578060ff165f036200159d57620015958533895f62002275565b9250620015bb565b8060ff16600103620015bb57620015b8853389600162002275565b92505b62001654848260ff1681518110620015d757620015d762003d59565b602002602001015160405180608001604052808a81526020018681526020018f81526020018e6001600160401b0316815250338d8560ff168151811062001622576200162262003d59565b6020026020010151600c5f336001600160a01b03166001600160a01b031681526020019081526020015f20546200262e565b62001660908362004025565b91506200166d816200403b565b90506200156f565b505f6001600a5f62001688338f620021dc565b815260208101919091526040015f205460ff161115620017b557335f908152600d60205260409020546001600160a01b031680620017145760405162461bcd60e51b815260206004820152602260248201527f476174654b65657065723a206e6f206578656375746f7220636f6e6669677572604482015261195960f21b606482015260840162000b1b565b806001600160a01b0316636e7327c78d8d60028f5162001735919062003ee0565b8151811062001748576200174862003d59565b60200260200101516040518363ffffffff1660e01b81526004016200176f9291906200405c565b602060405180830381865afa1580156200178b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620017b191906200400d565b9150505b5f620017c2828462004025565b9f919e50909c50505050505050505050505050565b5f620017e381620021cd565b6001600160a01b0382166200180c5760405162461bcd60e51b815260040162000b1b9062003f32565b600480546001600160a01b0319166001600160a01b0384169081179091556040519081527fd61278784e3e10496a434b239589564e6516898049f65aad25aba557e996bfcf906020015b60405180910390a15050565b5f6200186d6200264b565b5f805f6200187f8989898989620026a4565b915091506001600a5f62001894338a620021dc565b815260208101919091526040015f205460ff161115620018e957620018e681878760028951620018c5919062003ee0565b81518110620018d857620018d862003d59565b6020026020010151620029fd565b92505b620018f5838362004025565b9350505050620019056001600255565b95945050505050565b5f8051602062004a478339815191526200192881620021cd565b825182518114620019785760405162461bcd60e51b8152602060048201526019602482015278476174654b65657065723a2077726f6e67206c656e6774687360381b604482015260640162000b1b565b5f5b81811015620019f35783818151811062001998576200199862003d59565b6020026020010151600b5f620019bd8989868151811062001477576200147762003d59565b81526020019081526020015f209080519060200190620019df92919062003386565b50620019eb8162003d81565b90506200197a565b507f75a0f7f51bb213ab8b637a2577f563c6a728f27a2070c524d99c549c8eda2f15858585604051620014ef939291906200407f565b5f62001a3581620021cd565b6001600160a01b03821662001a5e5760405162461bcd60e51b815260040162000b1b9062003f32565b600380546001600160a01b0319166001600160a01b0384169081179091556040519081527fb68fd1a788a85f8f18de7976d851969ff9ff2216de81169c17a6f4ac94c23def9060200162001856565b5f8051602062004a4783398151915262001ac781620021cd565b6001600160a01b03831662001af05760405162461bcd60e51b815260040162000b1b9062003f32565b6001600160a01b0383165f81815260066020908152604091829020805460ff19168615159081179091558251938452908301527fbaae4373c518223c50d38b2e1e4a5c8b4ed466092987a7b3dc6af65367d517f0910162000feb565b5f82815260016020526040812062001b65908362002ba1565b9392505050565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60605f62001ba38484620021dc565b5f818152600a602052604090205490915060ff168062001c065760405162461bcd60e51b815260206004820152601a60248201527f476174654b65657065723a207a65726f207468726573686f6c64000000000000604482015260640162000b1b565b5f828152600b602052604090205460ff8216111562001c685760405162461bcd60e51b815260206004820152601e60248201527f476174654b65657065723a206e6f7420656e6f75676820627269646765730000604482015260640162000b1b565b5f8160ff166001600160401b0381111562001c875762001c876200342d565b60405190808252806020026020018201604052801562001cb1578160200160208202803683370190505b5090505f5b8260ff168160ff16101562001d78575f848152600b60205260408120805460ff841690811062001cea5762001cea62003d59565b5f9182526020808320909101546001600160a01b0316808352600690915260409091205490915060ff1662001d335760405162461bcd60e51b815260040162000b1b9062003d9c565b80838360ff168151811062001d4c5762001d4c62003d59565b6001600160a01b03909216602092830291909101909101525062001d70816200403b565b905062001cb6565b5095945050505050565b62001d8c6200264b565b6005546001600160a01b031662001de65760405162461bcd60e51b815260206004820152601c60248201527f476174654b65657065723a207472656173757279206e6f742073657400000000604482015260640162000b1b565b6001600160a01b03821662001e71576005546040515f916001600160a01b03169083908381818185875af1925050503d805f811462001e41576040519150601f19603f3d011682016040523d82523d5f602084013e62001e46565b606091505b505090508062001e6a5760405162461bcd60e51b815260040162000b1b9062003eab565b5062001e8b565b60055462001e8b9083906001600160a01b03168362002bae565b600554604080516001600160a01b0385811682526020820185905290921682820152517f87044da2612407bc001bb0985725dcc651a0dc71eaabfd1d7e8617ca85a8c19c9181900360600190a1620013526001600255565b600b602052815f5260405f20818154811062001efd575f80fd5b5f918252602090912001546001600160a01b03169150829050565b5f818152600160205260408120620009e09062002c02565b5f8281526020819052604090206001015462001f4c81620021cd565b62000adc838362002533565b6004545f906001600160a01b03848116911614801562001f79575061271082105b156200210b576001600160401b0384165f8181526007602090815260408083206001600160a01b038816808552908352818420549484526008835281842090845290915281205490829003620020125760405162461bcd60e51b815260206004820152601c60248201527f476174654b65657065723a206261736520666565206e6f742073657400000000604482015260640162000b1b565b805f03620020635760405162461bcd60e51b815260206004820152601860248201527f476174654b65657065723a2072617465206e6f74207365740000000000000000604482015260640162000b1b565b6200206f81886200412e565b6200207b908362004025565b9250600a831015620020df5760405162461bcd60e51b815260206004820152602660248201527f476174654b65657065723a206164646974696f6e616c46656520697320746f6f604482015265081cdb585b1b60d21b606482015260840162000b1b565b612710620020ee85856200412e565b620020fa919062004148565b62002106908462003ee0565b925050505b949350505050565b5f6200211f81620021cd565b6001600160a01b038216620021485760405162461bcd60e51b815260040162000b1b9062003f32565b600580546001600160a01b0319166001600160a01b0384169081179091556040519081527f3c864541ef71378c6229510ed90f376565ee42d9c5e0904a984a9e863e6db44f9060200162001856565b5f6001600160e01b03198216637965db0b60e01b1480620009e057506301ffc9a760e01b6001600160e01b0319831614620009e0565b620021d9813362002c0c565b50565b6001600160401b03811668010000000000000000600160e01b03604084901b161792915050565b604080517f59a1e8b66b6609951241aea6f047c6e9004e4e389ca42bfd172112ab74c3e24b6020820152908101839052606081018490526080810185905260a0810186905260c081018290525f9060e00160405160208183030381529060405280519060200120905095945050505050565b6060805f8315620022cf57865160208801206001600160a01b0387166040805160208101939093528201524660608201526080810186905260a00160408051601f198184030181529190529150600160f81b905062002307565b866001600160a01b0387164687604051602001620022f1949392919062004168565b60408051601f1981840301815291905291505f90505b81516200231681600162004025565b6001600160401b038111156200233057620023306200342d565b6040519080825280601f01601f1916602001820160405280156200235b576020820181803683370190505b5093505f5b81811015620023c7578381815181106200237e576200237e62003d59565b602001015160f81c60f81b8582815181106200239e576200239e62003d59565b60200101906001600160f81b03191690815f1a905350620023bf8162003d81565b905062002360565b5081848281518110620023de57620023de62003d59565b60200101906001600160f81b03191690815f1a905350505050949350505050565b5f805f80620024128a8a89898962002c70565b6001600160a01b038981165f90815260096020526040908190205490516307fa648b60e11b8152600481018590529295509293509190911690630ff4c916906024015f604051808303815f87803b1580156200246c575f80fd5b505af11580156200247f573d5f803e3d5ffd5b50506004546001600160a01b03808e16935063d174ff829250168214620024a75783620024a9565b5f5b8b8a8c8b6040518663ffffffff1660e01b8152600401620024ce949392919062004198565b5f604051808303818588803b158015620024e6575f80fd5b505af1158015620024f9573d5f803e3d5ffd5b50939d949c50939a5050505050505050505050565b6200251a828262002d36565b5f82815260016020526040902062000adc908262002dbd565b6200253f828262002dd3565b5f82815260016020526040902062000adc908262002e3a565b5f6060818162002575896001600160401b038a1633468962002203565b91505f632509db2b60e01b6200258f6004838a8c620041e1565b6200259a916200420a565b336040516001600160e01b031990921660248301526044820152466064820152608401604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b0383818316178352505050509050878782888d6040516020016200260d9594939291906200423b565b60408051808303601f19018152919052929a92995091975050505050505050565b5f806200263f878787878762002c70565b50979650505050505050565b60028054036200269e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640162000b1b565b60028055565b5f8060605f8460018651620026ba919062003ee0565b81518110620026cd57620026cd62003d59565b6020026020010151806020019051810190620026ea91906200400d565b90506060620026fd88888c8c8662002558565b5f828152600e60205260409020549195509150156200276a5760405162461bcd60e51b815260206004820152602260248201527f476174654b65657065723a2072657175657374496420616c7265616479207573604482015261195960f21b606482015260840162000b1b565b6040518060800160405280858152602001828152602001898152602001886001600160401b03168152508233604051602001620027aa9392919062003e77565b60408051601f1981840301815291815281516020928301205f878152600e90935290822055620027db338962001b94565b90505f815111620028395760405162461bcd60e51b815260206004820152602160248201527f476174654b65657065723a207a65726f2073656c6563746564206272696467656044820152607360f81b606482015260840162000b1b565b6002875162002849919062003ee0565b8151146200289a5760405162461bcd60e51b815260206004820152601d60248201527f476174654b65657065723a206f7074696f6e7320696e636f7272656374000000604482015260640162000b1b565b5f5b81518160ff161015620029a9578060ff165f03620028ca57620028c28333885f62002275565b9450620028e8565b8060ff16600103620028e857620028e5833388600162002275565b94505b5f62002983838360ff168151811062002905576200290562003d59565b602002602001015160405180608001604052808a81526020018981526020018e81526020018d6001600160401b031681525087338d8760ff168151811062002951576200295162003d59565b6020026020010151600c5f336001600160a01b03166001600160a01b031681526020019081526020015f2054620023ff565b50905062002992818962004025565b97505080620029a1906200403b565b90506200289c565b507f46386c8e5af377ca9b0207dba402bf603dbc266c51057a9f668e799d14c611d48186848c8c8833604051620029e797969594939291906200428e565b60405180910390a1505050509550959350505050565b335f908152600d60209081526040808320546009909252808320549051636e7327c760e01b81526001600160a01b03928316929091169083908390636e7327c79062002a5090899089906004016200405c565b602060405180830381865afa15801562002a6c573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019062002a9291906200400d565b6040516307fa648b60e11b8152600481018290529091506001600160a01b03831690630ff4c916906024015f604051808303815f87803b15801562002ad5575f80fd5b505af115801562002ae8573d5f803e3d5ffd5b505060405163e99100fb60e01b81526001600160a01b038616925063e99100fb9150839062002b22908b908b908b908990600401620042f5565b5f604051808303818588803b15801562002b3a575f80fd5b505af115801562002b4d573d5f803e3d5ffd5b50505050507fd0a507e9369d21f93dedfe5b006f4142dd76f6d5451603875266c9459ac213fc8787878433878960405162002b8f979695949392919062004337565b60405180910390a19695505050505050565b5f62001b65838362002e50565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905262000adc90849062002e79565b5f620009e0825490565b62002c18828262001b6c565b620013525762002c288162002f53565b62002c3583602062002f66565b60405160200162002c4892919062004391565b60408051601f198184030181529082905262461bcd60e51b825262000b1b9160040162004409565b5f805f876001600160a01b0316636e9cb0978888886040518463ffffffff1660e01b815260040162002ca5939291906200441d565b602060405180830381865afa15801562002cc1573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019062002ce791906200400d565b60045490915081906001600160a01b03908116908a160362002d295762002d1a88602001515189606001518b8862001f58565b62002d26908262004025565b90505b9890975095505050505050565b62002d42828262001b6c565b62001352575f828152602081815260408083206001600160a01b03851684529091529020805460ff1916600117905562002d793390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b5f62001b65836001600160a01b03841662003119565b62002ddf828262001b6c565b1562001352575f828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b5f62001b65836001600160a01b03841662003168565b5f825f01828154811062002e685762002e6862003d59565b905f5260205f200154905092915050565b5f62002ecf826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166200325c9092919063ffffffff16565b905080515f148062002ef257508080602001905181019062002ef291906200445e565b62000adc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840162000b1b565b6060620009e06001600160a01b03831660145b60605f62002f768360026200412e565b62002f8390600262004025565b6001600160401b0381111562002f9d5762002f9d6200342d565b6040519080825280601f01601f19166020018201604052801562002fc8576020820181803683370190505b509050600360fc1b815f8151811062002fe55762002fe562003d59565b60200101906001600160f81b03191690815f1a905350600f60fb1b8160018151811062003016576200301662003d59565b60200101906001600160f81b03191690815f1a9053505f6200303a8460026200412e565b6200304790600162004025565b90505b6001811115620030c8576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106200307f576200307f62003d59565b1a60f81b82828151811062003098576200309862003d59565b60200101906001600160f81b03191690815f1a90535060049490941c93620030c0816200447c565b90506200304a565b50831562001b655760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640162000b1b565b5f8181526001830160205260408120546200316057508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155620009e0565b505f620009e0565b5f818152600183016020526040812054801562003252575f6200318d60018362003ee0565b85549091505f90620031a29060019062003ee0565b905081811462003208575f865f018281548110620031c457620031c462003d59565b905f5260205f200154905080875f018481548110620031e757620031e762003d59565b5f918252602080832090910192909255918252600188019052604090208390555b85548690806200321c576200321c62004494565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f905560019350505050620009e0565b5f915050620009e0565b60606200210b84845f85855f80866001600160a01b03168587604051620032849190620044a8565b5f6040518083038185875af1925050503d805f8114620032c0576040519150601f19603f3d011682016040523d82523d5f602084013e620032c5565b606091505b5091509150620021068783838760608315620033455782515f036200333d576001600160a01b0385163b6200333d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162000b1b565b50816200210b565b6200210b83838151156200335c5781518083602001fd5b8060405162461bcd60e51b815260040162000b1b919062004409565b61058180620044c683390190565b828054828255905f5260205f20908101928215620033dc579160200282015b82811115620033dc57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190620033a5565b50620033ea929150620033ee565b5090565b5b80821115620033ea575f8155600101620033ef565b5f6020828403121562003415575f80fd5b81356001600160e01b03198116811462001b65575f80fd5b634e487b7160e01b5f52604160045260245ffd5b604051608081016001600160401b03811182821017156200346657620034666200342d565b60405290565b604051601f8201601f191681016001600160401b03811182821017156200349757620034976200342d565b604052919050565b5f6001600160401b03821115620034ba57620034ba6200342d565b5060051b60200190565b80356001600160401b0381168114620034db575f80fd5b919050565b80356001600160a01b0381168114620034db575f80fd5b5f6200350d62003507846200349f565b6200346c565b838152905060208082019060608086028501878111156200352c575f80fd5b855b81811015620035a55782818a03121562003547575f8081fd5b604080518481018181106001600160401b03821117156200356c576200356c6200342d565b82526200357983620034c4565b815262003588868401620034e0565b81870152828201359181019190915285529383019382016200352e565b50505050509392505050565b5f60208284031215620035c2575f80fd5b81356001600160401b03811115620035d8575f80fd5b8201601f81018413620035e9575f80fd5b6200210b84823560208401620034f7565b5f82601f8301126200360a575f80fd5b81356001600160401b038111156200362657620036266200342d565b6200363b601f8201601f19166020016200346c565b81815284602083860101111562003650575f80fd5b816020850160208301375f918101602001919091529392505050565b8015158114620021d9575f80fd5b8035620034db816200366c565b5f805f805f8060c087890312156200369d575f80fd5b86356001600160401b0380821115620036b4575f80fd5b908801906080828b031215620036c8575f80fd5b620036d262003441565b82358152602083013582811115620036e8575f80fd5b620036f68c828601620035fa565b602083015250604083013560408201526200371460608401620034c4565b60608201529750602089013596506200373060408a01620034e0565b95506200374060608a01620034e0565b9450608089013591508082111562003756575f80fd5b506200376589828a01620035fa565b9250506200377660a088016200367a565b90509295509295509295565b5f806040838503121562003794575f80fd5b6200379f83620034e0565b9150620037af60208401620034e0565b90509250929050565b5f60208284031215620037c9575f80fd5b62001b6582620034e0565b5f60208284031215620037e5575f80fd5b5035919050565b5f8060408385031215620037fe575f80fd5b6200380983620034e0565b946020939093013593505050565b5f806040838503121562003829575f80fd5b82359150620037af60208401620034e0565b5f82601f8301126200384b575f80fd5b813560206200385e62003507836200349f565b82815260059290921b840181019181810190868411156200387d575f80fd5b8286015b84811015620038a3576200389581620034c4565b835291830191830162003881565b509695505050505050565b5f805f60608486031215620038c1575f80fd5b620038cc84620034e0565b92506020808501356001600160401b0380821115620038e9575f80fd5b620038f7888389016200383b565b945060408701359150808211156200390d575f80fd5b508501601f810187136200391f575f80fd5b80356200393062003507826200349f565b81815260059190911b820183019083810190898311156200394f575f80fd5b928401925b828410156200397f57833560ff811681146200396f575f8081fd5b8252928401929084019062003954565b80955050505050509250925092565b5f82601f8301126200399e575f80fd5b81356020620039b162003507836200349f565b82815260059290921b84018101918181019086841115620039d0575f80fd5b8286015b84811015620038a35780356001600160401b03811115620039f4575f8081fd5b62003a048986838b0101620035fa565b845250918301918301620039d4565b5f805f805f6080868803121562003a28575f80fd5b85356001600160401b038082111562003a3f575f80fd5b818801915088601f83011262003a53575f80fd5b81358181111562003a62575f80fd5b89602082850101111562003a74575f80fd5b60208381019850909650880135945062003a9160408901620034c4565b9350606088013591508082111562003aa7575f80fd5b5062003ab6888289016200398e565b9150509295509295909350565b5f806040838503121562003ad5575f80fd5b6200379f83620034c4565b5f805f6060848603121562003af3575f80fd5b62003afe84620034e0565b92506020808501356001600160401b038082111562003b1b575f80fd5b62003b29888389016200383b565b9450604087013591508082111562003b3f575f80fd5b818701915087601f83011262003b53575f80fd5b813562003b6462003507826200349f565b81815260059190911b8301840190848101908a83111562003b83575f80fd5b8585015b8381101562003c225780358581111562003ba0575f8081fd5b8601603f81018d1362003bb2575f8081fd5b8781013562003bc562003507826200349f565b81815260059190911b820160400190898101908f83111562003be6575f8081fd5b6040840193505b8284101562003c115762003c0184620034e0565b8252928a0192908a019062003bed565b865250505091860191860162003b87565b508096505050505050509250925092565b5f806040838503121562003c45575f80fd5b62003c5083620034e0565b9150602083013562003c62816200366c565b809150509250929050565b5f806040838503121562003c7f575f80fd5b50508035926020909101359150565b5f806040838503121562003ca0575f80fd5b62003cab83620034e0565b9150620037af60208401620034c4565b5f8151808452602080850194508084015f5b8381101562003cf45781516001600160a01b03168752958201959082019060010162003ccd565b509495945050505050565b602081525f62001b65602083018462003cbb565b5f805f806080858703121562003d27575f80fd5b8435935062003d3960208601620034c4565b925062003d4960408601620034e0565b9396929550929360600135925050565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b5f6001820162003d955762003d9562003d6d565b5060010190565b60208082526021908201527f476174654b65657065723a20627269646765206e6f74207265676973746572656040820152601960fa1b606082015260800190565b5f5b8381101562003df957818101518382015260200162003ddf565b50505f910152565b5f815180845262003e1a81602086016020860162003ddd565b601f01601f19169290920160200192915050565b805182525f60208201516080602085015262003e4e608085018262003e01565b9050604083015160408501526001600160401b0360608401511660608501528091505092915050565b606081525f62003e8b606083018662003e2e565b6020830194909452506001600160a01b0391909116604090910152919050565b6020808252818101527f476174654b65657065723a206661696c656420746f2073656e64204574686572604082015260600190565b81810381811115620009e057620009e062003d6d565b5f60018060a01b0380871683526080602084015262003f19608084018762003e2e565b6040840195909552929092166060909101525092915050565b60208082526018908201527f476174654b65657065723a207a65726f20616464726573730000000000000000604082015260600190565b5f8151808452602080850194508084015f5b8381101562003cf45781516001600160401b03168752958201959082019060010162003f7b565b6001600160a01b0384168152606060208083018290525f9162003fc89084018662003f69565b83810360408501528451808252828601918301905f5b8181101562003fff57835160ff168352928401929184019160010162003fde565b509098975050505050505050565b5f602082840312156200401e575f80fd5b5051919050565b80820180821115620009e057620009e062003d6d565b5f60ff821660ff810362004053576200405362003d6d565b60010192915050565b6001600160401b0383168152604060208201525f6200210b604083018462003e01565b5f60018060a01b0380861683526020606081850152620040a3606085018762003f69565b8481036040860152855180825282820190600581901b830184018489015f805b848110156200411c57868403601f19018652825180518086529089019089860190845b81811015620041065783518d168352928b0192918b0191600101620040e6565b50509689019694505091870191600101620040c3565b50919c9b505050505050505050505050565b8082028115828204841417620009e057620009e062003d6d565b5f826200416357634e487b7160e01b5f52601260045260245ffd5b500490565b608081525f6200417c608083018762003e01565b6020830195909552506040810192909252606090910152919050565b608081525f620041ac608083018762003e2e565b6001600160a01b0386166020840152604083018590528281036060840152620041d6818562003e01565b979650505050505050565b5f8085851115620041f0575f80fd5b83861115620041fd575f80fd5b5050820193919092039150565b6001600160e01b03198135818116916004851015620042335780818660040360031b1b83161692505b505092915050565b60808152846080820152848660a08301375f60a086830101525f601f19601f870116820160a08382030160208401526200427960a082018762003e01565b60408401959095525050606001529392505050565b60e081525f620042a260e083018a62003cbb565b8860208401528281036040840152620042bc818962003e01565b606084019790975250506001600160401b0393909316608084015260a08301919091526001600160a01b031660c0909101529392505050565b8481526001600160401b0384166020820152608060408201525f6200431e608083018562003e01565b905060018060a01b038316606083015295945050505050565b8781526001600160401b038716602082015260e060408201525f6200436060e083018862003e01565b6060830196909652506001600160a01b03938416608082015291831660a083015290911660c0909101529392505050565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081525f8351620043ca81601785016020880162003ddd565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351620043fd81602884016020880162003ddd565b01602801949350505050565b602081525f62001b65602083018462003e01565b606081525f62004431606083018662003e2e565b6001600160a01b0385166020840152828103604084015262004454818562003e01565b9695505050505050565b5f602082840312156200446f575f80fd5b815162001b65816200366c565b5f816200448d576200448d62003d6d565b505f190190565b634e487b7160e01b5f52603160045260245ffd5b5f8251620044bb81846020870162003ddd565b919091019291505056fe60a060405234801561000f575f80fd5b5060405161058138038061058183398101604081905261002e916100f3565b610037336100a4565b6001600160a01b0381166100915760405162461bcd60e51b815260206004820152601c60248201527f4e617469766554726561737572793a207a65726f206164647265737300000000604482015260640160405180910390fd5b61009a816100a4565b5033608052610120565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f60208284031215610103575f80fd5b81516001600160a01b0381168114610119575f80fd5b9392505050565b60805161044361013e5f395f81816089015261012101526104435ff3fe60806040526004361061004c575f3560e01c80630ff4c9161461005757806345d61ded14610078578063715018a6146100c75780638da5cb5b146100db578063f2fde38b146100f7575f80fd5b3661005357005b5f80fd5b348015610062575f80fd5b506100766100713660046103c9565b610116565b005b348015610083575f80fd5b506100ab7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d2575f80fd5b50610076610295565b3480156100e6575f80fd5b505f546001600160a01b03166100ab565b348015610102575f80fd5b506100766101113660046103e0565b6102a8565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061015657505f546001600160a01b031633145b6101b85760405162461bcd60e51b815260206004820152602860248201527f4e617469766554726561737572793a206f6e6c792061646d696e206f722067616044820152673a32b5b2b2b832b960c11b60648201526084015b60405180910390fd5b6040515f90339083908381818185875af1925050503d805f81146101f7576040519150601f19603f3d011682016040523d82523d5f602084013e6101fc565b606091505b50509050806102595760405162461bcd60e51b8152602060048201526024808201527f4e617469766554726561737572793a206661696c656420746f2073656e6420456044820152633a3432b960e11b60648201526084016101af565b604080518381523360208201527f6e956827cc4d1fccd75ce1b2622b67a52f13906439c330d7f85258eb9b8b342e910160405180910390a15050565b61029d610321565b6102a65f61037a565b565b6102b0610321565b6001600160a01b0381166103155760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101af565b61031e8161037a565b50565b5f546001600160a01b031633146102a65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101af565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f602082840312156103d9575f80fd5b5035919050565b5f602082840312156103f0575f80fd5b81356001600160a01b0381168114610406575f80fd5b939250505056fea264697066735822122072a156b89eee99b6cf328696f77d473192a0042ef09b4a9e2f9f8b9489bdf84b64736f6c6343000814003397667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929a2646970667358221220337052b6261aa6f3672331d7ea6afb753d08fb47d0fbf56bf39f859edbf2fa1b64736f6c634300081400330000000000000000000000000f00f1a6a32e644815c5686ad7dc305a54b11200
Deployed Bytecode
0x60806040526004361062000296575f3560e01c80635ab83031116200015a578063ad3b1b4711620000c2578063e34955691162000082578063e349556914620008e9578063e78cea921462000900578063eb8ebd88146200091f578063f0f442601462000951578063f5b541a61462000975578063f7260d3e1462000998575f80fd5b8063ad3b1b471462000835578063b9058f2d1462000859578063ca15c873146200087d578063d547741f14620008a1578063dce4b72c14620008c5575f80fd5b80638e9ba159116200011a5780638e9ba159146200073e5780639010d07c146200076d57806391d1485414620007915780639ac2a01114620007b5578063a217fddf14620007ed578063a29880231462000802575f80fd5b80635ab83031146200068d5780636001427c14620006b157806361d027b314620006d5578063718da7ee14620006f65780638d398797146200071a575f80fd5b806328a09ba011620001fe578063420c02b911620001be578063420c02b914620005765780634364b3c2146200059a5780634c9ade3114620005bb57806352f62b1414620005f557806356847eed1462000619578063569459161462000653575f80fd5b806328a09ba014620004bc5780632de481e314620004e05780632f2ff15d146200050457806336568abe14620005285780633e7e25c1146200054c575f80fd5b80630d10907011620002565780630d109070146200038d5780630e03e49014620003d15780630fff447414620003f25780631e92ffe51462000421578063248a9ca3146200044557806325605b6d1462000477575f80fd5b806301ffc9a714620002a257806302560c5b14620002db57806305c4c75f1462000301578063078f8fde14620003185780630849b234146200033c575f80fd5b366200029e57005b5f80fd5b348015620002ae575f80fd5b50620002c6620002c036600462003404565b620009b9565b60405190151581526020015b60405180910390f35b348015620002e7575f80fd5b50620002ff620002f9366004620035b1565b620009e6565b005b620002ff6200031236600462003687565b62000ae1565b34801562000324575f80fd5b50620002ff6200033636600462003782565b62000f20565b34801562000348575f80fd5b50620003746200035a366004620037b8565b60096020525f90815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001620002d2565b34801562000399575f80fd5b50620003c27f4ba1c0b393f1850d2175b0f2d7c2d42c3f898b0037de3434dbcee26a67c6df6681565b604051908152602001620002d2565b348015620003dd575f80fd5b5062000374620003ef366004620037d4565b90565b348015620003fe575f80fd5b50620003c262000410366004620037b8565b600c6020525f908152604090205481565b3480156200042d575f80fd5b50620002ff6200043f366004620037ec565b62000ff8565b34801562000451575f80fd5b50620003c262000463366004620037d4565b5f9081526020819052604090206001015490565b34801562000483575f80fd5b50620004a962000495366004620037d4565b600a6020525f908152604090205460ff1681565b60405160ff9091168152602001620002d2565b348015620004c8575f80fd5b50620002ff620004da36600462003782565b620010b7565b348015620004ec575f80fd5b50620002ff620004fe366004620035b1565b620011b6565b34801562000510575f80fd5b50620002ff6200052236600462003817565b620012ac565b34801562000534575f80fd5b50620002ff6200054636600462003817565b620012d4565b34801562000558575f80fd5b50620003c26200056a366004620037b8565b6001600160a01b031690565b34801562000582575f80fd5b50620002ff62000594366004620038ae565b62001356565b348015620005a6575f80fd5b5060045462000374906001600160a01b031681565b348015620005c7575f80fd5b50620005df620005d936600462003a13565b620014fe565b60408051928352602083019190915201620002d2565b34801562000601575f80fd5b50620002ff62000613366004620037b8565b620017d7565b34801562000625575f80fd5b50620003c26200063736600462003ac3565b600760209081525f928352604080842090915290825290205481565b3480156200065f575f80fd5b50620003c26200067136600462003ac3565b600860209081525f928352604080842090915290825290205481565b34801562000699575f80fd5b50620003c2620006ab36600462003a13565b62001862565b348015620006bd575f80fd5b50620002ff620006cf36600462003ae0565b6200190e565b348015620006e1575f80fd5b5060055462000374906001600160a01b031681565b34801562000702575f80fd5b50620002ff62000714366004620037b8565b62001a29565b34801562000726575f80fd5b50620002ff6200073836600462003c33565b62001aad565b3480156200074a575f80fd5b50620003c26200075c366004620037d4565b600e6020525f908152604090205481565b34801562000779575f80fd5b50620003746200078b36600462003c6d565b62001b4c565b3480156200079d575f80fd5b50620002c6620007af36600462003817565b62001b6c565b348015620007c1575f80fd5b5062000374620007d3366004620037b8565b600d6020525f90815260409020546001600160a01b031681565b348015620007f9575f80fd5b50620003c25f81565b3480156200080e575f80fd5b50620008266200082036600462003c8e565b62001b94565b604051620002d2919062003cff565b34801562000841575f80fd5b50620002ff62000853366004620037ec565b62001d82565b34801562000865575f80fd5b50620003746200087736600462003c6d565b62001ee3565b34801562000889575f80fd5b50620003c26200089b366004620037d4565b62001f18565b348015620008ad575f80fd5b50620002ff620008bf36600462003817565b62001f30565b348015620008d1575f80fd5b50620003c2620008e336600462003d13565b62001f58565b348015620008f5575f80fd5b50620003c261271081565b3480156200090c575f80fd5b506003546001600160a01b031662000374565b3480156200092b575f80fd5b50620002c66200093d366004620037b8565b60066020525f908152604090205460ff1681565b3480156200095d575f80fd5b50620002ff6200096f366004620037b8565b62002113565b34801562000981575f80fd5b50620003c25f8051602062004a4783398151915281565b348015620009a4575f80fd5b5060035462000374906001600160a01b031681565b5f6001600160e01b03198216635a05180f60e01b1480620009e05750620009e08262002197565b92915050565b5f8051602062004a4783398151915262000a0081620021cd565b5f5b825181101562000adc575f83828151811062000a225762000a2262003d59565b6020908102919091018101516040808201805183516001600160401b03165f9081526008865283812085870180516001600160a01b0316835296528390205582519351905191519294507f0adecf987f53689a164e57450038e59d9ebbd56448b098f9f90664b03ded7bec9362000ac0939092906001600160401b039390931683526001600160a01b03919091166020830152604082015260600190565b60405180910390a15062000ad48162003d81565b905062000a02565b505050565b6001600160a01b0383165f9081526006602052604090205460ff1662000b245760405162461bcd60e51b815260040162000b1b9062003d9c565b60405180910390fd5b85858560405160200162000b3b9392919062003e77565b60408051601f19818403018152918152815160209283012088515f908152600e9093529120541462000ba95760405162461bcd60e51b8152602060048201526016602482015275476174654b65657065723a2077726f6e67206461746160501b604482015260640162000b1b565b5f80600b5f62000bbe888b60600151620021dc565b81526020019081526020015f2080548060200260200160405190810160405280929190818152602001828054801562000c1f57602002820191905f5260205f20905b81546001600160a01b0316815260019091019060200180831162000c00575b505050505090505f5b815181101562000c8057856001600160a01b031682828151811062000c515762000c5162003d59565b60200260200101516001600160a01b03160362000c6d57600192505b62000c788162003d81565b905062000c28565b508162000cd05760405162461bcd60e51b815260206004820152601860248201527f476174654b65657065723a2077726f6e67206272696467650000000000000000604482015260640162000b1b565b5f62000d0189604001518a606001516001600160401b031662000cf98a6001600160a01b031690565b468c62002203565b9050831562000d285762000d1d89602001518883600162002275565b60208a015262000d40565b62000d3a896020015188835f62002275565b60208a01525b5f808052600c6020527f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116e85462000d809088908c908c908c908b90620023ff565b9150508034101562000dd55760405162461bcd60e51b815260206004820152601c60248201527f476174654b65657065723a206e6f7420656e6f7567682076616c756500000000604482015260640162000b1b565b6001600160a01b038881165f908152600960205260408082205490519192169083908381818185875af1925050503d805f811462000e2f576040519150601f19603f3d011682016040523d82523d5f602084013e62000e34565b606091505b505090508062000e585760405162461bcd60e51b815260040162000b1b9062003eab565b8134111562000ed4573362000e6e833462003ee0565b6040515f81818185875af1925050503d805f811462000ea9576040519150601f19603f3d011682016040523d82523d5f602084013e62000eae565b606091505b5050809150508062000ed45760405162461bcd60e51b815260040162000b1b9062003eab565b7f9e5a15be9c5533e4856b81845fef972d2e4bf9a7209a918a9aaea0702b96625a888c8c3360405162000f0b949392919062003ef6565b60405180910390a15050505050505050505050565b5f8051602062004a4783398151915262000f3a81620021cd565b6001600160a01b03831662000f635760405162461bcd60e51b815260040162000b1b9062003f32565b6001600160a01b03821662000f8c5760405162461bcd60e51b815260040162000b1b9062003f32565b6001600160a01b038381165f818152600d602090815260409182902080546001600160a01b031916948716948517905581519283528201929092527ffb9f0b64a386bfdab88dc9625b782778e7f8eea8cf15b7fe829cdbc603fd479491015b60405180910390a1505050565b5f8051602062004a478339815191526200101281620021cd565b612710821115620010665760405162461bcd60e51b815260206004820152601a60248201527f476174654b65657065723a2077726f6e6720646973636f756e74000000000000604482015260640162000b1b565b6001600160a01b0383165f818152600c6020908152604091829020859055815192835282018490527f637bd656a37735385d7cdf9d178f011d76219f7bce376e3b4af724f636ccaba7910162000feb565b7f4ba1c0b393f1850d2175b0f2d7c2d42c3f898b0037de3434dbcee26a67c6df66620010e381620021cd565b6001600160a01b038281165f9081526009602052604090205416156200114c5760405162461bcd60e51b815260206004820152601f60248201527f476174654b65657065723a2070726f746f636f6c207265676973746572656400604482015260640162000b1b565b826040516200115b9062003378565b6001600160a01b039091168152602001604051809103905ff08015801562001185573d5f803e3d5ffd5b506001600160a01b039283165f90815260096020526040902080546001600160a01b03191691909316179091555050565b5f8051602062004a47833981519152620011d081620021cd565b5f5b825181101562000adc575f838281518110620011f257620011f262003d59565b6020908102919091018101516040808201805183516001600160401b03165f9081526007865283812085870180516001600160a01b0316835296528390205582519351905191519294507ff01d94c0ef9a14a0739f8de5ca2a540864c4a6a10c3b7961cb89ffaf2e1226329362001290939092906001600160401b039390931683526001600160a01b03919091166020830152604082015260600190565b60405180910390a150620012a48162003d81565b9050620011d2565b5f82815260208190526040902060010154620012c881620021cd565b62000adc83836200250e565b6001600160a01b0381163314620013465760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840162000b1b565b62001352828262002533565b5050565b5f8051602062004a478339815191526200137081620021cd565b825182518114620013c05760405162461bcd60e51b8152602060048201526019602482015278476174654b65657065723a2077726f6e67206c656e6774687360381b604482015260640162000b1b565b5f5b81811015620014b9576001848281518110620013e257620013e262003d59565b602002602001015160ff1610156200143d5760405162461bcd60e51b815260206004820152601b60248201527f476174654b65657065723a2077726f6e67207468726573686f6c640000000000604482015260640162000b1b565b83818151811062001452576200145262003d59565b6020026020010151600a5f620014858989868151811062001477576200147762003d59565b6020026020010151620021dc565b815260208101919091526040015f20805460ff191660ff92909216919091179055620014b18162003d81565b9050620013c2565b507f3f5883b75fe729a211e46068ed4a8704cbe2451b6dfe9662ec4a04f6c2dd19e6858585604051620014ef9392919062003fa2565b60405180910390a15050505050565b5f805f80846001865162001513919062003ee0565b8151811062001526576200152662003d59565b60200260200101518060200190518101906200154391906200400d565b905060606200155688888c8c8662002558565b90935090505f62001568338962001b94565b905060605f805b83518160ff16101562001675578060ff165f036200159d57620015958533895f62002275565b9250620015bb565b8060ff16600103620015bb57620015b8853389600162002275565b92505b62001654848260ff1681518110620015d757620015d762003d59565b602002602001015160405180608001604052808a81526020018681526020018f81526020018e6001600160401b0316815250338d8560ff168151811062001622576200162262003d59565b6020026020010151600c5f336001600160a01b03166001600160a01b031681526020019081526020015f20546200262e565b62001660908362004025565b91506200166d816200403b565b90506200156f565b505f6001600a5f62001688338f620021dc565b815260208101919091526040015f205460ff161115620017b557335f908152600d60205260409020546001600160a01b031680620017145760405162461bcd60e51b815260206004820152602260248201527f476174654b65657065723a206e6f206578656375746f7220636f6e6669677572604482015261195960f21b606482015260840162000b1b565b806001600160a01b0316636e7327c78d8d60028f5162001735919062003ee0565b8151811062001748576200174862003d59565b60200260200101516040518363ffffffff1660e01b81526004016200176f9291906200405c565b602060405180830381865afa1580156200178b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190620017b191906200400d565b9150505b5f620017c2828462004025565b9f919e50909c50505050505050505050505050565b5f620017e381620021cd565b6001600160a01b0382166200180c5760405162461bcd60e51b815260040162000b1b9062003f32565b600480546001600160a01b0319166001600160a01b0384169081179091556040519081527fd61278784e3e10496a434b239589564e6516898049f65aad25aba557e996bfcf906020015b60405180910390a15050565b5f6200186d6200264b565b5f805f6200187f8989898989620026a4565b915091506001600a5f62001894338a620021dc565b815260208101919091526040015f205460ff161115620018e957620018e681878760028951620018c5919062003ee0565b81518110620018d857620018d862003d59565b6020026020010151620029fd565b92505b620018f5838362004025565b9350505050620019056001600255565b95945050505050565b5f8051602062004a478339815191526200192881620021cd565b825182518114620019785760405162461bcd60e51b8152602060048201526019602482015278476174654b65657065723a2077726f6e67206c656e6774687360381b604482015260640162000b1b565b5f5b81811015620019f35783818151811062001998576200199862003d59565b6020026020010151600b5f620019bd8989868151811062001477576200147762003d59565b81526020019081526020015f209080519060200190620019df92919062003386565b50620019eb8162003d81565b90506200197a565b507f75a0f7f51bb213ab8b637a2577f563c6a728f27a2070c524d99c549c8eda2f15858585604051620014ef939291906200407f565b5f62001a3581620021cd565b6001600160a01b03821662001a5e5760405162461bcd60e51b815260040162000b1b9062003f32565b600380546001600160a01b0319166001600160a01b0384169081179091556040519081527fb68fd1a788a85f8f18de7976d851969ff9ff2216de81169c17a6f4ac94c23def9060200162001856565b5f8051602062004a4783398151915262001ac781620021cd565b6001600160a01b03831662001af05760405162461bcd60e51b815260040162000b1b9062003f32565b6001600160a01b0383165f81815260066020908152604091829020805460ff19168615159081179091558251938452908301527fbaae4373c518223c50d38b2e1e4a5c8b4ed466092987a7b3dc6af65367d517f0910162000feb565b5f82815260016020526040812062001b65908362002ba1565b9392505050565b5f918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60605f62001ba38484620021dc565b5f818152600a602052604090205490915060ff168062001c065760405162461bcd60e51b815260206004820152601a60248201527f476174654b65657065723a207a65726f207468726573686f6c64000000000000604482015260640162000b1b565b5f828152600b602052604090205460ff8216111562001c685760405162461bcd60e51b815260206004820152601e60248201527f476174654b65657065723a206e6f7420656e6f75676820627269646765730000604482015260640162000b1b565b5f8160ff166001600160401b0381111562001c875762001c876200342d565b60405190808252806020026020018201604052801562001cb1578160200160208202803683370190505b5090505f5b8260ff168160ff16101562001d78575f848152600b60205260408120805460ff841690811062001cea5762001cea62003d59565b5f9182526020808320909101546001600160a01b0316808352600690915260409091205490915060ff1662001d335760405162461bcd60e51b815260040162000b1b9062003d9c565b80838360ff168151811062001d4c5762001d4c62003d59565b6001600160a01b03909216602092830291909101909101525062001d70816200403b565b905062001cb6565b5095945050505050565b62001d8c6200264b565b6005546001600160a01b031662001de65760405162461bcd60e51b815260206004820152601c60248201527f476174654b65657065723a207472656173757279206e6f742073657400000000604482015260640162000b1b565b6001600160a01b03821662001e71576005546040515f916001600160a01b03169083908381818185875af1925050503d805f811462001e41576040519150601f19603f3d011682016040523d82523d5f602084013e62001e46565b606091505b505090508062001e6a5760405162461bcd60e51b815260040162000b1b9062003eab565b5062001e8b565b60055462001e8b9083906001600160a01b03168362002bae565b600554604080516001600160a01b0385811682526020820185905290921682820152517f87044da2612407bc001bb0985725dcc651a0dc71eaabfd1d7e8617ca85a8c19c9181900360600190a1620013526001600255565b600b602052815f5260405f20818154811062001efd575f80fd5b5f918252602090912001546001600160a01b03169150829050565b5f818152600160205260408120620009e09062002c02565b5f8281526020819052604090206001015462001f4c81620021cd565b62000adc838362002533565b6004545f906001600160a01b03848116911614801562001f79575061271082105b156200210b576001600160401b0384165f8181526007602090815260408083206001600160a01b038816808552908352818420549484526008835281842090845290915281205490829003620020125760405162461bcd60e51b815260206004820152601c60248201527f476174654b65657065723a206261736520666565206e6f742073657400000000604482015260640162000b1b565b805f03620020635760405162461bcd60e51b815260206004820152601860248201527f476174654b65657065723a2072617465206e6f74207365740000000000000000604482015260640162000b1b565b6200206f81886200412e565b6200207b908362004025565b9250600a831015620020df5760405162461bcd60e51b815260206004820152602660248201527f476174654b65657065723a206164646974696f6e616c46656520697320746f6f604482015265081cdb585b1b60d21b606482015260840162000b1b565b612710620020ee85856200412e565b620020fa919062004148565b62002106908462003ee0565b925050505b949350505050565b5f6200211f81620021cd565b6001600160a01b038216620021485760405162461bcd60e51b815260040162000b1b9062003f32565b600580546001600160a01b0319166001600160a01b0384169081179091556040519081527f3c864541ef71378c6229510ed90f376565ee42d9c5e0904a984a9e863e6db44f9060200162001856565b5f6001600160e01b03198216637965db0b60e01b1480620009e057506301ffc9a760e01b6001600160e01b0319831614620009e0565b620021d9813362002c0c565b50565b6001600160401b03811668010000000000000000600160e01b03604084901b161792915050565b604080517f59a1e8b66b6609951241aea6f047c6e9004e4e389ca42bfd172112ab74c3e24b6020820152908101839052606081018490526080810185905260a0810186905260c081018290525f9060e00160405160208183030381529060405280519060200120905095945050505050565b6060805f8315620022cf57865160208801206001600160a01b0387166040805160208101939093528201524660608201526080810186905260a00160408051601f198184030181529190529150600160f81b905062002307565b866001600160a01b0387164687604051602001620022f1949392919062004168565b60408051601f1981840301815291905291505f90505b81516200231681600162004025565b6001600160401b038111156200233057620023306200342d565b6040519080825280601f01601f1916602001820160405280156200235b576020820181803683370190505b5093505f5b81811015620023c7578381815181106200237e576200237e62003d59565b602001015160f81c60f81b8582815181106200239e576200239e62003d59565b60200101906001600160f81b03191690815f1a905350620023bf8162003d81565b905062002360565b5081848281518110620023de57620023de62003d59565b60200101906001600160f81b03191690815f1a905350505050949350505050565b5f805f80620024128a8a89898962002c70565b6001600160a01b038981165f90815260096020526040908190205490516307fa648b60e11b8152600481018590529295509293509190911690630ff4c916906024015f604051808303815f87803b1580156200246c575f80fd5b505af11580156200247f573d5f803e3d5ffd5b50506004546001600160a01b03808e16935063d174ff829250168214620024a75783620024a9565b5f5b8b8a8c8b6040518663ffffffff1660e01b8152600401620024ce949392919062004198565b5f604051808303818588803b158015620024e6575f80fd5b505af1158015620024f9573d5f803e3d5ffd5b50939d949c50939a5050505050505050505050565b6200251a828262002d36565b5f82815260016020526040902062000adc908262002dbd565b6200253f828262002dd3565b5f82815260016020526040902062000adc908262002e3a565b5f6060818162002575896001600160401b038a1633468962002203565b91505f632509db2b60e01b6200258f6004838a8c620041e1565b6200259a916200420a565b336040516001600160e01b031990921660248301526044820152466064820152608401604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b0383818316178352505050509050878782888d6040516020016200260d9594939291906200423b565b60408051808303601f19018152919052929a92995091975050505050505050565b5f806200263f878787878762002c70565b50979650505050505050565b60028054036200269e5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640162000b1b565b60028055565b5f8060605f8460018651620026ba919062003ee0565b81518110620026cd57620026cd62003d59565b6020026020010151806020019051810190620026ea91906200400d565b90506060620026fd88888c8c8662002558565b5f828152600e60205260409020549195509150156200276a5760405162461bcd60e51b815260206004820152602260248201527f476174654b65657065723a2072657175657374496420616c7265616479207573604482015261195960f21b606482015260840162000b1b565b6040518060800160405280858152602001828152602001898152602001886001600160401b03168152508233604051602001620027aa9392919062003e77565b60408051601f1981840301815291815281516020928301205f878152600e90935290822055620027db338962001b94565b90505f815111620028395760405162461bcd60e51b815260206004820152602160248201527f476174654b65657065723a207a65726f2073656c6563746564206272696467656044820152607360f81b606482015260840162000b1b565b6002875162002849919062003ee0565b8151146200289a5760405162461bcd60e51b815260206004820152601d60248201527f476174654b65657065723a206f7074696f6e7320696e636f7272656374000000604482015260640162000b1b565b5f5b81518160ff161015620029a9578060ff165f03620028ca57620028c28333885f62002275565b9450620028e8565b8060ff16600103620028e857620028e5833388600162002275565b94505b5f62002983838360ff168151811062002905576200290562003d59565b602002602001015160405180608001604052808a81526020018981526020018e81526020018d6001600160401b031681525087338d8760ff168151811062002951576200295162003d59565b6020026020010151600c5f336001600160a01b03166001600160a01b031681526020019081526020015f2054620023ff565b50905062002992818962004025565b97505080620029a1906200403b565b90506200289c565b507f46386c8e5af377ca9b0207dba402bf603dbc266c51057a9f668e799d14c611d48186848c8c8833604051620029e797969594939291906200428e565b60405180910390a1505050509550959350505050565b335f908152600d60209081526040808320546009909252808320549051636e7327c760e01b81526001600160a01b03928316929091169083908390636e7327c79062002a5090899089906004016200405c565b602060405180830381865afa15801562002a6c573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019062002a9291906200400d565b6040516307fa648b60e11b8152600481018290529091506001600160a01b03831690630ff4c916906024015f604051808303815f87803b15801562002ad5575f80fd5b505af115801562002ae8573d5f803e3d5ffd5b505060405163e99100fb60e01b81526001600160a01b038616925063e99100fb9150839062002b22908b908b908b908990600401620042f5565b5f604051808303818588803b15801562002b3a575f80fd5b505af115801562002b4d573d5f803e3d5ffd5b50505050507fd0a507e9369d21f93dedfe5b006f4142dd76f6d5451603875266c9459ac213fc8787878433878960405162002b8f979695949392919062004337565b60405180910390a19695505050505050565b5f62001b65838362002e50565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905262000adc90849062002e79565b5f620009e0825490565b62002c18828262001b6c565b620013525762002c288162002f53565b62002c3583602062002f66565b60405160200162002c4892919062004391565b60408051601f198184030181529082905262461bcd60e51b825262000b1b9160040162004409565b5f805f876001600160a01b0316636e9cb0978888886040518463ffffffff1660e01b815260040162002ca5939291906200441d565b602060405180830381865afa15801562002cc1573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019062002ce791906200400d565b60045490915081906001600160a01b03908116908a160362002d295762002d1a88602001515189606001518b8862001f58565b62002d26908262004025565b90505b9890975095505050505050565b62002d42828262001b6c565b62001352575f828152602081815260408083206001600160a01b03851684529091529020805460ff1916600117905562002d793390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b5f62001b65836001600160a01b03841662003119565b62002ddf828262001b6c565b1562001352575f828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b5f62001b65836001600160a01b03841662003168565b5f825f01828154811062002e685762002e6862003d59565b905f5260205f200154905092915050565b5f62002ecf826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166200325c9092919063ffffffff16565b905080515f148062002ef257508080602001905181019062002ef291906200445e565b62000adc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840162000b1b565b6060620009e06001600160a01b03831660145b60605f62002f768360026200412e565b62002f8390600262004025565b6001600160401b0381111562002f9d5762002f9d6200342d565b6040519080825280601f01601f19166020018201604052801562002fc8576020820181803683370190505b509050600360fc1b815f8151811062002fe55762002fe562003d59565b60200101906001600160f81b03191690815f1a905350600f60fb1b8160018151811062003016576200301662003d59565b60200101906001600160f81b03191690815f1a9053505f6200303a8460026200412e565b6200304790600162004025565b90505b6001811115620030c8576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106200307f576200307f62003d59565b1a60f81b82828151811062003098576200309862003d59565b60200101906001600160f81b03191690815f1a90535060049490941c93620030c0816200447c565b90506200304a565b50831562001b655760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640162000b1b565b5f8181526001830160205260408120546200316057508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155620009e0565b505f620009e0565b5f818152600183016020526040812054801562003252575f6200318d60018362003ee0565b85549091505f90620031a29060019062003ee0565b905081811462003208575f865f018281548110620031c457620031c462003d59565b905f5260205f200154905080875f018481548110620031e757620031e762003d59565b5f918252602080832090910192909255918252600188019052604090208390555b85548690806200321c576200321c62004494565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f905560019350505050620009e0565b5f915050620009e0565b60606200210b84845f85855f80866001600160a01b03168587604051620032849190620044a8565b5f6040518083038185875af1925050503d805f8114620032c0576040519150601f19603f3d011682016040523d82523d5f602084013e620032c5565b606091505b5091509150620021068783838760608315620033455782515f036200333d576001600160a01b0385163b6200333d5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162000b1b565b50816200210b565b6200210b83838151156200335c5781518083602001fd5b8060405162461bcd60e51b815260040162000b1b919062004409565b61058180620044c683390190565b828054828255905f5260205f20908101928215620033dc579160200282015b82811115620033dc57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190620033a5565b50620033ea929150620033ee565b5090565b5b80821115620033ea575f8155600101620033ef565b5f6020828403121562003415575f80fd5b81356001600160e01b03198116811462001b65575f80fd5b634e487b7160e01b5f52604160045260245ffd5b604051608081016001600160401b03811182821017156200346657620034666200342d565b60405290565b604051601f8201601f191681016001600160401b03811182821017156200349757620034976200342d565b604052919050565b5f6001600160401b03821115620034ba57620034ba6200342d565b5060051b60200190565b80356001600160401b0381168114620034db575f80fd5b919050565b80356001600160a01b0381168114620034db575f80fd5b5f6200350d62003507846200349f565b6200346c565b838152905060208082019060608086028501878111156200352c575f80fd5b855b81811015620035a55782818a03121562003547575f8081fd5b604080518481018181106001600160401b03821117156200356c576200356c6200342d565b82526200357983620034c4565b815262003588868401620034e0565b81870152828201359181019190915285529383019382016200352e565b50505050509392505050565b5f60208284031215620035c2575f80fd5b81356001600160401b03811115620035d8575f80fd5b8201601f81018413620035e9575f80fd5b6200210b84823560208401620034f7565b5f82601f8301126200360a575f80fd5b81356001600160401b038111156200362657620036266200342d565b6200363b601f8201601f19166020016200346c565b81815284602083860101111562003650575f80fd5b816020850160208301375f918101602001919091529392505050565b8015158114620021d9575f80fd5b8035620034db816200366c565b5f805f805f8060c087890312156200369d575f80fd5b86356001600160401b0380821115620036b4575f80fd5b908801906080828b031215620036c8575f80fd5b620036d262003441565b82358152602083013582811115620036e8575f80fd5b620036f68c828601620035fa565b602083015250604083013560408201526200371460608401620034c4565b60608201529750602089013596506200373060408a01620034e0565b95506200374060608a01620034e0565b9450608089013591508082111562003756575f80fd5b506200376589828a01620035fa565b9250506200377660a088016200367a565b90509295509295509295565b5f806040838503121562003794575f80fd5b6200379f83620034e0565b9150620037af60208401620034e0565b90509250929050565b5f60208284031215620037c9575f80fd5b62001b6582620034e0565b5f60208284031215620037e5575f80fd5b5035919050565b5f8060408385031215620037fe575f80fd5b6200380983620034e0565b946020939093013593505050565b5f806040838503121562003829575f80fd5b82359150620037af60208401620034e0565b5f82601f8301126200384b575f80fd5b813560206200385e62003507836200349f565b82815260059290921b840181019181810190868411156200387d575f80fd5b8286015b84811015620038a3576200389581620034c4565b835291830191830162003881565b509695505050505050565b5f805f60608486031215620038c1575f80fd5b620038cc84620034e0565b92506020808501356001600160401b0380821115620038e9575f80fd5b620038f7888389016200383b565b945060408701359150808211156200390d575f80fd5b508501601f810187136200391f575f80fd5b80356200393062003507826200349f565b81815260059190911b820183019083810190898311156200394f575f80fd5b928401925b828410156200397f57833560ff811681146200396f575f8081fd5b8252928401929084019062003954565b80955050505050509250925092565b5f82601f8301126200399e575f80fd5b81356020620039b162003507836200349f565b82815260059290921b84018101918181019086841115620039d0575f80fd5b8286015b84811015620038a35780356001600160401b03811115620039f4575f8081fd5b62003a048986838b0101620035fa565b845250918301918301620039d4565b5f805f805f6080868803121562003a28575f80fd5b85356001600160401b038082111562003a3f575f80fd5b818801915088601f83011262003a53575f80fd5b81358181111562003a62575f80fd5b89602082850101111562003a74575f80fd5b60208381019850909650880135945062003a9160408901620034c4565b9350606088013591508082111562003aa7575f80fd5b5062003ab6888289016200398e565b9150509295509295909350565b5f806040838503121562003ad5575f80fd5b6200379f83620034c4565b5f805f6060848603121562003af3575f80fd5b62003afe84620034e0565b92506020808501356001600160401b038082111562003b1b575f80fd5b62003b29888389016200383b565b9450604087013591508082111562003b3f575f80fd5b818701915087601f83011262003b53575f80fd5b813562003b6462003507826200349f565b81815260059190911b8301840190848101908a83111562003b83575f80fd5b8585015b8381101562003c225780358581111562003ba0575f8081fd5b8601603f81018d1362003bb2575f8081fd5b8781013562003bc562003507826200349f565b81815260059190911b820160400190898101908f83111562003be6575f8081fd5b6040840193505b8284101562003c115762003c0184620034e0565b8252928a0192908a019062003bed565b865250505091860191860162003b87565b508096505050505050509250925092565b5f806040838503121562003c45575f80fd5b62003c5083620034e0565b9150602083013562003c62816200366c565b809150509250929050565b5f806040838503121562003c7f575f80fd5b50508035926020909101359150565b5f806040838503121562003ca0575f80fd5b62003cab83620034e0565b9150620037af60208401620034c4565b5f8151808452602080850194508084015f5b8381101562003cf45781516001600160a01b03168752958201959082019060010162003ccd565b509495945050505050565b602081525f62001b65602083018462003cbb565b5f805f806080858703121562003d27575f80fd5b8435935062003d3960208601620034c4565b925062003d4960408601620034e0565b9396929550929360600135925050565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52601160045260245ffd5b5f6001820162003d955762003d9562003d6d565b5060010190565b60208082526021908201527f476174654b65657065723a20627269646765206e6f74207265676973746572656040820152601960fa1b606082015260800190565b5f5b8381101562003df957818101518382015260200162003ddf565b50505f910152565b5f815180845262003e1a81602086016020860162003ddd565b601f01601f19169290920160200192915050565b805182525f60208201516080602085015262003e4e608085018262003e01565b9050604083015160408501526001600160401b0360608401511660608501528091505092915050565b606081525f62003e8b606083018662003e2e565b6020830194909452506001600160a01b0391909116604090910152919050565b6020808252818101527f476174654b65657065723a206661696c656420746f2073656e64204574686572604082015260600190565b81810381811115620009e057620009e062003d6d565b5f60018060a01b0380871683526080602084015262003f19608084018762003e2e565b6040840195909552929092166060909101525092915050565b60208082526018908201527f476174654b65657065723a207a65726f20616464726573730000000000000000604082015260600190565b5f8151808452602080850194508084015f5b8381101562003cf45781516001600160401b03168752958201959082019060010162003f7b565b6001600160a01b0384168152606060208083018290525f9162003fc89084018662003f69565b83810360408501528451808252828601918301905f5b8181101562003fff57835160ff168352928401929184019160010162003fde565b509098975050505050505050565b5f602082840312156200401e575f80fd5b5051919050565b80820180821115620009e057620009e062003d6d565b5f60ff821660ff810362004053576200405362003d6d565b60010192915050565b6001600160401b0383168152604060208201525f6200210b604083018462003e01565b5f60018060a01b0380861683526020606081850152620040a3606085018762003f69565b8481036040860152855180825282820190600581901b830184018489015f805b848110156200411c57868403601f19018652825180518086529089019089860190845b81811015620041065783518d168352928b0192918b0191600101620040e6565b50509689019694505091870191600101620040c3565b50919c9b505050505050505050505050565b8082028115828204841417620009e057620009e062003d6d565b5f826200416357634e487b7160e01b5f52601260045260245ffd5b500490565b608081525f6200417c608083018762003e01565b6020830195909552506040810192909252606090910152919050565b608081525f620041ac608083018762003e2e565b6001600160a01b0386166020840152604083018590528281036060840152620041d6818562003e01565b979650505050505050565b5f8085851115620041f0575f80fd5b83861115620041fd575f80fd5b5050820193919092039150565b6001600160e01b03198135818116916004851015620042335780818660040360031b1b83161692505b505092915050565b60808152846080820152848660a08301375f60a086830101525f601f19601f870116820160a08382030160208401526200427960a082018762003e01565b60408401959095525050606001529392505050565b60e081525f620042a260e083018a62003cbb565b8860208401528281036040840152620042bc818962003e01565b606084019790975250506001600160401b0393909316608084015260a08301919091526001600160a01b031660c0909101529392505050565b8481526001600160401b0384166020820152608060408201525f6200431e608083018562003e01565b905060018060a01b038316606083015295945050505050565b8781526001600160401b038716602082015260e060408201525f6200436060e083018862003e01565b6060830196909652506001600160a01b03938416608082015291831660a083015290911660c0909101529392505050565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081525f8351620043ca81601785016020880162003ddd565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351620043fd81602884016020880162003ddd565b01602801949350505050565b602081525f62001b65602083018462003e01565b606081525f62004431606083018662003e2e565b6001600160a01b0385166020840152828103604084015262004454818562003e01565b9695505050505050565b5f602082840312156200446f575f80fd5b815162001b65816200366c565b5f816200448d576200448d62003d6d565b505f190190565b634e487b7160e01b5f52603160045260245ffd5b5f8251620044bb81846020870162003ddd565b919091019291505056fe60a060405234801561000f575f80fd5b5060405161058138038061058183398101604081905261002e916100f3565b610037336100a4565b6001600160a01b0381166100915760405162461bcd60e51b815260206004820152601c60248201527f4e617469766554726561737572793a207a65726f206164647265737300000000604482015260640160405180910390fd5b61009a816100a4565b5033608052610120565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f60208284031215610103575f80fd5b81516001600160a01b0381168114610119575f80fd5b9392505050565b60805161044361013e5f395f81816089015261012101526104435ff3fe60806040526004361061004c575f3560e01c80630ff4c9161461005757806345d61ded14610078578063715018a6146100c75780638da5cb5b146100db578063f2fde38b146100f7575f80fd5b3661005357005b5f80fd5b348015610062575f80fd5b506100766100713660046103c9565b610116565b005b348015610083575f80fd5b506100ab7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d2575f80fd5b50610076610295565b3480156100e6575f80fd5b505f546001600160a01b03166100ab565b348015610102575f80fd5b506100766101113660046103e0565b6102a8565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061015657505f546001600160a01b031633145b6101b85760405162461bcd60e51b815260206004820152602860248201527f4e617469766554726561737572793a206f6e6c792061646d696e206f722067616044820152673a32b5b2b2b832b960c11b60648201526084015b60405180910390fd5b6040515f90339083908381818185875af1925050503d805f81146101f7576040519150601f19603f3d011682016040523d82523d5f602084013e6101fc565b606091505b50509050806102595760405162461bcd60e51b8152602060048201526024808201527f4e617469766554726561737572793a206661696c656420746f2073656e6420456044820152633a3432b960e11b60648201526084016101af565b604080518381523360208201527f6e956827cc4d1fccd75ce1b2622b67a52f13906439c330d7f85258eb9b8b342e910160405180910390a15050565b61029d610321565b6102a65f61037a565b565b6102b0610321565b6001600160a01b0381166103155760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101af565b61031e8161037a565b50565b5f546001600160a01b031633146102a65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101af565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f602082840312156103d9575f80fd5b5035919050565b5f602082840312156103f0575f80fd5b81356001600160a01b0381168114610406575f80fd5b939250505056fea264697066735822122072a156b89eee99b6cf328696f77d473192a0042ef09b4a9e2f9f8b9489bdf84b64736f6c6343000814003397667070c54ef182b0f5858b034beac1b6f3089aa2d3188bb1e8929f4fa9b929a2646970667358221220337052b6261aa6f3672331d7ea6afb753d08fb47d0fbf56bf39f859edbf2fa1b64736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000f00f1a6a32e644815c5686ad7dc305a54b11200
-----Decoded View---------------
Arg [0] : receiver_ (address): 0x0F00F1a6A32e644815C5686aD7dc305A54B11200
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000000f00f1a6a32e644815c5686ad7dc305a54b11200
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in FRAX
0
Multichain Portfolio | 35 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.