-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cherry-pick: CCIP-4408: E2E test for LBTC (#1578)
cherry-pick da91f6f --------- Co-authored-by: Balamurali Gopalswami <167726375+b-gopalswami@users.noreply.github.com> Co-authored-by: Ryan Stout <ryan.stout@smartcontract.com> Co-authored-by: Friedemann Fürst <59653747+friedemannf@users.noreply.github.com> Co-authored-by: Otávio Migliavacca Madalosso <otavio.madalosso@smartcontract.com> Co-authored-by: app-token-issuer-infra-releng[bot] <120227048+app-token-issuer-infra-releng[bot]@users.noreply.github.com>
- Loading branch information
1 parent
f6a9169
commit 2bd8c76
Showing
19 changed files
with
3,087 additions
and
13 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
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,66 @@ | ||
// 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 mock contract facilitates testing of LBTC token transfers by burning and minting tokens. | ||
contract MockLBTCTokenPool is TokenPool, ITypeAndVersion { | ||
using SafeERC20 for IERC20; | ||
|
||
string public constant override typeAndVersion = "MockLBTCTokenPool 1.5.1"; | ||
|
||
// This variable i_destPoolData will have either a 32-byte or non-32-byte value, which will change the off-chain behavior. | ||
// If it is 32 bytes, the off-chain will consider it as attestation enabled and call the attestation API. | ||
// If it is non-32 bytes, the off-chain will consider it as attestation disabled. | ||
bytes public i_destPoolData; | ||
|
||
constructor( | ||
IERC20 token, | ||
address[] memory allowlist, | ||
address rmnProxy, | ||
address router, | ||
bytes memory destPoolData | ||
) TokenPool(token, allowlist, rmnProxy, router) { | ||
i_destPoolData = destPoolData; | ||
} | ||
|
||
function lockOrBurn( | ||
Pool.LockOrBurnInV1 calldata lockOrBurnIn | ||
) public virtual override returns (Pool.LockOrBurnOutV1 memory) { | ||
IBurnMintERC20(address(i_token)).burn(lockOrBurnIn.amount); | ||
emit Burned(msg.sender, lockOrBurnIn.amount); | ||
|
||
return | ||
Pool.LockOrBurnOutV1({ | ||
destTokenAddress: getRemoteToken( | ||
lockOrBurnIn.remoteChainSelector | ||
), | ||
destPoolData: i_destPoolData | ||
}); | ||
} | ||
|
||
function releaseOrMint( | ||
Pool.ReleaseOrMintInV1 calldata releaseOrMintIn | ||
) public virtual override returns (Pool.ReleaseOrMintOutV1 memory) { | ||
IBurnMintERC20(address(i_token)).mint(releaseOrMintIn.receiver, releaseOrMintIn.amount); | ||
|
||
emit Minted( | ||
msg.sender, | ||
releaseOrMintIn.receiver, | ||
releaseOrMintIn.amount | ||
); | ||
|
||
return | ||
Pool.ReleaseOrMintOutV1({ | ||
destinationAmount: releaseOrMintIn.amount | ||
}); | ||
} | ||
} | ||
|
2,713 changes: 2,713 additions & 0 deletions
2,713
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
Oops, something went wrong.