-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CCIP-4408: E2E test for LBTC #1563
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
3444dfc
CCIP-4408: Adding mock for lbtc test
b-gopalswami ab0f391
reverting dependencies update
b-gopalswami dd22875
Merge branch 'ccip-develop' of github.com:smartcontractkit/ccip into …
b-gopalswami 908ec33
Remvoing ctf v2 dep and deploying token and pool using Burn and Mint
b-gopalswami 85fa021
Update mocks to send hard coded hashes
b-gopalswami e80957c
Add MockLBTCTokenPool contract and generate gethwrappers
rstout f72e393
Merge branch 'ccip-develop' of github.com:smartcontractkit/ccip into …
b-gopalswami 4f44dce
Adopting mock lbtc token pool contract in the test
b-gopalswami 0a35ca8
Fix MockLBTCTokenPool bug
rstout 0f07a93
remove token transmitter address expectation
b-gopalswami 4a1e935
Fix exec plugin src provider
b-gopalswami af828af
Adding mocked hash in api attestation
b-gopalswami e248ec4
Update mock lbtc token pool contract to mint token
b-gopalswami 4081a34
Burn token in lockOrBurn function
b-gopalswami ef405ec
gomod tidy
b-gopalswami eeb5902
Adding test to CI
b-gopalswami 45163de
review comments
b-gopalswami d7051cf
MockLBTCTokenPool takes destPoolData as an arg
rstout 93be177
Adding additional test for non 32 bytes destination pool data
b-gopalswami 6e89ee6
Adding additional comments
b-gopalswami 4f4fb5f
Remove dead code
rstout 180259f
Bartek review comment
b-gopalswami eff3594
Merge branch 'ccip-develop' of github.com:smartcontractkit/ccip into …
b-gopalswami c433b36
Rens review comment
b-gopalswami e2b7247
removing immutable
b-gopalswami 75d2fad
Merge branch 'ccip-develop' into ccip-4408
b-gopalswami e700e8f
Merge branch 'ccip-develop' into ccip-4408
b-gopalswami File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need two entire smoke tests for the minor difference in tx types? Can't we just use one test and send both txs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test
TestSmokeCCIPForBidirectionalLane
which is used here is common one and this LBTC functionality is driven by config values in that test. This approach avoids adding new set of test and also running it using separate runner parallelize it.