Overview
ETH Balance
0 ETH
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
134832290 | 40 hrs ago | Contract Creation | 0 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
CCTPBridgeRouteConstants
Compiler Version
v0.8.26+commit.8a97fa7a
Optimization Enabled:
Yes with 999999 runs
Other Settings:
london EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.12; import "../../src/DaimoPayCCTPBridger.sol"; // @title CCTPBridgeRouteConstants // @notice Auto-generated constants for CCTP bridge routes library CCTPBridgeRouteConstants { // Return all CCTP bridge routes for the given source chain. function getCCTPBridgeRoutes(uint256 sourceChainId) public pure returns ( uint256[] memory chainIds, DaimoPayCCTPBridger.CCTPBridgeRoute[] memory bridgeRoutes ) { // Source chain 1 if (sourceChainId == 1) { chainIds = new uint256[](3); bridgeRoutes = new DaimoPayCCTPBridger.CCTPBridgeRoute[](3); // 1 -> 10 chainIds[0] = 10; bridgeRoutes[0] = DaimoPayCCTPBridger.CCTPBridgeRoute({ domain: 2, bridgeTokenOut: 0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85 }); // 1 -> 137 chainIds[1] = 137; bridgeRoutes[1] = DaimoPayCCTPBridger.CCTPBridgeRoute({ domain: 7, bridgeTokenOut: 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359 }); // 1 -> 42161 chainIds[2] = 42161; bridgeRoutes[2] = DaimoPayCCTPBridger.CCTPBridgeRoute({ domain: 3, bridgeTokenOut: 0xaf88d065e77c8cC2239327C5EDb3A432268e5831 }); return (chainIds, bridgeRoutes); } // Source chain 10 if (sourceChainId == 10) { chainIds = new uint256[](4); bridgeRoutes = new DaimoPayCCTPBridger.CCTPBridgeRoute[](4); // 10 -> 1 chainIds[0] = 1; bridgeRoutes[0] = DaimoPayCCTPBridger.CCTPBridgeRoute({ domain: 0, bridgeTokenOut: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 }); // 10 -> 137 chainIds[1] = 137; bridgeRoutes[1] = DaimoPayCCTPBridger.CCTPBridgeRoute({ domain: 7, bridgeTokenOut: 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359 }); // 10 -> 8453 chainIds[2] = 8453; bridgeRoutes[2] = DaimoPayCCTPBridger.CCTPBridgeRoute({ domain: 6, bridgeTokenOut: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 }); // 10 -> 42161 chainIds[3] = 42161; bridgeRoutes[3] = DaimoPayCCTPBridger.CCTPBridgeRoute({ domain: 3, bridgeTokenOut: 0xaf88d065e77c8cC2239327C5EDb3A432268e5831 }); return (chainIds, bridgeRoutes); } // Source chain 137 if (sourceChainId == 137) { chainIds = new uint256[](4); bridgeRoutes = new DaimoPayCCTPBridger.CCTPBridgeRoute[](4); // 137 -> 1 chainIds[0] = 1; bridgeRoutes[0] = DaimoPayCCTPBridger.CCTPBridgeRoute({ domain: 0, bridgeTokenOut: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 }); // 137 -> 10 chainIds[1] = 10; bridgeRoutes[1] = DaimoPayCCTPBridger.CCTPBridgeRoute({ domain: 2, bridgeTokenOut: 0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85 }); // 137 -> 8453 chainIds[2] = 8453; bridgeRoutes[2] = DaimoPayCCTPBridger.CCTPBridgeRoute({ domain: 6, bridgeTokenOut: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 }); // 137 -> 42161 chainIds[3] = 42161; bridgeRoutes[3] = DaimoPayCCTPBridger.CCTPBridgeRoute({ domain: 3, bridgeTokenOut: 0xaf88d065e77c8cC2239327C5EDb3A432268e5831 }); return (chainIds, bridgeRoutes); } // Source chain 8453 if (sourceChainId == 8453) { chainIds = new uint256[](3); bridgeRoutes = new DaimoPayCCTPBridger.CCTPBridgeRoute[](3); // 8453 -> 10 chainIds[0] = 10; bridgeRoutes[0] = DaimoPayCCTPBridger.CCTPBridgeRoute({ domain: 2, bridgeTokenOut: 0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85 }); // 8453 -> 137 chainIds[1] = 137; bridgeRoutes[1] = DaimoPayCCTPBridger.CCTPBridgeRoute({ domain: 7, bridgeTokenOut: 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359 }); // 8453 -> 42161 chainIds[2] = 42161; bridgeRoutes[2] = DaimoPayCCTPBridger.CCTPBridgeRoute({ domain: 3, bridgeTokenOut: 0xaf88d065e77c8cC2239327C5EDb3A432268e5831 }); return (chainIds, bridgeRoutes); } // Source chain 42161 if (sourceChainId == 42161) { chainIds = new uint256[](4); bridgeRoutes = new DaimoPayCCTPBridger.CCTPBridgeRoute[](4); // 42161 -> 1 chainIds[0] = 1; bridgeRoutes[0] = DaimoPayCCTPBridger.CCTPBridgeRoute({ domain: 0, bridgeTokenOut: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 }); // 42161 -> 10 chainIds[1] = 10; bridgeRoutes[1] = DaimoPayCCTPBridger.CCTPBridgeRoute({ domain: 2, bridgeTokenOut: 0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85 }); // 42161 -> 137 chainIds[2] = 137; bridgeRoutes[2] = DaimoPayCCTPBridger.CCTPBridgeRoute({ domain: 7, bridgeTokenOut: 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359 }); // 42161 -> 8453 chainIds[3] = 8453; bridgeRoutes[3] = DaimoPayCCTPBridger.CCTPBridgeRoute({ domain: 6, bridgeTokenOut: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 }); return (chainIds, bridgeRoutes); } // If source chain not found, revert revert("Source chain not found"); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.12; import "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; import "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol"; import "./interfaces/IDaimoPayBridger.sol"; import "../vendor/cctp/v1/ITokenMinter.sol"; import "../vendor/cctp/v1/ICCTPTokenMessenger.sol"; /// @author Daimo, Inc /// @custom:security-contact [email protected] /// @notice Bridges assets to a destination chain using CCTP v1. contract DaimoPayCCTPBridger is IDaimoPayBridger { using SafeERC20 for IERC20; struct CCTPBridgeRoute { /// CCTP domain of the destination chain. uint32 domain; /// The bridge that will be output by CCTP on the destination chain. address bridgeTokenOut; } /// CCTP TokenMinter for this chain. Has a function to identify the CCTP /// token on the current chain corresponding to a given output token. ITokenMinter public tokenMinter; /// CCTP TokenMessenger for this chain. Used to initiate the CCTP bridge. ICCTPTokenMessenger public cctpMessenger; /// Map destination chainId to CCTP domain and the bridge token address on /// the destination chain. mapping(uint256 toChainId => CCTPBridgeRoute bridgeRoute) public bridgeRouteMapping; /// Specify the CCTP chain IDs and domains that this bridger will support. constructor( ITokenMinter _tokenMinter, ICCTPTokenMessenger _cctpMessenger, uint256[] memory _toChainIds, CCTPBridgeRoute[] memory _bridgeRoutes ) { tokenMinter = _tokenMinter; cctpMessenger = _cctpMessenger; uint256 n = _toChainIds.length; require( n == _bridgeRoutes.length, "DPCCTPB: wrong bridgeRoutes length" ); for (uint256 i = 0; i < n; ++i) { bridgeRouteMapping[_toChainIds[i]] = _bridgeRoutes[i]; } } function addressToBytes32(address addr) internal pure returns (bytes32) { return bytes32(uint256(uint160(addr))); } // ----- BRIDGER FUNCTIONS ----- /// Given a list of bridge token options, find the index of the bridge token /// that matches the correct bridge token out. Return the length of the array /// if no match is found. function _findBridgeTokenOut( TokenAmount[] calldata bridgeTokenOutOptions, address bridgeTokenOut ) internal pure returns (uint256 index) { uint256 n = bridgeTokenOutOptions.length; for (uint256 i = 0; i < n; ++i) { if (address(bridgeTokenOutOptions[i].token) == bridgeTokenOut) { return i; } } return n; } /// Retrieves the necessary data for bridging tokens from the current chain /// to a specified destination chain using CCTP. /// CCTP does 1 to 1 token bridging, so the amount of tokens to bridge is /// the same as toAmount. function _getBridgeData( uint256 toChainId, TokenAmount[] calldata bridgeTokenOutOptions ) internal view returns ( address inToken, uint256 inAmount, address outToken, uint256 outAmount, uint32 toDomain ) { CCTPBridgeRoute memory bridgeRoute = bridgeRouteMapping[toChainId]; require( bridgeRoute.bridgeTokenOut != address(0), "DPCCTPB: bridge route not found" ); uint256 index = _findBridgeTokenOut( bridgeTokenOutOptions, bridgeRoute.bridgeTokenOut ); // If the index is the length of the array, then the bridge token out // was not found in the list of options. require( index < bridgeTokenOutOptions.length, "DPCCTPB: bad bridge token" ); toDomain = bridgeRoute.domain; outToken = bridgeRoute.bridgeTokenOut; outAmount = bridgeTokenOutOptions[index].amount; inToken = tokenMinter.getLocalToken( bridgeRoute.domain, addressToBytes32(bridgeRoute.bridgeTokenOut) ); inAmount = outAmount; } /// Determine the input token and amount required for bridging to /// another chain. function getBridgeTokenIn( uint256 toChainId, TokenAmount[] calldata bridgeTokenOutOptions ) external view returns (address bridgeTokenIn, uint256 inAmount) { (address _bridgeTokenIn, uint256 _inAmount, , , ) = _getBridgeData( toChainId, bridgeTokenOutOptions ); bridgeTokenIn = _bridgeTokenIn; inAmount = _inAmount; } /// Initiate a bridge to a destination chain using CCTP. function sendToChain( uint256 toChainId, address toAddress, TokenAmount[] calldata bridgeTokenOutOptions, bytes calldata /* extraData */ ) public { require(toChainId != block.chainid, "DPCCTPB: same chain"); ( address inToken, uint256 inAmount, address outToken, uint256 outAmount, uint32 toDomain ) = _getBridgeData(toChainId, bridgeTokenOutOptions); require(outAmount > 0, "DPCCTPB: zero amount"); // Move input token from caller to this contract and approve CCTP. IERC20(inToken).safeTransferFrom({ from: msg.sender, to: address(this), value: inAmount }); IERC20(inToken).forceApprove({ spender: address(cctpMessenger), value: inAmount }); cctpMessenger.depositForBurn({ amount: inAmount, destinationDomain: toDomain, mintRecipient: addressToBytes32(toAddress), burnToken: address(inToken) }); emit BridgeInitiated({ fromAddress: msg.sender, fromToken: inToken, fromAmount: inAmount, toChainId: toChainId, toAddress: toAddress, toToken: outToken, toAmount: outAmount }); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-20 standard as defined in the ERC. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.2.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC1363} from "../../../interfaces/IERC1363.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC-20 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 { /** * @dev An operation with an ERC-20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful. */ function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) { return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful. */ function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) { return _callOptionalReturnBool(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. * * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client" * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. * * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client" * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. * * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being * set here. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * Reverts if the returned value is other than `true`. */ function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal { if (to.code.length == 0) { safeTransfer(token, to, value); } else if (!token.transferAndCall(to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * Reverts if the returned value is other than `true`. */ function transferFromAndCallRelaxed( IERC1363 token, address from, address to, uint256 value, bytes memory data ) internal { if (to.code.length == 0) { safeTransferFrom(token, from, to, value); } else if (!token.transferFromAndCall(from, to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}. * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall} * once without retrying, and relies on the returned value to be true. * * Reverts if the returned value is other than `true`. */ function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal { if (to.code.length == 0) { forceApprove(token, to, value); } else if (!token.approveAndCall(to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements. */ function _callOptionalReturn(IERC20 token, bytes memory data) private { uint256 returnSize; uint256 returnValue; assembly ("memory-safe") { let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20) // bubble errors if iszero(success) { let ptr := mload(0x40) returndatacopy(ptr, 0, returndatasize()) revert(ptr, returndatasize()) } returnSize := returndatasize() returnValue := mload(0) } if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { bool success; uint256 returnSize; uint256 returnValue; assembly ("memory-safe") { success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20) returnSize := returndatasize() returnValue := mload(0) } return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1); } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.12; import "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; import "../TokenUtils.sol"; /// @author Daimo, Inc /// @custom:security-contact [email protected] /// @notice Bridges assets. Specifically, it lets any relayer initiate a bridge /// transaction to another chain. interface IDaimoPayBridger { /// Emitted when a bridge transaction is initiated event BridgeInitiated( address fromAddress, address fromToken, uint256 fromAmount, uint256 toChainId, address toAddress, address toToken, uint256 toAmount ); /// Determine the input token and amount required to achieve one of the /// given output options on a given chain. function getBridgeTokenIn( uint256 toChainId, TokenAmount[] memory bridgeTokenOutOptions ) external view returns (address bridgeTokenIn, uint256 inAmount); /// Initiate a bridge. Guarantee that one of the bridge token options /// (bridgeTokenOut, outAmount) shows up at toAddress on toChainId. /// Otherwise, revert. function sendToChain( uint256 toChainId, address toAddress, TokenAmount[] calldata bridgeTokenOutOptions, bytes calldata extraData ) external; }
/* * Copyright (c) 2022, Circle Internet Financial Limited. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ pragma solidity ^0.8.12; /** * @title ITokenMinter * @notice interface for minter of tokens that are mintable, burnable, and interchangeable * across domains. */ 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); /** * @notice Set the token controller of this ITokenMinter. Token controller * is responsible for mapping local tokens to remote tokens, and managing * token-specific limits * @param newTokenController new token controller address */ function setTokenController(address newTokenController) external; }
/* * Copyright (c) 2022, Circle Internet Financial Limited. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ pragma solidity ^0.8.12; /** * @title ICCTPTokenMessenger * @notice Initiates CCTP transfers. Interface derived from TokenMessenger.sol. */ interface ICCTPTokenMessenger { /** * @notice Deposits and burns tokens from sender to be minted on destination domain. * Emits a `DepositForBurn` event. * @dev reverts if: * - 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 * @return _nonce unique nonce reserved by message */ function depositForBurn( uint256 amount, uint32 destinationDomain, bytes32 mintRecipient, address burnToken ) external returns (uint64 _nonce); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC165} from "./IERC165.sol"; /** * @title IERC1363 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363]. * * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction. */ interface IERC1363 is IERC20, IERC165 { /* * Note: the ERC-165 identifier for this interface is 0xb0202a11. * 0xb0202a11 === * bytes4(keccak256('transferAndCall(address,uint256)')) ^ * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^ * bytes4(keccak256('approveAndCall(address,uint256)')) ^ * bytes4(keccak256('approveAndCall(address,uint256,bytes)')) */ /** * @dev Moves a `value` amount of tokens from the caller's account to `to` * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferAndCall(address to, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from the caller's account to `to` * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @param data Additional data with no specified format, sent in call to `to`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param from The address which you want to send tokens from. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferFromAndCall(address from, address to, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param from The address which you want to send tokens from. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @param data Additional data with no specified format, sent in call to `to`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`. * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function approveAndCall(address spender, uint256 value) external returns (bool); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`. * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. * @param data Additional data with no specified format, sent in call to `spender`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.12; import "openzeppelin-contracts/contracts/token/ERC20/IERC20.sol"; import "openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol"; /// Asset amount, e.g. $100 USDC or 0.1 ETH struct TokenAmount { /// Zero address = native asset, e.g. ETH IERC20 token; uint256 amount; } /// Utility functions that work for both ERC20 and native tokens. library TokenUtils { using SafeERC20 for IERC20; /// Returns ERC20 or ETH balance. function getBalanceOf( IERC20 token, address addr ) internal view returns (uint256) { if (address(token) == address(0)) { return addr.balance; } else { return token.balanceOf(addr); } } /// Approves a token transfer. function approve(IERC20 token, address spender, uint256 amount) internal { if (address(token) != address(0)) { token.forceApprove({spender: spender, value: amount}); } // Do nothing for native token. } /// Sends an ERC20 or ETH transfer. For ETH, verify call success. function transfer( IERC20 token, address payable recipient, uint256 amount ) internal { if (address(token) != address(0)) { token.safeTransfer({to: recipient, value: amount}); } else { // Native token transfer (bool success, ) = recipient.call{value: amount}(""); require(success, "TokenUtils: ETH transfer failed"); } } /// Sends an ERC20 or ETH transfer. Returns true if successful. function tryTransfer( IERC20 token, address recipient, uint256 amount ) internal returns (bool) { if (address(token) != address(0)) { return token.trySafeTransfer({to: recipient, value: amount}); } else { (bool success, ) = recipient.call{value: amount}(""); return success; } } /// Sends an ERC20 transfer. function transferFrom( IERC20 token, address from, address to, uint256 amount ) internal { require( address(token) != address(0), "TokenUtils: ETH transferFrom must be caller" ); token.safeTransferFrom({from: from, to: to, value: amount}); } /// Sends any token balance in the contract to the recipient. function transferBalance( IERC20 token, address payable recipient ) internal returns (uint256) { uint256 balance = getBalanceOf({token: token, addr: address(this)}); if (balance > 0) { transfer({token: token, recipient: recipient, amount: balance}); } return balance; } /// Check that the address has enough of at least one of the tokenAmounts. /// Returns the index of the first token that has sufficient balance, or /// the length of the tokenAmounts array if no token has sufficient balance. function checkBalance( TokenAmount[] calldata tokenAmounts ) internal view returns (uint256) { uint256 n = tokenAmounts.length; for (uint256 i = 0; i < n; ++i) { TokenAmount calldata tokenAmount = tokenAmounts[i]; uint256 balance = getBalanceOf({ token: tokenAmount.token, addr: address(this) }); if (balance >= tokenAmount.amount) { return i; } } return n; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../token/ERC20/IERC20.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "../utils/introspection/IERC165.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[ERC]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
{ "remappings": [ "@axelar-network/=lib/axelar-gmp-sdk-solidity/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/", "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "axelar-gmp-sdk-solidity/=lib/axelar-gmp-sdk-solidity/contracts/", "ds-test/=lib/solmate/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/", "halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "solmate/=lib/solmate/src/" ], "optimizer": { "enabled": true, "runs": 999999 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "viaIR": true, "libraries": { "script/constants/CCTPBridgeRouteConstants.sol": { "CCTPBridgeRouteConstants": "0xe254230d908324C771B7Cf118E03A22e34Fe8F4c" } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"uint256","name":"sourceChainId","type":"uint256"}],"name":"getCCTPBridgeRoutes","outputs":[{"internalType":"uint256[]","name":"chainIds","type":"uint256[]"},{"components":[{"internalType":"uint32","name":"domain","type":"uint32"},{"internalType":"address","name":"bridgeTokenOut","type":"address"}],"internalType":"struct DaimoPayCCTPBridger.CCTPBridgeRoute[]","name":"bridgeRoutes","type":"tuple[]"}],"stateMutability":"pure","type":"function"}]
Contract Creation Code
60808060405234601957610791908161001f823930815050f35b600080fdfe6080604052600436101561001257600080fd5b60003560e01c631279e0a41461002757600080fd5b60207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101065761005c6004356102d2565b906040519182916040830160408452815180915260206060850192019060005b8181106100ed5750505082810360208401526020808351928381520192019060005b8181106100ac575050500390f35b8251805163ffffffff16855260209081015173ffffffffffffffffffffffffffffffffffffffff16818601528695506040909401939092019160010161009e565b825184528695506020938401939092019160010161007c565b600080fd5b604051906040820182811067ffffffffffffffff82111761012b57604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f604051930116820182811067ffffffffffffffff82111761012b57604052565b6080906101aa8261015a565b60038152917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0018260005b8281106101e157505050565b6020906101ec61010b565b60008152600083820152828285010152016101d5565b60a09061020e8261015a565b60048152917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0018260005b82811061024557505050565b60209061025061010b565b6000815260008382015282828501015201610239565b8051156102735760200190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b8051600110156102735760400190565b8051600210156102735760600190565b8051600310156102735760800190565b6001811461049657600a81146106b957608981146105895761210581146104965761a4b1146103595760646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f536f7572636520636861696e206e6f7420666f756e64000000000000000000006044820152fd5b61036360a061015a565b60048152906080366020840137610378610202565b91600161038482610266565b5261038d61010b565b6000815273a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4860208201526103b484610266565b526103be83610266565b50600a6103ca826102a2565b526103d361010b565b60028152730b2c639c533813f4aa9d7837caf62653d097ff8560208201526103fa846102a2565b52610404836102a2565b506089610410826102b2565b5261041961010b565b60078152733c499c542cef5e3811e1192ce70d8cc03d5c33596020820152610440846102b2565b5261044a836102b2565b50612105610457826102c2565b5261046061010b565b6006815273833589fcd6edb6e08f4c7c32d4f71b54bda029136020820152610487846102c2565b52610491836102c2565b509190565b506104a1608061015a565b600381529060603660208401376104b661019e565b91600a6104c282610266565b526104cb61010b565b60028152730b2c639c533813f4aa9d7837caf62653d097ff8560208201526104f284610266565b526104fc83610266565b506089610508826102a2565b5261051161010b565b60078152733c499c542cef5e3811e1192ce70d8cc03d5c33596020820152610538846102a2565b52610542836102a2565b5061a4b161054f826102b2565b5261055861010b565b6003815273af88d065e77c8cc2239327c5edb3a432268e5831602082015261057f846102b2565b52610491836102b2565b5061059460a061015a565b600481529060803660208401376105a9610202565b9160016105b582610266565b526105be61010b565b6000815273a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4860208201526105e584610266565b526105ef83610266565b50600a6105fb826102a2565b5261060461010b565b60028152730b2c639c533813f4aa9d7837caf62653d097ff85602082015261062b846102a2565b52610635836102a2565b50612105610642826102b2565b5261064b61010b565b6006815273833589fcd6edb6e08f4c7c32d4f71b54bda029136020820152610672846102b2565b5261067c836102b2565b5061a4b1610689826102c2565b5261069261010b565b6003815273af88d065e77c8cc2239327c5edb3a432268e58316020820152610487846102c2565b506106c460a061015a565b600481529060803660208401376106d9610202565b9160016106e582610266565b526106ee61010b565b6000815273a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48602082015261071584610266565b5261071f83610266565b50608961072b826102a2565b5261073461010b565b60078152733c499c542cef5e3811e1192ce70d8cc03d5c3359602082015261062b846102a256fea2646970667358221220b7626679376f0ebe96e9baedc7ba083ab7a4b0266d05969e56079f907f2fb41764736f6c634300081a0033
Deployed Bytecode
0x6080604052600436101561001257600080fd5b60003560e01c631279e0a41461002757600080fd5b60207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101065761005c6004356102d2565b906040519182916040830160408452815180915260206060850192019060005b8181106100ed5750505082810360208401526020808351928381520192019060005b8181106100ac575050500390f35b8251805163ffffffff16855260209081015173ffffffffffffffffffffffffffffffffffffffff16818601528695506040909401939092019160010161009e565b825184528695506020938401939092019160010161007c565b600080fd5b604051906040820182811067ffffffffffffffff82111761012b57604052565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f604051930116820182811067ffffffffffffffff82111761012b57604052565b6080906101aa8261015a565b60038152917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0018260005b8281106101e157505050565b6020906101ec61010b565b60008152600083820152828285010152016101d5565b60a09061020e8261015a565b60048152917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0018260005b82811061024557505050565b60209061025061010b565b6000815260008382015282828501015201610239565b8051156102735760200190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b8051600110156102735760400190565b8051600210156102735760600190565b8051600310156102735760800190565b6001811461049657600a81146106b957608981146105895761210581146104965761a4b1146103595760646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f536f7572636520636861696e206e6f7420666f756e64000000000000000000006044820152fd5b61036360a061015a565b60048152906080366020840137610378610202565b91600161038482610266565b5261038d61010b565b6000815273a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4860208201526103b484610266565b526103be83610266565b50600a6103ca826102a2565b526103d361010b565b60028152730b2c639c533813f4aa9d7837caf62653d097ff8560208201526103fa846102a2565b52610404836102a2565b506089610410826102b2565b5261041961010b565b60078152733c499c542cef5e3811e1192ce70d8cc03d5c33596020820152610440846102b2565b5261044a836102b2565b50612105610457826102c2565b5261046061010b565b6006815273833589fcd6edb6e08f4c7c32d4f71b54bda029136020820152610487846102c2565b52610491836102c2565b509190565b506104a1608061015a565b600381529060603660208401376104b661019e565b91600a6104c282610266565b526104cb61010b565b60028152730b2c639c533813f4aa9d7837caf62653d097ff8560208201526104f284610266565b526104fc83610266565b506089610508826102a2565b5261051161010b565b60078152733c499c542cef5e3811e1192ce70d8cc03d5c33596020820152610538846102a2565b52610542836102a2565b5061a4b161054f826102b2565b5261055861010b565b6003815273af88d065e77c8cc2239327c5edb3a432268e5831602082015261057f846102b2565b52610491836102b2565b5061059460a061015a565b600481529060803660208401376105a9610202565b9160016105b582610266565b526105be61010b565b6000815273a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4860208201526105e584610266565b526105ef83610266565b50600a6105fb826102a2565b5261060461010b565b60028152730b2c639c533813f4aa9d7837caf62653d097ff85602082015261062b846102a2565b52610635836102a2565b50612105610642826102b2565b5261064b61010b565b6006815273833589fcd6edb6e08f4c7c32d4f71b54bda029136020820152610672846102b2565b5261067c836102b2565b5061a4b1610689826102c2565b5261069261010b565b6003815273af88d065e77c8cc2239327c5edb3a432268e58316020820152610487846102c2565b506106c460a061015a565b600481529060803660208401376106d9610202565b9160016106e582610266565b526106ee61010b565b6000815273a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48602082015261071584610266565b5261071f83610266565b50608961072b826102a2565b5261073461010b565b60078152733c499c542cef5e3811e1192ce70d8cc03d5c3359602082015261062b846102a256fea2646970667358221220b7626679376f0ebe96e9baedc7ba083ab7a4b0266d05969e56079f907f2fb41764736f6c634300081a0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.