Overview
ETH Balance
ETH Value
$2.87 (@ $2,977.29/ETH)Latest 1 from a total of 1 transactions
| Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Transfer Ownersh... | 4214189 | 151 days ago | IN | 0 ETH | 0.00000003 |
Latest 25 internal transactions (View All)
| Parent Transaction Hash | Block | From | To | |||
|---|---|---|---|---|---|---|
| 16689783 | 6 days ago | 0.00160027 ETH | ||||
| 16689783 | 6 days ago | 0.00160027 ETH | ||||
| 16594231 | 7 days ago | 0.00059199 ETH | ||||
| 16594231 | 7 days ago | 0.00059199 ETH | ||||
| 16589602 | 7 days ago | 0.00085386 ETH | ||||
| 16589602 | 7 days ago | 0.00085386 ETH | ||||
| 14408202 | 33 days ago | 0.00011044 ETH | ||||
| 14408202 | 33 days ago | 0.00011044 ETH | ||||
| 14320861 | 34 days ago | 0.00010595 ETH | ||||
| 14320861 | 34 days ago | 0.00010595 ETH | ||||
| 14319055 | 34 days ago | 0.0000959 ETH | ||||
| 14319055 | 34 days ago | 0.0000959 ETH | ||||
| 14317956 | 34 days ago | 0.0001023 ETH | ||||
| 14317956 | 34 days ago | 0.0001023 ETH | ||||
| 14317498 | 34 days ago | 0.00010217 ETH | ||||
| 14317498 | 34 days ago | 0.00010217 ETH | ||||
| 14316805 | 34 days ago | 0.00015714 ETH | ||||
| 14316805 | 34 days ago | 0.00015714 ETH | ||||
| 14316480 | 34 days ago | 0.00015714 ETH | ||||
| 14316480 | 34 days ago | 0.00015714 ETH | ||||
| 14316174 | 34 days ago | 0.00012181 ETH | ||||
| 14316174 | 34 days ago | 0.00012181 ETH | ||||
| 14316040 | 34 days ago | 0.00012181 ETH | ||||
| 14316040 | 34 days ago | 0.00012181 ETH | ||||
| 14259998 | 34 days ago | 0.00006649 ETH |
Cross-Chain Transactions
Contract Source Code Verified (Exact Match)
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import {IERC20} from "@chainlink/contracts-ccip/src/v0.8/vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";
import {IRouterClient} from "@chainlink/contracts-ccip/src/v0.8/ccip/interfaces/IRouterClient.sol";
import {Client} from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol";
import {AbstractAdapter} from "./AbstractAdapter.sol";
import {IBridge} from "../IBridge.sol";
import {Pool} from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Pool.sol";
import {LombardTokenPool} from "./TokenPool.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IERC20 as OZIERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
/**
* @title CCIP bridge adapter
* @author Lombard.finance
* @notice CLAdapter present an intermediary to enforce TokenPool compatibility
*/
contract CLAdapter is AbstractAdapter, Ownable, ReentrancyGuard {
error CLZeroChain();
error CLZeroChanSelector();
error CLAttemptToOverrideChainSelector();
error CLAttemptToOverrideChain();
error CLRefundFailed(address, uint256);
error CLUnauthorizedTokenPool(address);
error ZeroPayload();
error ReceiverTooBig();
error AmountOverflow();
error CLPayloadMismatch();
error CLWrongPayloadHashLength();
event CLChainSelectorSet(bytes32, uint64);
event CLTokenPoolDeployed(address);
mapping(bytes32 => uint64) public getRemoteChainSelector;
mapping(uint64 => bytes32) public getChain;
uint128 public getExecutionGasLimit;
LombardTokenPool public tokenPool; // 1-to-1 with adapter
// store last state
uint256 internal _lastBurnedAmount;
bytes internal _lastPayload;
mapping(address => uint256) public refunds;
modifier onlyTokenPool() {
if (address(tokenPool) != _msgSender()) {
revert CLUnauthorizedTokenPool(_msgSender());
}
_;
}
/// @notice msg.sender gets the ownership of the contract given
/// token pool implementation
constructor(
IBridge bridge_,
uint128 executionGasLimit_,
//
address ccipRouter_,
address[] memory allowlist_,
address rmnProxy_
) AbstractAdapter(bridge_) Ownable(_msgSender()) {
_setExecutionGasLimit(executionGasLimit_);
tokenPool = new LombardTokenPool(
IERC20(address(bridge_.lbtc())),
ccipRouter_,
allowlist_,
rmnProxy_,
CLAdapter(this)
);
tokenPool.transferOwnership(_msgSender());
emit CLTokenPoolDeployed(address(tokenPool));
}
/// USER ACTIONS ///
function withdrawRefund() external nonReentrant {
uint256 refundAm = refunds[_msgSender()];
refunds[_msgSender()] = 0;
(bool success, ) = payable(_msgSender()).call{value: refundAm}("");
if (!success) {
revert CLRefundFailed(_msgSender(), refundAm);
}
}
/**
* @notice Calculate the fee to be paid for CCIP message routing.
* @dev Ignores _toContract and _payload, because they're not a part of CCIP message.
* @param _toChain Chain id of destination chain.
* @param _toAddress Recipient address.
* @param _amount The amount of LBTC to bridge.
* @return The fee in native currency for CCIP message routing.
*/
function getFee(
bytes32 _toChain,
bytes32 /* _toContract, */,
bytes32 _toAddress,
uint256 _amount,
bytes memory /* _payload */
) public view override returns (uint256) {
return
IRouterClient(tokenPool.getRouter()).getFee(
getRemoteChainSelector[_toChain],
_buildCCIPMessage(abi.encodePacked(_toAddress), _amount)
);
}
function initiateDeposit(
uint64 remoteChainSelector,
bytes calldata receiver,
uint256 amount
)
external
onlyTokenPool
returns (uint256 lastBurnedAmount, bytes memory lastPayload)
{
SafeERC20.safeTransferFrom(
OZIERC20(address(lbtc())),
_msgSender(),
address(this),
amount
);
if (_lastPayload.length > 0) {
// just return if already initiated
lastBurnedAmount = _lastBurnedAmount;
lastPayload = _lastPayload;
_lastPayload = new bytes(0);
_lastBurnedAmount = 0;
} else {
if (receiver.length > 32) revert ReceiverTooBig();
if (amount >= 2 ** 64) revert AmountOverflow();
IERC20(address(lbtc())).approve(address(bridge), amount);
(lastBurnedAmount, lastPayload) = bridge.deposit(
getChain[remoteChainSelector],
bytes32(receiver),
uint64(amount)
);
}
bridge.lbtc().burn(lastBurnedAmount);
}
function deposit(
address fromAddress,
bytes32 _toChain,
bytes32,
bytes32 _toAddress,
uint256 _amount,
bytes memory _payload
) external payable virtual override {
_onlyBridge();
// transfer assets from bridge
SafeERC20.safeTransferFrom(
OZIERC20(address(lbtc())),
_msgSender(),
address(this),
_amount
);
// if deposit was initiated by adapter do nothing
if (fromAddress == address(this)) {
return;
}
_lastBurnedAmount = _amount;
_lastPayload = _payload;
uint64 chainSelector = getRemoteChainSelector[_toChain];
Client.EVM2AnyMessage memory message = _buildCCIPMessage(
abi.encodePacked(_toAddress),
_amount
);
address router = tokenPool.getRouter();
uint256 fee = IRouterClient(router).getFee(chainSelector, message);
if (msg.value < fee) {
revert NotEnoughToPayFee(fee);
}
if (msg.value > fee) {
uint256 refundAm = msg.value - fee;
refunds[fromAddress] += refundAm;
}
IERC20(address(lbtc())).approve(router, _amount);
IRouterClient(router).ccipSend{value: fee}(chainSelector, message);
}
/// @dev same as `initiateWithdrawal` but without signatures opted in data
function initWithdrawalNoSignatures(
uint64 remoteSelector,
bytes calldata onChainData
) external onlyTokenPool returns (uint64) {
_receive(getChain[remoteSelector], onChainData);
return bridge.withdraw(onChainData);
}
function initiateWithdrawal(
uint64 remoteSelector,
bytes calldata payloadHash,
bytes calldata offchainData
) external onlyTokenPool returns (uint64) {
if (payloadHash.length != 32) {
revert CLWrongPayloadHashLength();
}
(bytes memory payload, bytes memory proof) = abi.decode(
offchainData,
(bytes, bytes)
);
/// verify hash, because payload from offchainData is untrusted
/// and would be replaced during manual execution.
/// Bypass other payload checks against CCIP message
/// because payload can only be generated in deposit transaction
if (bytes32(payloadHash[:32]) != sha256(payload)) {
revert CLPayloadMismatch();
}
_receive(getChain[remoteSelector], payload);
bridge.authNotary(payload, proof);
return bridge.withdraw(payload);
}
/// ONLY OWNER FUNCTIONS ///
function setExecutionGasLimit(uint128 newVal) external onlyOwner {
_setExecutionGasLimit(newVal);
}
/// PRIVATE FUNCTIONS ///
function _buildCCIPMessage(
bytes memory _receiver,
uint256 _amount
) private view returns (Client.EVM2AnyMessage memory) {
// Set the token amounts
Client.EVMTokenAmount[]
memory tokenAmounts = new Client.EVMTokenAmount[](1);
tokenAmounts[0] = Client.EVMTokenAmount({
token: address(bridge.lbtc()),
amount: _amount
});
return
Client.EVM2AnyMessage({
receiver: _receiver,
data: "",
tokenAmounts: tokenAmounts,
extraArgs: Client._argsToBytes(
Client.EVMExtraArgsV2({
gasLimit: getExecutionGasLimit,
allowOutOfOrderExecution: true
})
),
feeToken: address(0) // let's pay with native tokens
});
}
function _onlyOwner() internal view override onlyOwner {}
function _setExecutionGasLimit(uint128 newVal) internal {
emit ExecutionGasLimitSet(getExecutionGasLimit, newVal);
getExecutionGasLimit = newVal;
}
/**
* @notice Allows owner set chain selector for chain id
* @param chain ABI encoded chain id
* @param chainSelector Chain selector of chain id (https://docs.chain.link/ccip/directory/testnet/chain/)
*/
function setRemoteChainSelector(
bytes32 chain,
uint64 chainSelector
) external onlyOwner {
if (chain == bytes32(0)) {
revert CLZeroChain();
}
if (chainSelector == 0) {
revert CLZeroChain();
}
if (getRemoteChainSelector[chain] != 0) {
revert CLAttemptToOverrideChainSelector();
}
if (getChain[chainSelector] != bytes32(0)) {
revert CLAttemptToOverrideChain();
}
getRemoteChainSelector[chain] = chainSelector;
getChain[chainSelector] = chain;
emit CLChainSelectorSet(chain, chainSelector);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {Pool} from "../libraries/Pool.sol";
import {IERC165} from "../../vendor/openzeppelin-solidity/v5.0.2/contracts/utils/introspection/IERC165.sol";
/// @notice Shared public interface for multiple V1 pool types.
/// Each pool type handles a different child token model (lock/unlock, mint/burn.)
interface IPoolV1 is IERC165 {
/// @notice Lock tokens into the pool or burn the tokens.
/// @param lockOrBurnIn Encoded data fields for the processing of tokens on the source chain.
/// @return lockOrBurnOut Encoded data fields for the processing of tokens on the destination chain.
function lockOrBurn(
Pool.LockOrBurnInV1 calldata lockOrBurnIn
) external returns (Pool.LockOrBurnOutV1 memory lockOrBurnOut);
/// @notice Releases or mints tokens to the receiver address.
/// @param releaseOrMintIn All data required to release or mint tokens.
/// @return releaseOrMintOut The amount of tokens released or minted on the local chain, denominated
/// in the local token's decimals.
/// @dev The offramp asserts that the balanceOf of the receiver has been incremented by exactly the number
/// of tokens that is returned in ReleaseOrMintOutV1.destinationAmount. If the amounts do not match, the tx reverts.
function releaseOrMint(
Pool.ReleaseOrMintInV1 calldata releaseOrMintIn
) external returns (Pool.ReleaseOrMintOutV1 memory);
/// @notice Checks whether a remote chain is supported in the token pool.
/// @param remoteChainSelector The selector of the remote chain.
/// @return true if the given chain is a permissioned remote chain.
function isSupportedChain(uint64 remoteChainSelector) external view returns (bool);
/// @notice Returns if the token pool supports the given token.
/// @param token The address of the token.
/// @return true if the token is supported by the pool.
function isSupportedToken(address token) external view returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @notice This interface contains the only RMN-related functions that might be used on-chain by other CCIP contracts.
interface IRMN {
/// @notice A Merkle root tagged with the address of the commit store contract it is destined for.
struct TaggedRoot {
address commitStore;
bytes32 root;
}
/// @notice Callers MUST NOT cache the return value as a blessed tagged root could become unblessed.
function isBlessed(TaggedRoot calldata taggedRoot) external view returns (bool);
/// @notice Iff there is an active global or legacy curse, this function returns true.
function isCursed() external view returns (bool);
/// @notice Iff there is an active global curse, or an active curse for `subject`, this function returns true.
/// @param subject To check whether a particular chain is cursed, set to bytes16(uint128(chainSelector)).
function isCursed(bytes16 subject) external view returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {Client} from "../libraries/Client.sol";
interface IRouter {
error OnlyOffRamp();
/// @notice Route the message to its intended receiver contract.
/// @param message Client.Any2EVMMessage struct.
/// @param gasForCallExactCheck of params for exec
/// @param gasLimit set of params for exec
/// @param receiver set of params for exec
/// @dev if the receiver is a contracts that signals support for CCIP execution through EIP-165.
/// the contract is called. If not, only tokens are transferred.
/// @return success A boolean value indicating whether the ccip message was received without errors.
/// @return retBytes A bytes array containing return data form CCIP receiver.
/// @return gasUsed the gas used by the external customer call. Does not include any overhead.
function routeMessage(
Client.Any2EVMMessage calldata message,
uint16 gasForCallExactCheck,
uint256 gasLimit,
address receiver
) external returns (bool success, bytes memory retBytes, uint256 gasUsed);
/// @notice Returns the configured onramp for a specific destination chain.
/// @param destChainSelector The destination chain Id to get the onRamp for.
/// @return onRampAddress The address of the onRamp.
function getOnRamp(uint64 destChainSelector) external view returns (address onRampAddress);
/// @notice Return true if the given offRamp is a configured offRamp for the given source chain.
/// @param sourceChainSelector The source chain selector to check.
/// @param offRamp The address of the offRamp to check.
function isOffRamp(uint64 sourceChainSelector, address offRamp) external view returns (bool isOffRamp);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import {Client} from "../libraries/Client.sol";
interface IRouterClient {
error UnsupportedDestinationChain(uint64 destChainSelector);
error InsufficientFeeTokenAmount();
error InvalidMsgValue();
/// @notice Checks if the given chain ID is supported for sending/receiving.
/// @param destChainSelector The chain to check.
/// @return supported is true if it is supported, false if not.
function isChainSupported(uint64 destChainSelector) external view returns (bool supported);
/// @param destinationChainSelector The destination chainSelector
/// @param message The cross-chain CCIP message including data and/or tokens
/// @return fee returns execution fee for the message
/// delivery to destination chain, denominated in the feeToken specified in the message.
/// @dev Reverts with appropriate reason upon invalid message.
function getFee(
uint64 destinationChainSelector,
Client.EVM2AnyMessage memory message
) external view returns (uint256 fee);
/// @notice Request a message to be sent to the destination chain
/// @param destinationChainSelector The destination chain ID
/// @param message The cross-chain CCIP message including data and/or tokens
/// @return messageId The message ID
/// @dev Note if msg.value is larger than the required fee (from getFee) we accept
/// the overpayment with no refund.
/// @dev Reverts with appropriate reason upon invalid message.
function ccipSend(
uint64 destinationChainSelector,
Client.EVM2AnyMessage calldata message
) external payable returns (bytes32);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// End consumer library.
library Client {
/// @dev RMN depends on this struct, if changing, please notify the RMN maintainers.
struct EVMTokenAmount {
address token; // token address on the local chain.
uint256 amount; // Amount of tokens.
}
struct Any2EVMMessage {
bytes32 messageId; // MessageId corresponding to ccipSend on source.
uint64 sourceChainSelector; // Source chain selector.
bytes sender; // abi.decode(sender) if coming from an EVM chain.
bytes data; // payload sent in original message.
EVMTokenAmount[] destTokenAmounts; // Tokens and their amounts in their destination chain representation.
}
// If extraArgs is empty bytes, the default is 200k gas limit.
struct EVM2AnyMessage {
bytes receiver; // abi.encode(receiver address) for dest EVM chains
bytes data; // Data payload
EVMTokenAmount[] tokenAmounts; // Token transfers
address feeToken; // Address of feeToken. address(0) means you will send msg.value.
bytes extraArgs; // Populate this with _argsToBytes(EVMExtraArgsV2)
}
// bytes4(keccak256("CCIP EVMExtraArgsV1"));
bytes4 public constant EVM_EXTRA_ARGS_V1_TAG = 0x97a657c9;
struct EVMExtraArgsV1 {
uint256 gasLimit;
}
function _argsToBytes(EVMExtraArgsV1 memory extraArgs) internal pure returns (bytes memory bts) {
return abi.encodeWithSelector(EVM_EXTRA_ARGS_V1_TAG, extraArgs);
}
// bytes4(keccak256("CCIP EVMExtraArgsV2"));
bytes4 public constant EVM_EXTRA_ARGS_V2_TAG = 0x181dcf10;
/// @param gasLimit: gas limit for the callback on the destination chain.
/// @param allowOutOfOrderExecution: if true, it indicates that the message can be executed in any order relative to other messages from the same sender.
/// This value's default varies by chain. On some chains, a particular value is enforced, meaning if the expected value
/// is not set, the message request will revert.
struct EVMExtraArgsV2 {
uint256 gasLimit;
bool allowOutOfOrderExecution;
}
function _argsToBytes(EVMExtraArgsV2 memory extraArgs) internal pure returns (bytes memory bts) {
return abi.encodeWithSelector(EVM_EXTRA_ARGS_V2_TAG, extraArgs);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @notice This library contains various token pool functions to aid constructing the return data.
library Pool {
// The tag used to signal support for the pool v1 standard
// bytes4(keccak256("CCIP_POOL_V1"))
bytes4 public constant CCIP_POOL_V1 = 0xaff2afbf;
// The number of bytes in the return data for a pool v1 releaseOrMint call.
// This should match the size of the ReleaseOrMintOutV1 struct.
uint16 public constant CCIP_POOL_V1_RET_BYTES = 32;
// The default max number of bytes in the return data for a pool v1 lockOrBurn call.
// This data can be used to send information to the destination chain token pool. Can be overwritten
// in the TokenTransferFeeConfig.destBytesOverhead if more data is required.
uint32 public constant CCIP_LOCK_OR_BURN_V1_RET_BYTES = 32;
struct LockOrBurnInV1 {
bytes receiver; // The recipient of the tokens on the destination chain, abi encoded
uint64 remoteChainSelector; // ─╮ The chain ID of the destination chain
address originalSender; // ─────╯ The original sender of the tx on the source chain
uint256 amount; // The amount of tokens to lock or burn, denominated in the source token's decimals
address localToken; // The address on this chain of the token to lock or burn
}
struct LockOrBurnOutV1 {
// The address of the destination token, abi encoded in the case of EVM chains
// This value is UNTRUSTED as any pool owner can return whatever value they want.
bytes destTokenAddress;
// Optional pool data to be transferred to the destination chain. Be default this is capped at
// CCIP_LOCK_OR_BURN_V1_RET_BYTES bytes. If more data is required, the TokenTransferFeeConfig.destBytesOverhead
// has to be set for the specific token.
bytes destPoolData;
}
struct ReleaseOrMintInV1 {
bytes originalSender; // The original sender of the tx on the source chain
uint64 remoteChainSelector; // ─╮ The chain ID of the source chain
address receiver; // ───────────╯ The recipient of the tokens on the destination chain.
uint256 amount; // The amount of tokens to release or mint, denominated in the source token's decimals
address localToken; // The address on this chain of the token to release or mint
/// @dev WARNING: sourcePoolAddress should be checked prior to any processing of funds. Make sure it matches the
/// expected pool address for the given remoteChainSelector.
bytes sourcePoolAddress; // The address of the source pool, abi encoded in the case of EVM chains
bytes sourcePoolData; // The data received from the source pool to process the release or mint
/// @dev WARNING: offchainTokenData is untrusted data.
bytes offchainTokenData; // The offchain data to process the release or mint
}
struct ReleaseOrMintOutV1 {
// The number of tokens released or minted on the destination chain, denominated in the local token's decimals.
// This value is expected to be equal to the ReleaseOrMintInV1.amount in the case where the source and destination
// chain have the same number of decimals.
uint256 destinationAmount;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.4;
/// @notice Implements Token Bucket rate limiting.
/// @dev uint128 is safe for rate limiter state.
/// For USD value rate limiting, it can adequately store USD value in 18 decimals.
/// For ERC20 token amount rate limiting, all tokens that will be listed will have at most
/// a supply of uint128.max tokens, and it will therefore not overflow the bucket.
/// In exceptional scenarios where tokens consumed may be larger than uint128,
/// e.g. compromised issuer, an enabled RateLimiter will check and revert.
library RateLimiter {
error BucketOverfilled();
error OnlyCallableByAdminOrOwner();
error TokenMaxCapacityExceeded(uint256 capacity, uint256 requested, address tokenAddress);
error TokenRateLimitReached(uint256 minWaitInSeconds, uint256 available, address tokenAddress);
error AggregateValueMaxCapacityExceeded(uint256 capacity, uint256 requested);
error AggregateValueRateLimitReached(uint256 minWaitInSeconds, uint256 available);
error InvalidRateLimitRate(Config rateLimiterConfig);
error DisabledNonZeroRateLimit(Config config);
error RateLimitMustBeDisabled();
event TokensConsumed(uint256 tokens);
event ConfigChanged(Config config);
struct TokenBucket {
uint128 tokens; // ──────╮ Current number of tokens that are in the bucket.
uint32 lastUpdated; // │ Timestamp in seconds of the last token refill, good for 100+ years.
bool isEnabled; // ──────╯ Indication whether the rate limiting is enabled or not
uint128 capacity; // ────╮ Maximum number of tokens that can be in the bucket.
uint128 rate; // ────────╯ Number of tokens per second that the bucket is refilled.
}
struct Config {
bool isEnabled; // Indication whether the rate limiting should be enabled
uint128 capacity; // ────╮ Specifies the capacity of the rate limiter
uint128 rate; // ───────╯ Specifies the rate of the rate limiter
}
/// @notice _consume removes the given tokens from the pool, lowering the
/// rate tokens allowed to be consumed for subsequent calls.
/// @param requestTokens The total tokens to be consumed from the bucket.
/// @param tokenAddress The token to consume capacity for, use 0x0 to indicate aggregate value capacity.
/// @dev Reverts when requestTokens exceeds bucket capacity or available tokens in the bucket
/// @dev emits removal of requestTokens if requestTokens is > 0
function _consume(TokenBucket storage s_bucket, uint256 requestTokens, address tokenAddress) internal {
// If there is no value to remove or rate limiting is turned off, skip this step to reduce gas usage
if (!s_bucket.isEnabled || requestTokens == 0) {
return;
}
uint256 tokens = s_bucket.tokens;
uint256 capacity = s_bucket.capacity;
uint256 timeDiff = block.timestamp - s_bucket.lastUpdated;
if (timeDiff != 0) {
if (tokens > capacity) revert BucketOverfilled();
// Refill tokens when arriving at a new block time
tokens = _calculateRefill(capacity, tokens, timeDiff, s_bucket.rate);
s_bucket.lastUpdated = uint32(block.timestamp);
}
if (capacity < requestTokens) {
// Token address 0 indicates consuming aggregate value rate limit capacity.
if (tokenAddress == address(0)) revert AggregateValueMaxCapacityExceeded(capacity, requestTokens);
revert TokenMaxCapacityExceeded(capacity, requestTokens, tokenAddress);
}
if (tokens < requestTokens) {
uint256 rate = s_bucket.rate;
// Wait required until the bucket is refilled enough to accept this value, round up to next higher second
// Consume is not guaranteed to succeed after wait time passes if there is competing traffic.
// This acts as a lower bound of wait time.
uint256 minWaitInSeconds = ((requestTokens - tokens) + (rate - 1)) / rate;
if (tokenAddress == address(0)) revert AggregateValueRateLimitReached(minWaitInSeconds, tokens);
revert TokenRateLimitReached(minWaitInSeconds, tokens, tokenAddress);
}
tokens -= requestTokens;
// Downcast is safe here, as tokens is not larger than capacity
s_bucket.tokens = uint128(tokens);
emit TokensConsumed(requestTokens);
}
/// @notice Gets the token bucket with its values for the block it was requested at.
/// @return The token bucket.
function _currentTokenBucketState(TokenBucket memory bucket) internal view returns (TokenBucket memory) {
// We update the bucket to reflect the status at the exact time of the
// call. This means we might need to refill a part of the bucket based
// on the time that has passed since the last update.
bucket.tokens =
uint128(_calculateRefill(bucket.capacity, bucket.tokens, block.timestamp - bucket.lastUpdated, bucket.rate));
bucket.lastUpdated = uint32(block.timestamp);
return bucket;
}
/// @notice Sets the rate limited config.
/// @param s_bucket The token bucket
/// @param config The new config
function _setTokenBucketConfig(TokenBucket storage s_bucket, Config memory config) internal {
// First update the bucket to make sure the proper rate is used for all the time
// up until the config change.
uint256 timeDiff = block.timestamp - s_bucket.lastUpdated;
if (timeDiff != 0) {
s_bucket.tokens = uint128(_calculateRefill(s_bucket.capacity, s_bucket.tokens, timeDiff, s_bucket.rate));
s_bucket.lastUpdated = uint32(block.timestamp);
}
s_bucket.tokens = uint128(_min(config.capacity, s_bucket.tokens));
s_bucket.isEnabled = config.isEnabled;
s_bucket.capacity = config.capacity;
s_bucket.rate = config.rate;
emit ConfigChanged(config);
}
/// @notice Validates the token bucket config
function _validateTokenBucketConfig(Config memory config, bool mustBeDisabled) internal pure {
if (config.isEnabled) {
if (config.rate >= config.capacity || config.rate == 0) {
revert InvalidRateLimitRate(config);
}
if (mustBeDisabled) {
revert RateLimitMustBeDisabled();
}
} else {
if (config.rate != 0 || config.capacity != 0) {
revert DisabledNonZeroRateLimit(config);
}
}
}
/// @notice Calculate refilled tokens
/// @param capacity bucket capacity
/// @param tokens current bucket tokens
/// @param timeDiff block time difference since last refill
/// @param rate bucket refill rate
/// @return the value of tokens after refill
function _calculateRefill(
uint256 capacity,
uint256 tokens,
uint256 timeDiff,
uint256 rate
) private pure returns (uint256) {
return _min(capacity, tokens + timeDiff * rate);
}
/// @notice Return the smallest of two integers
/// @param a first int
/// @param b second int
/// @return smallest
function _min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;
import {IPoolV1} from "../interfaces/IPool.sol";
import {IRMN} from "../interfaces/IRMN.sol";
import {IRouter} from "../interfaces/IRouter.sol";
import {OwnerIsCreator} from "../../shared/access/OwnerIsCreator.sol";
import {Pool} from "../libraries/Pool.sol";
import {RateLimiter} from "../libraries/RateLimiter.sol";
import {IERC20} from "../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";
import {IERC165} from "../../vendor/openzeppelin-solidity/v5.0.2/contracts/utils/introspection/IERC165.sol";
import {EnumerableSet} from "../../vendor/openzeppelin-solidity/v5.0.2/contracts/utils/structs/EnumerableSet.sol";
/// @notice Base abstract class with common functions for all token pools.
/// A token pool serves as isolated place for holding tokens and token specific logic
/// that may execute as tokens move across the bridge.
abstract contract TokenPool is IPoolV1, OwnerIsCreator {
using EnumerableSet for EnumerableSet.AddressSet;
using EnumerableSet for EnumerableSet.UintSet;
using RateLimiter for RateLimiter.TokenBucket;
error CallerIsNotARampOnRouter(address caller);
error ZeroAddressNotAllowed();
error SenderNotAllowed(address sender);
error AllowListNotEnabled();
error NonExistentChain(uint64 remoteChainSelector);
error ChainNotAllowed(uint64 remoteChainSelector);
error CursedByRMN();
error ChainAlreadyExists(uint64 chainSelector);
error InvalidSourcePoolAddress(bytes sourcePoolAddress);
error InvalidToken(address token);
error Unauthorized(address caller);
event Locked(address indexed sender, uint256 amount);
event Burned(address indexed sender, uint256 amount);
event Released(address indexed sender, address indexed recipient, uint256 amount);
event Minted(address indexed sender, address indexed recipient, uint256 amount);
event ChainAdded(
uint64 remoteChainSelector,
bytes remoteToken,
RateLimiter.Config outboundRateLimiterConfig,
RateLimiter.Config inboundRateLimiterConfig
);
event ChainConfigured(
uint64 remoteChainSelector,
RateLimiter.Config outboundRateLimiterConfig,
RateLimiter.Config inboundRateLimiterConfig
);
event ChainRemoved(uint64 remoteChainSelector);
event RemotePoolSet(uint64 indexed remoteChainSelector, bytes previousPoolAddress, bytes remotePoolAddress);
event AllowListAdd(address sender);
event AllowListRemove(address sender);
event RouterUpdated(address oldRouter, address newRouter);
struct ChainUpdate {
uint64 remoteChainSelector; // ──╮ Remote chain selector
bool allowed; // ────────────────╯ Whether the chain should be enabled
bytes remotePoolAddress; // Address of the remote pool, ABI encoded in the case of a remote EVM chain.
bytes remoteTokenAddress; // Address of the remote token, ABI encoded in the case of a remote EVM chain.
RateLimiter.Config outboundRateLimiterConfig; // Outbound rate limited config, meaning the rate limits for all of the onRamps for the given chain
RateLimiter.Config inboundRateLimiterConfig; // Inbound rate limited config, meaning the rate limits for all of the offRamps for the given chain
}
struct RemoteChainConfig {
RateLimiter.TokenBucket outboundRateLimiterConfig; // Outbound rate limited config, meaning the rate limits for all of the onRamps for the given chain
RateLimiter.TokenBucket inboundRateLimiterConfig; // Inbound rate limited config, meaning the rate limits for all of the offRamps for the given chain
bytes remotePoolAddress; // Address of the remote pool, ABI encoded in the case of a remote EVM chain.
bytes remoteTokenAddress; // Address of the remote token, ABI encoded in the case of a remote EVM chain.
}
/// @dev The bridgeable token that is managed by this pool.
IERC20 internal immutable i_token;
/// @dev The address of the RMN proxy
address internal immutable i_rmnProxy;
/// @dev The immutable flag that indicates if the pool is access-controlled.
bool internal immutable i_allowlistEnabled;
/// @dev A set of addresses allowed to trigger lockOrBurn as original senders.
/// Only takes effect if i_allowlistEnabled is true.
/// This can be used to ensure only token-issuer specified addresses can
/// move tokens.
EnumerableSet.AddressSet internal s_allowList;
/// @dev The address of the router
IRouter internal s_router;
/// @dev A set of allowed chain selectors. We want the allowlist to be enumerable to
/// be able to quickly determine (without parsing logs) who can access the pool.
/// @dev The chain selectors are in uint256 format because of the EnumerableSet implementation.
EnumerableSet.UintSet internal s_remoteChainSelectors;
mapping(uint64 remoteChainSelector => RemoteChainConfig) internal s_remoteChainConfigs;
/// @notice The address of the rate limiter admin.
/// @dev Can be address(0) if none is configured.
address internal s_rateLimitAdmin;
constructor(IERC20 token, address[] memory allowlist, address rmnProxy, address router) {
if (address(token) == address(0) || router == address(0) || rmnProxy == address(0)) revert ZeroAddressNotAllowed();
i_token = token;
i_rmnProxy = rmnProxy;
s_router = IRouter(router);
// Pool can be set as permissioned or permissionless at deployment time only to save hot-path gas.
i_allowlistEnabled = allowlist.length > 0;
if (i_allowlistEnabled) {
_applyAllowListUpdates(new address[](0), allowlist);
}
}
/// @notice Get RMN proxy address
/// @return rmnProxy Address of RMN proxy
function getRmnProxy() public view returns (address rmnProxy) {
return i_rmnProxy;
}
/// @inheritdoc IPoolV1
function isSupportedToken(address token) public view virtual returns (bool) {
return token == address(i_token);
}
/// @notice Gets the IERC20 token that this pool can lock or burn.
/// @return token The IERC20 token representation.
function getToken() public view returns (IERC20 token) {
return i_token;
}
/// @notice Gets the pool's Router
/// @return router The pool's Router
function getRouter() public view returns (address router) {
return address(s_router);
}
/// @notice Sets the pool's Router
/// @param newRouter The new Router
function setRouter(address newRouter) public onlyOwner {
if (newRouter == address(0)) revert ZeroAddressNotAllowed();
address oldRouter = address(s_router);
s_router = IRouter(newRouter);
emit RouterUpdated(oldRouter, newRouter);
}
/// @notice Signals which version of the pool interface is supported
function supportsInterface(bytes4 interfaceId) public pure virtual override returns (bool) {
return interfaceId == Pool.CCIP_POOL_V1 || interfaceId == type(IPoolV1).interfaceId
|| interfaceId == type(IERC165).interfaceId;
}
// ================================================================
// │ Validation │
// ================================================================
/// @notice Validates the lock or burn input for correctness on
/// - token to be locked or burned
/// - RMN curse status
/// - allowlist status
/// - if the sender is a valid onRamp
/// - rate limit status
/// @param lockOrBurnIn The input to validate.
/// @dev This function should always be called before executing a lock or burn. Not doing so would allow
/// for various exploits.
function _validateLockOrBurn(Pool.LockOrBurnInV1 memory lockOrBurnIn) internal {
if (!isSupportedToken(lockOrBurnIn.localToken)) revert InvalidToken(lockOrBurnIn.localToken);
if (IRMN(i_rmnProxy).isCursed(bytes16(uint128(lockOrBurnIn.remoteChainSelector)))) revert CursedByRMN();
_checkAllowList(lockOrBurnIn.originalSender);
_onlyOnRamp(lockOrBurnIn.remoteChainSelector);
_consumeOutboundRateLimit(lockOrBurnIn.remoteChainSelector, lockOrBurnIn.amount);
}
/// @notice Validates the release or mint input for correctness on
/// - token to be released or minted
/// - RMN curse status
/// - if the sender is a valid offRamp
/// - if the source pool is valid
/// - rate limit status
/// @param releaseOrMintIn The input to validate.
/// @dev This function should always be called before executing a release or mint. Not doing so would allow
/// for various exploits.
function _validateReleaseOrMint(Pool.ReleaseOrMintInV1 memory releaseOrMintIn) internal {
if (!isSupportedToken(releaseOrMintIn.localToken)) revert InvalidToken(releaseOrMintIn.localToken);
if (IRMN(i_rmnProxy).isCursed(bytes16(uint128(releaseOrMintIn.remoteChainSelector)))) revert CursedByRMN();
_onlyOffRamp(releaseOrMintIn.remoteChainSelector);
// Validates that the source pool address is configured on this pool.
bytes memory configuredRemotePool = getRemotePool(releaseOrMintIn.remoteChainSelector);
if (
configuredRemotePool.length == 0
|| keccak256(releaseOrMintIn.sourcePoolAddress) != keccak256(configuredRemotePool)
) {
revert InvalidSourcePoolAddress(releaseOrMintIn.sourcePoolAddress);
}
_consumeInboundRateLimit(releaseOrMintIn.remoteChainSelector, releaseOrMintIn.amount);
}
// ================================================================
// │ Chain permissions │
// ================================================================
/// @notice Gets the pool address on the remote chain.
/// @param remoteChainSelector Remote chain selector.
/// @dev To support non-evm chains, this value is encoded into bytes
function getRemotePool(uint64 remoteChainSelector) public view returns (bytes memory) {
return s_remoteChainConfigs[remoteChainSelector].remotePoolAddress;
}
/// @notice Gets the token address on the remote chain.
/// @param remoteChainSelector Remote chain selector.
/// @dev To support non-evm chains, this value is encoded into bytes
function getRemoteToken(uint64 remoteChainSelector) public view returns (bytes memory) {
return s_remoteChainConfigs[remoteChainSelector].remoteTokenAddress;
}
/// @notice Sets the remote pool address for a given chain selector.
/// @param remoteChainSelector The remote chain selector for which the remote pool address is being set.
/// @param remotePoolAddress The address of the remote pool.
function setRemotePool(uint64 remoteChainSelector, bytes calldata remotePoolAddress) external onlyOwner {
if (!isSupportedChain(remoteChainSelector)) revert NonExistentChain(remoteChainSelector);
bytes memory prevAddress = s_remoteChainConfigs[remoteChainSelector].remotePoolAddress;
s_remoteChainConfigs[remoteChainSelector].remotePoolAddress = remotePoolAddress;
emit RemotePoolSet(remoteChainSelector, prevAddress, remotePoolAddress);
}
/// @inheritdoc IPoolV1
function isSupportedChain(uint64 remoteChainSelector) public view returns (bool) {
return s_remoteChainSelectors.contains(remoteChainSelector);
}
/// @notice Get list of allowed chains
/// @return list of chains.
function getSupportedChains() public view returns (uint64[] memory) {
uint256[] memory uint256ChainSelectors = s_remoteChainSelectors.values();
uint64[] memory chainSelectors = new uint64[](uint256ChainSelectors.length);
for (uint256 i = 0; i < uint256ChainSelectors.length; ++i) {
chainSelectors[i] = uint64(uint256ChainSelectors[i]);
}
return chainSelectors;
}
/// @notice Sets the permissions for a list of chains selectors. Actual senders for these chains
/// need to be allowed on the Router to interact with this pool.
/// @dev Only callable by the owner
/// @param chains A list of chains and their new permission status & rate limits. Rate limits
/// are only used when the chain is being added through `allowed` being true.
function applyChainUpdates(ChainUpdate[] calldata chains) external virtual onlyOwner {
for (uint256 i = 0; i < chains.length; ++i) {
ChainUpdate memory update = chains[i];
RateLimiter._validateTokenBucketConfig(update.outboundRateLimiterConfig, !update.allowed);
RateLimiter._validateTokenBucketConfig(update.inboundRateLimiterConfig, !update.allowed);
if (update.allowed) {
// If the chain already exists, revert
if (!s_remoteChainSelectors.add(update.remoteChainSelector)) {
revert ChainAlreadyExists(update.remoteChainSelector);
}
if (update.remotePoolAddress.length == 0 || update.remoteTokenAddress.length == 0) {
revert ZeroAddressNotAllowed();
}
s_remoteChainConfigs[update.remoteChainSelector] = RemoteChainConfig({
outboundRateLimiterConfig: RateLimiter.TokenBucket({
rate: update.outboundRateLimiterConfig.rate,
capacity: update.outboundRateLimiterConfig.capacity,
tokens: update.outboundRateLimiterConfig.capacity,
lastUpdated: uint32(block.timestamp),
isEnabled: update.outboundRateLimiterConfig.isEnabled
}),
inboundRateLimiterConfig: RateLimiter.TokenBucket({
rate: update.inboundRateLimiterConfig.rate,
capacity: update.inboundRateLimiterConfig.capacity,
tokens: update.inboundRateLimiterConfig.capacity,
lastUpdated: uint32(block.timestamp),
isEnabled: update.inboundRateLimiterConfig.isEnabled
}),
remotePoolAddress: update.remotePoolAddress,
remoteTokenAddress: update.remoteTokenAddress
});
emit ChainAdded(
update.remoteChainSelector,
update.remoteTokenAddress,
update.outboundRateLimiterConfig,
update.inboundRateLimiterConfig
);
} else {
// If the chain doesn't exist, revert
if (!s_remoteChainSelectors.remove(update.remoteChainSelector)) {
revert NonExistentChain(update.remoteChainSelector);
}
delete s_remoteChainConfigs[update.remoteChainSelector];
emit ChainRemoved(update.remoteChainSelector);
}
}
}
// ================================================================
// │ Rate limiting │
// ================================================================
/// @notice Sets the rate limiter admin address.
/// @dev Only callable by the owner.
/// @param rateLimitAdmin The new rate limiter admin address.
function setRateLimitAdmin(address rateLimitAdmin) external onlyOwner {
s_rateLimitAdmin = rateLimitAdmin;
}
/// @notice Gets the rate limiter admin address.
function getRateLimitAdmin() external view returns (address) {
return s_rateLimitAdmin;
}
/// @notice Consumes outbound rate limiting capacity in this pool
function _consumeOutboundRateLimit(uint64 remoteChainSelector, uint256 amount) internal {
s_remoteChainConfigs[remoteChainSelector].outboundRateLimiterConfig._consume(amount, address(i_token));
}
/// @notice Consumes inbound rate limiting capacity in this pool
function _consumeInboundRateLimit(uint64 remoteChainSelector, uint256 amount) internal {
s_remoteChainConfigs[remoteChainSelector].inboundRateLimiterConfig._consume(amount, address(i_token));
}
/// @notice Gets the token bucket with its values for the block it was requested at.
/// @return The token bucket.
function getCurrentOutboundRateLimiterState(
uint64 remoteChainSelector
) external view returns (RateLimiter.TokenBucket memory) {
return s_remoteChainConfigs[remoteChainSelector].outboundRateLimiterConfig._currentTokenBucketState();
}
/// @notice Gets the token bucket with its values for the block it was requested at.
/// @return The token bucket.
function getCurrentInboundRateLimiterState(
uint64 remoteChainSelector
) external view returns (RateLimiter.TokenBucket memory) {
return s_remoteChainConfigs[remoteChainSelector].inboundRateLimiterConfig._currentTokenBucketState();
}
/// @notice Sets the chain rate limiter config.
/// @param remoteChainSelector The remote chain selector for which the rate limits apply.
/// @param outboundConfig The new outbound rate limiter config, meaning the onRamp rate limits for the given chain.
/// @param inboundConfig The new inbound rate limiter config, meaning the offRamp rate limits for the given chain.
function setChainRateLimiterConfig(
uint64 remoteChainSelector,
RateLimiter.Config memory outboundConfig,
RateLimiter.Config memory inboundConfig
) external {
if (msg.sender != s_rateLimitAdmin && msg.sender != owner()) revert Unauthorized(msg.sender);
_setRateLimitConfig(remoteChainSelector, outboundConfig, inboundConfig);
}
function _setRateLimitConfig(
uint64 remoteChainSelector,
RateLimiter.Config memory outboundConfig,
RateLimiter.Config memory inboundConfig
) internal {
if (!isSupportedChain(remoteChainSelector)) revert NonExistentChain(remoteChainSelector);
RateLimiter._validateTokenBucketConfig(outboundConfig, false);
s_remoteChainConfigs[remoteChainSelector].outboundRateLimiterConfig._setTokenBucketConfig(outboundConfig);
RateLimiter._validateTokenBucketConfig(inboundConfig, false);
s_remoteChainConfigs[remoteChainSelector].inboundRateLimiterConfig._setTokenBucketConfig(inboundConfig);
emit ChainConfigured(remoteChainSelector, outboundConfig, inboundConfig);
}
// ================================================================
// │ Access │
// ================================================================
/// @notice Checks whether remote chain selector is configured on this contract, and if the msg.sender
/// is a permissioned onRamp for the given chain on the Router.
function _onlyOnRamp(uint64 remoteChainSelector) internal view {
if (!isSupportedChain(remoteChainSelector)) revert ChainNotAllowed(remoteChainSelector);
if (!(msg.sender == s_router.getOnRamp(remoteChainSelector))) revert CallerIsNotARampOnRouter(msg.sender);
}
/// @notice Checks whether remote chain selector is configured on this contract, and if the msg.sender
/// is a permissioned offRamp for the given chain on the Router.
function _onlyOffRamp(uint64 remoteChainSelector) internal view {
if (!isSupportedChain(remoteChainSelector)) revert ChainNotAllowed(remoteChainSelector);
if (!s_router.isOffRamp(remoteChainSelector, msg.sender)) revert CallerIsNotARampOnRouter(msg.sender);
}
// ================================================================
// │ Allowlist │
// ================================================================
function _checkAllowList(address sender) internal view {
if (i_allowlistEnabled) {
if (!s_allowList.contains(sender)) {
revert SenderNotAllowed(sender);
}
}
}
/// @notice Gets whether the allowList functionality is enabled.
/// @return true is enabled, false if not.
function getAllowListEnabled() external view returns (bool) {
return i_allowlistEnabled;
}
/// @notice Gets the allowed addresses.
/// @return The allowed addresses.
function getAllowList() external view returns (address[] memory) {
return s_allowList.values();
}
/// @notice Apply updates to the allow list.
/// @param removes The addresses to be removed.
/// @param adds The addresses to be added.
function applyAllowListUpdates(address[] calldata removes, address[] calldata adds) external onlyOwner {
_applyAllowListUpdates(removes, adds);
}
/// @notice Internal version of applyAllowListUpdates to allow for reuse in the constructor.
function _applyAllowListUpdates(address[] memory removes, address[] memory adds) internal {
if (!i_allowlistEnabled) revert AllowListNotEnabled();
for (uint256 i = 0; i < removes.length; ++i) {
address toRemove = removes[i];
if (s_allowList.remove(toRemove)) {
emit AllowListRemove(toRemove);
}
}
for (uint256 i = 0; i < adds.length; ++i) {
address toAdd = adds[i];
if (toAdd == address(0)) {
continue;
}
if (s_allowList.add(toAdd)) {
emit AllowListAdd(toAdd);
}
}
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {ConfirmedOwnerWithProposal} from "./ConfirmedOwnerWithProposal.sol";
/// @title The ConfirmedOwner contract
/// @notice A contract with helpers for basic contract ownership.
contract ConfirmedOwner is ConfirmedOwnerWithProposal {
constructor(address newOwner) ConfirmedOwnerWithProposal(newOwner, address(0)) {}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {IOwnable} from "../interfaces/IOwnable.sol";
/// @title The ConfirmedOwner contract
/// @notice A contract with helpers for basic contract ownership.
contract ConfirmedOwnerWithProposal is IOwnable {
address private s_owner;
address private s_pendingOwner;
event OwnershipTransferRequested(address indexed from, address indexed to);
event OwnershipTransferred(address indexed from, address indexed to);
constructor(address newOwner, address pendingOwner) {
// solhint-disable-next-line gas-custom-errors
require(newOwner != address(0), "Cannot set owner to zero");
s_owner = newOwner;
if (pendingOwner != address(0)) {
_transferOwnership(pendingOwner);
}
}
/// @notice Allows an owner to begin transferring ownership to a new address.
function transferOwnership(address to) public override onlyOwner {
_transferOwnership(to);
}
/// @notice Allows an ownership transfer to be completed by the recipient.
function acceptOwnership() external override {
// solhint-disable-next-line gas-custom-errors
require(msg.sender == s_pendingOwner, "Must be proposed owner");
address oldOwner = s_owner;
s_owner = msg.sender;
s_pendingOwner = address(0);
emit OwnershipTransferred(oldOwner, msg.sender);
}
/// @notice Get the current owner
function owner() public view override returns (address) {
return s_owner;
}
/// @notice validate, transfer ownership, and emit relevant events
function _transferOwnership(address to) private {
// solhint-disable-next-line gas-custom-errors
require(to != msg.sender, "Cannot transfer to self");
s_pendingOwner = to;
emit OwnershipTransferRequested(s_owner, to);
}
/// @notice validate access
function _validateOwnership() internal view {
// solhint-disable-next-line gas-custom-errors
require(msg.sender == s_owner, "Only callable by owner");
}
/// @notice Reverts if called by anyone other than the contract owner.
modifier onlyOwner() {
_validateOwnership();
_;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {ConfirmedOwner} from "./ConfirmedOwner.sol";
/// @title The OwnerIsCreator contract
/// @notice A contract with helpers for basic contract ownership.
contract OwnerIsCreator is ConfirmedOwner {
constructor() ConfirmedOwner(msg.sender) {}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IOwnable {
function owner() external returns (address);
function transferOwnership(address recipient) external;
function acceptOwnership() external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @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 v5.0.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.20;
/**
* @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 is the index of the value in the `values` array plus 1.
// Position 0 is used to mean a value is not in the set.
mapping(bytes32 value => uint256) _positions;
}
/**
* @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._positions[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 cache the value's position to prevent multiple reads from the same storage slot
uint256 position = set._positions[value];
if (position != 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 valueIndex = position - 1;
uint256 lastIndex = set._values.length - 1;
if (valueIndex != lastIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the lastValue to the index where the value to delete is
set._values[valueIndex] = lastValue;
// Update the tracked position of the lastValue (that was just moved)
set._positions[lastValue] = position;
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the tracked position for the deleted slot
delete set._positions[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._positions[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: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../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.
*
* The initial owner is set to the address provided by the deployer. 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;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @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 {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @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 {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_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 v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.20;
/**
* @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 v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @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 value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` 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 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../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 An operation with an ERC20 token failed.
*/
error SafeERC20FailedOperation(address token);
/**
* @dev Indicates a failed `decreaseAllowance` request.
*/
error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);
/**
* @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.encodeCall(token.transfer, (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.encodeCall(token.transferFrom, (from, to, 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);
forceApprove(token, spender, oldAllowance + value);
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
* value, non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
unchecked {
uint256 currentAllowance = token.allowance(address(this), spender);
if (currentAllowance < requestedDecrease) {
revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
}
forceApprove(token, spender, currentAllowance - requestedDecrease);
}
}
/**
* @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.encodeCall(token.approve, (spender, value));
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @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);
if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @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(token).code.length > 0;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error AddressInsufficientBalance(address account);
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedInnerCall();
/**
* @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert AddressInsufficientBalance(address(this));
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
revert FailedInnerCall();
}
}
/**
* @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 or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {FailedInnerCall} error.
*
* 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.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @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`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert AddressInsufficientBalance(address(this));
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
* unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {FailedInnerCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
*/
function _revert(bytes memory returndata) 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 FailedInnerCall();
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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 (last updated v5.0.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.20;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS
}
/**
* @dev The signature derives the `address(0)`.
*/
error ECDSAInvalidSignature();
/**
* @dev The signature has an invalid length.
*/
error ECDSAInvalidSignatureLength(uint256 length);
/**
* @dev The signature has an S value that is in the upper half order.
*/
error ECDSAInvalidSignatureS(bytes32 s);
/**
* @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
* return address(0) without also returning an error description. Errors are documented using an enum (error type)
* and a bytes32 providing additional information about the error.
*
* If no error is returned, then the address can be used for verification purposes.
*
* The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*/
function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {
unchecked {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
// We do not check for an overflow here since the shift operation results in 0 or 1.
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*/
function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError, bytes32) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS, s);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature, bytes32(0));
}
return (signer, RecoverError.NoError, bytes32(0));
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
(address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);
_throwError(error, errorArg);
return recovered;
}
/**
* @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
*/
function _throwError(RecoverError error, bytes32 errorArg) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert ECDSAInvalidSignature();
} else if (error == RecoverError.InvalidSignatureLength) {
revert ECDSAInvalidSignatureLength(uint256(errorArg));
} else if (error == RecoverError.InvalidSignatureS) {
revert ECDSAInvalidSignatureS(errorArg);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
/**
* @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;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
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
if (_status == ENTERED) {
revert ReentrancyGuardReentrantCall();
}
// 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
pragma solidity 0.8.24;
import {IAdapter} from "./IAdapter.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
import {IBridge, IBaseLBTC} from "../IBridge.sol";
/**
* @title Abstract bridge adapter
* @author Lombard.finance
* @notice Implements basic communication with Bridge contract.
* Should be extended with business logic of bridging protocols (e.g. CCIP, LayerZero).
*/
abstract contract AbstractAdapter is IAdapter, Context {
error Adapter_ZeroAddress();
error Adapter_AddressIsEOA();
error NotBridge();
event BridgeChanged(IBridge indexed oldBridge, IBridge indexed newBridge);
IBridge public override bridge;
constructor(IBridge bridge_) {
_notZero(address(bridge_));
bridge = bridge_;
}
function lbtc() public view returns (IBaseLBTC) {
return bridge.lbtc();
}
/// MODIFIERS ///
modifier onlyBridge() {
_onlyBridge();
_;
}
/// ONLY OWNER FUNCTIONS ///
/**
* @notice Change the bridge address
* @param bridge_ New bridge address
*/
function changeBridge(IBridge bridge_) external {
_onlyOwner();
_notZero(address(bridge_));
IBridge oldBridge = bridge;
bridge = bridge_;
emit BridgeChanged(oldBridge, bridge_);
}
/// PRIVATE FUNCTIONS ///
function _onlyOwner() internal view virtual;
function _onlyBridge() internal view {
if (_msgSender() != address(bridge)) {
revert NotBridge();
}
}
function _notZero(address addr) internal pure {
if (addr == address(0)) {
revert Adapter_ZeroAddress();
}
}
/**
* @dev Called when data is received.
*/
function _receive(bytes32 fromChain, bytes memory payload) internal {
bridge.receivePayload(fromChain, payload);
}
/**
* @notice Sends a payload from the source to destination chain.
* @param _toChain Destination chain's.
* @param _payload The payload to send.
* @param _refundAddress Address where refund fee
*/
function _deposit(
bytes32 _toChain,
bytes memory _payload,
address _refundAddress
) internal virtual {}
function deposit(
address _fromAddress,
bytes32 _toChain,
bytes32 /* _toContract */,
bytes32 /* _toAddress */,
uint256 /* _amount */,
bytes memory _payload
) external payable virtual override {
_deposit(_toChain, _payload, _fromAddress);
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import {IBridge} from "../IBridge.sol";
interface IAdapter {
/// @notice Thrown when msg.value is not enough to pay CCIP fee.
error NotEnoughToPayFee(uint256 fee);
event ExecutionGasLimitSet(uint128 indexed prevVal, uint128 indexed newVal);
function bridge() external view returns (IBridge);
function getFee(
bytes32 _toChain,
bytes32 _toContract,
bytes32 _toAddress,
uint256 _amount,
bytes memory _payload
) external view returns (uint256);
function deposit(
address _fromAddress,
bytes32 _toChain,
bytes32 _toContract,
bytes32 _toAddress,
uint256 _amount,
bytes memory _payload
) external payable;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import {IERC20} from "@chainlink/contracts-ccip/src/v0.8/vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";
import {IRouterClient} from "@chainlink/contracts-ccip/src/v0.8/ccip/interfaces/IRouterClient.sol";
import {Client} from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Client.sol";
import {IBridge} from "../IBridge.sol";
import {Pool} from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Pool.sol";
import {TokenPool} from "@chainlink/contracts-ccip/src/v0.8/ccip/pools/TokenPool.sol";
import {CLAdapter} from "./CLAdapter.sol";
contract LombardTokenPool is TokenPool {
CLAdapter public adapter;
/// @notice msg.sender gets the ownership of the contract given
/// token pool implementation
constructor(
IERC20 lbtc_,
address ccipRouter_,
address[] memory allowlist_,
address rmnProxy_,
CLAdapter adapter_
) TokenPool(lbtc_, allowlist_, rmnProxy_, ccipRouter_) {
adapter = adapter_;
}
/// @notice Burn the token in the pool
/// @dev The _validateLockOrBurn check is an essential security check
function lockOrBurn(
Pool.LockOrBurnInV1 calldata lockOrBurnIn
) external virtual override returns (Pool.LockOrBurnOutV1 memory) {
_validateLockOrBurn(lockOrBurnIn);
// send out to burn
i_token.approve(address(adapter), lockOrBurnIn.amount);
(uint256 burnedAmount, bytes memory payload) = adapter.initiateDeposit(
lockOrBurnIn.remoteChainSelector,
lockOrBurnIn.receiver,
lockOrBurnIn.amount
);
emit Burned(lockOrBurnIn.originalSender, burnedAmount);
bytes memory destPoolData = abi.encode(sha256(payload));
return
Pool.LockOrBurnOutV1({
destTokenAddress: getRemoteToken(
lockOrBurnIn.remoteChainSelector
),
destPoolData: destPoolData
});
}
/// @notice Mint tokens from the pool to the recipient
/// @dev The _validateReleaseOrMint check is an essential security check
function releaseOrMint(
Pool.ReleaseOrMintInV1 calldata releaseOrMintIn
) external virtual override returns (Pool.ReleaseOrMintOutV1 memory) {
_validateReleaseOrMint(releaseOrMintIn);
uint64 amount = adapter.initiateWithdrawal(
releaseOrMintIn.remoteChainSelector,
releaseOrMintIn.sourcePoolData,
releaseOrMintIn.offchainTokenData
);
emit Minted(msg.sender, releaseOrMintIn.receiver, uint256(amount));
return Pool.ReleaseOrMintOutV1({destinationAmount: uint256(amount)});
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import {IBaseLBTC} from "../LBTC/IBaseLBTC.sol";
import "./adapters/IAdapter.sol";
import {IConsortiumConsumer, INotaryConsortium} from "../interfaces/IConsortiumConsumer.sol";
interface IBridge is IConsortiumConsumer {
/// @notice Emitted when the destination is unknown.
error UnknownDestination();
/// @notice Emitted when the zero address is used.
error Bridge_ZeroAddress();
error Bridge_ZeroAmount();
/// @notice Emitted adapter is not set for destination without consortium
error BadConfiguration();
/// @notice Emitted when the destination is already known.
error KnownDestination();
/// @notice Emitted when the zero contract hash is used.
error ZeroContractHash();
/// @notice Emitted when the chain id is invalid.
error ZeroChainId();
/// @notice Emitted when the destination is not valid.
error NotValidDestination();
/// @notice Emitted when amount is below commission
error AmountLessThanCommission(uint256 commission);
/// @notice Emitted when the origin contract is unknown.
error UnknownOriginContract(bytes32 fromChain, bytes32 fromContract);
/// @notice Emitted when the unexpected action is used.
error UnexpectedAction(bytes4 action);
error UnknownAdapter(address);
error PayloadAlreadyUsed(bytes32);
/// @notice Emitted no payload submitted by adapter
error AdapterNotConfirmed();
/// @notice Emitted no payload submitted by consortium
error ConsortiumNotConfirmed();
/// @notice Emitted when the deposit absolute commission is changed.
event DepositAbsoluteCommissionChanged(
uint64 newValue,
bytes32 indexed chain
);
/// @notice Emitted when the deposit relative commission is changed.
event DepositRelativeCommissionChanged(
uint16 newValue,
bytes32 indexed chain
);
/// @notice Emitted when a bridge destination is added.
event BridgeDestinationAdded(
bytes32 indexed chain,
bytes32 indexed contractAddress
);
/// @notice Emitted when a bridge destination is removed.
event BridgeDestinationRemoved(bytes32 indexed chain);
/// @notice Emitted when the adapter is changed.
event AdapterChanged(address previousAdapter, IAdapter newAdapter);
/// @notice Emitted when the is a deposit in the bridge
event DepositToBridge(
address indexed fromAddress,
bytes32 indexed toAddress,
bytes32 indexed payloadHash,
bytes payload
);
/// @notice Emitted when a withdraw is made from the bridge
event WithdrawFromBridge(
address indexed recipient,
bytes32 indexed payloadHash,
bytes payload,
uint64 amount
);
event PayloadReceived(
address indexed recipient,
bytes32 indexed payloadHash,
address indexed adapter
);
event PayloadNotarized(
address indexed recipient,
bytes32 indexed payloadHash
);
event RateLimitsChanged(
bytes32 indexed chainId,
uint256 limit,
uint256 window
);
/// @notice Emitted when the treasury is changed.
event TreasuryChanged(address previousTreasury, address newTreasury);
function lbtc() external view returns (IBaseLBTC);
function receivePayload(bytes32 fromChain, bytes calldata payload) external;
function deposit(
bytes32 toChain,
bytes32 toAddress,
uint64 amount
) external payable returns (uint256, bytes memory);
function authNotary(bytes calldata payload, bytes calldata proof) external;
function withdraw(bytes calldata payload) external returns (uint64);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
interface INotaryConsortium {
/// @dev Error thrown when signature payload is already used
error PayloadAlreadyUsed();
/// @dev Error thrown when signatures length is not equal to signers length
error LengthMismatch();
/// @dev Error thrown when there are not enough signatures
error NotEnoughSignatures();
/// @dev Error thrown when unexpected action is used
error UnexpectedAction(bytes4 action);
/// @dev Event emitted when the validator set is updated
event ValidatorSetUpdated(
uint256 indexed epoch,
address[] validators,
uint256[] weights,
uint256 threshold
);
/// @dev Error thrown when validator set already set
error ValSetAlreadySet();
/// @dev Error thrown when no validator set is set
error NoValidatorSet();
/// @dev Error thrown when invalid epoch is provided
error InvalidEpoch();
function checkProof(
bytes32 _payloadHash,
bytes calldata _proof
) external view;
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import {INotaryConsortium} from "../consortium/INotaryConsortium.sol";
/**
* @title Consortium Consumer interface
* @author Lombard.Finance
* @notice Common interface for contracts who verify signatures with `INotaryConsortium`
*/
interface IConsortiumConsumer {
event ConsortiumChanged(
INotaryConsortium indexed prevVal,
INotaryConsortium indexed newVal
);
function changeConsortium(INotaryConsortium newVal) external;
function consortium() external view returns (INotaryConsortium);
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
interface IBaseLBTC {
error ZeroAddress();
error WithdrawalsDisabled();
error ScriptPubkeyUnsupported();
error AmountLessThanCommission(uint256 fee);
error AmountBelowDustLimit(uint256 dustLimit);
error InvalidDustFeeRate();
error UnexpectedAction(bytes4 action);
error InvalidUserSignature();
error PayloadAlreadyUsed();
error InvalidInputLength();
error InvalidMintAmount();
event UnstakeRequest(
address indexed fromAddress,
bytes scriptPubKey,
uint256 amount
);
event WithdrawalsEnabled(bool);
event NameAndSymbolChanged(string name, string symbol);
event ConsortiumChanged(address indexed prevVal, address indexed newVal);
event TreasuryAddressChanged(
address indexed prevValue,
address indexed newValue
);
event BurnCommissionChanged(
uint64 indexed prevValue,
uint64 indexed newValue
);
event DustFeeRateChanged(uint256 indexed oldRate, uint256 indexed newRate);
event BasculeChanged(address indexed prevVal, address indexed newVal);
event FeeCharged(uint256 indexed fee, bytes userSignature);
event FeeChanged(uint256 indexed oldFee, uint256 indexed newFee);
error FeeGreaterThanAmount();
event MintProofConsumed(
address indexed recipient,
bytes32 indexed payloadHash,
bytes payload
);
event BatchMintSkipped(bytes32 indexed payloadHash, bytes payload);
function burn(uint256 amount) external;
function burn(address from, uint256 amount) external;
function mint(address to, uint256 amount) external;
function getTreasury() external returns (address);
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract IBridge","name":"bridge_","type":"address"},{"internalType":"uint128","name":"executionGasLimit_","type":"uint128"},{"internalType":"address","name":"ccipRouter_","type":"address"},{"internalType":"address[]","name":"allowlist_","type":"address[]"},{"internalType":"address","name":"rmnProxy_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"Adapter_AddressIsEOA","type":"error"},{"inputs":[],"name":"Adapter_ZeroAddress","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"AmountOverflow","type":"error"},{"inputs":[],"name":"CLAttemptToOverrideChain","type":"error"},{"inputs":[],"name":"CLAttemptToOverrideChainSelector","type":"error"},{"inputs":[],"name":"CLPayloadMismatch","type":"error"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"CLRefundFailed","type":"error"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"CLUnauthorizedTokenPool","type":"error"},{"inputs":[],"name":"CLWrongPayloadHashLength","type":"error"},{"inputs":[],"name":"CLZeroChain","type":"error"},{"inputs":[],"name":"CLZeroChanSelector","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"NotBridge","type":"error"},{"inputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"NotEnoughToPayFee","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReceiverTooBig","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"ZeroPayload","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IBridge","name":"oldBridge","type":"address"},{"indexed":true,"internalType":"contract IBridge","name":"newBridge","type":"address"}],"name":"BridgeChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"","type":"uint64"}],"name":"CLChainSelectorSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"","type":"address"}],"name":"CLTokenPoolDeployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint128","name":"prevVal","type":"uint128"},{"indexed":true,"internalType":"uint128","name":"newVal","type":"uint128"}],"name":"ExecutionGasLimitSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"bridge","outputs":[{"internalType":"contract IBridge","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IBridge","name":"bridge_","type":"address"}],"name":"changeBridge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"fromAddress","type":"address"},{"internalType":"bytes32","name":"_toChain","type":"bytes32"},{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"bytes32","name":"_toAddress","type":"bytes32"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint64","name":"","type":"uint64"}],"name":"getChain","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getExecutionGasLimit","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_toChain","type":"bytes32"},{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"bytes32","name":"_toAddress","type":"bytes32"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"getFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"getRemoteChainSelector","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"remoteSelector","type":"uint64"},{"internalType":"bytes","name":"onChainData","type":"bytes"}],"name":"initWithdrawalNoSignatures","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"remoteChainSelector","type":"uint64"},{"internalType":"bytes","name":"receiver","type":"bytes"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"initiateDeposit","outputs":[{"internalType":"uint256","name":"lastBurnedAmount","type":"uint256"},{"internalType":"bytes","name":"lastPayload","type":"bytes"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"remoteSelector","type":"uint64"},{"internalType":"bytes","name":"payloadHash","type":"bytes"},{"internalType":"bytes","name":"offchainData","type":"bytes"}],"name":"initiateWithdrawal","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lbtc","outputs":[{"internalType":"contract IBaseLBTC","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"refunds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint128","name":"newVal","type":"uint128"}],"name":"setExecutionGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"chain","type":"bytes32"},{"internalType":"uint64","name":"chainSelector","type":"uint64"}],"name":"setRemoteChainSelector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"tokenPool","outputs":[{"internalType":"contract LombardTokenPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawRefund","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
60806040523480156200001157600080fd5b5060405162005cac38038062005cac83398101604081905262000034916200033d565b3385620000418162000218565b600080546001600160a01b0319166001600160a01b0392831617905581166200008457604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b6200008f8162000243565b506001600255620000a08462000295565b846001600160a01b03166368b3c9106040518163ffffffff1660e01b8152600401602060405180830381865afa158015620000df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000105919062000471565b838383306040516200011790620002f1565b6200012795949392919062000498565b604051809103906000f08015801562000144573d6000803e3d6000fd5b50600680546001600160a01b0319166001600160a01b0392909216918217905563f2fde38b620001713390565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401600060405180830381600087803b158015620001b357600080fd5b505af1158015620001c8573d6000803e3d6000fd5b50506006546040516001600160a01b0390911681527f45163ba2f75e282ba1000a5e166237acb454fa6b2b4cc778671bf977a01b13b49250602001905060405180910390a1505050505062000512565b6001600160a01b038116620002405760405163cf891a8760e01b815260040160405180910390fd5b50565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6005546040516001600160801b038084169216907f45a4a024e3d155ab5b1634193775d00d4cbf4ef295e76d0bf1aa6dfeb114dd8490600090a3600580546001600160801b0319166001600160801b0392909216919091179055565b6137a5806200250783390190565b6001600160a01b03811681146200024057600080fd5b80516200032281620002ff565b919050565b634e487b7160e01b600052604160045260246000fd5b600080600080600060a086880312156200035657600080fd5b85516200036381620002ff565b602087810151919650906001600160801b03811681146200038357600080fd5b60408801519095506200039681620002ff565b60608801519094506001600160401b0380821115620003b457600080fd5b818901915089601f830112620003c957600080fd5b815181811115620003de57620003de62000327565b8060051b604051601f19603f8301168101818110858211171562000406576200040662000327565b60405291825284820192508381018501918c8311156200042557600080fd5b938501935b828510156200044e576200043e8562000315565b845293850193928501926200042a565b809750505050505050620004656080870162000315565b90509295509295909350565b6000602082840312156200048457600080fd5b81516200049181620002ff565b9392505050565b600060a0820160018060a01b0380891684526020818916602086015260a0604086015282885180855260c08701915060208a01945060005b81811015620004f0578551851683529483019491830191600101620004d0565b5050968216606086015250939093166080909201919091525090949350505050565b611fe580620005226000396000f3fe6080604052600436106101145760003560e01c8063715886c4116100a0578063b1ab7e2211610064578063b1ab7e2214610337578063bc3da53514610357578063e240550d14610384578063e78cea92146103a4578063f2fde38b146103c457600080fd5b8063715886c41461025d578063775710d4146102705780638da5cb5b146102a657806392b0680a146102c4578063a1a6d508146102fc57600080fd5b8063110f8874116100e7578063110f8874146101d0578063453bb95c146101e5578063550e7ab21461020557806368b3c91014610233578063715018a61461024857600080fd5b806308774410146101195780630c373d741461013b5780630cca6c0f14610178578063104e992914610198575b600080fd5b34801561012557600080fd5b506101396101343660046116d5565b6103e4565b005b34801561014757600080fd5b5061015b61015636600461174f565b610445565b6040516001600160401b0390911681526020015b60405180910390f35b34801561018457600080fd5b5061015b6101933660046117a3565b61056a565b3480156101a457600080fd5b506006546101b8906001600160a01b031681565b6040516001600160a01b03909116815260200161016f565b3480156101dc57600080fd5b50610139610743565b3480156101f157600080fd5b50610139610200366004611825565b6107de565b34801561021157600080fd5b50610225610220366004611855565b610912565b60405161016f929190611900565b34801561023f57600080fd5b506101b8610c96565b34801561025457600080fd5b50610139610d13565b61013961026b3660046119dc565b610d25565b34801561027c57600080fd5b5061015b61028b366004611a50565b6003602052600090815260409020546001600160401b031681565b3480156102b257600080fd5b506001546001600160a01b03166101b8565b3480156102d057600080fd5b506005546102e4906001600160801b031681565b6040516001600160801b03909116815260200161016f565b34801561030857600080fd5b50610329610317366004611a69565b60046020526000908152604090205481565b60405190815260200161016f565b34801561034357600080fd5b50610329610352366004611a86565b610ffc565b34801561036357600080fd5b506103296103723660046116d5565b60096020526000908152604090205481565b34801561039057600080fd5b5061013961039f366004611ae9565b611126565b3480156103b057600080fd5b506000546101b8906001600160a01b031681565b3480156103d057600080fd5b506101396103df3660046116d5565b61113a565b6103ec611175565b6103f58161117d565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917fd565484d693f5157abcceb853139678038bc740991b0a4dc3baa2426325bb3c09190a35050565b6006546000906001600160a01b0316331461048657335b604051631b585c9760e11b81526001600160a01b0390911660048201526024015b60405180910390fd5b6104eb60046000866001600160401b03166001600160401b031681526020019081526020016000205484848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506111a492505050565b60005460405163025a3c9960e21b81526001600160a01b0390911690630968f2649061051d9086908690600401611b12565b6020604051808303816000875af115801561053c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105609190611b41565b90505b9392505050565b6006546000906001600160a01b03163314610585573361045c565b602084146105a65760405163607484d560e11b815260040160405180910390fd5b6000806105b584860186611b5e565b915091506002826040516105c99190611bc1565b602060405180830381855afa1580156105e6573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906106099190611bdd565b61061760206000898b611bf6565b61062091611c20565b1461063d5760405162e33d8b60e61b815260040160405180910390fd5b6001600160401b03881660009081526004602052604090205461066090836111a4565b600054604051636b93aa5160e01b81526001600160a01b0390911690636b93aa51906106929085908590600401611c3e565b600060405180830381600087803b1580156106ac57600080fd5b505af11580156106c0573d6000803e3d6000fd5b505060005460405163025a3c9960e21b81526001600160a01b039091169250630968f26491506106f4908590600401611c6c565b6020604051808303816000875af1158015610713573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107379190611b41565b98975050505050505050565b61074b611204565b33600081815260096020526040808220805490839055905190929083908381818185875af1925050503d80600081146107a0576040519150601f19603f3d011682016040523d82523d6000602084013e6107a5565b606091505b50509050806107d057604051634dd98c2f60e11b81523360048201526024810183905260440161047d565b50506107dc6001600255565b565b6107e661122c565b816108045760405163e531cb7360e01b815260040160405180910390fd5b806001600160401b031660000361082e5760405163e531cb7360e01b815260040160405180910390fd5b6000828152600360205260409020546001600160401b03161561086457604051635b97bc1560e11b815260040160405180910390fd5b6001600160401b0381166000908152600460205260409020541561089b5760405163e95ca6dd60e01b815260040160405180910390fd5b6000828152600360209081526040808320805467ffffffffffffffff19166001600160401b03861690811790915580845260048352928190208590558051858152918201929092527f61805347ac73c642ed5bfbc228e1702a4d51591b36a35387250de0c0d75b0072910160405180910390a15050565b6006546000906060906001600160a01b03163314610930573361045c565b61094361093b610c96565b333086611259565b60006008805461095290611c7f565b90501115610a395760075491506008805461096c90611c7f565b80601f016020809104026020016040519081016040528092919081815260200182805461099890611c7f565b80156109e55780601f106109ba576101008083540402835291602001916109e5565b820191906000526020600020905b8154815290600101906020018083116109c857829003601f168201915b50939450600093506109f692505050565b6040519080825280601f01601f191660200182016040528015610a20576020820181803683370190505b50600890610a2e9082611d01565b506000600755610bb9565b6020841115610a5a57604051625fa1f560e31b815260040160405180910390fd5b680100000000000000008310610a8357604051630590fb9f60e01b815260040160405180910390fd5b610a8b610c96565b60005460405163095ea7b360e01b81526001600160a01b0391821660048201526024810186905291169063095ea7b3906044016020604051808303816000875af1158015610add573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b019190611dc0565b50600080546001600160401b038816825260046020526040909120546001600160a01b03909116906383031c4190610b398789611c20565b6040516001600160e01b031960e085901b168152600481019290925260248201526001600160401b03861660448201526064016000604051808303816000875af1158015610b8b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610bb39190810190611de2565b90925090505b60008054906101000a90046001600160a01b03166001600160a01b03166368b3c9106040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2e9190611e64565b6001600160a01b03166342966c68836040518263ffffffff1660e01b8152600401610c5b91815260200190565b600060405180830381600087803b158015610c7557600080fd5b505af1158015610c89573d6000803e3d6000fd5b5050505094509492505050565b60008060009054906101000a90046001600160a01b03166001600160a01b03166368b3c9106040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0e9190611e64565b905090565b610d1b61122c565b6107dc60006112b9565b610d2d61130b565b610d40610d38610c96565b333085611259565b6001600160a01b0386163014610ff45760078290556008610d618282611d01565b5060008581526003602090815260408083205481519283018790526001600160401b03169291610da191016040516020818303038152906040528561133f565b90506000600660009054906101000a90046001600160a01b03166001600160a01b031663b0f479a16040518163ffffffff1660e01b8152600401602060405180830381865afa158015610df8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e1c9190611e64565b90506000816001600160a01b03166320487ded85856040518363ffffffff1660e01b8152600401610e4e929190611e81565b602060405180830381865afa158015610e6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8f9190611bdd565b905080341015610eb55760405163af09dec960e01b81526004810182905260240161047d565b80341115610efd576000610ec98234611f73565b6001600160a01b038c16600090815260096020526040812080549293508392909190610ef6908490611f86565b9091555050505b610f05610c96565b60405163095ea7b360e01b81526001600160a01b03848116600483015260248201899052919091169063095ea7b3906044016020604051808303816000875af1158015610f56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7a9190611dc0565b506040516396f4e9f960e01b81526001600160a01b038316906396f4e9f9908390610fab9088908890600401611e81565b60206040518083038185885af1158015610fc9573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610fee9190611bdd565b50505050505b505050505050565b6006546040805163b0f479a160e01b815290516000926001600160a01b03169163b0f479a19160048083019260209291908290030181865afa158015611046573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106a9190611e64565b6000878152600360209081526040918290205482519182018890526001600160a01b0393909316926320487ded926001600160401b03909116916110be91016040516020818303038152906040528761133f565b6040518363ffffffff1660e01b81526004016110db929190611e81565b602060405180830381865afa1580156110f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061111c9190611bdd565b9695505050505050565b61112e61122c565b611137816114fb565b50565b61114261122c565b6001600160a01b03811661116c57604051631e4fbdf760e01b81526000600482015260240161047d565b611137816112b9565b6107dc61122c565b6001600160a01b0381166111375760405163cf891a8760e01b815260040160405180910390fd5b600054604051638783f52560e01b81526001600160a01b0390911690638783f525906111d69085908590600401611900565b600060405180830381600087803b1580156111f057600080fd5b505af1158015610ff4573d6000803e3d6000fd5b600280540361122657604051633ee5aeb560e01b815260040160405180910390fd5b60028055565b6001546001600160a01b031633146107dc5760405163118cdaa760e01b815233600482015260240161047d565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526112b3908590611560565b50505050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000546001600160a01b0316336001600160a01b0316146107dc57604051637fea9dc560e01b815260040160405180910390fd5b61137a6040518060a0016040528060608152602001606081526020016060815260200160006001600160a01b03168152602001606081525090565b604080516001808252818301909252600091816020015b60408051808201909152600080825260208201528152602001906001900390816113915750506040805180820180835260005463068b3c9160e41b90915291519293509182916001600160a01b0316906368b3c910906044808501916020918187030181865afa158015611409573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061142d9190611e64565b6001600160a01b03168152602001848152508160008151811061145257611452611f99565b6020908102919091018101919091526040805160a081018252868152815180840183526000808252828501919091528183018590526060820152815180830183526005546001600160801b03168082526001918501918252835160248101919091529051151560448083019190915283518083039091018152606490910190925291810180516001600160e01b0316630181dcf160e41b17905260808201529150505b92915050565b6005546040516001600160801b038084169216907f45a4a024e3d155ab5b1634193775d00d4cbf4ef295e76d0bf1aa6dfeb114dd8490600090a3600580546fffffffffffffffffffffffffffffffff19166001600160801b0392909216919091179055565b60006115756001600160a01b038416836115c8565b9050805160001415801561159a5750808060200190518101906115989190611dc0565b155b156115c357604051635274afe760e01b81526001600160a01b038416600482015260240161047d565b505050565b60606105638383600084600080856001600160a01b031684866040516115ee9190611bc1565b60006040518083038185875af1925050503d806000811461162b576040519150601f19603f3d011682016040523d82523d6000602084013e611630565b606091505b509150915061111c8683836060826116505761164b82611697565b610563565b815115801561166757506001600160a01b0384163b155b1561169057604051639996b31560e01b81526001600160a01b038516600482015260240161047d565b5080610563565b8051156116a75780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6001600160a01b038116811461113757600080fd5b6000602082840312156116e757600080fd5b8135610563816116c0565b6001600160401b038116811461113757600080fd5b60008083601f84011261171957600080fd5b5081356001600160401b0381111561173057600080fd5b60208301915083602082850101111561174857600080fd5b9250929050565b60008060006040848603121561176457600080fd5b833561176f816116f2565b925060208401356001600160401b0381111561178a57600080fd5b61179686828701611707565b9497909650939450505050565b6000806000806000606086880312156117bb57600080fd5b85356117c6816116f2565b945060208601356001600160401b03808211156117e257600080fd5b6117ee89838a01611707565b9096509450604088013591508082111561180757600080fd5b5061181488828901611707565b969995985093965092949392505050565b6000806040838503121561183857600080fd5b82359150602083013561184a816116f2565b809150509250929050565b6000806000806060858703121561186b57600080fd5b8435611876816116f2565b935060208501356001600160401b0381111561189157600080fd5b61189d87828801611707565b9598909750949560400135949350505050565b60005b838110156118cb5781810151838201526020016118b3565b50506000910152565b600081518084526118ec8160208601602086016118b0565b601f01601f19169290920160200192915050565b82815260406020820152600061056060408301846118d4565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561195757611957611919565b604052919050565b60006001600160401b0382111561197857611978611919565b50601f01601f191660200190565b600082601f83011261199757600080fd5b81356119aa6119a58261195f565b61192f565b8181528460208386010111156119bf57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060008060c087890312156119f557600080fd5b8635611a00816116c0565b95506020870135945060408701359350606087013592506080870135915060a08701356001600160401b03811115611a3757600080fd5b611a4389828a01611986565b9150509295509295509295565b600060208284031215611a6257600080fd5b5035919050565b600060208284031215611a7b57600080fd5b8135610563816116f2565b600080600080600060a08688031215611a9e57600080fd5b8535945060208601359350604086013592506060860135915060808601356001600160401b03811115611ad057600080fd5b611adc88828901611986565b9150509295509295909350565b600060208284031215611afb57600080fd5b81356001600160801b038116811461056357600080fd5b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b600060208284031215611b5357600080fd5b8151610563816116f2565b60008060408385031215611b7157600080fd5b82356001600160401b0380821115611b8857600080fd5b611b9486838701611986565b93506020850135915080821115611baa57600080fd5b50611bb785828601611986565b9150509250929050565b60008251611bd38184602087016118b0565b9190910192915050565b600060208284031215611bef57600080fd5b5051919050565b60008085851115611c0657600080fd5b83861115611c1357600080fd5b5050820193919092039150565b803560208310156114f557600019602084900360031b1b1692915050565b604081526000611c5160408301856118d4565b8281036020840152611c6381856118d4565b95945050505050565b60208152600061056360208301846118d4565b600181811c90821680611c9357607f821691505b602082108103611cb357634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156115c3576000816000526020600020601f850160051c81016020861015611ce25750805b601f850160051c820191505b81811015610ff457828155600101611cee565b81516001600160401b03811115611d1a57611d1a611919565b611d2e81611d288454611c7f565b84611cb9565b602080601f831160018114611d635760008415611d4b5750858301515b600019600386901b1c1916600185901b178555610ff4565b600085815260208120601f198616915b82811015611d9257888601518255948401946001909101908401611d73565b5085821015611db05787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208284031215611dd257600080fd5b8151801515811461056357600080fd5b60008060408385031215611df557600080fd5b8251915060208301516001600160401b03811115611e1257600080fd5b8301601f81018513611e2357600080fd5b8051611e316119a58261195f565b818152866020838501011115611e4657600080fd5b611e578260208301602086016118b0565b8093505050509250929050565b600060208284031215611e7657600080fd5b8151610563816116c0565b600060406001600160401b03851683526020604081850152845160a06040860152611eaf60e08601826118d4565b905081860151603f1980878403016060880152611ecc83836118d4565b6040890151888203830160808a01528051808352908601945060009350908501905b80841015611f2057845180516001600160a01b0316835286015186830152938501936001939093019290860190611eee565b5060608901516001600160a01b031660a08901526080890151888203830160c08a01529550611f4f81876118d4565b9a9950505050505050505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156114f5576114f5611f5d565b808201808211156114f5576114f5611f5d565b634e487b7160e01b600052603260045260246000fdfea2646970667358221220b9c7110de1ef1b4f8eb18b6db60477d039fbc925f32be6f459e6dc2703d95bd664736f6c6343000818003360e06040523480156200001157600080fd5b50604051620037a5380380620037a583398101604081905262000034916200056e565b8483838633806000816200008f5760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f7420736574206f776e657220746f207a65726f000000000000000060448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b0384811691909117909155811615620000c257620000c28162000198565b5050506001600160a01b0384161580620000e357506001600160a01b038116155b80620000f657506001600160a01b038216155b1562000115576040516342bcdf7f60e11b815260040160405180910390fd5b6001600160a01b0384811660805282811660a052600480546001600160a01b031916918316919091179055825115801560c052620001685760408051600081526020810190915262000168908462000243565b5050600980546001600160a01b0319166001600160a01b03949094169390931790925550620006e2945050505050565b336001600160a01b03821603620001f25760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000604482015260640162000086565b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b60c05162000264576040516335f4a7b360e01b815260040160405180910390fd5b60005b8251811015620002ef57600083828151811062000288576200028862000694565b60209081029190910101519050620002a2600282620003a0565b15620002e5576040516001600160a01b03821681527f800671136ab6cfee9fbe5ed1fb7ca417811aca3cf864800d127b927adedf75669060200160405180910390a15b5060010162000267565b5060005b81518110156200039b57600082828151811062000314576200031462000694565b6020026020010151905060006001600160a01b0316816001600160a01b03160362000340575062000392565b6200034d600282620003c0565b1562000390576040516001600160a01b03821681527f2640d4d76caf8bf478aabfa982fa4e1c4eb71a37f93cd15e80dbc657911546d89060200160405180910390a15b505b600101620002f3565b505050565b6000620003b7836001600160a01b038416620003d7565b90505b92915050565b6000620003b7836001600160a01b038416620004db565b60008181526001830160205260408120548015620004d0576000620003fe600183620006aa565b85549091506000906200041490600190620006aa565b90508082146200048057600086600001828154811062000438576200043862000694565b90600052602060002001549050808760000184815481106200045e576200045e62000694565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080620004945762000494620006cc565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050620003ba565b6000915050620003ba565b60008181526001830160205260408120546200052457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620003ba565b506000620003ba565b6001600160a01b03811681146200054357600080fd5b50565b805162000553816200052d565b919050565b634e487b7160e01b600052604160045260246000fd5b600080600080600060a086880312156200058757600080fd5b855162000594816200052d565b80955050602080870151620005a9816200052d565b60408801519095506001600160401b0380821115620005c757600080fd5b818901915089601f830112620005dc57600080fd5b815181811115620005f157620005f162000558565b8060051b604051601f19603f8301168101818110858211171562000619576200061962000558565b60405291825284820192508381018501918c8311156200063857600080fd5b938501935b828510156200066157620006518562000546565b845293850193928501926200063d565b809850505050505050620006786060870162000546565b9150620006886080870162000546565b90509295509295909350565b634e487b7160e01b600052603260045260246000fd5b81810381811115620003ba57634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b60805160a05160c05161305b6200074a60003960008181610421015281816114ab0152611b7a0152600081816103fb0152818161134901526116940152600081816102080152818161055b015281816109de01528181611b2a0152611cca015261305b6000f3fe608060405234801561001057600080fd5b506004361061018e5760003560e01c80639a4575b9116100de578063c4bffe2b11610097578063db6327dc11610071578063db6327dc146103e6578063dc0bd971146103f9578063e0351e131461041f578063f2fde38b1461044557600080fd5b8063c4bffe2b146103ab578063c75eea9c146103c0578063cf7401f3146103d357600080fd5b80639a4575b9146102d9578063a7cd63b7146102f9578063af58d59f1461030e578063b0f479a114610374578063b794658014610385578063c0d786551461039857600080fd5b806354c8a4f31161014b57806379ba50971161012557806379ba50971461029a5780637d54534e146102a25780638926f54f146102b55780638da5cb5b146102c857600080fd5b806354c8a4f3146102615780636d3d1a581461027657806378a010b21461028757600080fd5b806301ffc9a71461019357806303eadcfc146101bb5780630a2fd493146101e657806321df0da714610206578063240028e81461022c578063390775371461023f575b600080fd5b6101a66101a1366004612294565b610458565b60405190151581526020015b60405180910390f35b6009546101ce906001600160a01b031681565b6040516001600160a01b0390911681526020016101b2565b6101f96101f43660046122e3565b6104aa565b6040516101b29190612350565b7f00000000000000000000000000000000000000000000000000000000000000006101ce565b6101a661023a366004612383565b610559565b61025261024d3660046123a0565b61058b565b604051905181526020016101b2565b61027461026f366004612426565b6106d1565b005b6008546001600160a01b03166101ce565b610274610295366004612491565b61074c565b6102746108a3565b6102746102b0366004612383565b61094d565b6101a66102c33660046122e3565b610977565b6000546001600160a01b03166101ce565b6102ec6102e7366004612515565b61098d565b6040516101b2919061254f565b610301610bde565b6040516101b29190612591565b61032161031c3660046122e3565b610bef565b6040516101b2919081516001600160801b03908116825260208084015163ffffffff1690830152604080840151151590830152606080840151821690830152608092830151169181019190915260a00190565b6004546001600160a01b03166101ce565b6101f96103933660046122e3565b610c9c565b6102746103a6366004612383565b610cc6565b6103b3610d56565b6040516101b291906125de565b6103216103ce3660046122e3565b610e0c565b6102746103e1366004612750565b610eb6565b6102746103f4366004612797565b610f0c565b7f00000000000000000000000000000000000000000000000000000000000000006101ce565b7f00000000000000000000000000000000000000000000000000000000000000006101a6565b610274610453366004612383565b6112ce565b60006001600160e01b0319821663aff2afbf60e01b148061048957506001600160e01b03198216630e64dd2960e01b145b806104a457506001600160e01b031982166301ffc9a760e01b145b92915050565b6001600160401b03811660009081526007602052604090206004018054606091906104d4906127d8565b80601f0160208091040260200160405190810160405280929190818152602001828054610500906127d8565b801561054d5780601f106105225761010080835404028352916020019161054d565b820191906000526020600020905b81548152906001019060200180831161053057829003601f168201915b50505050509050919050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b6040805160208101909152600081526105ab6105a68361288f565b6112e2565b6009546000906001600160a01b0316630cca6c0f6105cf60408601602087016122e3565b6105dc60c0870187612983565b6105e960e0890189612983565b6040518663ffffffff1660e01b81526004016106099594939291906129f2565b6020604051808303816000875af1158015610628573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064c9190612a34565b905061065e6060840160408501612383565b6001600160a01b0316336001600160a01b03167f9d228d69b5fdb8d273a2336f8fb8612d039631024ea9bf09c424a9503aa078f0836001600160401b03166040516106ab91815260200190565b60405180910390a360408051602081019091526001600160401b03909116815292915050565b6106d9611454565b610746848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506040805160208088028281018201909352878252909350879250869182918501908490808284376000920191909152506114a992505050565b50505050565b610754611454565b61075d83610977565b61078a57604051631e670e4b60e01b81526001600160401b03841660048201526024015b60405180910390fd5b6001600160401b038316600090815260076020526040812060040180546107b0906127d8565b80601f01602080910402602001604051908101604052809291908181526020018280546107dc906127d8565b80156108295780601f106107fe57610100808354040283529160200191610829565b820191906000526020600020905b81548152906001019060200180831161080c57829003601f168201915b505050506001600160401b038616600090815260076020526040902091925050600401610857838583612aa1565b50836001600160401b03167fdb4d6220746a38cbc5335f7e108f7de80f482f4d23350253dfd0917df75a14bf82858560405161089593929190612b61565b60405180910390a250505050565b6001546001600160a01b031633146108f65760405162461bcd60e51b815260206004820152601660248201527526bab9ba10313290383937b837b9b2b21037bbb732b960511b6044820152606401610781565b60008054336001600160a01b0319808316821784556001805490911690556040516001600160a01b0390921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b610955611454565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b60006104a460056001600160401b038416611612565b60408051808201909152606080825260208201526109b26109ad83612b91565b61162d565b60095460405163095ea7b360e01b81526001600160a01b039182166004820152606084013560248201527f00000000000000000000000000000000000000000000000000000000000000009091169063095ea7b3906044016020604051808303816000875af1158015610a29573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a4d9190612c34565b5060095460009081906001600160a01b031663550e7ab2610a7460408701602088016122e3565b610a7e8780612983565b88606001356040518563ffffffff1660e01b8152600401610aa29493929190612c51565b6000604051808303816000875af1158015610ac1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ae99190810190612c85565b9092509050610afe6060850160408601612383565b6001600160a01b03167f696de425f79f4a40bc6d2122ca50507f0efbeabbff86a84871b7196ab8ea8df783604051610b3891815260200190565b60405180910390a26000600282604051610b529190612d07565b602060405180830381855afa158015610b6f573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190610b929190612d23565b604051602001610ba491815260200190565b60408051601f19818403018152828201825292508190610bcd9061039390890160208a016122e3565b815260200191909152949350505050565b6060610bea6002611751565b905090565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091526001600160401b038216600090815260076020908152604091829020825160a08101845260028201546001600160801b038082168352600160801b80830463ffffffff1695840195909552600160a01b90910460ff1615159482019490945260039091015480841660608301529190910490911660808201526104a49061175e565b6001600160401b03811660009081526007602052604090206005018054606091906104d4906127d8565b610cce611454565b6001600160a01b038116610cf5576040516342bcdf7f60e11b815260040160405180910390fd5b600480546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f02dc5c233404867c793b749c6d644beb2277536d18a7e7974d3f238e4c6f1684910160405180910390a15050565b60606000610d646005611751565b9050600081516001600160401b03811115610d8157610d8161261f565b604051908082528060200260200182016040528015610daa578160200160208202803683370190505b50905060005b8251811015610e0557828181518110610dcb57610dcb612d3c565b6020026020010151828281518110610de557610de5612d3c565b6001600160401b0390921660209283029190910190910152600101610db0565b5092915050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091526001600160401b038216600090815260076020908152604091829020825160a08101845281546001600160801b038082168352600160801b80830463ffffffff1695840195909552600160a01b90910460ff1615159482019490945260019091015480841660608301529190910490911660808201526104a49061175e565b6008546001600160a01b03163314801590610edc57506000546001600160a01b03163314155b15610efc5760405163472511eb60e11b8152336004820152602401610781565b610f078383836117ec565b505050565b610f14611454565b60005b81811015610f07576000838383818110610f3357610f33612d3c565b9050602002810190610f459190612d52565b610f4e90612d69565b9050610f6381608001518260200151156118ba565b610f768160a001518260200151156118ba565b8060200151156111e3578051610f97906005906001600160401b031661197b565b610fc2578051604051631d5ad3c560e01b81526001600160401b039091166004820152602401610781565b6040810151511580610fd75750606081015151155b15610ff5576040516342bcdf7f60e11b815260040160405180910390fd5b6040805161012081018252608083810180516020908101516001600160801b039081168486019081524263ffffffff90811660a0808901829052865151151560c08a01528651860151851660e08a015295518901518416610100890152918752875180860189529489018051850151841686528585019290925281515115158589015281518401518316606080870191909152915188015183168587015283870194855288880151878901908152828a01518389015289516001600160401b031660009081526007865289902088518051825482890151838e01519289166001600160a01b031992831617600160801b91881682021760ff60a01b19908116600160a01b941515850217865584890151948d0151948a16948a168202949094176001860155995180516002860180549b8301519f830151918b169b9093169a909a179d9096168a029c909c1790911696151502959095179098559081015194015193811693169091029190911760038201559151909190600482019061117b9082612e1c565b50606082015160058201906111909082612e1c565b505081516060830151608084015160a08501516040517f8d340f17e19058004c20453540862a9c62778504476f6756755cb33bcd6c38c295506111d69493929190612f05565b60405180910390a16112c5565b80516111fa906005906001600160401b0316611987565b611225578051604051631e670e4b60e01b81526001600160401b039091166004820152602401610781565b80516001600160401b0316600090815260076020526040812080546001600160a81b0319908116825560018201839055600282018054909116905560038101829055906112756004830182612246565b611283600583016000612246565b505080516040516001600160401b0390911681527f5204aec90a3c794d8e90fded8b46ae9c7c552803e7e832e0c1d358396d8599169060200160405180910390a15b50600101610f17565b6112d6611454565b6112df81611993565b50565b6112ef8160800151610559565b61131d57608081015160405163961c9a4f60e01b81526001600160a01b039091166004820152602401610781565b6020810151604051632cbc26bb60e01b815260809190911b67ffffffffffffffff60801b1660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632cbc26bb90602401602060405180830381865afa158015611398573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bc9190612c34565b156113da57604051630a75a23b60e31b815260040160405180910390fd5b6113e78160200151611a3c565b60006113f682602001516104aa565b905080516000148061141a575080805190602001208260a001518051906020012014155b1561143e578160a001516040516324eb47e560e01b81526004016107819190612350565b61145082602001518360600151611b08565b5050565b6000546001600160a01b031633146114a75760405162461bcd60e51b815260206004820152601660248201527527b7363c9031b0b63630b1363290313c9037bbb732b960511b6044820152606401610781565b565b7f00000000000000000000000000000000000000000000000000000000000000006114e7576040516335f4a7b360e01b815260040160405180910390fd5b60005b825181101561157057600083828151811061150757611507612d3c565b60200260200101519050611525816002611b4e90919063ffffffff16565b15611567576040516001600160a01b03821681527f800671136ab6cfee9fbe5ed1fb7ca417811aca3cf864800d127b927adedf75669060200160405180910390a15b506001016114ea565b5060005b8151811015610f0757600082828151811061159157611591612d3c565b6020026020010151905060006001600160a01b0316816001600160a01b0316036115bb575061160a565b6115c6600282611b63565b15611608576040516001600160a01b03821681527f2640d4d76caf8bf478aabfa982fa4e1c4eb71a37f93cd15e80dbc657911546d89060200160405180910390a15b505b600101611574565b600081815260018301602052604081205415155b9392505050565b61163a8160800151610559565b61166857608081015160405163961c9a4f60e01b81526001600160a01b039091166004820152602401610781565b6020810151604051632cbc26bb60e01b815260809190911b67ffffffffffffffff60801b1660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632cbc26bb90602401602060405180830381865afa1580156116e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117079190612c34565b1561172557604051630a75a23b60e31b815260040160405180910390fd5b6117328160400151611b78565b61173f8160200151611bd1565b6112df81602001518260600151611cab565b6060600061162683611cee565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091526117d182606001516001600160801b031683600001516001600160801b0316846020015163ffffffff16426117be9190612f5b565b85608001516001600160801b0316611d49565b6001600160801b031682525063ffffffff4216602082015290565b6117f583610977565b61181d57604051631e670e4b60e01b81526001600160401b0384166004820152602401610781565b6118288260006118ba565b6001600160401b038316600090815260076020526040902061184a9083611d73565b6118558160006118ba565b6001600160401b038316600090815260076020526040902061187a9060020182611d73565b7f0350d63aa5f270e01729d00d627eeb8f3429772b1818c016c66a588a864f912b8383836040516118ad93929190612f6e565b60405180910390a1505050565b8151156119345781602001516001600160801b031682604001516001600160801b03161015806118f5575060408201516001600160801b0316155b156119155781604051632008344960e21b81526004016107819190612f98565b80156114505760405163433fc33d60e01b815260040160405180910390fd5b60408201516001600160801b031615158061195b575060208201516001600160801b031615155b1561145057816040516335a2be7360e21b81526004016107819190612f98565b60006116268383611e8a565b60006116268383611ed9565b336001600160a01b038216036119eb5760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c660000000000000000006044820152606401610781565b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b611a4581610977565b611a6d576040516354c8163f60e11b81526001600160401b0382166004820152602401610781565b600480546040516383826b2b60e01b81526001600160401b038416928101929092523360248301526001600160a01b0316906383826b2b90604401602060405180830381865afa158015611ac5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ae99190612c34565b6112df5760405163728fe07b60e01b8152336004820152602401610781565b6001600160401b038216600090815260076020526040902061145090600201827f0000000000000000000000000000000000000000000000000000000000000000611fcc565b6000611626836001600160a01b038416611ed9565b6000611626836001600160a01b038416611e8a565b7f0000000000000000000000000000000000000000000000000000000000000000156112df57611ba960028261220e565b6112df576040516368692cbb60e11b81526001600160a01b0382166004820152602401610781565b611bda81610977565b611c02576040516354c8163f60e11b81526001600160401b0382166004820152602401610781565b6004805460405163a8d87a3b60e01b81526001600160401b038416928101929092526001600160a01b03169063a8d87a3b90602401602060405180830381865afa158015611c54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c789190612fa6565b6001600160a01b0316336001600160a01b0316146112df5760405163728fe07b60e01b8152336004820152602401610781565b6001600160401b038216600090815260076020526040902061145090827f0000000000000000000000000000000000000000000000000000000000000000611fcc565b60608160000180548060200260200160405190810160405280929190818152602001828054801561054d57602002820191906000526020600020905b815481526020019060010190808311611d2a5750505050509050919050565b6000611d6885611d598486612fc3565b611d639087612fda565b612230565b90505b949350505050565b8154600090611d8f90600160801b900463ffffffff1642612f5b565b90508015611ded5760018301548354611dc1916001600160801b03808216928116918591600160801b90910416611d49565b83546001600160801b03919091166001600160a01b031990911617600160801b4263ffffffff16021783555b60208201518354611e0a916001600160801b039081169116612230565b835483511515600160a01b0274ff00000000ffffffffffffffffffffffffffffffff199091166001600160801b039283161717845560208301516040808501518316600160801b0291909216176001850155517f9ea3374b67bf275e6bb9c8ae68f9cae023e1c528b4b27e092f0bb209d3531c19906118ad908490612f98565b6000818152600183016020526040812054611ed1575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556104a4565b5060006104a4565b60008181526001830160205260408120548015611fc2576000611efd600183612f5b565b8554909150600090611f1190600190612f5b565b9050808214611f76576000866000018281548110611f3157611f31612d3c565b9060005260206000200154905080876000018481548110611f5457611f54612d3c565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611f8757611f87612fed565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506104a4565b60009150506104a4565b8254600160a01b900460ff161580611fe2575081155b15611fec57505050565b825460018401546001600160801b038083169291169060009061201c90600160801b900463ffffffff1642612f5b565b90508015612088578183111561204557604051634b92ca1560e11b815260040160405180910390fd5b600186015461206990839085908490600160801b90046001600160801b0316611d49565b865463ffffffff60801b1916600160801b4263ffffffff160217875592505b848210156120f3576001600160a01b0384166120c15760405163f94ebcd160e01b81526004810183905260248101869052604401610781565b604051630d3b2b9560e11b815260048101839052602481018690526001600160a01b0385166044820152606401610781565b848310156121a457600186810154600160801b90046001600160801b03169060009082906121219082612f5b565b61212b878a612f5b565b6121359190612fda565b61213f9190613003565b90506001600160a01b038616612172576040516302a4f38160e31b81526004810182905260248101869052604401610781565b604051636864691d60e11b815260048101829052602481018690526001600160a01b0387166044820152606401610781565b6121ae8584612f5b565b86546fffffffffffffffffffffffffffffffff19166001600160801b0382161787556040518681529093507f1871cdf8010e63f2eb8384381a68dfa7416dc571a5517e66e88b2d2d0c0a690a9060200160405180910390a1505050505050565b6001600160a01b03811660009081526001830160205260408120541515611626565b600081831061223f5781611626565b5090919050565b508054612252906127d8565b6000825580601f10612262575050565b601f0160209004906000526020600020908101906112df91905b80821115612290576000815560010161227c565b5090565b6000602082840312156122a657600080fd5b81356001600160e01b03198116811461162657600080fd5b6001600160401b03811681146112df57600080fd5b80356122de816122be565b919050565b6000602082840312156122f557600080fd5b8135611626816122be565b60005b8381101561231b578181015183820152602001612303565b50506000910152565b6000815180845261233c816020860160208601612300565b601f01601f19169290920160200192915050565b6020815260006116266020830184612324565b6001600160a01b03811681146112df57600080fd5b80356122de81612363565b60006020828403121561239557600080fd5b813561162681612363565b6000602082840312156123b257600080fd5b81356001600160401b038111156123c857600080fd5b8201610100818503121561162657600080fd5b60008083601f8401126123ed57600080fd5b5081356001600160401b0381111561240457600080fd5b6020830191508360208260051b850101111561241f57600080fd5b9250929050565b6000806000806040858703121561243c57600080fd5b84356001600160401b038082111561245357600080fd5b61245f888389016123db565b9096509450602087013591508082111561247857600080fd5b50612485878288016123db565b95989497509550505050565b6000806000604084860312156124a657600080fd5b83356124b1816122be565b925060208401356001600160401b03808211156124cd57600080fd5b818601915086601f8301126124e157600080fd5b8135818111156124f057600080fd5b87602082850101111561250257600080fd5b6020830194508093505050509250925092565b60006020828403121561252757600080fd5b81356001600160401b0381111561253d57600080fd5b820160a0818503121561162657600080fd5b60208152600082516040602084015261256b6060840182612324565b90506020840151601f198483030160408501526125888282612324565b95945050505050565b6020808252825182820181905260009190848201906040850190845b818110156125d25783516001600160a01b0316835292840192918401916001016125ad565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156125d25783516001600160401b0316835292840192918401916001016125fa565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b03811182821017156126585761265861261f565b60405290565b60405160c081016001600160401b03811182821017156126585761265861261f565b604051601f8201601f191681016001600160401b03811182821017156126a8576126a861261f565b604052919050565b80151581146112df57600080fd5b80356122de816126b0565b80356001600160801b03811681146122de57600080fd5b6000606082840312156126f257600080fd5b604051606081018181106001600160401b03821117156127145761271461261f565b6040529050808235612725816126b0565b8152612733602084016126c9565b6020820152612744604084016126c9565b60408201525092915050565b600080600060e0848603121561276557600080fd5b8335612770816122be565b925061277f85602086016126e0565b915061278e85608086016126e0565b90509250925092565b600080602083850312156127aa57600080fd5b82356001600160401b038111156127c057600080fd5b6127cc858286016123db565b90969095509350505050565b600181811c908216806127ec57607f821691505b60208210810361280c57634e487b7160e01b600052602260045260246000fd5b50919050565b60006001600160401b0382111561282b5761282b61261f565b50601f01601f191660200190565b600082601f83011261284a57600080fd5b813561285d61285882612812565b612680565b81815284602083860101111561287257600080fd5b816020850160208301376000918101602001919091529392505050565b600061010082360312156128a257600080fd5b6128aa612635565b82356001600160401b03808211156128c157600080fd5b6128cd36838701612839565b83526128db602086016122d3565b60208401526128ec60408601612378565b60408401526060850135606084015261290760808601612378565b608084015260a085013591508082111561292057600080fd5b61292c36838701612839565b60a084015260c085013591508082111561294557600080fd5b61295136838701612839565b60c084015260e085013591508082111561296a57600080fd5b5061297736828601612839565b60e08301525092915050565b6000808335601e1984360301811261299a57600080fd5b8301803591506001600160401b038211156129b457600080fd5b60200191503681900382131561241f57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160401b0386168152606060208201526000612a156060830186886129c9565b8281036040840152612a288185876129c9565b98975050505050505050565b600060208284031215612a4657600080fd5b8151611626816122be565b601f821115610f07576000816000526020600020601f850160051c81016020861015612a7a5750805b601f850160051c820191505b81811015612a9957828155600101612a86565b505050505050565b6001600160401b03831115612ab857612ab861261f565b612acc83612ac683546127d8565b83612a51565b6000601f841160018114612b005760008515612ae85750838201355b600019600387901b1c1916600186901b178355612b5a565b600083815260209020601f19861690835b82811015612b315786850135825560209485019460019092019101612b11565b5086821015612b4e5760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b604081526000612b746040830186612324565b8281036020840152612b878185876129c9565b9695505050505050565b600060a08236031215612ba357600080fd5b60405160a081016001600160401b038282108183111715612bc657612bc661261f565b816040528435915080821115612bdb57600080fd5b50612be836828601612839565b8252506020830135612bf9816122be565b60208201526040830135612c0c81612363565b6040820152606083810135908201526080830135612c2981612363565b608082015292915050565b600060208284031215612c4657600080fd5b8151611626816126b0565b6001600160401b0385168152606060208201526000612c746060830185876129c9565b905082604083015295945050505050565b60008060408385031215612c9857600080fd5b8251915060208301516001600160401b03811115612cb557600080fd5b8301601f81018513612cc657600080fd5b8051612cd461285882612812565b818152866020838501011115612ce957600080fd5b612cfa826020830160208601612300565b8093505050509250929050565b60008251612d19818460208701612300565b9190910192915050565b600060208284031215612d3557600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6000823561013e19833603018112612d1957600080fd5b60006101408236031215612d7c57600080fd5b612d8461265e565b612d8d836122d3565b8152612d9b602084016126be565b602082015260408301356001600160401b0380821115612dba57600080fd5b612dc636838701612839565b60408401526060850135915080821115612ddf57600080fd5b50612dec36828601612839565b606083015250612dff36608085016126e0565b6080820152612e113660e085016126e0565b60a082015292915050565b81516001600160401b03811115612e3557612e3561261f565b612e4981612e4384546127d8565b84612a51565b602080601f831160018114612e7e5760008415612e665750858301515b600019600386901b1c1916600185901b178555612a99565b600085815260208120601f198616915b82811015612ead57888601518255948401946001909101908401612e8e565b5085821015612ecb5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b8051151582526020808201516001600160801b039081169184019190915260409182015116910152565b60006101006001600160401b0387168352806020840152612f2881840187612324565b915050612f386040830185612edb565b61258860a0830184612edb565b634e487b7160e01b600052601160045260246000fd5b818103818111156104a4576104a4612f45565b6001600160401b038416815260e08101612f8b6020830185612edb565b611d6b6080830184612edb565b606081016104a48284612edb565b600060208284031215612fb857600080fd5b815161162681612363565b80820281158282048414176104a4576104a4612f45565b808201808211156104a4576104a4612f45565b634e487b7160e01b600052603160045260246000fd5b60008261302057634e487b7160e01b600052601260045260246000fd5b50049056fea2646970667358221220e38151fc11019f3ac1ad014b4852d3a196843d1f0ce7cce7a67fd8258d58358a64736f6c63430008180033000000000000000000000000a869817b48b25eee986bdf4be04062e6fd2c418b00000000000000000000000000000000000000000000000000000000000493e00000000000000000000000007c19b79d2a054114ab36ad758a36e92376e267da00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000032270e4fa459ca47ae0334488e27ffb9bc9ab4a10000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106101145760003560e01c8063715886c4116100a0578063b1ab7e2211610064578063b1ab7e2214610337578063bc3da53514610357578063e240550d14610384578063e78cea92146103a4578063f2fde38b146103c457600080fd5b8063715886c41461025d578063775710d4146102705780638da5cb5b146102a657806392b0680a146102c4578063a1a6d508146102fc57600080fd5b8063110f8874116100e7578063110f8874146101d0578063453bb95c146101e5578063550e7ab21461020557806368b3c91014610233578063715018a61461024857600080fd5b806308774410146101195780630c373d741461013b5780630cca6c0f14610178578063104e992914610198575b600080fd5b34801561012557600080fd5b506101396101343660046116d5565b6103e4565b005b34801561014757600080fd5b5061015b61015636600461174f565b610445565b6040516001600160401b0390911681526020015b60405180910390f35b34801561018457600080fd5b5061015b6101933660046117a3565b61056a565b3480156101a457600080fd5b506006546101b8906001600160a01b031681565b6040516001600160a01b03909116815260200161016f565b3480156101dc57600080fd5b50610139610743565b3480156101f157600080fd5b50610139610200366004611825565b6107de565b34801561021157600080fd5b50610225610220366004611855565b610912565b60405161016f929190611900565b34801561023f57600080fd5b506101b8610c96565b34801561025457600080fd5b50610139610d13565b61013961026b3660046119dc565b610d25565b34801561027c57600080fd5b5061015b61028b366004611a50565b6003602052600090815260409020546001600160401b031681565b3480156102b257600080fd5b506001546001600160a01b03166101b8565b3480156102d057600080fd5b506005546102e4906001600160801b031681565b6040516001600160801b03909116815260200161016f565b34801561030857600080fd5b50610329610317366004611a69565b60046020526000908152604090205481565b60405190815260200161016f565b34801561034357600080fd5b50610329610352366004611a86565b610ffc565b34801561036357600080fd5b506103296103723660046116d5565b60096020526000908152604090205481565b34801561039057600080fd5b5061013961039f366004611ae9565b611126565b3480156103b057600080fd5b506000546101b8906001600160a01b031681565b3480156103d057600080fd5b506101396103df3660046116d5565b61113a565b6103ec611175565b6103f58161117d565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917fd565484d693f5157abcceb853139678038bc740991b0a4dc3baa2426325bb3c09190a35050565b6006546000906001600160a01b0316331461048657335b604051631b585c9760e11b81526001600160a01b0390911660048201526024015b60405180910390fd5b6104eb60046000866001600160401b03166001600160401b031681526020019081526020016000205484848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506111a492505050565b60005460405163025a3c9960e21b81526001600160a01b0390911690630968f2649061051d9086908690600401611b12565b6020604051808303816000875af115801561053c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105609190611b41565b90505b9392505050565b6006546000906001600160a01b03163314610585573361045c565b602084146105a65760405163607484d560e11b815260040160405180910390fd5b6000806105b584860186611b5e565b915091506002826040516105c99190611bc1565b602060405180830381855afa1580156105e6573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906106099190611bdd565b61061760206000898b611bf6565b61062091611c20565b1461063d5760405162e33d8b60e61b815260040160405180910390fd5b6001600160401b03881660009081526004602052604090205461066090836111a4565b600054604051636b93aa5160e01b81526001600160a01b0390911690636b93aa51906106929085908590600401611c3e565b600060405180830381600087803b1580156106ac57600080fd5b505af11580156106c0573d6000803e3d6000fd5b505060005460405163025a3c9960e21b81526001600160a01b039091169250630968f26491506106f4908590600401611c6c565b6020604051808303816000875af1158015610713573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107379190611b41565b98975050505050505050565b61074b611204565b33600081815260096020526040808220805490839055905190929083908381818185875af1925050503d80600081146107a0576040519150601f19603f3d011682016040523d82523d6000602084013e6107a5565b606091505b50509050806107d057604051634dd98c2f60e11b81523360048201526024810183905260440161047d565b50506107dc6001600255565b565b6107e661122c565b816108045760405163e531cb7360e01b815260040160405180910390fd5b806001600160401b031660000361082e5760405163e531cb7360e01b815260040160405180910390fd5b6000828152600360205260409020546001600160401b03161561086457604051635b97bc1560e11b815260040160405180910390fd5b6001600160401b0381166000908152600460205260409020541561089b5760405163e95ca6dd60e01b815260040160405180910390fd5b6000828152600360209081526040808320805467ffffffffffffffff19166001600160401b03861690811790915580845260048352928190208590558051858152918201929092527f61805347ac73c642ed5bfbc228e1702a4d51591b36a35387250de0c0d75b0072910160405180910390a15050565b6006546000906060906001600160a01b03163314610930573361045c565b61094361093b610c96565b333086611259565b60006008805461095290611c7f565b90501115610a395760075491506008805461096c90611c7f565b80601f016020809104026020016040519081016040528092919081815260200182805461099890611c7f565b80156109e55780601f106109ba576101008083540402835291602001916109e5565b820191906000526020600020905b8154815290600101906020018083116109c857829003601f168201915b50939450600093506109f692505050565b6040519080825280601f01601f191660200182016040528015610a20576020820181803683370190505b50600890610a2e9082611d01565b506000600755610bb9565b6020841115610a5a57604051625fa1f560e31b815260040160405180910390fd5b680100000000000000008310610a8357604051630590fb9f60e01b815260040160405180910390fd5b610a8b610c96565b60005460405163095ea7b360e01b81526001600160a01b0391821660048201526024810186905291169063095ea7b3906044016020604051808303816000875af1158015610add573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b019190611dc0565b50600080546001600160401b038816825260046020526040909120546001600160a01b03909116906383031c4190610b398789611c20565b6040516001600160e01b031960e085901b168152600481019290925260248201526001600160401b03861660448201526064016000604051808303816000875af1158015610b8b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610bb39190810190611de2565b90925090505b60008054906101000a90046001600160a01b03166001600160a01b03166368b3c9106040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2e9190611e64565b6001600160a01b03166342966c68836040518263ffffffff1660e01b8152600401610c5b91815260200190565b600060405180830381600087803b158015610c7557600080fd5b505af1158015610c89573d6000803e3d6000fd5b5050505094509492505050565b60008060009054906101000a90046001600160a01b03166001600160a01b03166368b3c9106040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0e9190611e64565b905090565b610d1b61122c565b6107dc60006112b9565b610d2d61130b565b610d40610d38610c96565b333085611259565b6001600160a01b0386163014610ff45760078290556008610d618282611d01565b5060008581526003602090815260408083205481519283018790526001600160401b03169291610da191016040516020818303038152906040528561133f565b90506000600660009054906101000a90046001600160a01b03166001600160a01b031663b0f479a16040518163ffffffff1660e01b8152600401602060405180830381865afa158015610df8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e1c9190611e64565b90506000816001600160a01b03166320487ded85856040518363ffffffff1660e01b8152600401610e4e929190611e81565b602060405180830381865afa158015610e6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e8f9190611bdd565b905080341015610eb55760405163af09dec960e01b81526004810182905260240161047d565b80341115610efd576000610ec98234611f73565b6001600160a01b038c16600090815260096020526040812080549293508392909190610ef6908490611f86565b9091555050505b610f05610c96565b60405163095ea7b360e01b81526001600160a01b03848116600483015260248201899052919091169063095ea7b3906044016020604051808303816000875af1158015610f56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7a9190611dc0565b506040516396f4e9f960e01b81526001600160a01b038316906396f4e9f9908390610fab9088908890600401611e81565b60206040518083038185885af1158015610fc9573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610fee9190611bdd565b50505050505b505050505050565b6006546040805163b0f479a160e01b815290516000926001600160a01b03169163b0f479a19160048083019260209291908290030181865afa158015611046573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106a9190611e64565b6000878152600360209081526040918290205482519182018890526001600160a01b0393909316926320487ded926001600160401b03909116916110be91016040516020818303038152906040528761133f565b6040518363ffffffff1660e01b81526004016110db929190611e81565b602060405180830381865afa1580156110f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061111c9190611bdd565b9695505050505050565b61112e61122c565b611137816114fb565b50565b61114261122c565b6001600160a01b03811661116c57604051631e4fbdf760e01b81526000600482015260240161047d565b611137816112b9565b6107dc61122c565b6001600160a01b0381166111375760405163cf891a8760e01b815260040160405180910390fd5b600054604051638783f52560e01b81526001600160a01b0390911690638783f525906111d69085908590600401611900565b600060405180830381600087803b1580156111f057600080fd5b505af1158015610ff4573d6000803e3d6000fd5b600280540361122657604051633ee5aeb560e01b815260040160405180910390fd5b60028055565b6001546001600160a01b031633146107dc5760405163118cdaa760e01b815233600482015260240161047d565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526112b3908590611560565b50505050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000546001600160a01b0316336001600160a01b0316146107dc57604051637fea9dc560e01b815260040160405180910390fd5b61137a6040518060a0016040528060608152602001606081526020016060815260200160006001600160a01b03168152602001606081525090565b604080516001808252818301909252600091816020015b60408051808201909152600080825260208201528152602001906001900390816113915750506040805180820180835260005463068b3c9160e41b90915291519293509182916001600160a01b0316906368b3c910906044808501916020918187030181865afa158015611409573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061142d9190611e64565b6001600160a01b03168152602001848152508160008151811061145257611452611f99565b6020908102919091018101919091526040805160a081018252868152815180840183526000808252828501919091528183018590526060820152815180830183526005546001600160801b03168082526001918501918252835160248101919091529051151560448083019190915283518083039091018152606490910190925291810180516001600160e01b0316630181dcf160e41b17905260808201529150505b92915050565b6005546040516001600160801b038084169216907f45a4a024e3d155ab5b1634193775d00d4cbf4ef295e76d0bf1aa6dfeb114dd8490600090a3600580546fffffffffffffffffffffffffffffffff19166001600160801b0392909216919091179055565b60006115756001600160a01b038416836115c8565b9050805160001415801561159a5750808060200190518101906115989190611dc0565b155b156115c357604051635274afe760e01b81526001600160a01b038416600482015260240161047d565b505050565b60606105638383600084600080856001600160a01b031684866040516115ee9190611bc1565b60006040518083038185875af1925050503d806000811461162b576040519150601f19603f3d011682016040523d82523d6000602084013e611630565b606091505b509150915061111c8683836060826116505761164b82611697565b610563565b815115801561166757506001600160a01b0384163b155b1561169057604051639996b31560e01b81526001600160a01b038516600482015260240161047d565b5080610563565b8051156116a75780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6001600160a01b038116811461113757600080fd5b6000602082840312156116e757600080fd5b8135610563816116c0565b6001600160401b038116811461113757600080fd5b60008083601f84011261171957600080fd5b5081356001600160401b0381111561173057600080fd5b60208301915083602082850101111561174857600080fd5b9250929050565b60008060006040848603121561176457600080fd5b833561176f816116f2565b925060208401356001600160401b0381111561178a57600080fd5b61179686828701611707565b9497909650939450505050565b6000806000806000606086880312156117bb57600080fd5b85356117c6816116f2565b945060208601356001600160401b03808211156117e257600080fd5b6117ee89838a01611707565b9096509450604088013591508082111561180757600080fd5b5061181488828901611707565b969995985093965092949392505050565b6000806040838503121561183857600080fd5b82359150602083013561184a816116f2565b809150509250929050565b6000806000806060858703121561186b57600080fd5b8435611876816116f2565b935060208501356001600160401b0381111561189157600080fd5b61189d87828801611707565b9598909750949560400135949350505050565b60005b838110156118cb5781810151838201526020016118b3565b50506000910152565b600081518084526118ec8160208601602086016118b0565b601f01601f19169290920160200192915050565b82815260406020820152600061056060408301846118d4565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561195757611957611919565b604052919050565b60006001600160401b0382111561197857611978611919565b50601f01601f191660200190565b600082601f83011261199757600080fd5b81356119aa6119a58261195f565b61192f565b8181528460208386010111156119bf57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060008060c087890312156119f557600080fd5b8635611a00816116c0565b95506020870135945060408701359350606087013592506080870135915060a08701356001600160401b03811115611a3757600080fd5b611a4389828a01611986565b9150509295509295509295565b600060208284031215611a6257600080fd5b5035919050565b600060208284031215611a7b57600080fd5b8135610563816116f2565b600080600080600060a08688031215611a9e57600080fd5b8535945060208601359350604086013592506060860135915060808601356001600160401b03811115611ad057600080fd5b611adc88828901611986565b9150509295509295909350565b600060208284031215611afb57600080fd5b81356001600160801b038116811461056357600080fd5b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b600060208284031215611b5357600080fd5b8151610563816116f2565b60008060408385031215611b7157600080fd5b82356001600160401b0380821115611b8857600080fd5b611b9486838701611986565b93506020850135915080821115611baa57600080fd5b50611bb785828601611986565b9150509250929050565b60008251611bd38184602087016118b0565b9190910192915050565b600060208284031215611bef57600080fd5b5051919050565b60008085851115611c0657600080fd5b83861115611c1357600080fd5b5050820193919092039150565b803560208310156114f557600019602084900360031b1b1692915050565b604081526000611c5160408301856118d4565b8281036020840152611c6381856118d4565b95945050505050565b60208152600061056360208301846118d4565b600181811c90821680611c9357607f821691505b602082108103611cb357634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156115c3576000816000526020600020601f850160051c81016020861015611ce25750805b601f850160051c820191505b81811015610ff457828155600101611cee565b81516001600160401b03811115611d1a57611d1a611919565b611d2e81611d288454611c7f565b84611cb9565b602080601f831160018114611d635760008415611d4b5750858301515b600019600386901b1c1916600185901b178555610ff4565b600085815260208120601f198616915b82811015611d9257888601518255948401946001909101908401611d73565b5085821015611db05787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208284031215611dd257600080fd5b8151801515811461056357600080fd5b60008060408385031215611df557600080fd5b8251915060208301516001600160401b03811115611e1257600080fd5b8301601f81018513611e2357600080fd5b8051611e316119a58261195f565b818152866020838501011115611e4657600080fd5b611e578260208301602086016118b0565b8093505050509250929050565b600060208284031215611e7657600080fd5b8151610563816116c0565b600060406001600160401b03851683526020604081850152845160a06040860152611eaf60e08601826118d4565b905081860151603f1980878403016060880152611ecc83836118d4565b6040890151888203830160808a01528051808352908601945060009350908501905b80841015611f2057845180516001600160a01b0316835286015186830152938501936001939093019290860190611eee565b5060608901516001600160a01b031660a08901526080890151888203830160c08a01529550611f4f81876118d4565b9a9950505050505050505050565b634e487b7160e01b600052601160045260246000fd5b818103818111156114f5576114f5611f5d565b808201808211156114f5576114f5611f5d565b634e487b7160e01b600052603260045260246000fdfea2646970667358221220b9c7110de1ef1b4f8eb18b6db60477d039fbc925f32be6f459e6dc2703d95bd664736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000a869817b48b25eee986bdf4be04062e6fd2c418b00000000000000000000000000000000000000000000000000000000000493e00000000000000000000000007c19b79d2a054114ab36ad758a36e92376e267da00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000032270e4fa459ca47ae0334488e27ffb9bc9ab4a10000000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : bridge_ (address): 0xA869817b48b25EeE986bdF4bE04062e6fd2C418B
Arg [1] : executionGasLimit_ (uint128): 300000
Arg [2] : ccipRouter_ (address): 0x7c19b79D2a054114Ab36ad758A36e92376e267DA
Arg [3] : allowlist_ (address[]):
Arg [4] : rmnProxy_ (address): 0x32270E4FA459cA47ae0334488e27ffb9bC9aB4a1
-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 000000000000000000000000a869817b48b25eee986bdf4be04062e6fd2c418b
Arg [1] : 00000000000000000000000000000000000000000000000000000000000493e0
Arg [2] : 0000000000000000000000007c19b79d2a054114ab36ad758a36e92376e267da
Arg [3] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [4] : 00000000000000000000000032270e4fa459ca47ae0334488e27ffb9bc9ab4a1
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000000
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| KATANA | 100.00% | $2,977.29 | 0.00096293 | $2.87 |
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.