Skip to content

Commit

Permalink
Burn token in lockOrBurn function
Browse files Browse the repository at this point in the history
  • Loading branch information
b-gopalswami committed Dec 9, 2024
1 parent e248ec4 commit 4081a34
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
11 changes: 5 additions & 6 deletions contracts/src/v0.8/ccip/test/mocks/MockLBTCTokenPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ contract MockLBTCTokenPool is TokenPool, ITypeAndVersion {
address[] memory allowlist,
address rmnProxy,
address router
) TokenPool(token, 18, allowlist, rmnProxy, router) {
) TokenPool(token, 8, allowlist, rmnProxy, router) {

}

Expand All @@ -37,6 +37,9 @@ contract MockLBTCTokenPool is TokenPool, ITypeAndVersion {
payload = abi.encodePacked(hex"1234abcd");
destPoolData = abi.encode(sha256(payload));

IBurnMintERC20(address(i_token)).burn(lockOrBurnIn.amount);
emit Burned(msg.sender, lockOrBurnIn.amount);

return
Pool.LockOrBurnOutV1({
destTokenAddress: getRemoteToken(
Expand All @@ -51,12 +54,8 @@ contract MockLBTCTokenPool is TokenPool, ITypeAndVersion {
) 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);
IBurnMintERC20(address(i_token)).mint(releaseOrMintIn.receiver, releaseOrMintIn.amount);

emit Minted(
msg.sender,
Expand Down
Loading

0 comments on commit 4081a34

Please sign in to comment.