-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
3,324 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity 0.8.24; | ||
|
||
import {ITypeAndVersion} from "../../../shared/interfaces/ITypeAndVersion.sol"; | ||
import {IBurnMintERC20} from "../../../shared/token/ERC20/IBurnMintERC20.sol"; | ||
|
||
import {Pool} from "../../libraries/Pool.sol"; | ||
import {TokenPool} from "../../pools/TokenPool.sol"; | ||
|
||
import {IERC20} from "../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol"; | ||
import {SafeERC20} from "../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/utils/SafeERC20.sol"; | ||
|
||
/// @notice This pool mints and burns LBTC tokens through the Cross Chain Transfer | ||
/// Protocol (CCTP). | ||
contract MockLBTCTokenPool is TokenPool, ITypeAndVersion { | ||
using SafeERC20 for IERC20; | ||
|
||
string public constant override typeAndVersion = "MockLBTCTokenPool 1.5.1"; | ||
|
||
constructor( | ||
IERC20 token, | ||
address[] memory allowlist, | ||
address rmnProxy, | ||
address router | ||
) TokenPool(token, 18, allowlist, rmnProxy, router) { | ||
|
||
} | ||
|
||
/// @notice Burn the token in the pool | ||
/// @dev emits ITokenMessenger.DepositForBurn | ||
/// @dev Assumes caller has validated destinationReceiver | ||
function lockOrBurn( | ||
Pool.LockOrBurnInV1 calldata lockOrBurnIn | ||
) public virtual override returns (Pool.LockOrBurnOutV1 memory) { | ||
bytes memory payload; | ||
bytes memory destPoolData; | ||
payload = abi.encodePacked(hex"1234abcd"); | ||
destPoolData = abi.encode(sha256(payload)); | ||
|
||
return | ||
Pool.LockOrBurnOutV1({ | ||
destTokenAddress: getRemoteToken( | ||
lockOrBurnIn.remoteChainSelector | ||
), | ||
destPoolData: destPoolData | ||
}); | ||
} | ||
|
||
function releaseOrMint( | ||
Pool.ReleaseOrMintInV1 calldata releaseOrMintIn | ||
) public virtual override returns (Pool.ReleaseOrMintOutV1 memory) { | ||
|
||
// TODO: validate releaseOrMintIn.offchainTokenData? | ||
|
||
// Calculate the local amount | ||
uint256 localAmount = | ||
_calculateLocalAmount(releaseOrMintIn.amount, _parseRemoteDecimals(releaseOrMintIn.sourcePoolData)); | ||
// Mint to the receiver | ||
IBurnMintERC20(address(i_token)).mint(releaseOrMintIn.receiver, localAmount); | ||
|
||
emit Minted( | ||
msg.sender, | ||
releaseOrMintIn.receiver, | ||
releaseOrMintIn.amount | ||
); | ||
|
||
return | ||
Pool.ReleaseOrMintOutV1({ | ||
destinationAmount: releaseOrMintIn.amount | ||
}); | ||
} | ||
} | ||
|
3,018 changes: 3,018 additions & 0 deletions
3,018
core/gethwrappers/ccip/generated/mock_lbtc_token_pool/mock_lbtc_token_pool.go
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.