-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CCIP-4408: E2E test for LBTC (#1563)
## Motivation Adding two E2E test to validate Lombard integration. Test-1: Make sure the destination payload data from mock token pool is sent as 32 bytes and that triggers call attestation API enabled flow. Mock attestation API provides the required attestation and token transfer should be successful. Test-2: Send non 32 bytes destination payload data form mock token pool and that should trigger attestation disabled flow and the token transfer should be successful. ## Solution --------- Co-authored-by: Ryan Stout <[email protected]>
- Loading branch information
1 parent
b276d4d
commit a7871ef
Showing
20 changed files
with
3,420 additions
and
16 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, 8, 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 | ||
}); | ||
} | ||
} | ||
|
3,042 changes: 3,042 additions & 0 deletions
3,042
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.