Overview
ETH Balance
0 ETH
Eth Value
$0.00Token Holdings
More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 3,714 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Receive Circle T... | 18777811 | 381 days ago | IN | 0 ETH | 0.01038253 | ||||
Receive Circle T... | 18777557 | 381 days ago | IN | 0 ETH | 0.01163057 | ||||
Receive Circle T... | 18777557 | 381 days ago | IN | 0 ETH | 0.01162945 | ||||
Receive Circle T... | 18777051 | 382 days ago | IN | 0 ETH | 0.01058753 | ||||
Receive Circle T... | 18776945 | 382 days ago | IN | 0 ETH | 0.02701099 | ||||
Receive Circle T... | 18776893 | 382 days ago | IN | 0 ETH | 0.01092295 | ||||
Receive Circle T... | 18776862 | 382 days ago | IN | 0 ETH | 0.00936769 | ||||
Receive Circle T... | 18776734 | 382 days ago | IN | 0 ETH | 0.0074564 | ||||
Receive Circle T... | 18776290 | 382 days ago | IN | 0 ETH | 0.00769444 | ||||
Receive Circle T... | 18776123 | 382 days ago | IN | 0 ETH | 0.00886163 | ||||
Receive Circle T... | 18775990 | 382 days ago | IN | 0 ETH | 0.0069966 | ||||
Receive Circle T... | 18775971 | 382 days ago | IN | 0 ETH | 0.0079211 | ||||
Receive Circle T... | 18775718 | 382 days ago | IN | 0 ETH | 0.00856386 | ||||
Receive Circle T... | 18775681 | 382 days ago | IN | 0 ETH | 0.00851598 | ||||
Receive Circle T... | 18775546 | 382 days ago | IN | 0 ETH | 0.00811502 | ||||
Receive Circle T... | 18775273 | 382 days ago | IN | 0 ETH | 0.00917206 | ||||
Receive Circle T... | 18774925 | 382 days ago | IN | 0 ETH | 0.01119325 | ||||
Receive Circle T... | 18774768 | 382 days ago | IN | 0 ETH | 0.00974122 | ||||
Receive Circle T... | 18774352 | 382 days ago | IN | 0 ETH | 0.0128852 | ||||
Receive Circle T... | 18774282 | 382 days ago | IN | 0 ETH | 0.02354263 | ||||
Receive Circle T... | 18774248 | 382 days ago | IN | 0 ETH | 0.01297074 | ||||
Receive Circle T... | 18774224 | 382 days ago | IN | 0 ETH | 0.01047278 | ||||
Receive Circle T... | 18774210 | 382 days ago | IN | 0 ETH | 0.01160024 | ||||
Receive Circle T... | 18774154 | 382 days ago | IN | 0 ETH | 0.01135548 | ||||
Receive Circle T... | 18774091 | 382 days ago | IN | 0 ETH | 0.01060454 |
Latest 25 internal transactions (View All)
Advanced mode:
Loading...
Loading
Contract Name:
SynapseCCTP
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; // prettier-ignore import { CCTPIncorrectChainId, CCTPIncorrectDomain, CCTPIncorrectGasAmount, CCTPMessageNotReceived, CCTPTokenNotFound, CCTPZeroAddress, CCTPZeroAmount, RemoteCCTPDeploymentNotSet, RemoteCCTPTokenNotSet } from "./libs/Errors.sol"; import {SynapseCCTPEvents} from "./events/SynapseCCTPEvents.sol"; import {EnumerableSet, SynapseCCTPFees} from "./fees/SynapseCCTPFees.sol"; import {IMessageTransmitter} from "./interfaces/IMessageTransmitter.sol"; import {ISynapseCCTP} from "./interfaces/ISynapseCCTP.sol"; import {ITokenMinter} from "./interfaces/ITokenMinter.sol"; import {ITokenMessenger} from "./interfaces/ITokenMessenger.sol"; import {RequestLib} from "./libs/Request.sol"; import {MinimalForwarderLib} from "./libs/MinimalForwarder.sol"; import {TypeCasts} from "./libs/TypeCasts.sol"; import {IDefaultPool} from "../router/interfaces/IDefaultPool.sol"; import {SafeERC20, IERC20} from "@openzeppelin/contracts-4.5.0/token/ERC20/utils/SafeERC20.sol"; import {Pausable} from "@openzeppelin/contracts-4.5.0/security/Pausable.sol"; contract SynapseCCTP is SynapseCCTPFees, Pausable, SynapseCCTPEvents, ISynapseCCTP { using EnumerableSet for EnumerableSet.AddressSet; using MinimalForwarderLib for address; using SafeERC20 for IERC20; using TypeCasts for address; using TypeCasts for bytes32; /// @notice Struct defining the configuration of a remote domain that has SynapseCCTP deployed. /// @dev CCTP uses the following convention for domain numbers: /// - 0: Ethereum Mainnet /// - 1: Avalanche Mainnet /// With more chains added, the convention will be extended. /// @param domain Value for the remote domain used in CCTP messages. /// @param synapseCCTP Address of the SynapseCCTP deployed on the remote chain. struct DomainConfig { uint32 domain; address synapseCCTP; } /// @notice Refers to the local domain number used in CCTP messages. uint32 public immutable localDomain; IMessageTransmitter public immutable messageTransmitter; ITokenMessenger public immutable tokenMessenger; // (chainId => configuration of the remote chain) mapping(uint256 => DomainConfig) public remoteDomainConfig; // (Circle token => liquidity pool with the token) mapping(address => address) public circleTokenPool; constructor(ITokenMessenger tokenMessenger_, address owner_) { tokenMessenger = tokenMessenger_; messageTransmitter = IMessageTransmitter(tokenMessenger_.localMessageTransmitter()); localDomain = messageTransmitter.localDomain(); _transferOwnership(owner_); } // ═════════════════════════════════════════════ SET CONFIG LOGIC ══════════════════════════════════════════════════ /// @notice Sets the remote domain and deployment of SynapseCCTP for the given remote chainId. function setRemoteDomainConfig( uint256 remoteChainId, uint32 remoteDomain, address remoteSynapseCCTP ) external onlyOwner { // ChainId should be non-zero and different from the local chain id. if (remoteChainId == 0 || remoteChainId == block.chainid) revert CCTPIncorrectChainId(); // Remote domain should differ from the local domain. if (remoteDomain == localDomain) revert CCTPIncorrectDomain(); // Remote domain should be 0 IF AND ONLY IF remote chain id is 1 (Ethereum Mainnet). if ((remoteDomain == 0) != (remoteChainId == 1)) revert CCTPIncorrectDomain(); // Remote SynapseCCTP should be non-zero. if (remoteSynapseCCTP == address(0)) revert CCTPZeroAddress(); remoteDomainConfig[remoteChainId] = DomainConfig(remoteDomain, remoteSynapseCCTP); } /// @notice Sets the liquidity pool for the given Circle token. function setCircleTokenPool(address circleToken, address pool) external onlyOwner { if (circleToken == address(0)) revert CCTPZeroAddress(); if (!_bridgeTokens.contains(circleToken)) revert CCTPTokenNotFound(); // Pool address can be zero if no swaps are supported for the Circle token. circleTokenPool[circleToken] = pool; } /// @notice Allows the contract owner to pause the sending of CCTP tokens. /// Note: this does not affect the receiving of CCTP tokens. function pauseSending() external onlyOwner { _pause(); } /// @notice Allows the contract owner to unpause the sending of CCTP tokens. /// Note: this does not affect the receiving of CCTP tokens. function unpauseSending() external onlyOwner { _unpause(); } // ═════════════════════════════════════════════ FEES WITHDRAWING ══════════════════════════════════════════════════ /// @notice Allows the owner to withdraw accumulated protocol fees. function withdrawProtocolFees(address token) external onlyOwner { uint256 accFees = accumulatedFees[address(0)][token]; if (accFees == 0) revert CCTPZeroAmount(); accumulatedFees[address(0)][token] = 0; IERC20(token).safeTransfer(msg.sender, accFees); } /// @notice Allows the Relayer's fee collector to withdraw accumulated relayer fees. function withdrawRelayerFees(address token) external { uint256 accFees = accumulatedFees[msg.sender][token]; if (accFees == 0) revert CCTPZeroAmount(); accumulatedFees[msg.sender][token] = 0; IERC20(token).safeTransfer(msg.sender, accFees); } // ════════════════════════════════════════════════ CCTP LOGIC ═════════════════════════════════════════════════════ /// @inheritdoc ISynapseCCTP function sendCircleToken( address recipient, uint256 chainId, address burnToken, uint256 amount, uint32 requestVersion, bytes memory swapParams ) external whenNotPaused { // Check if token is supported before doing anything else. if (!_bridgeTokens.contains(burnToken)) revert CCTPTokenNotFound(); // Pull token from user and update the amount in case of transfer fee. amount = _pullToken(burnToken, amount); uint64 nonce = messageTransmitter.nextAvailableNonce(); // This will revert if the request version is not supported, or swap params are not properly formatted. bytes memory formattedRequest = RequestLib.formatRequest( requestVersion, RequestLib.formatBaseRequest(localDomain, nonce, burnToken, amount, recipient), swapParams ); DomainConfig memory config = remoteDomainConfig[chainId]; bytes32 dstSynapseCCTP = config.synapseCCTP.addressToBytes32(); if (dstSynapseCCTP == 0) revert RemoteCCTPDeploymentNotSet(); uint32 destinationDomain = config.domain; // Construct the request identifier to be used as salt later. // The identifier (requestID) is unique for every single request on all the chains. // This is done by including origin and destination domains as well as origin nonce in the hashed data. // Origin domain and nonce are included in `formattedRequest`, so we only need to add the destination domain. bytes32 requestID = _requestID(destinationDomain, requestVersion, formattedRequest); // Issue allowance if needed _approveToken(burnToken, address(tokenMessenger), amount); tokenMessenger.depositForBurnWithCaller( amount, destinationDomain, dstSynapseCCTP, burnToken, _destinationCaller(dstSynapseCCTP.bytes32ToAddress(), requestID) ); // We want to emit the EOA address that initiated the transaction as "sender", // so we use `tx.origin` instead of `msg.sender`. // Note: this is done for analytics only, and should NOT be used by off-chain actors // for security purposes. // solhint-disable avoid-tx-origin emit CircleRequestSent( chainId, tx.origin, nonce, burnToken, amount, requestVersion, formattedRequest, requestID ); } /// @inheritdoc ISynapseCCTP function receiveCircleToken( bytes calldata message, bytes calldata signature, uint32 requestVersion, bytes memory formattedRequest ) external payable { // Check that the Relayer provided correct `msg.value` if (msg.value != chainGasAmount) revert CCTPIncorrectGasAmount(); (bytes memory baseRequest, bytes memory swapParams) = RequestLib.decodeRequest( requestVersion, formattedRequest ); (uint32 originDomain, , address originBurnToken, uint256 amount, address recipient) = RequestLib .decodeBaseRequest(baseRequest); // For requestID hashing we use origin and destination domains as well as origin nonce. // This ensures that requestID is unique for each request, and that it is not possible to replay requests. bytes32 requestID = _requestID(localDomain, requestVersion, formattedRequest); // Kindly ask the Circle Bridge to mint the tokens for us. _mintCircleToken(message, signature, requestID); address token = _getLocalToken(originDomain, originBurnToken); uint256 fee; // Apply the bridging fee. This will revert if amount <= fee. (amount, fee) = _applyRelayerFee(token, amount, requestVersion == RequestLib.REQUEST_SWAP); // Fulfill the request: perform an optional swap and send the end tokens to the recipient. (address tokenOut, uint256 amountOut) = _fulfillRequest(recipient, token, amount, swapParams); // Perform the gas airdrop and emit corresponding event if gas airdrop is enabled if (msg.value > 0) _transferMsgValue(recipient); emit CircleRequestFulfilled(originDomain, recipient, token, fee, tokenOut, amountOut, requestID); } // ═══════════════════════════════════════════════════ VIEWS ═══════════════════════════════════════════════════════ /// @notice Get the local token associated with the given remote domain and token. function getLocalToken(uint32 remoteDomain, address remoteToken) external view returns (address) { return _getLocalToken(remoteDomain, remoteToken); } /// @notice Checks if the given request is already fulfilled. function isRequestFulfilled(bytes32 requestID) external view returns (bool) { // Request is fulfilled if the requestID is already used, meaning the forwarder is already deployed. return MinimalForwarderLib.predictAddress(address(this), requestID).code.length > 0; } // ══════════════════════════════════════════════ INTERNAL LOGIC ═══════════════════════════════════════════════════ /// @dev Approves the token to be spent by the given spender indefinitely by giving infinite allowance. /// Doesn't modify the allowance if it's already enough for the given amount. function _approveToken( address token, address spender, uint256 amount ) internal { uint256 allowance = IERC20(token).allowance(address(this), spender); if (allowance < amount) { // Reset allowance to 0 before setting it to the new value. if (allowance != 0) IERC20(token).safeApprove(spender, 0); IERC20(token).safeApprove(spender, type(uint256).max); } } /// @dev Pulls the token from the sender. function _pullToken(address token, uint256 amount) internal returns (uint256 amountPulled) { uint256 balanceBefore = IERC20(token).balanceOf(address(this)); IERC20(token).safeTransferFrom(msg.sender, address(this), amount); amountPulled = IERC20(token).balanceOf(address(this)) - balanceBefore; } /// @dev Mints the Circle token by sending the message and signature to the Circle Bridge. function _mintCircleToken( bytes calldata message, bytes calldata signature, bytes32 requestID ) internal { // Deploy a forwarder specific to this request. Will revert if the requestID has been used before. address forwarder = MinimalForwarderLib.deploy(requestID); // Form the payload for the Circle Bridge. bytes memory payload = abi.encodeWithSelector(IMessageTransmitter.receiveMessage.selector, message, signature); // Use the deployed forwarder (who is the only one who can call the Circle Bridge for this message) // This will revert if the provided message is not properly formatted, or if the signatures are invalid. bytes memory returnData = forwarder.forwardCall(address(messageTransmitter), payload); // messageTransmitter.receiveMessage is supposed to return true if the message was received. if (!abi.decode(returnData, (bool))) revert CCTPMessageNotReceived(); } /// @dev Performs a swap, if was requested back on origin chain, and transfers the tokens to the recipient. /// Should the swap fail, will transfer `token` to the recipient instead. function _fulfillRequest( address recipient, address token, uint256 amount, bytes memory swapParams ) internal returns (address tokenOut, uint256 amountOut) { // Fallback to Base Request if no swap params are provided if (swapParams.length == 0) { IERC20(token).safeTransfer(recipient, amount); return (token, amount); } // We checked request version to be a valid value when wrapping into `request`, // so this could only be `RequestLib.REQUEST_SWAP`. address pool = circleTokenPool[token]; // Fallback to Base Request if no pool is found if (pool == address(0)) { IERC20(token).safeTransfer(recipient, amount); return (token, amount); } (uint8 tokenIndexFrom, uint8 tokenIndexTo, uint256 deadline, uint256 minAmountOut) = RequestLib .decodeSwapParams(swapParams); tokenOut = _tryGetToken(pool, tokenIndexTo); // Fallback to Base Request if failed to get tokenOut address if (tokenOut == address(0)) { IERC20(token).safeTransfer(recipient, amount); return (token, amount); } // Approve the pool to spend the token, if needed. _approveToken(token, pool, amount); amountOut = _trySwap(pool, tokenIndexFrom, tokenIndexTo, amount, deadline, minAmountOut); // Fallback to Base Request if failed to swap if (amountOut == 0) { IERC20(token).safeTransfer(recipient, amount); return (token, amount); } // Transfer the swapped tokens to the recipient. IERC20(tokenOut).safeTransfer(recipient, amountOut); } /// @dev Tries to swap tokens using the provided swap instructions. /// Instead of reverting, returns 0 if the swap failed. function _trySwap( address pool, uint8 tokenIndexFrom, uint8 tokenIndexTo, uint256 amount, uint256 deadline, uint256 minAmountOut ) internal returns (uint256 amountOut) { try IDefaultPool(pool).swap(tokenIndexFrom, tokenIndexTo, amount, minAmountOut, deadline) returns ( uint256 amountOut_ ) { amountOut = amountOut_; } catch { // Swapping failed, return 0 amountOut = 0; } } // ══════════════════════════════════════════════ INTERNAL VIEWS ═══════════════════════════════════════════════════ /// @dev Gets the address of the local minted Circle token from the local TokenMinter. function _getLocalToken(uint32 remoteDomain, address remoteToken) internal view returns (address token) { ITokenMinter minter = ITokenMinter(tokenMessenger.localMinter()); token = minter.getLocalToken(remoteDomain, remoteToken.addressToBytes32()); // Revert if TokenMinter is not aware of this remote token. if (token == address(0)) revert CCTPTokenNotFound(); } /// @dev Tries to get the token address from the pool. /// Instead of reverting, returns 0 if the getToken failed. function _tryGetToken(address pool, uint8 tokenIndex) internal view returns (address token) { // Issue a low level static call instead of IDefaultPool(pool).getToken(tokenIndex) // to ensure this never reverts (bool success, bytes memory returnData) = pool.staticcall( abi.encodeWithSelector(IDefaultPool.getToken.selector, tokenIndex) ); if (success && returnData.length == 32) { // Do the casting instead of using abi.decode to discard the dirty highest bits if there are any token = bytes32(returnData).bytes32ToAddress(); } else { // Return 0 on revert or if pool returned something unexpected token = address(0); } } /// @dev Predicts the address of the destination caller that will be used to call the Circle Message Transmitter. function _destinationCaller(address synapseCCTP, bytes32 requestID) internal pure returns (bytes32) { // On the destination chain, Synapse CCTP will deploy a MinimalForwarder for each request, // using requestID as salt for the create2 deployment. return synapseCCTP.predictAddress(requestID).addressToBytes32(); } /// @dev Calculates the unique identifier of the request. function _requestID( uint32 destinationDomain, uint32 requestVersion, bytes memory formattedRequest ) internal pure returns (bytes32 requestID) { // Merge the destination domain and the request version into a single uint256. uint256 prefix = (uint256(destinationDomain) << 32) | requestVersion; bytes32 requestHash = keccak256(formattedRequest); // Use assembly to return hash of the prefix and the request hash. // We are using scratch space to avoid unnecessary memory expansion. // solhint-disable-next-line no-inline-assembly assembly { // Store prefix in memory at 0, and requestHash at 32. mstore(0, prefix) mstore(32, requestHash) // Return hash of first 64 bytes of memory. requestID := keccak256(0, 64) } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; error CastOverflow(); error IncorrectRequestLength(); error UnknownRequestVersion(); error CCTPGasRescueFailed(); error CCTPIncorrectChainId(); error CCTPIncorrectConfig(); error CCTPIncorrectDomain(); error CCTPIncorrectGasAmount(); error CCTPIncorrectProtocolFee(); error CCTPInsufficientAmount(); error CCTPSymbolAlreadyAdded(); error CCTPSymbolIncorrect(); error CCTPTokenAlreadyAdded(); error CCTPTokenNotFound(); error CCTPZeroAddress(); error CCTPZeroAmount(); error CCTPMessageNotReceived(); error RemoteCCTPDeploymentNotSet(); error RemoteCCTPTokenNotSet(); error ForwarderDeploymentFailed();
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; abstract contract SynapseCCTPEvents { /// @notice Emitted when a Circle token is sent with an attached action request. /// @dev To fulfill the request, the validator needs to fetch `message` from `MessageSent` event /// emitted by Circle's MessageTransmitter in the same tx, then fetch `signature` for the message from Circle API. /// This data will need to be presented to SynapseCCTP on the destination chain, /// along with `requestVersion` and `formattedRequest` emitted in this event. /// @param chainId Chain ID of the destination chain /// @param sender Sender of the CCTP tokens on origin chain /// @param nonce Nonce of the CCTP message on origin chain /// @param token Address of Circle token that was burnt /// @param amount Amount of Circle tokens burnt /// @param requestVersion Version of the request format /// @param formattedRequest Formatted request for the action to take on the destination chain /// @param requestID Unique identifier of the request event CircleRequestSent( uint256 chainId, address indexed sender, uint64 nonce, address token, uint256 amount, uint32 requestVersion, bytes formattedRequest, bytes32 requestID ); /// @notice Emitted when a Circle token is received with an attached action request. /// @param originDomain CCTP domain of the origin chain /// @param recipient End recipient of the tokens on this chain /// @param mintToken Address of the minted Circle token /// @param fee Fee paid for fulfilling the request, in minted tokens /// @param token Address of token that recipient received /// @param amount Amount of tokens received by recipient /// @param requestID Unique identifier of the request event CircleRequestFulfilled( uint32 originDomain, address indexed recipient, address mintToken, uint256 fee, address token, uint256 amount, bytes32 requestID ); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import {SynapseCCTPFeesEvents} from "../events/SynapseCCTPFeesEvents.sol"; import {ISynapseCCTPFees} from "../interfaces/ISynapseCCTPFees.sol"; // prettier-ignore import { CCTPGasRescueFailed, CCTPIncorrectConfig, CCTPIncorrectProtocolFee, CCTPInsufficientAmount, CCTPSymbolAlreadyAdded, CCTPSymbolIncorrect, CCTPTokenAlreadyAdded, CCTPTokenNotFound } from "../libs/Errors.sol"; import {TypeCasts} from "../libs/TypeCasts.sol"; import {BridgeToken} from "../../router/libs/Structs.sol"; import {Ownable} from "@openzeppelin/contracts-4.5.0/access/Ownable.sol"; import {EnumerableSet} from "@openzeppelin/contracts-4.5.0/utils/structs/EnumerableSet.sol"; abstract contract SynapseCCTPFees is SynapseCCTPFeesEvents, Ownable, ISynapseCCTPFees { using EnumerableSet for EnumerableSet.AddressSet; using TypeCasts for uint256; /// @notice CCTP fee structure for a supported Circle token. /// @dev Optimized for storage. 2**72 is 4*10**21, which is enough to represent adequate amounts /// for stable coins with 18 decimals. Circle tokens have 6 decimals, so this is more than enough. /// @param relayerFee Fee % for bridging a token to this chain, multiplied by `FEE_DENOMINATOR` /// @param minBaseFee Minimum fee for bridging a token to this chain using a base request /// @param minSwapFee Minimum fee for bridging a token to this chain using a swap request /// @param maxFee Maximum fee for bridging a token to this chain struct CCTPFee { uint40 relayerFee; uint72 minBaseFee; uint72 minSwapFee; uint72 maxFee; } /// @dev Denominator used to calculate the bridge fee uint256 private constant FEE_DENOMINATOR = 10**10; /// @dev Maximum relayer fee that can be set: 10 bps uint256 private constant MAX_RELAYER_FEE = 10**7; /// @dev Maximum protocol fee that can be set: 50% uint256 private constant MAX_PROTOCOL_FEE = FEE_DENOMINATOR / 2; /// @dev Mandatory prefix used for CCTP token symbols to distinguish them from other bridge symbols bytes private constant SYMBOL_PREFIX = "CCTP."; /// @dev Length of the mandatory prefix used for CCTP token symbols uint256 private constant SYMBOL_PREFIX_LENGTH = 5; // ══════════════════════════════════════════════════ STORAGE ══════════════════════════════════════════════════════ /// @notice Maps bridge token address into bridge token symbol mapping(address => string) public tokenToSymbol; /// @notice Maps bridge token symbol into bridge token address mapping(string => address) public symbolToToken; /// @notice Maps bridge token address into CCTP fee structure mapping(address => CCTPFee) public feeStructures; /// @notice Maps fee collector address into accumulated fees for a token /// (feeCollector => (token => amount)) /// @dev Fee collector address of address(0) indicates that fees are accumulated by the Protocol mapping(address => mapping(address => uint256)) public accumulatedFees; /// @notice Maps Relayer address into collector address for accumulated Relayer's fees /// @dev Default value of address(0) indicates that a Relayer's fees are accumulated by the Protocol mapping(address => address) public relayerFeeCollectors; /// @notice Protocol fee: percentage of the relayer fee that is collected by the Protocol /// @dev Protocol collects the full fee amount, if the Relayer hasn't set a fee collector uint256 public protocolFee; /// @notice Amount of chain's native gas airdropped to the token recipient for every fulfilled CCTP request uint256 public chainGasAmount; /// @dev A list of all supported bridge tokens EnumerableSet.AddressSet internal _bridgeTokens; // ════════════════════════════════════════════════ ONLY OWNER ═════════════════════════════════════════════════════ /// @notice Adds a new token to the list of supported tokens, with the given symbol and fee structure. /// @dev The symbol must start with "CCTP." /// @param symbol Symbol of the token /// @param token Address of the token /// @param relayerFee Fee % for bridging a token to this chain, multiplied by `FEE_DENOMINATOR` /// @param minBaseFee Minimum fee for bridging a token to this chain using a base request /// @param minSwapFee Minimum fee for bridging a token to this chain using a swap request /// @param maxFee Maximum fee for bridging a token to this chain function addToken( string memory symbol, address token, uint256 relayerFee, uint256 minBaseFee, uint256 minSwapFee, uint256 maxFee ) external onlyOwner { if (token == address(0)) revert CCTPIncorrectConfig(); // Add a new token to the list of supported tokens, and check that it hasn't been added before if (!_bridgeTokens.add(token)) revert CCTPTokenAlreadyAdded(); // Check that symbol hasn't been added yet and starts with "CCTP." _assertCanAddSymbol(symbol); // Add token <> symbol link tokenToSymbol[token] = symbol; symbolToToken[symbol] = token; // Set token fee _setTokenFee(token, relayerFee, minBaseFee, minSwapFee, maxFee); } /// @notice Removes a token from the list of supported tokens. /// @dev Will revert if the token is not supported. function removeToken(address token) external onlyOwner { // Remove a token from the list of supported tokens, and check that it has been added before if (!_bridgeTokens.remove(token)) revert CCTPTokenNotFound(); // Remove token <> symbol link string memory symbol = tokenToSymbol[token]; delete tokenToSymbol[token]; delete symbolToToken[symbol]; // Remove token fee structure delete feeStructures[token]; } /// @notice Allows to rescue stuck gas from the contract. function rescueGas() external onlyOwner { (bool success, ) = msg.sender.call{value: address(this).balance}(""); if (!success) revert CCTPGasRescueFailed(); } /// @notice Sets the amount of chain gas airdropped to the token recipient for every fulfilled CCTP request. function setChainGasAmount(uint256 newChainGasAmount) external onlyOwner { chainGasAmount = newChainGasAmount; emit ChainGasAmountUpdated(newChainGasAmount); } /// @notice Updates the fee structure for a supported Circle token. /// @dev Will revert if the token is not supported. /// @param token Address of the token /// @param relayerFee Fee % for bridging a token to this chain, multiplied by `FEE_DENOMINATOR` /// @param minBaseFee Minimum fee for bridging a token to this chain using a base request /// @param minSwapFee Minimum fee for bridging a token to this chain using a swap request /// @param maxFee Maximum fee for bridging a token to this chain function setTokenFee( address token, uint256 relayerFee, uint256 minBaseFee, uint256 minSwapFee, uint256 maxFee ) external onlyOwner { if (!_bridgeTokens.contains(token)) revert CCTPTokenNotFound(); _setTokenFee(token, relayerFee, minBaseFee, minSwapFee, maxFee); } /// @notice Sets a new protocol fee. /// @dev The protocol fee is a percentage of the relayer fee that is collected by the Protocol. /// @param newProtocolFee New protocol fee, multiplied by `FEE_DENOMINATOR` function setProtocolFee(uint256 newProtocolFee) external onlyOwner { if (newProtocolFee > MAX_PROTOCOL_FEE) revert CCTPIncorrectProtocolFee(); protocolFee = newProtocolFee; emit ProtocolFeeUpdated(newProtocolFee); } // ═══════════════════════════════════════════ RELAYER INTERACTIONS ════════════════════════════════════════════════ /// @notice Allows the Relayer to set a fee collector for accumulated fees. /// - New fees accumulated by the Relayer could only be withdrawn by new Relayer's fee collector. /// - Old fees accumulated by the Relayer could only be withdrawn by old Relayer's fee collector. /// @dev Default value of address(0) indicates that a Relayer's fees are accumulated by the Protocol. function setFeeCollector(address feeCollector) external { address oldFeeCollector = relayerFeeCollectors[msg.sender]; relayerFeeCollectors[msg.sender] = feeCollector; emit FeeCollectorUpdated(msg.sender, oldFeeCollector, feeCollector); } // ═══════════════════════════════════════════════════ VIEWS ═══════════════════════════════════════════════════════ /// @notice Calculates the fee amount for bridging a token to this chain using CCTP. /// @dev Will not check if fee exceeds the token amount. Will return 0 if the token is not supported. /// @param token Address of the Circle token /// @param amount Amount of the Circle tokens to be bridged to this chain /// @param isSwap Whether the request is a swap request /// @return fee Fee amount function calculateFeeAmount( address token, uint256 amount, bool isSwap ) external view returns (uint256 fee) { return _calculateFeeAmount(token, amount, isSwap); } /// @notice Returns the list of all supported bridge tokens and their symbols. function getBridgeTokens() external view returns (BridgeToken[] memory bridgeTokens) { uint256 length = _bridgeTokens.length(); bridgeTokens = new BridgeToken[](length); for (uint256 i = 0; i < length; i++) { address token = _bridgeTokens.at(i); bridgeTokens[i] = BridgeToken({symbol: tokenToSymbol[token], token: token}); } } // ══════════════════════════════════════════════ INTERNAL LOGIC ═══════════════════════════════════════════════════ /// @dev Applies the relayer fee and updates the accumulated fee amount for the token. /// Will revert if the fee exceeds the token amount, or token is not supported. function _applyRelayerFee( address token, uint256 amount, bool isSwap ) internal returns (uint256 amountAfterFee, uint256 fee) { if (!_bridgeTokens.contains(token)) revert CCTPTokenNotFound(); fee = _calculateFeeAmount(token, amount, isSwap); if (fee >= amount) revert CCTPInsufficientAmount(); // Could use the unchecked math, as we already checked that fee < amount unchecked { amountAfterFee = amount - fee; } // Check if the Relayer has specified a fee collector address feeCollector = relayerFeeCollectors[msg.sender]; if (feeCollector == address(0)) { // If the fee collector is not set, the Protocol will collect the full fees accumulatedFees[address(0)][token] += fee; emit FeeCollected(address(0), 0, fee); } else { // Otherwise, the Relayer and the Protocol will split the fees uint256 protocolFeeAmount = (fee * protocolFee) / FEE_DENOMINATOR; uint256 relayerFeeAmount = fee - protocolFeeAmount; accumulatedFees[address(0)][token] += protocolFeeAmount; accumulatedFees[feeCollector][token] += relayerFeeAmount; emit FeeCollected(feeCollector, relayerFeeAmount, protocolFeeAmount); } } /// @dev Sets the fee structure for a supported Circle token. function _setTokenFee( address token, uint256 relayerFee, uint256 minBaseFee, uint256 minSwapFee, uint256 maxFee ) internal { // Check that relayer fee is not too high if (relayerFee > MAX_RELAYER_FEE) revert CCTPIncorrectConfig(); // Min base fee must not exceed min swap fee if (minBaseFee > minSwapFee) revert CCTPIncorrectConfig(); // Min swap fee must not exceed max fee if (minSwapFee > maxFee) revert CCTPIncorrectConfig(); feeStructures[token] = CCTPFee({ relayerFee: relayerFee.safeCastToUint40(), minBaseFee: minBaseFee.safeCastToUint72(), minSwapFee: minSwapFee.safeCastToUint72(), maxFee: maxFee.safeCastToUint72() }); } /// @dev Transfers `msg.value` to the recipient. Assumes that `msg.value == chainGasAmount` at this point. function _transferMsgValue(address recipient) internal { // Try to send the gas airdrop to the recipient (bool success, ) = recipient.call{value: msg.value}(""); // If the transfer failed, set the emitted amount to 0 emit ChainGasAirdropped(success ? msg.value : 0); } // ══════════════════════════════════════════════ INTERNAL VIEWS ═══════════════════════════════════════════════════ /// @dev Checks that the symbol hasn't been added yet and starts with "CCTP." function _assertCanAddSymbol(string memory symbol) internal view { // Check if the symbol has already been added if (symbolToToken[symbol] != address(0)) revert CCTPSymbolAlreadyAdded(); // Cast to bytes to check the length bytes memory symbolBytes = bytes(symbol); // Check that symbol is correct: starts with "CCTP." and has at least 1 more character if (symbolBytes.length <= SYMBOL_PREFIX_LENGTH) revert CCTPSymbolIncorrect(); for (uint256 i = 0; i < SYMBOL_PREFIX_LENGTH; ) { if (symbolBytes[i] != SYMBOL_PREFIX[i]) revert CCTPSymbolIncorrect(); unchecked { ++i; } } } /// @dev Calculates the fee amount for bridging a token to this chain using CCTP. /// Will not check if fee exceeds the token amount. Will return 0 if the token is not supported. function _calculateFeeAmount( address token, uint256 amount, bool isSwap ) internal view returns (uint256 fee) { CCTPFee memory feeStructure = feeStructures[token]; // Calculate the fee amount fee = (amount * feeStructure.relayerFee) / FEE_DENOMINATOR; // Apply minimum fee uint256 minFee = isSwap ? feeStructure.minSwapFee : feeStructure.minBaseFee; if (fee < minFee) fee = minFee; // Apply maximum fee if (fee > feeStructure.maxFee) fee = feeStructure.maxFee; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; interface IMessageTransmitter { /** * @notice Receives an incoming message, validating the header and passing * the body to application-specific handler. * @param message The message raw bytes * @param signature The message signature * @return success bool, true if successful */ function receiveMessage(bytes calldata message, bytes calldata signature) external returns (bool success); /** * @notice Sends an outgoing message from the source domain, with a specified caller on the * destination domain. * @dev Increment nonce, format the message, and emit `MessageSent` event with message information. * WARNING: if the `destinationCaller` does not represent a valid address as bytes32, then it will not be possible * to broadcast the message on the destination domain. This is an advanced feature, and the standard * sendMessage() should be preferred for use cases where a specific destination caller is not required. * @param destinationDomain Domain of destination chain * @param recipient Address of message recipient on destination domain as bytes32 * @param destinationCaller caller on the destination domain, as bytes32 * @param messageBody Raw bytes content of message * @return nonce reserved by message */ function sendMessageWithCaller( uint32 destinationDomain, bytes32 recipient, bytes32 destinationCaller, bytes calldata messageBody ) external returns (uint64); // ═══════════════════════════════════════════════════ VIEWS ═══════════════════════════════════════════════════════ // Domain of chain on which the contract is deployed function localDomain() external view returns (uint32); // Next available nonce from this source domain function nextAvailableNonce() external view returns (uint64); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import {ITokenMessenger} from "./ITokenMessenger.sol"; interface ISynapseCCTP { /// @notice Send a Circle token supported by CCTP to a given chain /// with the request for the action to take on the destination chain. /// @dev The request is a bytes array containing information about the end recipient of the tokens, /// as well as an optional swap action to take on the destination chain. /// `chainId` refers to value from EIP-155 (block.chainid). /// @param recipient Recipient of the tokens on destination chain /// @param chainId Chain ID of the destination chain /// @param burnToken Address of Circle token to burn /// @param amount Amount of tokens to burn /// @param requestVersion Version of the request format /// @param swapParams Swap parameters for the action to take on the destination chain (could be empty) function sendCircleToken( address recipient, uint256 chainId, address burnToken, uint256 amount, uint32 requestVersion, bytes memory swapParams ) external; /// @notice Receive Circle token supported by CCTP with the request for the action to take. /// @dev The request is a bytes array containing information about the end recipient of the tokens, /// as well as an optional swap action to take on this chain. /// @dev The relayers need to use SynapseCCTP.chainGasAmount() as `msg.value` when calling this function, /// or the call will revert. /// @param message Message raw bytes emitted by CCTP MessageTransmitter on origin chain /// @param signature Circle's attestation for the message obtained from Circle's API /// @param requestVersion Version of the request format /// @param formattedRequest Formatted request for the action to take on this chain function receiveCircleToken( bytes calldata message, bytes calldata signature, uint32 requestVersion, bytes memory formattedRequest ) external payable; // ═══════════════════════════════════════════════════ VIEWS ═══════════════════════════════════════════════════════ /// @notice Returns the whitelisted liquidity pool for a given Circle token. /// @dev Returns address(0) if the token bridge+swap is not supported. function circleTokenPool(address token) external view returns (address pool); /// @notice Returns the address of Circle's TokenMessenger contract used for bridging Circle tokens. function tokenMessenger() external view returns (ITokenMessenger); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; interface ITokenMinter { /** * @notice Mints `amount` of local tokens corresponding to the * given (`sourceDomain`, `burnToken`) pair, to `to` address. * @dev reverts if the (`sourceDomain`, `burnToken`) pair does not * map to a nonzero local token address. This mapping can be queried using * getLocalToken(). * @param sourceDomain Source domain where `burnToken` was burned. * @param burnToken Burned token address as bytes32. * @param to Address to receive minted tokens, corresponding to `burnToken`, * on this domain. * @param amount Amount of tokens to mint. Must be less than or equal * to the minterAllowance of this TokenMinter for given `_mintToken`. * @return mintToken token minted. */ function mint( uint32 sourceDomain, bytes32 burnToken, address to, uint256 amount ) external returns (address mintToken); /** * @notice Burn tokens owned by this ITokenMinter. * @param burnToken burnable token. * @param amount amount of tokens to burn. Must be less than or equal to this ITokenMinter's * account balance of the given `_burnToken`. */ function burn(address burnToken, uint256 amount) external; /** * @notice Get the local token associated with the given remote domain and token. * @param remoteDomain Remote domain * @param remoteToken Remote token * @return local token address */ function getLocalToken(uint32 remoteDomain, bytes32 remoteToken) external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; interface ITokenMessenger { /** * @notice Deposits and burns tokens from sender to be minted on destination domain. The mint * on the destination domain must be called by `destinationCaller`. * WARNING: if the `destinationCaller` does not represent a valid address as bytes32, then it will not be possible * to broadcast the message on the destination domain. This is an advanced feature, and the standard * depositForBurn() should be preferred for use cases where a specific destination caller is not required. * Emits a `DepositForBurn` event. * @dev reverts if: * - given destinationCaller is zero address * - given burnToken is not supported * - given destinationDomain has no TokenMessenger registered * - transferFrom() reverts. For example, if sender's burnToken balance or approved allowance * to this contract is less than `amount`. * - burn() reverts. For example, if `amount` is 0. * - MessageTransmitter returns false or reverts. * @param amount amount of tokens to burn * @param destinationDomain destination domain * @param mintRecipient address of mint recipient on destination domain * @param burnToken address of contract to burn deposited tokens, on local domain * @param destinationCaller caller on the destination domain, as bytes32 * @return nonce unique nonce reserved by message */ function depositForBurnWithCaller( uint256 amount, uint32 destinationDomain, bytes32 mintRecipient, address burnToken, bytes32 destinationCaller ) external returns (uint64 nonce); /** * @notice Handles an incoming message received by the local MessageTransmitter, * and takes the appropriate action. For a burn message, mints the * associated token to the requested recipient on the local domain. * @dev Validates the local sender is the local MessageTransmitter, and the * remote sender is a registered remote TokenMessenger for `remoteDomain`. * @param remoteDomain The domain where the message originated from. * @param sender The sender of the message (remote TokenMessenger). * @param messageBody The message body bytes. * @return success Bool, true if successful. */ function handleReceiveMessage( uint32 remoteDomain, bytes32 sender, bytes calldata messageBody ) external returns (bool success); // ═══════════════════════════════════════════════════ VIEWS ═══════════════════════════════════════════════════════ // Local Message Transmitter responsible for sending and receiving messages to/from remote domains function localMessageTransmitter() external view returns (address); // Minter responsible for minting and burning tokens on the local domain function localMinter() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import {IncorrectRequestLength, UnknownRequestVersion} from "./Errors.sol"; /// # Base Request layout /// /// | Field | Type | Description | /// | --------------- | ------- | ---------------------------------------------- | /// | originDomain | uint32 | Domain of the origin chain used by Circle CCTP | /// | nonce | uint64 | Nonce of the CCTP message on origin chain | /// | originBurnToken | address | Circle token that was burned on origin chain | /// | amount | uint256 | Amount of tokens burned on origin chain | /// | recipient | address | Recipient of the tokens on destination chain | /// /// # Swap Params layout /// /// | Field | Type | Description | /// | -------------- | ------- | ------------------------------------------------------------- | /// | tokenIndexFrom | uint8 | Index of the minted Circle token in the pool | /// | tokenIndexTo | uint8 | Index of the final token in the pool | /// | deadline | uint256 | Latest timestamp to execute the swap | /// | minAmountOut | uint256 | Minimum amount of tokens to receive from the swap | library RequestLib { uint32 internal constant REQUEST_BASE = 0; uint32 internal constant REQUEST_SWAP = 1; /// @notice Length of the encoded base request. uint256 internal constant REQUEST_BASE_LENGTH = 5 * 32; /// @notice Length of the encoded swap parameters. uint256 internal constant SWAP_PARAMS_LENGTH = 4 * 32; /// @notice Length of the encoded swap request. /// Need 2 extra words for each `bytes` field to store its offset in the full payload, and length. uint256 internal constant REQUEST_SWAP_LENGTH = 4 * 32 + REQUEST_BASE_LENGTH + SWAP_PARAMS_LENGTH; // ════════════════════════════════════════════════ FORMATTING ═════════════════════════════════════════════════════ /// @notice Formats the base request into a bytes array. /// @param originDomain Domain of the origin chain /// @param nonce Nonce of the CCTP message on origin chain /// @param originBurnToken Circle token that was burned on origin chain /// @param amount Amount of tokens burned on origin chain /// @param recipient Recipient of the tokens on destination chain /// @return formattedRequest Properly formatted base request function formatBaseRequest( uint32 originDomain, uint64 nonce, address originBurnToken, uint256 amount, address recipient ) internal pure returns (bytes memory formattedRequest) { return abi.encode(originDomain, nonce, originBurnToken, amount, recipient); } /// @notice Formats the swap parameters part of the swap request into a bytes array. /// @param tokenIndexFrom Index of the minted Circle token in the pool /// @param tokenIndexTo Index of the final token in the pool /// @param deadline Latest timestamp to execute the swap /// @param minAmountOut Minimum amount of tokens to receive from the swap /// @return formattedSwapParams Properly formatted swap parameters function formatSwapParams( uint8 tokenIndexFrom, uint8 tokenIndexTo, uint256 deadline, uint256 minAmountOut ) internal pure returns (bytes memory formattedSwapParams) { return abi.encode(tokenIndexFrom, tokenIndexTo, deadline, minAmountOut); } /// @notice Formats the request into a bytes array. /// @dev Will revert if the either of these is true: /// - Request version is unknown. /// - Base request is not properly formatted. /// - Swap parameters are specified for a base request. /// - Swap parameters are not properly formatted. /// @param requestVersion Version of the request format /// @param baseRequest Formatted base request /// @param swapParams Formatted swap parameters /// @return formattedRequest Properly formatted request function formatRequest( uint32 requestVersion, bytes memory baseRequest, bytes memory swapParams ) internal pure returns (bytes memory formattedRequest) { if (baseRequest.length != REQUEST_BASE_LENGTH) revert IncorrectRequestLength(); if (requestVersion == REQUEST_BASE) { if (swapParams.length != 0) revert IncorrectRequestLength(); // swapParams is empty, so we can just return the base request return baseRequest; } else if (requestVersion == REQUEST_SWAP) { if (swapParams.length != SWAP_PARAMS_LENGTH) revert IncorrectRequestLength(); // Encode both the base request and the swap parameters return abi.encode(baseRequest, swapParams); } else { revert UnknownRequestVersion(); } } // ═════════════════════════════════════════════════ DECODING ══════════════════════════════════════════════════════ /// @notice Decodes the base request from a bytes array. /// @dev Will revert if the request is not properly formatted. /// @param baseRequest Formatted base request /// @return originDomain Domain of the origin chain /// @return nonce Nonce of the CCTP message on origin domain /// @return originBurnToken Circle token that was burned on origin domain /// @return amount Amount of tokens to burn /// @return recipient Recipient of the tokens on destination domain function decodeBaseRequest(bytes memory baseRequest) internal pure returns ( uint32 originDomain, uint64 nonce, address originBurnToken, uint256 amount, address recipient ) { if (baseRequest.length != REQUEST_BASE_LENGTH) revert IncorrectRequestLength(); return abi.decode(baseRequest, (uint32, uint64, address, uint256, address)); } /// @notice Decodes the swap parameters from a bytes array. /// @dev Will revert if the swap parameters are not properly formatted. /// @param swapParams Formatted swap parameters /// @return tokenIndexFrom Index of the minted Circle token in the pool /// @return tokenIndexTo Index of the final token in the pool /// @return deadline Latest timestamp to execute the swap /// @return minAmountOut Minimum amount of tokens to receive from the swap function decodeSwapParams(bytes memory swapParams) internal pure returns ( uint8 tokenIndexFrom, uint8 tokenIndexTo, uint256 deadline, uint256 minAmountOut ) { if (swapParams.length != SWAP_PARAMS_LENGTH) revert IncorrectRequestLength(); return abi.decode(swapParams, (uint8, uint8, uint256, uint256)); } /// @notice Decodes the versioned request from a bytes array. /// @dev Will revert if the either of these is true: /// - Request version is unknown. /// - Request is not properly formatted. /// @param requestVersion Version of the request format /// @param formattedRequest Formatted request /// @return baseRequest Formatted base request /// @return swapParams Formatted swap parameters function decodeRequest(uint32 requestVersion, bytes memory formattedRequest) internal pure returns (bytes memory baseRequest, bytes memory swapParams) { if (requestVersion == REQUEST_BASE) { if (formattedRequest.length != REQUEST_BASE_LENGTH) revert IncorrectRequestLength(); return (formattedRequest, ""); } else if (requestVersion == REQUEST_SWAP) { if (formattedRequest.length != REQUEST_SWAP_LENGTH) revert IncorrectRequestLength(); return abi.decode(formattedRequest, (bytes, bytes)); } else { revert UnknownRequestVersion(); } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import {ForwarderDeploymentFailed} from "./Errors.sol"; import {TypeCasts} from "./TypeCasts.sol"; import {Address} from "@openzeppelin/contracts-4.5.0/utils/Address.sol"; /// Minimal Forwarder is a EIP-1167 (Minimal Proxy Contract) spin-off that /// forwards all calls to a any target address with any payload. /// Unlike EIP-1167, delegates calls are not used, so the forwarder contract /// is `msg.sender` as far as the target contract is concerned. /// # Minimal Forwarder Bytecode /// Inspired by [EIP-1167](https://eips.ethereum.org/EIPS/eip-1167). /// Following changes were made: /// - Target address is not saved in the deployed contract code, but is passed as a part of the payload. /// - To forward a call, the sender needs to provide the target address as the first 32 bytes of the payload. /// - The payload to pass to the target contract occupies the rest of the payload, having an offset of 32 bytes. /// - The target address is derived using CALLDATALOAD. /// - CALLVALUE is used to pass the msg.value to the target contract. /// - `call()` is used instead of `delegatecall()`. /// ## Bytecode Table /// | Pos | OP | OP + Args | Description | S7 | S6 | S5 | S4 | S3 | S2 | S1 | S0 | /// | ---- | ---- | --------- | -------------- | --- | ---- | --- | --- | ------ | --- | ------ | ------ | /// | 0x00 | 0x60 | 0x6020 | push1 0x20 | | | | | | | | 32 | /// | 0x02 | 0x36 | 0x36 | calldatasize | | | | | | | cds | 32 | /// | 0x03 | 0x03 | 0x03 | sub | | | | | | | | cds-32 | /// | 0x04 | 0x80 | 0x80 | dup1 | | | | | | | cds-32 | cds-32 | /// | 0x05 | 0x60 | 0x6020 | push1 0x20 | | | | | | 32 | cds-32 | cds-32 | /// | 0x07 | 0x3d | 0x3d | returndatasize | | | | | 0 | 32 | cds-32 | cds-32 | /// | 0x08 | 0x37 | 0x37 | calldatacopy | | | | | | | | cds-32 | /// | 0x09 | 0x3d | 0x3d | returndatasize | | | | | | | 0 | cds-32 | /// | 0x0a | 0x3d | 0x3d | returndatasize | | | | | | 0 | 0 | cds-32 | /// | 0x0b | 0x3d | 0x3d | returndatasize | | | | | 0 | 0 | 0 | cds-32 | /// | 0x0c | 0x92 | 0x92 | swap3 | | | | | cds-32 | 0 | 0 | 0 | /// | 0x0d | 0x3d | 0x3d | returndatasize | | | | 0 | cds-32 | 0 | 0 | 0 | /// | 0x0e | 0x34 | 0x34 | callvalue | | | val | 0 | cds-32 | 0 | 0 | 0 | /// | 0x0f | 0x3d | 0x3d | returndatasize | | 0 | val | 0 | cds-32 | 0 | 0 | 0 | /// | 0x10 | 0x35 | 0x35 | calldataload | | addr | val | 0 | cds-32 | 0 | 0 | 0 | /// | 0x11 | 0x5a | 0x5a | gas | gas | addr | val | 0 | cds-32 | 0 | 0 | 0 | /// | 0x12 | 0xf1 | 0xf1 | call | | | | | | | suc | 0 | /// | 0x13 | 0x3d | 0x3d | returndatasize | | | | | | rds | suc | 0 | /// | 0x14 | 0x82 | 0x82 | dup3 | | | | | 0 | rds | suc | 0 | /// | 0x15 | 0x80 | 0x80 | dup1 | | | | 0 | 0 | rds | suc | 0 | /// | 0x16 | 0x3e | 0x3e | returndatacopy | | | | | | | suc | 0 | /// | 0x17 | 0x90 | 0x90 | swap1 | | | | | | | 0 | suc | /// | 0x18 | 0x3d | 0x3d | returndatasize | | | | | | rds | 0 | suc | /// | 0x19 | 0x91 | 0x91 | swap2 | | | | | | suc | 0 | rds | /// | 0x1a | 0x60 | 0x601e | push1 0x1e | | | | | 0x1e | suc | 0 | rds | /// | 0x1c | 0x57 | 0x57 | jumpi | | | | | | | 0 | rds | /// | 0x1d | 0xfd | 0xfd | revert | | | | | | | | | /// | 0x1e | 0x5b | 0x5b | jumpdest | | | | | | | 0 | rds | /// | 0x1f | 0xf3 | 0xf3 | return | | | | | | | | | /// > - Opcode + Args refers to the bytecode of the opcode and its arguments (if there are any). /// > - Stack View (S7..S0) is shown after the execution of the opcode. /// > - The stack elements are shown from top to bottom. /// > Opcodes are typically dealing with the top stack elements, so they are shown first. /// > - `cds` refers to the calldata size. /// > - `rds` refers to the returndata size (which is zero before the first external call). /// > - `val` refers to the provided `msg.value`. /// > - `addr` refers to the target address loaded from calldata. /// > - `gas` refers to the return value of the `gas()` opcode: the amount of gas left. /// > - `suc` refers to the return value of the `call()` opcode: 0 on failure, 1 on success. /// ## Bytecode Explanation /// - `0x00..0x03` - Calculate the offset of the payload in the calldata (first 32 bytes is target address). /// > - `sub` pops the top two stack items, subtracts them, and pushes the result onto the stack. /// - `0x04..0x04` - Duplicate the offset to use it later as "payload length". /// > - `dup1` duplicates the top stack item. /// - `0x05..0x08` - Copy the target call payload to memory. /// > - `calldatacopy` copies a portion of the calldata to memory. Pops three top stack elements: /// > memory offset to write to, calldata offset to read from, and length of the data to copy. /// - `0x09..0x11` - Prepare the stack for the `call` opcode. /// > - We are putting an extra zero on the stack to use it later on, as `returndatacopy` will not return zero /// > after we perform the first external call. /// > - `swap3` swaps the top stack item with the fourth stack item. /// > - `callvalue` pushes `msg.value` onto the stack. /// > - `calldataload` pushes a word (32 bytes) onto the stack from calldata. Pops the calldata offset from the stack. /// > Writes the word from calldata to the stack. We are using offset==0 to load the target address. /// > - `gas` pushes the remaining gas onto the stack. /// - `0x12..0x12` - Call the target contract. /// > - `call` issues an external call to a target address. /// > - Pops seven top stack items: gas, target address, value, input offset, input length, /// > memory offset to write return data to, and length of return data to write to memory. /// > - Pushes on stack: 0 on failure, 1 on success. /// - `0x13..0x16` - Copy the return data to memory. /// > - `returndatasize` pushes the size of the returned data from the external call onto the stack. /// > - `dup3` duplicates the third stack item. /// > - `returncopydata` copies a portion of the returned data to memory. Pops three top stack elements: /// > memory offset to write to, return data offset to read from, and length of the data to copy. /// - `0x17..0x1b` - Prepare the stack for either revert or return: jump dst, success flag, zero, and return data size. /// > - `swap1` swaps the top stack item with the second stack item. /// > - `swap2` swaps the top stack item with the third stack item. /// > - `0x1e` refers to the position of the `jumpdest` opcode. /// > It is used to jump to the `return` opcode, if call was successful. /// - `0x1c..0x1c` - Jump to 0x1e position, if call was successful. /// > - `jumpi` pops two top stack items: jump destination and jump condition. /// > If jump condition is nonzero, jumps to the jump destination. /// - `0x1d..0x1d` - Revert if call was unsuccessful. /// > - `revert` pops two top stack items: memory offset to read revert message from and length of the revert message. /// > - This allows us to bubble the revert message from the external call. /// - `0x1e..0x1e` - Jump destination for successful call. /// > - `jumpdest` is a no-op that marks a valid jump destination. /// - `0x1f..0x1f` - Return if call was successful. /// > - `return` pops two top stack items: memory offset to read return data from and length of the return data. /// > - This allows us to reuse the return data from the external call. /// # Minimal Forwarder Init Code /// Inspired by [Create3 Init Code](https://github.com/0xSequence/create3/blob/master/contracts/Create3.sol). /// Following changes were made: /// - Adjusted bytecode length to 32 bytes. /// - Replaced second PUSH1 opcode with RETURNDATASIZE to push 0 onto the stack. /// > `bytecode` refers to the bytecode specified in the above table. /// ## Init Code Table /// | Pos | OP | OP + Args | Description | S1 | S0 | /// | ---- | ---- | --------- | --------------- | --- | -------- | /// | 0x00 | 0x7f | 0x7fXXXX | push32 bytecode | | bytecode | /// | 0x1b | 0x3d | 0x3d | returndatasize | 0 | bytecode | /// | 0x1c | 0x52 | 0x52 | mstore | | | /// | 0x1d | 0x60 | 0x6020 | push1 0x20 | | 32 | /// | 0x1f | 0x3d | 0x3d | returndatasize | 0 | 32 | /// | 0x20 | 0xf3 | 0xf3 | return | | | /// > Init Code is executed when a contract is deployed. The returned value is saved as the contract code. /// > Therefore, the init code is constructed in such a way that it returns the Minimal Forwarder bytecode. /// ## Init Code Explanation /// - `0x00..0x1a` - Push the Minimal Forwarder bytecode onto the stack. /// > - `push32` pushes 32 bytes as a single stack item onto the stack. /// - `0x1b..0x1b` - Push 0 onto the stack. /// > No external calls were made, so the return data size is 0. /// - `0x1c..0x1c` - Write the Minimal Forwarder bytecode to memory. /// > - `mstore` pops two top stack items: memory offset to write to and value to write. /// > - Minimal Forwarder bytecode is 32 bytes long, so we need a single `mstore` to write it to memory. /// - `0x1d..0x1f` - Prepare stack for `return` opcode. /// > - We need to put `0 32` on the stack in order to return first 32 bytes of memory. /// - `0x20..0x20` - Return the Minimal Forwarder bytecode. /// > - `return` pops two top stack items: memory offset to read return data from and length of the return data. /// > - This allows us to return the Minimal Forwarder bytecode. library MinimalForwarderLib { using Address for address; using TypeCasts for address; using TypeCasts for bytes32; /// @notice Minimal Forwarder deployed bytecode. See the above table for more details. bytes internal constant FORWARDER_BYTECODE = hex"60_20_36_03_80_60_20_3d_37_3d_3d_3d_92_3d_34_3d_35_5a_f1_3d_82_80_3e_90_3d_91_60_1e_57_fd_5b_f3"; /// @notice Init code to deploy a minimal forwarder contract. bytes internal constant FORWARDER_INIT_CODE = abi.encodePacked(hex"7f", FORWARDER_BYTECODE, hex"3d_52_60_20_3d_f3"); /// @notice Hash of the minimal forwarder init code. Used to predict the address of a deployed forwarder. bytes32 internal constant FORWARDER_INIT_CODE_HASH = keccak256(FORWARDER_INIT_CODE); /// @notice Deploys a minimal forwarder contract using `CREATE2` with a given salt. /// @dev Will revert if the salt is already used. /// @param salt The salt to use for the deployment /// @return forwarder The address of the deployed minimal forwarder function deploy(bytes32 salt) internal returns (address forwarder) { // `bytes arr` is stored in memory in the following way // 1. First, uint256 arr.length is stored. That requires 32 bytes (0x20). // 2. Then, the array data is stored. bytes memory initCode = FORWARDER_INIT_CODE; // solhint-disable-next-line no-inline-assembly assembly { // Deploy the minimal forwarder with our pre-made bytecode via CREATE2. // We add 0x20 to get the location where the init code starts. forwarder := create2(0, add(initCode, 0x20), mload(initCode), salt) } // Deploy fails if the given salt is already used. if (forwarder == address(0)) { revert ForwarderDeploymentFailed(); } } /// @notice Forwards a call to a target address using a minimal forwarder. /// @dev Will bubble up any revert messages from the target. /// @param forwarder The address of the minimal forwarder to use /// @param target The address of the target contract to call /// @param payload The payload to pass to the target contract /// @return returnData The return data from the target contract function forwardCall( address forwarder, address target, bytes memory payload ) internal returns (bytes memory returnData) { // Forward a call without any ETH value returnData = forwardCallWithValue(forwarder, target, payload, 0); } /// @notice Forwards a call to a target address using a minimal forwarder with the given `msg.value`. /// @dev Will bubble up any revert messages from the target. /// @param forwarder The address of the minimal forwarder to use /// @param target The address of the target contract to call /// @param payload The payload to pass to the target contract /// @param value The amount of ETH to send with the call /// @return returnData The return data from the target contract function forwardCallWithValue( address forwarder, address target, bytes memory payload, uint256 value ) internal returns (bytes memory returnData) { // The payload to pass to the forwarder: // 1. First 32 bytes is the encoded target address // 2. The rest is the encoded payload to pass to the target returnData = forwarder.functionCallWithValue(abi.encodePacked(target.addressToBytes32(), payload), value); } /// @notice Predicts the address of a minimal forwarder contract deployed using `deploy()`. /// @param deployer The address of the deployer of the minimal forwarder /// @param salt The salt to use for the deployment /// @return The predicted address of the minimal forwarder deployed with the given salt function predictAddress(address deployer, bytes32 salt) internal pure returns (address) { return keccak256(abi.encodePacked(hex"ff", deployer, salt, FORWARDER_INIT_CODE_HASH)).bytes32ToAddress(); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import {CastOverflow} from "./Errors.sol"; library TypeCasts { // alignment preserving cast function addressToBytes32(address addr) internal pure returns (bytes32) { return bytes32(uint256(uint160(addr))); } // alignment preserving cast function bytes32ToAddress(bytes32 buf) internal pure returns (address) { return address(uint160(uint256(buf))); } /// @dev Casts uint256 to uint40, reverts on overflow function safeCastToUint40(uint256 value) internal pure returns (uint40) { if (value > type(uint40).max) { revert CastOverflow(); } return uint40(value); } /// @dev Casts uint256 to uint72, reverts on overflow function safeCastToUint72(uint256 value) internal pure returns (uint72) { if (value > type(uint72).max) { revert CastOverflow(); } return uint72(value); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; interface IDefaultPool { function swap( uint8 tokenIndexFrom, uint8 tokenIndexTo, uint256 dx, uint256 minDy, uint256 deadline ) external returns (uint256 amountOut); function calculateSwap( uint8 tokenIndexFrom, uint8 tokenIndexTo, uint256 dx ) external view returns (uint256 amountOut); function getToken(uint8 index) external view returns (address token); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; abstract contract SynapseCCTPFeesEvents { /// @notice Emitted when the fee collector is updated for a relayer /// @param relayer The relayer address /// @param oldFeeCollector The old fee collector address: will be able to withdraw prior fees /// @param newFeeCollector The new fee collector address: will be able to withdraw future fees event FeeCollectorUpdated(address indexed relayer, address oldFeeCollector, address newFeeCollector); /// @notice Emitted when the fee for relaying a CCTP message is collected /// @dev If fee collector address is not set, the full fee is collected for the protocol /// @param feeCollector The fee collector address /// @param relayerFeeAmount The amount of fees collected for the relayer /// @param protocolFeeAmount The amount of fees collected for the protocol event FeeCollected(address feeCollector, uint256 relayerFeeAmount, uint256 protocolFeeAmount); /// @notice Emitted when the amount of native gas airdropped to recipients is updated /// @param chainGasAmount The new amount of native gas airdropped to recipients event ChainGasAmountUpdated(uint256 chainGasAmount); /// @notice Emitted when the native chain gas is airdropped to a recipient event ChainGasAirdropped(uint256 amount); /// @notice Emitted when the protocol fee is updated /// @param newProtocolFee The new protocol fee event ProtocolFeeUpdated(uint256 newProtocolFee); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.17; import {BridgeToken} from "../../router/libs/Structs.sol"; interface ISynapseCCTPFees { /// @notice Calculates the fee amount for bridging a token to this chain using CCTP. /// @dev Will not check if fee exceeds the token amount. Will return 0 if the token is not supported. /// @param token Address of the Circle token /// @param amount Amount of the Circle tokens to be bridged to this chain /// @param isSwap Whether the request is a swap request /// @return fee Fee amount function calculateFeeAmount( address token, uint256 amount, bool isSwap ) external view returns (uint256 fee); /// @notice Returns the list of all supported bridge tokens and their symbols. function getBridgeTokens() external view returns (BridgeToken[] memory bridgeTokens); /// @notice Returns the address of the CCTP token for a given symbol. /// @dev Will return address(0) if the token is not supported. function symbolToToken(string memory symbol) external view returns (address token); /// @notice Returns the symbol of a given CCTP token. /// @dev Will return empty string if the token is not supported. function tokenToSymbol(address token) external view returns (string memory symbol); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.13; // "using A for B global" requires 0.8.13 or higher // ══════════════════════════════════════════ TOKEN AND POOL DESCRIPTION ═══════════════════════════════════════════════ /// @notice Struct representing a bridge token. Used as the return value in view functions. /// @param symbol Bridge token symbol: unique token ID consistent among all chains /// @param token Bridge token address struct BridgeToken { string symbol; address token; } /// @notice Struct used by IPoolHandler to represent a token in a pool /// @param index Token index in the pool /// @param token Token address struct IndexedToken { uint8 index; address token; } /// @notice Struct representing a token, and the available Actions for performing a swap. /// @param actionMask Bitmask representing what actions (see ActionLib) are available for swapping a token /// @param token Token address struct LimitedToken { uint256 actionMask; address token; } /// @notice Struct representing how pool tokens are stored by `SwapQuoter`. /// @param isWeth Whether the token represents Wrapped ETH. /// @param token Token address. struct PoolToken { bool isWeth; address token; } /// @notice Struct representing a liquidity pool. Used as the return value in view functions. /// @param pool Pool address. /// @param lpToken Address of pool's LP token. /// @param tokens List of pool's tokens. struct Pool { address pool; address lpToken; PoolToken[] tokens; } // ════════════════════════════════════════════════ ROUTER STRUCTS ═════════════════════════════════════════════════════ /// @notice Struct representing a quote request for swapping a bridge token. /// Used in destination chain's SynapseRouter, hence the name "Destination Request". /// @dev tokenOut is passed externally. /// @param symbol Bridge token symbol: unique token ID consistent among all chains /// @param amountIn Amount of bridge token to start with, before the bridge fee is applied struct DestRequest { string symbol; uint256 amountIn; } /// @notice Struct representing a swap request for SynapseRouter. /// @dev tokenIn is supplied separately. /// @param routerAdapter Contract that will perform the swap for the Router. Address(0) specifies a "no swap" query. /// @param tokenOut Token address to swap to. /// @param minAmountOut Minimum amount of tokens to receive after the swap, or tx will be reverted. /// @param deadline Latest timestamp for when the transaction needs to be executed, or tx will be reverted. /// @param rawParams ABI-encoded params for the swap that will be passed to `routerAdapter`. /// Should be DefaultParams for swaps via DefaultAdapter. struct SwapQuery { address routerAdapter; address tokenOut; uint256 minAmountOut; uint256 deadline; bytes rawParams; } // ════════════════════════════════════════════════ ADAPTER STRUCTS ════════════════════════════════════════════════════ /// @notice Struct representing parameters for swapping via DefaultAdapter. /// @param action Action that DefaultAdapter needs to perform. /// @param pool Liquidity pool that will be used for Swap/AddLiquidity/RemoveLiquidity actions. /// @param tokenIndexFrom Token index to swap from. Used for swap/addLiquidity actions. /// @param tokenIndexTo Token index to swap to. Used for swap/removeLiquidity actions. struct DefaultParams { Action action; address pool; uint8 tokenIndexFrom; uint8 tokenIndexTo; } /// @notice All possible actions that DefaultAdapter could perform. enum Action { Swap, // swap between two pools tokens AddLiquidity, // add liquidity in a form of a single pool token RemoveLiquidity, // remove liquidity in a form of a single pool token HandleEth // ETH <> WETH interaction } using ActionLib for Action global; /// @notice Library for dealing with bit masks which describe what set of Actions is available. library ActionLib { /// @notice Returns a bitmask with all possible actions set to True. function allActions() internal pure returns (uint256 actionMask) { actionMask = type(uint256).max; } /// @notice Returns whether the given action is set to True in the bitmask. function isIncluded(Action action, uint256 actionMask) internal pure returns (bool) { return actionMask & mask(action) != 0; } /// @notice Returns a bitmask with only the given action set to True. function mask(Action action) internal pure returns (uint256) { return 1 << uint256(action); } /// @notice Returns a bitmask with only two given actions set to True. function mask(Action a, Action b) internal pure returns (uint256) { return mask(a) | mask(b); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * 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. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // 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; 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 on 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; assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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); /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
{ "remappings": [ "@boringcrypto/=node_modules/@boringcrypto/", "@ensdomains/=node_modules/@ensdomains/", "@openzeppelin/=node_modules/@openzeppelin/", "ds-test/=lib/forge-std/lib/ds-test/src/", "eth-gas-reporter/=node_modules/eth-gas-reporter/", "forge-std/=lib/forge-std/src/", "hardhat-deploy/=node_modules/hardhat-deploy/", "hardhat/=node_modules/hardhat/", "sol-explore/=node_modules/sol-explore/", "solmate/=lib/solmate/src/", "synthetix/=node_modules/synthetix/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract ITokenMessenger","name":"tokenMessenger_","type":"address"},{"internalType":"address","name":"owner_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CCTPGasRescueFailed","type":"error"},{"inputs":[],"name":"CCTPIncorrectChainId","type":"error"},{"inputs":[],"name":"CCTPIncorrectConfig","type":"error"},{"inputs":[],"name":"CCTPIncorrectDomain","type":"error"},{"inputs":[],"name":"CCTPIncorrectGasAmount","type":"error"},{"inputs":[],"name":"CCTPIncorrectProtocolFee","type":"error"},{"inputs":[],"name":"CCTPInsufficientAmount","type":"error"},{"inputs":[],"name":"CCTPMessageNotReceived","type":"error"},{"inputs":[],"name":"CCTPSymbolAlreadyAdded","type":"error"},{"inputs":[],"name":"CCTPSymbolIncorrect","type":"error"},{"inputs":[],"name":"CCTPTokenAlreadyAdded","type":"error"},{"inputs":[],"name":"CCTPTokenNotFound","type":"error"},{"inputs":[],"name":"CCTPZeroAddress","type":"error"},{"inputs":[],"name":"CCTPZeroAmount","type":"error"},{"inputs":[],"name":"CastOverflow","type":"error"},{"inputs":[],"name":"ForwarderDeploymentFailed","type":"error"},{"inputs":[],"name":"IncorrectRequestLength","type":"error"},{"inputs":[],"name":"RemoteCCTPDeploymentNotSet","type":"error"},{"inputs":[],"name":"UnknownRequestVersion","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ChainGasAirdropped","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"chainGasAmount","type":"uint256"}],"name":"ChainGasAmountUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"originDomain","type":"uint32"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"address","name":"mintToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"requestID","type":"bytes32"}],"name":"CircleRequestFulfilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"chainId","type":"uint256"},{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint64","name":"nonce","type":"uint64"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"requestVersion","type":"uint32"},{"indexed":false,"internalType":"bytes","name":"formattedRequest","type":"bytes"},{"indexed":false,"internalType":"bytes32","name":"requestID","type":"bytes32"}],"name":"CircleRequestSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"feeCollector","type":"address"},{"indexed":false,"internalType":"uint256","name":"relayerFeeAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"protocolFeeAmount","type":"uint256"}],"name":"FeeCollected","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"relayer","type":"address"},{"indexed":false,"internalType":"address","name":"oldFeeCollector","type":"address"},{"indexed":false,"internalType":"address","name":"newFeeCollector","type":"address"}],"name":"FeeCollectorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newProtocolFee","type":"uint256"}],"name":"ProtocolFeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"accumulatedFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"symbol","type":"string"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"relayerFee","type":"uint256"},{"internalType":"uint256","name":"minBaseFee","type":"uint256"},{"internalType":"uint256","name":"minSwapFee","type":"uint256"},{"internalType":"uint256","name":"maxFee","type":"uint256"}],"name":"addToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"isSwap","type":"bool"}],"name":"calculateFeeAmount","outputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chainGasAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"circleTokenPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"feeStructures","outputs":[{"internalType":"uint40","name":"relayerFee","type":"uint40"},{"internalType":"uint72","name":"minBaseFee","type":"uint72"},{"internalType":"uint72","name":"minSwapFee","type":"uint72"},{"internalType":"uint72","name":"maxFee","type":"uint72"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBridgeTokens","outputs":[{"components":[{"internalType":"string","name":"symbol","type":"string"},{"internalType":"address","name":"token","type":"address"}],"internalType":"struct BridgeToken[]","name":"bridgeTokens","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"remoteDomain","type":"uint32"},{"internalType":"address","name":"remoteToken","type":"address"}],"name":"getLocalToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"requestID","type":"bytes32"}],"name":"isRequestFulfilled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"localDomain","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"messageTransmitter","outputs":[{"internalType":"contract IMessageTransmitter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauseSending","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"protocolFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"message","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"uint32","name":"requestVersion","type":"uint32"},{"internalType":"bytes","name":"formattedRequest","type":"bytes"}],"name":"receiveCircleToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"relayerFeeCollectors","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"remoteDomainConfig","outputs":[{"internalType":"uint32","name":"domain","type":"uint32"},{"internalType":"address","name":"synapseCCTP","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"removeToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rescueGas","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"burnToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint32","name":"requestVersion","type":"uint32"},{"internalType":"bytes","name":"swapParams","type":"bytes"}],"name":"sendCircleToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newChainGasAmount","type":"uint256"}],"name":"setChainGasAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"circleToken","type":"address"},{"internalType":"address","name":"pool","type":"address"}],"name":"setCircleTokenPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"feeCollector","type":"address"}],"name":"setFeeCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newProtocolFee","type":"uint256"}],"name":"setProtocolFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"remoteChainId","type":"uint256"},{"internalType":"uint32","name":"remoteDomain","type":"uint32"},{"internalType":"address","name":"remoteSynapseCCTP","type":"address"}],"name":"setRemoteDomainConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"relayerFee","type":"uint256"},{"internalType":"uint256","name":"minBaseFee","type":"uint256"},{"internalType":"uint256","name":"minSwapFee","type":"uint256"},{"internalType":"uint256","name":"maxFee","type":"uint256"}],"name":"setTokenFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"symbolToToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenMessenger","outputs":[{"internalType":"contract ITokenMessenger","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenToSymbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpauseSending","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"withdrawProtocolFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"withdrawRelayerFees","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60e06040523480156200001157600080fd5b5060405162003e1138038062003e118339810160408190526200003491620001af565b6200003f3362000146565b600a805460ff191690556001600160a01b03821660c081905260408051632c12192160e01b81529051632c121921916004808201926020929091908290030181865afa15801562000094573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000ba9190620001ee565b6001600160a01b031660a08190526040805163234d8e3d60e21b81529051638d3638f4916004808201926020929091908290030181865afa15801562000104573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200012a919062000215565b63ffffffff166080526200013e8162000146565b50506200023d565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381168114620001ac57600080fd5b50565b60008060408385031215620001c357600080fd5b8251620001d08162000196565b6020840151909250620001e38162000196565b809150509250929050565b6000602082840312156200020157600080fd5b81516200020e8162000196565b9392505050565b6000602082840312156200022857600080fd5b815163ffffffff811681146200020e57600080fd5b60805160a05160c051613b6c620002a56000396000818161034401528181610bec01528181610c1b0152611e0201526000818161044401528181610a570152611d9b01526000818161047801528181610ae201528181610e2101526116040152613b6c6000f3fe6080604052600436106102045760003560e01c80638da5cb5b11610118578063d77938e4116100a0578063e9259ab91161006f578063e9259ab9146106e8578063e9bbb36d14610752578063f2fde38b14610772578063f7265b3a14610792578063f879a41a146107b257600080fd5b8063d77938e414610614578063dc72495b14610629578063e00a83e0146106bd578063e7a64a80146106d357600080fd5b8063a4b1d034116100e7578063a4b1d0341461052f578063a5bc29c214610565578063b0e21e8a146105a6578063b250fe6b146105bc578063d4a67c6d146105dc57600080fd5b80638da5cb5b146104af57806392a442ea146104cd5780639c1d060e146104ed578063a42dce801461050f57600080fd5b80634a5ae51d1161019b5780635fa7b5841161016a5780635fa7b584146103dd578063715018a6146103fd578063787dce3d146104125780637b04c181146104325780638d3638f41461046657600080fd5b80634a5ae51d146103665780634a85178d146103795780634bdb4eed146103995780635c975abb146103b957600080fd5b8063304ddb4c116101d7578063304ddb4c146102af57806340432d51146102cf57806341f355ee146102e4578063461178301461033257600080fd5b80630ba36121146102095780630d25aafe1461023f5780632cc9e7e51461026d5780632d80caa51461028f575b600080fd5b34801561021557600080fd5b50610229610224366004613053565b6107d2565b60405161023691906130c0565b60405180910390f35b34801561024b57600080fd5b5061025f61025a3660046130e1565b61086c565b604051908152602001610236565b34801561027957600080fd5b5061028d610288366004613123565b610883565b005b34801561029b57600080fd5b5061028d6102aa366004613053565b610933565b3480156102bb57600080fd5b5061028d6102ca366004613231565b6109d9565b3480156102db57600080fd5b5061028d610d35565b3480156102f057600080fd5b5061031a6102ff366004613053565b6005602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610236565b34801561033e57600080fd5b5061031a7f000000000000000000000000000000000000000000000000000000000000000081565b61028d6103743660046132f8565b610dcb565b34801561038557600080fd5b5061028d610394366004613391565b610f3e565b3480156103a557600080fd5b5061028d6103b4366004613402565b611038565b3480156103c557600080fd5b50600a5460ff165b6040519015158152602001610236565b3480156103e957600080fd5b5061028d6103f8366004613053565b61109e565b34801561040957600080fd5b5061028d611205565b34801561041e57600080fd5b5061028d61042d366004613446565b61123b565b34801561043e57600080fd5b5061031a7f000000000000000000000000000000000000000000000000000000000000000081565b34801561047257600080fd5b5061049a7f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff9091168152602001610236565b3480156104bb57600080fd5b506000546001600160a01b031661031a565b3480156104d957600080fd5b506103cd6104e8366004613446565b6112d1565b3480156104f957600080fd5b506105026112ef565b604051610236919061345f565b34801561051b57600080fd5b5061028d61052a366004613053565b61147b565b34801561053b57600080fd5b5061031a61054a366004613053565b600c602052600090815260409020546001600160a01b031681565b34801561057157600080fd5b5061031a6105803660046134de565b80516020818301810180516002825292820191909301209152546001600160a01b031681565b3480156105b257600080fd5b5061025f60065481565b3480156105c857600080fd5b5061028d6105d7366004613446565b6114eb565b3480156105e857600080fd5b5061025f6105f7366004613123565b600460209081526000928352604080842090915290825290205481565b34801561062057600080fd5b5061028d61154a565b34801561063557600080fd5b50610686610644366004613053565b60036020526000908152604090205464ffffffffff8116906001600160481b03650100000000008204811691600160701b8104821691600160b81b9091041684565b6040805164ffffffffff90951685526001600160481b03938416602086015291831691840191909152166060820152608001610236565b3480156106c957600080fd5b5061025f60075481565b3480156106df57600080fd5b5061028d61157c565b3480156106f457600080fd5b5061072e610703366004613446565b600b6020526000908152604090205463ffffffff81169064010000000090046001600160a01b031682565b6040805163ffffffff90931683526001600160a01b03909116602083015201610236565b34801561075e57600080fd5b5061028d61076d366004613512565b6115ae565b34801561077e57600080fd5b5061028d61078d366004613053565b6116f8565b34801561079e57600080fd5b5061028d6107ad366004613053565b611790565b3480156107be57600080fd5b5061031a6107cd366004613549565b611806565b600160205260009081526040902080546107eb90613567565b80601f016020809104026020016040519081016040528092919081815260200182805461081790613567565b80156108645780601f1061083957610100808354040283529160200191610864565b820191906000526020600020905b81548152906001019060200180831161084757829003601f168201915b505050505081565b600061087984848461181b565b90505b9392505050565b6000546001600160a01b031633146108b65760405162461bcd60e51b81526004016108ad9061359b565b60405180910390fd5b6001600160a01b0382166108dd576040516312182f6560e11b815260040160405180910390fd5b6108e86008836118fe565b610905576040516314ed699b60e21b815260040160405180910390fd5b6001600160a01b039182166000908152600c6020526040902080546001600160a01b03191691909216179055565b6000546001600160a01b0316331461095d5760405162461bcd60e51b81526004016108ad9061359b565b6001600160a01b0381166000908152600080516020613aee8339815191526020526040812054908190036109a4576040516330b93f1d60e01b815260040160405180910390fd5b6001600160a01b0382166000818152600080516020613aee83398151915260205260408120556109d5903383611920565b5050565b600a5460ff1615610a1f5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016108ad565b610a2a6008856118fe565b610a47576040516314ed699b60e21b815260040160405180910390fd5b610a518484611988565b925060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638371744e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ab3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad791906135ec565b6040805163ffffffff7f00000000000000000000000000000000000000000000000000000000000000001660208201526001600160401b038316818301526001600160a01b038089166060830152608082018890528a1660a0808301919091528251808303909101815260c0909101909152909150600090610b5b90859085611a88565b6000888152600b6020908152604080832081518083019092525463ffffffff8116825264010000000090046001600160a01b031691810182905292935090819003610bb9576040516354351d8760e11b815260040160405180910390fd5b8151835160208086019190912067ffffffff0000000083831b1663ffffffff8a16176000908152915260409020610c118a7f00000000000000000000000000000000000000000000000000000000000000008b611b51565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663f856ddb68a84868e610c4e8288611c06565b6040516001600160e01b031960e088901b168152600481019590955263ffffffff93909316602485015260448401919091526001600160a01b03166064830152608482015260a4016020604051808303816000875af1158015610cb5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd991906135ec565b50326001600160a01b03167fc4980459837e213aedb84d9046eab1db050fec66cb9e046c4fe3b5578b01b20c8c888d8d8d8b88604051610d1f9796959493929190613607565b60405180910390a2505050505050505050505050565b6000546001600160a01b03163314610d5f5760405162461bcd60e51b81526004016108ad9061359b565b604051600090339047908381818185875af1925050503d8060008114610da1576040519150601f19603f3d011682016040523d82523d6000602084013e610da6565b606091505b5050905080610dc85760405163272b087d60e11b815260040160405180910390fd5b50565b6007543414610ded5760405163c561806560e01b815260040160405180910390fd5b600080610dfa8484611c2a565b91509150600080600080610e0d86611cd8565b8b516020808e019190912063ffffffff8f167f0000000000000000000000000000000000000000000000000000000000000000831b67ffffffff000000001617600090815291526040812095995092975090955093509190509050610e758d8d8d8d85611d28565b6000610e818686611dfd565b90506000610e99828663ffffffff8e16600114611f48565b9095509050600080610ead8685898d612142565b90925090503415610ec157610ec18661225b565b6040805163ffffffff8b1681526001600160a01b03868116602083015291810185905283821660608201526080810183905260a08101879052908716907f7864397c00beabf21ab17a04795e450354505d879a634dd2632f4fdc4b5ba04e9060c00160405180910390a25050505050505050505050505050505050565b6000546001600160a01b03163314610f685760405162461bcd60e51b81526004016108ad9061359b565b6001600160a01b038516610f8f576040516376998feb60e01b815260040160405180910390fd5b610f9a6008866122f5565b610fb757604051631191732560e01b815260040160405180910390fd5b610fc08661230a565b6001600160a01b0385166000908152600160205260409020610fe287826136a9565b5084600287604051610ff49190613768565b90815260405190819003602001902080546001600160a01b03929092166001600160a01b03199092169190911790556110308585858585612417565b505050505050565b6000546001600160a01b031633146110625760405162461bcd60e51b81526004016108ad9061359b565b61106d6008866118fe565b61108a576040516314ed699b60e21b815260040160405180910390fd5b6110978585858585612417565b5050505050565b6000546001600160a01b031633146110c85760405162461bcd60e51b81526004016108ad9061359b565b6110d360088261257c565b6110f0576040516314ed699b60e21b815260040160405180910390fd5b6001600160a01b0381166000908152600160205260408120805461111390613567565b80601f016020809104026020016040519081016040528092919081815260200182805461113f90613567565b801561118c5780601f106111615761010080835404028352916020019161118c565b820191906000526020600020905b81548152906001019060200180831161116f57829003601f168201915b505050506001600160a01b03841660009081526001602052604081209293506111b6929150612ff4565b6002816040516111c69190613768565b908152604080516020928190038301902080546001600160a01b03191690556001600160a01b0393909316600090815260039091529182209190915550565b6000546001600160a01b0316331461122f5760405162461bcd60e51b81526004016108ad9061359b565b6112396000612591565b565b6000546001600160a01b031633146112655760405162461bcd60e51b81526004016108ad9061359b565b61127560026402540be40061379a565b811115611295576040516328562c4760e01b815260040160405180910390fd5b60068190556040518181527fd10d75876659a287a59a6ccfa2e3fff42f84d94b542837acd30bc184d562de40906020015b60405180910390a150565b6000806112de30846125e1565b6001600160a01b03163b1192915050565b606060006112fd60086126a2565b9050806001600160401b038111156113175761131761316e565b60405190808252806020026020018201604052801561135d57816020015b6040805180820190915260608152600060208201528152602001906001900390816113355790505b50915060005b818110156114765760006113786008836126ac565b9050604051806040016040528060016000846001600160a01b03166001600160a01b0316815260200190815260200160002080546113b590613567565b80601f01602080910402602001604051908101604052809291908181526020018280546113e190613567565b801561142e5780601f106114035761010080835404028352916020019161142e565b820191906000526020600020905b81548152906001019060200180831161141157829003601f168201915b50505050508152602001826001600160a01b0316815250848381518110611457576114576137bc565b602002602001018190525050808061146e906137d2565b915050611363565b505090565b3360008181526005602090815260409182902080546001600160a01b031981166001600160a01b03878116918217909355845192909116808352928201529092917f9dfcadd14a1ddfb19c51e84b87452ca32a43c5559e9750d1575c77105cdeac1e910160405180910390a25050565b6000546001600160a01b031633146115155760405162461bcd60e51b81526004016108ad9061359b565b60078190556040518181527f5e8bad84cb22c143a6757c7f1252a7d53493816880330977cc99bb7c15aaf6b4906020016112c6565b6000546001600160a01b031633146115745760405162461bcd60e51b81526004016108ad9061359b565b6112396126b8565b6000546001600160a01b031633146115a65760405162461bcd60e51b81526004016108ad9061359b565b611239612750565b6000546001600160a01b031633146115d85760405162461bcd60e51b81526004016108ad9061359b565b8215806115e457504683145b1561160257604051633f8f40a960e01b815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000063ffffffff168263ffffffff160361164e576040516312792e1960e31b815260040160405180910390fd5b63ffffffff8216156001841414611678576040516312792e1960e31b815260040160405180910390fd5b6001600160a01b03811661169f576040516312182f6560e11b815260040160405180910390fd5b60408051808201825263ffffffff93841681526001600160a01b0392831660208083019182526000968752600b905291909420935184549151909216640100000000026001600160c01b03199091169190921617179055565b6000546001600160a01b031633146117225760405162461bcd60e51b81526004016108ad9061359b565b6001600160a01b0381166117875760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108ad565b610dc881612591565b3360009081526004602090815260408083206001600160a01b0385168452909152812054908190036117d5576040516330b93f1d60e01b815260040160405180910390fd5b3360008181526004602090815260408083206001600160a01b03871680855292528220919091556109d59183611920565b60006118128383611dfd565b90505b92915050565b6001600160a01b03831660009081526003602090815260408083208151608081018352905464ffffffffff81168083526001600160481b03650100000000008304811695840195909552600160701b8204851693830193909352600160b81b900490921660608301526402540be4009061189590866137eb565b61189f919061379a565b91506000836118b25781602001516118b8565b81604001515b6001600160481b03169050808310156118cf578092505b81606001516001600160481b03168311156118f55781606001516001600160481b031692505b50509392505050565b6001600160a01b03811660009081526001830160205260408120541515611812565b6040516001600160a01b03831660248201526044810182905261198390849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526127ca565b505050565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa1580156119d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119f59190613802565b9050611a0c6001600160a01b03851633308661289c565b6040516370a0823160e01b815230600482015281906001600160a01b038616906370a0823190602401602060405180830381865afa158015611a52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a769190613802565b611a80919061381b565b949350505050565b606060a0835114611aac576040516374593f8760e01b815260040160405180910390fd5b63ffffffff8416611ade57815115611ad7576040516374593f8760e01b815260040160405180910390fd5b508161087c565b60001963ffffffff851601611b38576080825114611b0f576040516374593f8760e01b815260040160405180910390fd5b8282604051602001611b2292919061382e565b604051602081830303815290604052905061087c565b60405163523fa8d560e01b815260040160405180910390fd5b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611ba1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bc59190613802565b905081811015611c00578015611bea57611bea6001600160a01b0385168460006128d4565b611c006001600160a01b038516846000196128d4565b50505050565b6000611812611c1e6001600160a01b038516846125e1565b6001600160a01b031690565b60608063ffffffff8416611c725760a0835114611c5a576040516374593f8760e01b815260040160405180910390fd5b50506040805160208101909152600081528190611cd1565b60001963ffffffff851601611b38576080611c8e60a082613853565b611c989190613853565b835114611cb8576040516374593f8760e01b815260040160405180910390fd5b82806020019051810190611ccc91906138ab565b915091505b9250929050565b600080600080600060a0865114611d02576040516374593f8760e01b815260040160405180910390fd5b85806020019051810190611d16919061390e565b939a9299509097509550909350915050565b6000611d33826129e9565b905060006357ecfd2860e01b87878787604051602401611d56949392919061399e565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915290506000611dc06001600160a01b0384167f000000000000000000000000000000000000000000000000000000000000000084612a7c565b905080806020019051810190611dd691906139c5565b611df35760405163182f34eb60e01b815260040160405180910390fd5b5050505050505050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663cb75c11c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611e5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e8291906139e2565b9050806001600160a01b03166378a0565e85611ead866001600160a01b03166001600160a01b031690565b6040516001600160e01b031960e085901b16815263ffffffff9290921660048301526024820152604401602060405180830381865afa158015611ef4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1891906139e2565b91506001600160a01b038216611f41576040516314ed699b60e21b815260040160405180910390fd5b5092915050565b600080611f566008866118fe565b611f73576040516314ed699b60e21b815260040160405180910390fd5b611f7e85858561181b565b9050838110611fa057604051630fab90b960e21b815260040160405180910390fd5b3360009081526005602052604090205481850392506001600160a01b031680612043576001600160a01b0386166000908152600080516020613aee833981519152602052604081208054849290611ff8908490613853565b909155505060408051600080825260208201529081018390527f108516ddcf5ba43cea6bb2cd5ff6d59ac196c1c86ccb9178332b9dd72d1ca5619060600160405180910390a1612139565b60006402540be4006006548461205991906137eb565b612063919061379a565b90506000612071828561381b565b6001600160a01b0389166000908152600080516020613aee83398151915260205260408120805492935084929091906120ab908490613853565b90915550506001600160a01b038084166000908152600460209081526040808320938c16835292905290812080548392906120e7908490613853565b9091555050604080516001600160a01b0385168152602081018390529081018390527f108516ddcf5ba43cea6bb2cd5ff6d59ac196c1c86ccb9178332b9dd72d1ca5619060600160405180910390a150505b50935093915050565b600080825160000361216c576121626001600160a01b0386168786611920565b5083905082612252565b6001600160a01b038086166000908152600c602052604090205416806121ac576121a06001600160a01b0387168887611920565b85859250925050612252565b6000806000806121bb88612a8b565b93509350935093506121cd8584612ad6565b96506001600160a01b038716612201576121f16001600160a01b038b168c8b611920565b8989965096505050505050612252565b61220c8a868b611b51565b61221a8585858c8686612baa565b955085600003612238576121f16001600160a01b038b168c8b611920565b61224c6001600160a01b0388168c88611920565b50505050505b94509492505050565b6000816001600160a01b03163460405160006040518083038185875af1925050503d80600081146122a8576040519150601f19603f3d011682016040523d82523d6000602084013e6122ad565b606091505b505090507ff9b0951a3a6282341e1ba9414555d42d04e99076337702ee6dc484a706bfd683816122de5760006122e0565b345b60405190815260200160405180910390a15050565b6000611812836001600160a01b038416612c48565b60006001600160a01b03166002826040516123259190613768565b908152604051908190036020019020546001600160a01b03161461235c576040516382ca3adf60e01b815260040160405180910390fd5b80518190600510612380576040516307f1fcb560e31b815260040160405180910390fd5b60005b6005811015611983576040518060400160405280600581526020016421a1aa281760d91b81525081815181106123bb576123bb6137bc565b602001015160f81c60f81b6001600160f81b0319168282815181106123e2576123e26137bc565b01602001516001600160f81b0319161461240f576040516307f1fcb560e31b815260040160405180910390fd5b600101612383565b6298968084111561243b576040516376998feb60e01b815260040160405180910390fd5b8183111561245c576040516376998feb60e01b815260040160405180910390fd5b8082111561247d576040516376998feb60e01b815260040160405180910390fd5b604051806080016040528061249186612c97565b64ffffffffff1681526020016124a685612cc3565b6001600160481b031681526020016124bd84612cc3565b6001600160481b031681526020016124d483612cc3565b6001600160481b039081169091526001600160a01b039096166000908152600360209081526040918290208351815492850151938501516060909501518a16600160b81b026001600160b81b03958b16600160701b02959095166dffffffffffffffffffffffffffff94909a1665010000000000026dffffffffffffffffffffffffffff1990931664ffffffffff909116179190911791909116969096171790945550505050565b6000611812836001600160a01b038416612ced565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061181283836040518060400160405280602081526020017f602036038060203d373d3d3d923d343d355af13d82803e903d91601e57fd5bf381525060405160200161262e91906139ff565b60405160208183030381529060405280519060200120604051602001612689939291906001600160f81b0319815260609390931b6bffffffffffffffffffffffff191660018401526015830191909152603582015260550190565b6040516020818303038152906040528051906020012090565b6000611815825490565b60006118128383612de0565b600a5460ff16156126fe5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016108ad565b600a805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586127333390565b6040516001600160a01b03909116815260200160405180910390a1565b600a5460ff166127995760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016108ad565b600a805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612733565b600061281f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612e0a9092919063ffffffff16565b805190915015611983578080602001905181019061283d91906139c5565b6119835760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016108ad565b6040516001600160a01b0380851660248301528316604482015260648101829052611c009085906323b872dd60e01b9060840161194c565b80158061294e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612928573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061294c9190613802565b155b6129b95760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016108ad565b6040516001600160a01b03831660248201526044810182905261198390849063095ea7b360e01b9060640161194c565b6000806040518060400160405280602081526020017f602036038060203d373d3d3d923d343d355af13d82803e903d91601e57fd5bf3815250604051602001612a3291906139ff565b6040516020818303038152906040529050828151602083016000f591506001600160a01b038216612a76576040516309ebea7f60e21b815260040160405180910390fd5b50919050565b60606108798484846000612e19565b6000806000806080855114612ab3576040516374593f8760e01b815260040160405180910390fd5b84806020019051810190612ac79190613a4a565b93509350935093509193509193565b6040805160ff831660248083019190915282518083039091018152604490910182526020810180516001600160e01b031662415c3360e91b1790529051600091829182916001600160a01b03871691612b2f9190613768565b600060405180830381855afa9150503d8060008114612b6a576040519150601f19603f3d011682016040523d82523d6000602084013e612b6f565b606091505b5091509150818015612b82575080516020145b15612b9d57612b96612b9382613a8d565b90565b9250612ba2565b600092505b505092915050565b6040516348b4aac360e11b815260ff8087166004830152851660248201526044810184905260648101829052608481018390526000906001600160a01b0388169063916955869060a4016020604051808303816000875af1925050508015612c2f575060408051601f3d908101601f19168201909252612c2c91810190613802565b60015b612c3b57506000612c3e565b90505b9695505050505050565b6000818152600183016020526040812054612c8f57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611815565b506000611815565b600064ffffffffff821115612cbf57604051631cb1a8e360e31b815260040160405180910390fd5b5090565b60006001600160481b03821115612cbf57604051631cb1a8e360e31b815260040160405180910390fd5b60008181526001830160205260408120548015612dd6576000612d1160018361381b565b8554909150600090612d259060019061381b565b9050818114612d8a576000866000018281548110612d4557612d456137bc565b9060005260206000200154905080876000018481548110612d6857612d686137bc565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612d9b57612d9b613ab1565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611815565b6000915050611815565b6000826000018281548110612df757612df76137bc565b9060005260206000200154905092915050565b60606108798484600085612e64565b6060612e5b6001600160a01b03851684604051602001612e3a929190613ac7565b60408051601f198184030181529190526001600160a01b0387169084612f95565b95945050505050565b606082471015612ec55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016108ad565b6001600160a01b0385163b612f1c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108ad565b600080866001600160a01b03168587604051612f389190613768565b60006040518083038185875af1925050503d8060008114612f75576040519150601f19603f3d011682016040523d82523d6000602084013e612f7a565b606091505b5091509150612f8a828286612fbb565b979650505050505050565b6060610879848484604051806060016040528060298152602001613b0e60299139612e64565b60608315612fca57508161087c565b825115612fda5782518084602001fd5b8160405162461bcd60e51b81526004016108ad91906130c0565b50805461300090613567565b6000825580601f10613010575050565b601f016020900490600052602060002090810190610dc891905b80821115612cbf576000815560010161302a565b6001600160a01b0381168114610dc857600080fd5b60006020828403121561306557600080fd5b813561087c8161303e565b60005b8381101561308b578181015183820152602001613073565b50506000910152565b600081518084526130ac816020860160208601613070565b601f01601f19169290920160200192915050565b6020815260006118126020830184613094565b8015158114610dc857600080fd5b6000806000606084860312156130f657600080fd5b83356131018161303e565b9250602084013591506040840135613118816130d3565b809150509250925092565b6000806040838503121561313657600080fd5b82356131418161303e565b915060208301356131518161303e565b809150509250929050565b63ffffffff81168114610dc857600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156131ac576131ac61316e565b604052919050565b60006001600160401b038211156131cd576131cd61316e565b50601f01601f191660200190565b600082601f8301126131ec57600080fd5b81356131ff6131fa826131b4565b613184565b81815284602083860101111561321457600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060008060c0878903121561324a57600080fd5b86356132558161303e565b955060208701359450604087013561326c8161303e565b93506060870135925060808701356132838161315c565b915060a08701356001600160401b0381111561329e57600080fd5b6132aa89828a016131db565b9150509295509295509295565b60008083601f8401126132c957600080fd5b5081356001600160401b038111156132e057600080fd5b602083019150836020828501011115611cd157600080fd5b6000806000806000806080878903121561331157600080fd5b86356001600160401b038082111561332857600080fd5b6133348a838b016132b7565b9098509650602089013591508082111561334d57600080fd5b6133598a838b016132b7565b90965094506040890135915061336e8261315c565b9092506060880135908082111561338457600080fd5b506132aa89828a016131db565b60008060008060008060c087890312156133aa57600080fd5b86356001600160401b038111156133c057600080fd5b6133cc89828a016131db565b96505060208701356133dd8161303e565b95989597505050506040840135936060810135936080820135935060a0909101359150565b600080600080600060a0868803121561341a57600080fd5b85356134258161303e565b97602087013597506040870135966060810135965060800135945092505050565b60006020828403121561345857600080fd5b5035919050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b838110156134d057888303603f19018552815180518785526134aa88860182613094565b918901516001600160a01b03169489019490945294870194925090860190600101613486565b509098975050505050505050565b6000602082840312156134f057600080fd5b81356001600160401b0381111561350657600080fd5b611a80848285016131db565b60008060006060848603121561352757600080fd5b8335925060208401356135398161315c565b915060408401356131188161303e565b6000806040838503121561355c57600080fd5b82356131418161315c565b600181811c9082168061357b57607f821691505b602082108103612a7657634e487b7160e01b600052602260045260246000fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b80516001600160401b03811681146135e757600080fd5b919050565b6000602082840312156135fe57600080fd5b611812826135d0565b8781526001600160401b038716602082015260018060a01b038616604082015284606082015263ffffffff8416608082015260e060a0820152600061364f60e0830185613094565b90508260c083015298975050505050505050565b601f82111561198357600081815260208120601f850160051c8101602086101561368a5750805b601f850160051c820191505b8181101561103057828155600101613696565b81516001600160401b038111156136c2576136c261316e565b6136d6816136d08454613567565b84613663565b602080601f83116001811461370b57600084156136f35750858301515b600019600386901b1c1916600185901b178555611030565b600085815260208120601f198616915b8281101561373a5788860151825594840194600190910190840161371b565b50858210156137585787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000825161377a818460208701613070565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b6000826137b757634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b6000600182016137e4576137e4613784565b5060010190565b808202811582820484141761181557611815613784565b60006020828403121561381457600080fd5b5051919050565b8181038181111561181557611815613784565b6040815260006138416040830185613094565b8281036020840152612e5b8185613094565b8082018082111561181557611815613784565b600082601f83011261387757600080fd5b81516138856131fa826131b4565b81815284602083860101111561389a57600080fd5b611a80826020830160208701613070565b600080604083850312156138be57600080fd5b82516001600160401b03808211156138d557600080fd5b6138e186838701613866565b935060208501519150808211156138f757600080fd5b5061390485828601613866565b9150509250929050565b600080600080600060a0868803121561392657600080fd5b85516139318161315c565b945061393f602087016135d0565b9350604086015161394f8161303e565b6060870151608088015191945092506139678161303e565b809150509295509295909350565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6040815260006139b2604083018688613975565b8281036020840152612f8a818587613975565b6000602082840312156139d757600080fd5b815161087c816130d3565b6000602082840312156139f457600080fd5b815161087c8161303e565b607f60f81b81528151600090613a1c816001850160208701613070565b653d5260203df360d01b6001939091019283015250600701919050565b805160ff811681146135e757600080fd5b60008060008060808587031215613a6057600080fd5b613a6985613a39565b9350613a7760208601613a39565b6040860151606090960151949790965092505050565b80516020808301519190811015612a765760001960209190910360031b1b16919050565b634e487b7160e01b600052603160045260246000fd5b82815260008251613adf816020850160208701613070565b91909101602001939250505056fe17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a2646970667358221220b174b85a435dcf2d679d2b471b8ba6c4e99f09c5f79326ba1a6766c02b84342264736f6c63430008110033000000000000000000000000bd3fa81b58ba92a82136038b25adec7066af3155000000000000000000000000b73acb429ba868984c0236bdf940d4fe1e643f27
Deployed Bytecode
0x6080604052600436106102045760003560e01c80638da5cb5b11610118578063d77938e4116100a0578063e9259ab91161006f578063e9259ab9146106e8578063e9bbb36d14610752578063f2fde38b14610772578063f7265b3a14610792578063f879a41a146107b257600080fd5b8063d77938e414610614578063dc72495b14610629578063e00a83e0146106bd578063e7a64a80146106d357600080fd5b8063a4b1d034116100e7578063a4b1d0341461052f578063a5bc29c214610565578063b0e21e8a146105a6578063b250fe6b146105bc578063d4a67c6d146105dc57600080fd5b80638da5cb5b146104af57806392a442ea146104cd5780639c1d060e146104ed578063a42dce801461050f57600080fd5b80634a5ae51d1161019b5780635fa7b5841161016a5780635fa7b584146103dd578063715018a6146103fd578063787dce3d146104125780637b04c181146104325780638d3638f41461046657600080fd5b80634a5ae51d146103665780634a85178d146103795780634bdb4eed146103995780635c975abb146103b957600080fd5b8063304ddb4c116101d7578063304ddb4c146102af57806340432d51146102cf57806341f355ee146102e4578063461178301461033257600080fd5b80630ba36121146102095780630d25aafe1461023f5780632cc9e7e51461026d5780632d80caa51461028f575b600080fd5b34801561021557600080fd5b50610229610224366004613053565b6107d2565b60405161023691906130c0565b60405180910390f35b34801561024b57600080fd5b5061025f61025a3660046130e1565b61086c565b604051908152602001610236565b34801561027957600080fd5b5061028d610288366004613123565b610883565b005b34801561029b57600080fd5b5061028d6102aa366004613053565b610933565b3480156102bb57600080fd5b5061028d6102ca366004613231565b6109d9565b3480156102db57600080fd5b5061028d610d35565b3480156102f057600080fd5b5061031a6102ff366004613053565b6005602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610236565b34801561033e57600080fd5b5061031a7f000000000000000000000000bd3fa81b58ba92a82136038b25adec7066af315581565b61028d6103743660046132f8565b610dcb565b34801561038557600080fd5b5061028d610394366004613391565b610f3e565b3480156103a557600080fd5b5061028d6103b4366004613402565b611038565b3480156103c557600080fd5b50600a5460ff165b6040519015158152602001610236565b3480156103e957600080fd5b5061028d6103f8366004613053565b61109e565b34801561040957600080fd5b5061028d611205565b34801561041e57600080fd5b5061028d61042d366004613446565b61123b565b34801561043e57600080fd5b5061031a7f0000000000000000000000000a992d191deec32afe36203ad87d7d289a738f8181565b34801561047257600080fd5b5061049a7f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff9091168152602001610236565b3480156104bb57600080fd5b506000546001600160a01b031661031a565b3480156104d957600080fd5b506103cd6104e8366004613446565b6112d1565b3480156104f957600080fd5b506105026112ef565b604051610236919061345f565b34801561051b57600080fd5b5061028d61052a366004613053565b61147b565b34801561053b57600080fd5b5061031a61054a366004613053565b600c602052600090815260409020546001600160a01b031681565b34801561057157600080fd5b5061031a6105803660046134de565b80516020818301810180516002825292820191909301209152546001600160a01b031681565b3480156105b257600080fd5b5061025f60065481565b3480156105c857600080fd5b5061028d6105d7366004613446565b6114eb565b3480156105e857600080fd5b5061025f6105f7366004613123565b600460209081526000928352604080842090915290825290205481565b34801561062057600080fd5b5061028d61154a565b34801561063557600080fd5b50610686610644366004613053565b60036020526000908152604090205464ffffffffff8116906001600160481b03650100000000008204811691600160701b8104821691600160b81b9091041684565b6040805164ffffffffff90951685526001600160481b03938416602086015291831691840191909152166060820152608001610236565b3480156106c957600080fd5b5061025f60075481565b3480156106df57600080fd5b5061028d61157c565b3480156106f457600080fd5b5061072e610703366004613446565b600b6020526000908152604090205463ffffffff81169064010000000090046001600160a01b031682565b6040805163ffffffff90931683526001600160a01b03909116602083015201610236565b34801561075e57600080fd5b5061028d61076d366004613512565b6115ae565b34801561077e57600080fd5b5061028d61078d366004613053565b6116f8565b34801561079e57600080fd5b5061028d6107ad366004613053565b611790565b3480156107be57600080fd5b5061031a6107cd366004613549565b611806565b600160205260009081526040902080546107eb90613567565b80601f016020809104026020016040519081016040528092919081815260200182805461081790613567565b80156108645780601f1061083957610100808354040283529160200191610864565b820191906000526020600020905b81548152906001019060200180831161084757829003601f168201915b505050505081565b600061087984848461181b565b90505b9392505050565b6000546001600160a01b031633146108b65760405162461bcd60e51b81526004016108ad9061359b565b60405180910390fd5b6001600160a01b0382166108dd576040516312182f6560e11b815260040160405180910390fd5b6108e86008836118fe565b610905576040516314ed699b60e21b815260040160405180910390fd5b6001600160a01b039182166000908152600c6020526040902080546001600160a01b03191691909216179055565b6000546001600160a01b0316331461095d5760405162461bcd60e51b81526004016108ad9061359b565b6001600160a01b0381166000908152600080516020613aee8339815191526020526040812054908190036109a4576040516330b93f1d60e01b815260040160405180910390fd5b6001600160a01b0382166000818152600080516020613aee83398151915260205260408120556109d5903383611920565b5050565b600a5460ff1615610a1f5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016108ad565b610a2a6008856118fe565b610a47576040516314ed699b60e21b815260040160405180910390fd5b610a518484611988565b925060007f0000000000000000000000000a992d191deec32afe36203ad87d7d289a738f816001600160a01b0316638371744e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ab3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad791906135ec565b6040805163ffffffff7f00000000000000000000000000000000000000000000000000000000000000001660208201526001600160401b038316818301526001600160a01b038089166060830152608082018890528a1660a0808301919091528251808303909101815260c0909101909152909150600090610b5b90859085611a88565b6000888152600b6020908152604080832081518083019092525463ffffffff8116825264010000000090046001600160a01b031691810182905292935090819003610bb9576040516354351d8760e11b815260040160405180910390fd5b8151835160208086019190912067ffffffff0000000083831b1663ffffffff8a16176000908152915260409020610c118a7f000000000000000000000000bd3fa81b58ba92a82136038b25adec7066af31558b611b51565b6001600160a01b037f000000000000000000000000bd3fa81b58ba92a82136038b25adec7066af31551663f856ddb68a84868e610c4e8288611c06565b6040516001600160e01b031960e088901b168152600481019590955263ffffffff93909316602485015260448401919091526001600160a01b03166064830152608482015260a4016020604051808303816000875af1158015610cb5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd991906135ec565b50326001600160a01b03167fc4980459837e213aedb84d9046eab1db050fec66cb9e046c4fe3b5578b01b20c8c888d8d8d8b88604051610d1f9796959493929190613607565b60405180910390a2505050505050505050505050565b6000546001600160a01b03163314610d5f5760405162461bcd60e51b81526004016108ad9061359b565b604051600090339047908381818185875af1925050503d8060008114610da1576040519150601f19603f3d011682016040523d82523d6000602084013e610da6565b606091505b5050905080610dc85760405163272b087d60e11b815260040160405180910390fd5b50565b6007543414610ded5760405163c561806560e01b815260040160405180910390fd5b600080610dfa8484611c2a565b91509150600080600080610e0d86611cd8565b8b516020808e019190912063ffffffff8f167f0000000000000000000000000000000000000000000000000000000000000000831b67ffffffff000000001617600090815291526040812095995092975090955093509190509050610e758d8d8d8d85611d28565b6000610e818686611dfd565b90506000610e99828663ffffffff8e16600114611f48565b9095509050600080610ead8685898d612142565b90925090503415610ec157610ec18661225b565b6040805163ffffffff8b1681526001600160a01b03868116602083015291810185905283821660608201526080810183905260a08101879052908716907f7864397c00beabf21ab17a04795e450354505d879a634dd2632f4fdc4b5ba04e9060c00160405180910390a25050505050505050505050505050505050565b6000546001600160a01b03163314610f685760405162461bcd60e51b81526004016108ad9061359b565b6001600160a01b038516610f8f576040516376998feb60e01b815260040160405180910390fd5b610f9a6008866122f5565b610fb757604051631191732560e01b815260040160405180910390fd5b610fc08661230a565b6001600160a01b0385166000908152600160205260409020610fe287826136a9565b5084600287604051610ff49190613768565b90815260405190819003602001902080546001600160a01b03929092166001600160a01b03199092169190911790556110308585858585612417565b505050505050565b6000546001600160a01b031633146110625760405162461bcd60e51b81526004016108ad9061359b565b61106d6008866118fe565b61108a576040516314ed699b60e21b815260040160405180910390fd5b6110978585858585612417565b5050505050565b6000546001600160a01b031633146110c85760405162461bcd60e51b81526004016108ad9061359b565b6110d360088261257c565b6110f0576040516314ed699b60e21b815260040160405180910390fd5b6001600160a01b0381166000908152600160205260408120805461111390613567565b80601f016020809104026020016040519081016040528092919081815260200182805461113f90613567565b801561118c5780601f106111615761010080835404028352916020019161118c565b820191906000526020600020905b81548152906001019060200180831161116f57829003601f168201915b505050506001600160a01b03841660009081526001602052604081209293506111b6929150612ff4565b6002816040516111c69190613768565b908152604080516020928190038301902080546001600160a01b03191690556001600160a01b0393909316600090815260039091529182209190915550565b6000546001600160a01b0316331461122f5760405162461bcd60e51b81526004016108ad9061359b565b6112396000612591565b565b6000546001600160a01b031633146112655760405162461bcd60e51b81526004016108ad9061359b565b61127560026402540be40061379a565b811115611295576040516328562c4760e01b815260040160405180910390fd5b60068190556040518181527fd10d75876659a287a59a6ccfa2e3fff42f84d94b542837acd30bc184d562de40906020015b60405180910390a150565b6000806112de30846125e1565b6001600160a01b03163b1192915050565b606060006112fd60086126a2565b9050806001600160401b038111156113175761131761316e565b60405190808252806020026020018201604052801561135d57816020015b6040805180820190915260608152600060208201528152602001906001900390816113355790505b50915060005b818110156114765760006113786008836126ac565b9050604051806040016040528060016000846001600160a01b03166001600160a01b0316815260200190815260200160002080546113b590613567565b80601f01602080910402602001604051908101604052809291908181526020018280546113e190613567565b801561142e5780601f106114035761010080835404028352916020019161142e565b820191906000526020600020905b81548152906001019060200180831161141157829003601f168201915b50505050508152602001826001600160a01b0316815250848381518110611457576114576137bc565b602002602001018190525050808061146e906137d2565b915050611363565b505090565b3360008181526005602090815260409182902080546001600160a01b031981166001600160a01b03878116918217909355845192909116808352928201529092917f9dfcadd14a1ddfb19c51e84b87452ca32a43c5559e9750d1575c77105cdeac1e910160405180910390a25050565b6000546001600160a01b031633146115155760405162461bcd60e51b81526004016108ad9061359b565b60078190556040518181527f5e8bad84cb22c143a6757c7f1252a7d53493816880330977cc99bb7c15aaf6b4906020016112c6565b6000546001600160a01b031633146115745760405162461bcd60e51b81526004016108ad9061359b565b6112396126b8565b6000546001600160a01b031633146115a65760405162461bcd60e51b81526004016108ad9061359b565b611239612750565b6000546001600160a01b031633146115d85760405162461bcd60e51b81526004016108ad9061359b565b8215806115e457504683145b1561160257604051633f8f40a960e01b815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000063ffffffff168263ffffffff160361164e576040516312792e1960e31b815260040160405180910390fd5b63ffffffff8216156001841414611678576040516312792e1960e31b815260040160405180910390fd5b6001600160a01b03811661169f576040516312182f6560e11b815260040160405180910390fd5b60408051808201825263ffffffff93841681526001600160a01b0392831660208083019182526000968752600b905291909420935184549151909216640100000000026001600160c01b03199091169190921617179055565b6000546001600160a01b031633146117225760405162461bcd60e51b81526004016108ad9061359b565b6001600160a01b0381166117875760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108ad565b610dc881612591565b3360009081526004602090815260408083206001600160a01b0385168452909152812054908190036117d5576040516330b93f1d60e01b815260040160405180910390fd5b3360008181526004602090815260408083206001600160a01b03871680855292528220919091556109d59183611920565b60006118128383611dfd565b90505b92915050565b6001600160a01b03831660009081526003602090815260408083208151608081018352905464ffffffffff81168083526001600160481b03650100000000008304811695840195909552600160701b8204851693830193909352600160b81b900490921660608301526402540be4009061189590866137eb565b61189f919061379a565b91506000836118b25781602001516118b8565b81604001515b6001600160481b03169050808310156118cf578092505b81606001516001600160481b03168311156118f55781606001516001600160481b031692505b50509392505050565b6001600160a01b03811660009081526001830160205260408120541515611812565b6040516001600160a01b03831660248201526044810182905261198390849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526127ca565b505050565b6040516370a0823160e01b815230600482015260009081906001600160a01b038516906370a0823190602401602060405180830381865afa1580156119d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119f59190613802565b9050611a0c6001600160a01b03851633308661289c565b6040516370a0823160e01b815230600482015281906001600160a01b038616906370a0823190602401602060405180830381865afa158015611a52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a769190613802565b611a80919061381b565b949350505050565b606060a0835114611aac576040516374593f8760e01b815260040160405180910390fd5b63ffffffff8416611ade57815115611ad7576040516374593f8760e01b815260040160405180910390fd5b508161087c565b60001963ffffffff851601611b38576080825114611b0f576040516374593f8760e01b815260040160405180910390fd5b8282604051602001611b2292919061382e565b604051602081830303815290604052905061087c565b60405163523fa8d560e01b815260040160405180910390fd5b604051636eb1769f60e11b81523060048201526001600160a01b0383811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611ba1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bc59190613802565b905081811015611c00578015611bea57611bea6001600160a01b0385168460006128d4565b611c006001600160a01b038516846000196128d4565b50505050565b6000611812611c1e6001600160a01b038516846125e1565b6001600160a01b031690565b60608063ffffffff8416611c725760a0835114611c5a576040516374593f8760e01b815260040160405180910390fd5b50506040805160208101909152600081528190611cd1565b60001963ffffffff851601611b38576080611c8e60a082613853565b611c989190613853565b835114611cb8576040516374593f8760e01b815260040160405180910390fd5b82806020019051810190611ccc91906138ab565b915091505b9250929050565b600080600080600060a0865114611d02576040516374593f8760e01b815260040160405180910390fd5b85806020019051810190611d16919061390e565b939a9299509097509550909350915050565b6000611d33826129e9565b905060006357ecfd2860e01b87878787604051602401611d56949392919061399e565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915290506000611dc06001600160a01b0384167f0000000000000000000000000a992d191deec32afe36203ad87d7d289a738f8184612a7c565b905080806020019051810190611dd691906139c5565b611df35760405163182f34eb60e01b815260040160405180910390fd5b5050505050505050565b6000807f000000000000000000000000bd3fa81b58ba92a82136038b25adec7066af31556001600160a01b031663cb75c11c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611e5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e8291906139e2565b9050806001600160a01b03166378a0565e85611ead866001600160a01b03166001600160a01b031690565b6040516001600160e01b031960e085901b16815263ffffffff9290921660048301526024820152604401602060405180830381865afa158015611ef4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1891906139e2565b91506001600160a01b038216611f41576040516314ed699b60e21b815260040160405180910390fd5b5092915050565b600080611f566008866118fe565b611f73576040516314ed699b60e21b815260040160405180910390fd5b611f7e85858561181b565b9050838110611fa057604051630fab90b960e21b815260040160405180910390fd5b3360009081526005602052604090205481850392506001600160a01b031680612043576001600160a01b0386166000908152600080516020613aee833981519152602052604081208054849290611ff8908490613853565b909155505060408051600080825260208201529081018390527f108516ddcf5ba43cea6bb2cd5ff6d59ac196c1c86ccb9178332b9dd72d1ca5619060600160405180910390a1612139565b60006402540be4006006548461205991906137eb565b612063919061379a565b90506000612071828561381b565b6001600160a01b0389166000908152600080516020613aee83398151915260205260408120805492935084929091906120ab908490613853565b90915550506001600160a01b038084166000908152600460209081526040808320938c16835292905290812080548392906120e7908490613853565b9091555050604080516001600160a01b0385168152602081018390529081018390527f108516ddcf5ba43cea6bb2cd5ff6d59ac196c1c86ccb9178332b9dd72d1ca5619060600160405180910390a150505b50935093915050565b600080825160000361216c576121626001600160a01b0386168786611920565b5083905082612252565b6001600160a01b038086166000908152600c602052604090205416806121ac576121a06001600160a01b0387168887611920565b85859250925050612252565b6000806000806121bb88612a8b565b93509350935093506121cd8584612ad6565b96506001600160a01b038716612201576121f16001600160a01b038b168c8b611920565b8989965096505050505050612252565b61220c8a868b611b51565b61221a8585858c8686612baa565b955085600003612238576121f16001600160a01b038b168c8b611920565b61224c6001600160a01b0388168c88611920565b50505050505b94509492505050565b6000816001600160a01b03163460405160006040518083038185875af1925050503d80600081146122a8576040519150601f19603f3d011682016040523d82523d6000602084013e6122ad565b606091505b505090507ff9b0951a3a6282341e1ba9414555d42d04e99076337702ee6dc484a706bfd683816122de5760006122e0565b345b60405190815260200160405180910390a15050565b6000611812836001600160a01b038416612c48565b60006001600160a01b03166002826040516123259190613768565b908152604051908190036020019020546001600160a01b03161461235c576040516382ca3adf60e01b815260040160405180910390fd5b80518190600510612380576040516307f1fcb560e31b815260040160405180910390fd5b60005b6005811015611983576040518060400160405280600581526020016421a1aa281760d91b81525081815181106123bb576123bb6137bc565b602001015160f81c60f81b6001600160f81b0319168282815181106123e2576123e26137bc565b01602001516001600160f81b0319161461240f576040516307f1fcb560e31b815260040160405180910390fd5b600101612383565b6298968084111561243b576040516376998feb60e01b815260040160405180910390fd5b8183111561245c576040516376998feb60e01b815260040160405180910390fd5b8082111561247d576040516376998feb60e01b815260040160405180910390fd5b604051806080016040528061249186612c97565b64ffffffffff1681526020016124a685612cc3565b6001600160481b031681526020016124bd84612cc3565b6001600160481b031681526020016124d483612cc3565b6001600160481b039081169091526001600160a01b039096166000908152600360209081526040918290208351815492850151938501516060909501518a16600160b81b026001600160b81b03958b16600160701b02959095166dffffffffffffffffffffffffffff94909a1665010000000000026dffffffffffffffffffffffffffff1990931664ffffffffff909116179190911791909116969096171790945550505050565b6000611812836001600160a01b038416612ced565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061181283836040518060400160405280602081526020017f602036038060203d373d3d3d923d343d355af13d82803e903d91601e57fd5bf381525060405160200161262e91906139ff565b60405160208183030381529060405280519060200120604051602001612689939291906001600160f81b0319815260609390931b6bffffffffffffffffffffffff191660018401526015830191909152603582015260550190565b6040516020818303038152906040528051906020012090565b6000611815825490565b60006118128383612de0565b600a5460ff16156126fe5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016108ad565b600a805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586127333390565b6040516001600160a01b03909116815260200160405180910390a1565b600a5460ff166127995760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016108ad565b600a805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612733565b600061281f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612e0a9092919063ffffffff16565b805190915015611983578080602001905181019061283d91906139c5565b6119835760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016108ad565b6040516001600160a01b0380851660248301528316604482015260648101829052611c009085906323b872dd60e01b9060840161194c565b80158061294e5750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015612928573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061294c9190613802565b155b6129b95760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016108ad565b6040516001600160a01b03831660248201526044810182905261198390849063095ea7b360e01b9060640161194c565b6000806040518060400160405280602081526020017f602036038060203d373d3d3d923d343d355af13d82803e903d91601e57fd5bf3815250604051602001612a3291906139ff565b6040516020818303038152906040529050828151602083016000f591506001600160a01b038216612a76576040516309ebea7f60e21b815260040160405180910390fd5b50919050565b60606108798484846000612e19565b6000806000806080855114612ab3576040516374593f8760e01b815260040160405180910390fd5b84806020019051810190612ac79190613a4a565b93509350935093509193509193565b6040805160ff831660248083019190915282518083039091018152604490910182526020810180516001600160e01b031662415c3360e91b1790529051600091829182916001600160a01b03871691612b2f9190613768565b600060405180830381855afa9150503d8060008114612b6a576040519150601f19603f3d011682016040523d82523d6000602084013e612b6f565b606091505b5091509150818015612b82575080516020145b15612b9d57612b96612b9382613a8d565b90565b9250612ba2565b600092505b505092915050565b6040516348b4aac360e11b815260ff8087166004830152851660248201526044810184905260648101829052608481018390526000906001600160a01b0388169063916955869060a4016020604051808303816000875af1925050508015612c2f575060408051601f3d908101601f19168201909252612c2c91810190613802565b60015b612c3b57506000612c3e565b90505b9695505050505050565b6000818152600183016020526040812054612c8f57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155611815565b506000611815565b600064ffffffffff821115612cbf57604051631cb1a8e360e31b815260040160405180910390fd5b5090565b60006001600160481b03821115612cbf57604051631cb1a8e360e31b815260040160405180910390fd5b60008181526001830160205260408120548015612dd6576000612d1160018361381b565b8554909150600090612d259060019061381b565b9050818114612d8a576000866000018281548110612d4557612d456137bc565b9060005260206000200154905080876000018481548110612d6857612d686137bc565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080612d9b57612d9b613ab1565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611815565b6000915050611815565b6000826000018281548110612df757612df76137bc565b9060005260206000200154905092915050565b60606108798484600085612e64565b6060612e5b6001600160a01b03851684604051602001612e3a929190613ac7565b60408051601f198184030181529190526001600160a01b0387169084612f95565b95945050505050565b606082471015612ec55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016108ad565b6001600160a01b0385163b612f1c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108ad565b600080866001600160a01b03168587604051612f389190613768565b60006040518083038185875af1925050503d8060008114612f75576040519150601f19603f3d011682016040523d82523d6000602084013e612f7a565b606091505b5091509150612f8a828286612fbb565b979650505050505050565b6060610879848484604051806060016040528060298152602001613b0e60299139612e64565b60608315612fca57508161087c565b825115612fda5782518084602001fd5b8160405162461bcd60e51b81526004016108ad91906130c0565b50805461300090613567565b6000825580601f10613010575050565b601f016020900490600052602060002090810190610dc891905b80821115612cbf576000815560010161302a565b6001600160a01b0381168114610dc857600080fd5b60006020828403121561306557600080fd5b813561087c8161303e565b60005b8381101561308b578181015183820152602001613073565b50506000910152565b600081518084526130ac816020860160208601613070565b601f01601f19169290920160200192915050565b6020815260006118126020830184613094565b8015158114610dc857600080fd5b6000806000606084860312156130f657600080fd5b83356131018161303e565b9250602084013591506040840135613118816130d3565b809150509250925092565b6000806040838503121561313657600080fd5b82356131418161303e565b915060208301356131518161303e565b809150509250929050565b63ffffffff81168114610dc857600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156131ac576131ac61316e565b604052919050565b60006001600160401b038211156131cd576131cd61316e565b50601f01601f191660200190565b600082601f8301126131ec57600080fd5b81356131ff6131fa826131b4565b613184565b81815284602083860101111561321457600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060008060c0878903121561324a57600080fd5b86356132558161303e565b955060208701359450604087013561326c8161303e565b93506060870135925060808701356132838161315c565b915060a08701356001600160401b0381111561329e57600080fd5b6132aa89828a016131db565b9150509295509295509295565b60008083601f8401126132c957600080fd5b5081356001600160401b038111156132e057600080fd5b602083019150836020828501011115611cd157600080fd5b6000806000806000806080878903121561331157600080fd5b86356001600160401b038082111561332857600080fd5b6133348a838b016132b7565b9098509650602089013591508082111561334d57600080fd5b6133598a838b016132b7565b90965094506040890135915061336e8261315c565b9092506060880135908082111561338457600080fd5b506132aa89828a016131db565b60008060008060008060c087890312156133aa57600080fd5b86356001600160401b038111156133c057600080fd5b6133cc89828a016131db565b96505060208701356133dd8161303e565b95989597505050506040840135936060810135936080820135935060a0909101359150565b600080600080600060a0868803121561341a57600080fd5b85356134258161303e565b97602087013597506040870135966060810135965060800135945092505050565b60006020828403121561345857600080fd5b5035919050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b838110156134d057888303603f19018552815180518785526134aa88860182613094565b918901516001600160a01b03169489019490945294870194925090860190600101613486565b509098975050505050505050565b6000602082840312156134f057600080fd5b81356001600160401b0381111561350657600080fd5b611a80848285016131db565b60008060006060848603121561352757600080fd5b8335925060208401356135398161315c565b915060408401356131188161303e565b6000806040838503121561355c57600080fd5b82356131418161315c565b600181811c9082168061357b57607f821691505b602082108103612a7657634e487b7160e01b600052602260045260246000fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b80516001600160401b03811681146135e757600080fd5b919050565b6000602082840312156135fe57600080fd5b611812826135d0565b8781526001600160401b038716602082015260018060a01b038616604082015284606082015263ffffffff8416608082015260e060a0820152600061364f60e0830185613094565b90508260c083015298975050505050505050565b601f82111561198357600081815260208120601f850160051c8101602086101561368a5750805b601f850160051c820191505b8181101561103057828155600101613696565b81516001600160401b038111156136c2576136c261316e565b6136d6816136d08454613567565b84613663565b602080601f83116001811461370b57600084156136f35750858301515b600019600386901b1c1916600185901b178555611030565b600085815260208120601f198616915b8281101561373a5788860151825594840194600190910190840161371b565b50858210156137585787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000825161377a818460208701613070565b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b6000826137b757634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b6000600182016137e4576137e4613784565b5060010190565b808202811582820484141761181557611815613784565b60006020828403121561381457600080fd5b5051919050565b8181038181111561181557611815613784565b6040815260006138416040830185613094565b8281036020840152612e5b8185613094565b8082018082111561181557611815613784565b600082601f83011261387757600080fd5b81516138856131fa826131b4565b81815284602083860101111561389a57600080fd5b611a80826020830160208701613070565b600080604083850312156138be57600080fd5b82516001600160401b03808211156138d557600080fd5b6138e186838701613866565b935060208501519150808211156138f757600080fd5b5061390485828601613866565b9150509250929050565b600080600080600060a0868803121561392657600080fd5b85516139318161315c565b945061393f602087016135d0565b9350604086015161394f8161303e565b6060870151608088015191945092506139678161303e565b809150509295509295909350565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6040815260006139b2604083018688613975565b8281036020840152612f8a818587613975565b6000602082840312156139d757600080fd5b815161087c816130d3565b6000602082840312156139f457600080fd5b815161087c8161303e565b607f60f81b81528151600090613a1c816001850160208701613070565b653d5260203df360d01b6001939091019283015250600701919050565b805160ff811681146135e757600080fd5b60008060008060808587031215613a6057600080fd5b613a6985613a39565b9350613a7760208601613a39565b6040860151606090960151949790965092505050565b80516020808301519190811015612a765760001960209190910360031b1b16919050565b634e487b7160e01b600052603160045260246000fd5b82815260008251613adf816020850160208701613070565b91909101602001939250505056fe17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a2646970667358221220b174b85a435dcf2d679d2b471b8ba6c4e99f09c5f79326ba1a6766c02b84342264736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000bd3fa81b58ba92a82136038b25adec7066af3155000000000000000000000000b73acb429ba868984c0236bdf940d4fe1e643f27
-----Decoded View---------------
Arg [0] : tokenMessenger_ (address): 0xBd3fa81B58Ba92a82136038B25aDec7066af3155
Arg [1] : owner_ (address): 0xb73AcB429Ba868984c0236bdf940D4FE1E643F27
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000bd3fa81b58ba92a82136038b25adec7066af3155
Arg [1] : 000000000000000000000000b73acb429ba868984c0236bdf940d4fe1e643f27
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ARB | 100.00% | $3,396.24 | 0.0003 | $1.02 |
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.