Skip to content
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-4130 CCIP-Compatible Generic BurnMintERC20 #15123

Merged
merged 56 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
8ce0c12
make generic BurnMintERC20 that's ccip-compatible
jhweintraub Nov 5, 2024
e84c420
formatting
jhweintraub Nov 5, 2024
53a3d37
changeset, compiler version set to 8.19 for conformity, and new gethw…
jhweintraub Nov 5, 2024
4082a05
[Bot] Update changeset file with jira issues
app-token-issuer-infra-releng[bot] Nov 5, 2024
fb77e5b
adjust compiler version
jhweintraub Nov 5, 2024
0744916
replace ERC677 with ERC20 in tests that don't need it.
jhweintraub Nov 6, 2024
2b03e2f
move burnMintERC20 to access control not ownership
jhweintraub Nov 7, 2024
eee9d79
forge fmt
jhweintraub Nov 7, 2024
6160bf1
Merge branch 'develop' into feat/genericERC20
jhweintraub Nov 7, 2024
568a536
undo accidental changes to go file in merge
jhweintraub Nov 7, 2024
70a41ae
fix compiler errors
jhweintraub Nov 7, 2024
63ab7c6
Merge 70a41aeae9eb040c81fa1fdc8b6716e23d9eae1c into 3b6aacef0c21beca9…
jhweintraub Nov 7, 2024
decd644
Update gethwrappers
app-token-issuer-infra-releng[bot] Nov 7, 2024
d0d68f7
formatting
jhweintraub Nov 7, 2024
2258a0b
remove more references to ERC677
jhweintraub Nov 7, 2024
6f2bd9f
Merge branch 'develop' into feat/genericERC20
jhweintraub Nov 11, 2024
2be4438
fix snapshot broken in merge
jhweintraub Nov 11, 2024
11c5898
Merge branch 'develop' into feat/genericERC20
jhweintraub Nov 11, 2024
9aee6d0
remove automatic mint and burn role granting in BurnMintERC20 constru…
jhweintraub Nov 11, 2024
c40c669
Merge 9aee6d04a6119b0621078f9270e383b66b54e6ce into 00d966176b8212c27…
jhweintraub Nov 11, 2024
794adba
Update gethwrappers
app-token-issuer-infra-releng[bot] Nov 11, 2024
bea7c55
optimize contract and change function names for new naming convention
jhweintraub Nov 11, 2024
d502b02
Merge bea7c554f84d47668bc78dd8d79be81d7ac0ff6e into a455950e53f8ef7f5…
jhweintraub Nov 11, 2024
5351c79
snapshot fix
jhweintraub Nov 11, 2024
25a1196
pnpm prettier formatting
jhweintraub Nov 11, 2024
147f69a
Merge 25a1196a053ce19e4f1322a5495a9c4aa54be7f0 into a455950e53f8ef7f5…
jhweintraub Nov 11, 2024
3ed0a97
Update gethwrappers
app-token-issuer-infra-releng[bot] Nov 11, 2024
dce25c7
optimize transfer and approve function by removing unnec. error check…
jhweintraub Nov 11, 2024
dd7bb2b
Merge dce25c7fd803b23ae0821c041c27943acef85eb6 into a455950e53f8ef7f5…
jhweintraub Nov 11, 2024
d813844
Merge dd7bb2ba3f18d1da8f3a97e950e6e476086c6023 into a455950e53f8ef7f5…
jhweintraub Nov 11, 2024
2ee121d
Update gethwrappers
app-token-issuer-infra-releng[bot] Nov 11, 2024
f07b0af
remove unused import and better interface imports
jhweintraub Nov 11, 2024
dcc5172
snapshot fix
jhweintraub Nov 11, 2024
1902174
Merge branch 'develop' into feat/genericERC20
jhweintraub Nov 12, 2024
658c9e4
remove failing coverage test
jhweintraub Nov 12, 2024
a9813a0
Merge branch 'develop' into feat/genericERC20
jhweintraub Nov 12, 2024
8e2661c
add missing single quote in github action
jhweintraub Nov 12, 2024
419e69c
lets try this one more time
jhweintraub Nov 12, 2024
e3ce8f3
remove IR minimum compilation detail
jhweintraub Nov 12, 2024
18ef340
gas snapshot fix attempt
jhweintraub Nov 12, 2024
58e2a6a
Revert "optimize transfer and approve function by removing unnec. err…
RensR Nov 13, 2024
609e9ef
Merge branch 'develop' into feat/genericERC20
RensR Nov 13, 2024
1202ea8
fix naming of tests
RensR Nov 13, 2024
c7005c6
Merge 1202ea8ab5a0a186a14bccc4bbf628bca4860baf into 61aa9afd6b25ae50d…
jhweintraub Nov 13, 2024
802f71b
Update gethwrappers
app-token-issuer-infra-releng[bot] Nov 13, 2024
322b74c
fix min pragma
RensR Nov 13, 2024
f1d9f7f
Merge branch 'develop' into feat/genericERC20
jhweintraub Nov 14, 2024
b99d088
add important natspec comment
jhweintraub Nov 15, 2024
5802a9e
Merge branch 'develop' into feat/genericERC20
jhweintraub Nov 15, 2024
ca8d02c
Merge branch 'develop' into feat/genericERC20
jhweintraub Nov 19, 2024
5ddd909
Merge branch 'develop' into feat/genericERC20
jhweintraub Nov 19, 2024
f18d1e3
snapshot fix
jhweintraub Nov 19, 2024
9a4b443
another snapshot fix attempt
jhweintraub Nov 19, 2024
e333214
Merge branch 'develop' into feat/genericERC20
jhweintraub Nov 19, 2024
15b29bf
Merge branch 'develop' into feat/genericERC20
jhweintraub Nov 20, 2024
da791c9
Merge branch 'develop' into feat/genericERC20
jhweintraub Nov 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/solidity-foundry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
cat <<EOF > matrix.json
[
{ "name": "automation", "setup": { "run-coverage": false, "min-coverage": 98.5, "run-gas-snapshot": false, "run-forge-fmt": false }},
{ "name": "ccip", "setup": { "run-coverage": true, "min-coverage": 98.8, "run-gas-snapshot": true, "run-forge-fmt": true }},
{ "name": "ccip", "setup": { "run-coverage": true, "min-coverage": 98.8, "extra-coverage-params": "--no-match-path='*End2End*'", "run-gas-snapshot": true, "run-forge-fmt": true }},
{ "name": "functions", "setup": { "run-coverage": false, "min-coverage": 98.5, "run-gas-snapshot": true, "run-forge-fmt": false }},
{ "name": "keystone", "setup": { "run-coverage": true, "min-coverage": 72.8, "run-gas-snapshot": false, "run-forge-fmt": false }},
{ "name": "l2ep", "setup": { "run-coverage": true, "min-coverage": 61.0, "run-gas-snapshot": true, "run-forge-fmt": false }},
Expand Down
10 changes: 10 additions & 0 deletions contracts/.changeset/hot-pandas-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
'@chainlink/contracts': minor
---

Add a new contract, BurnMintERC20, which is basically just our ERC677 implementation without the transferAndCall function. #internal


PR issue: CCIP-4130

Solidity Review issue: CCIP-3966
226 changes: 113 additions & 113 deletions contracts/gas-snapshots/ccip.gas-snapshot

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions contracts/gas-snapshots/shared.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ AuthorizedCallers_applyAuthorizedCallerUpdates:test_SkipRemove_Success() (gas: 3
AuthorizedCallers_applyAuthorizedCallerUpdates:test_ZeroAddressNotAllowed_Revert() (gas: 64413)
AuthorizedCallers_constructor:test_ZeroAddressNotAllowed_Revert() (gas: 64390)
AuthorizedCallers_constructor:test_constructor_Success() (gas: 674931)
BurnMintERC20_approve:test_approve() (gas: 57652)
BurnMintERC20_burn:test_BasicBurn() (gas: 153607)
BurnMintERC20_burnFrom:test_BurnFrom() (gas: 57995)
BurnMintERC20_burnFromAlias:test_burn() (gas: 58039)
BurnMintERC20_constructor:test_Constructor() (gas: 1694831)
BurnMintERC20_getCCIPAdmin:test_getCCIPAdmin() (gas: 10548)
BurnMintERC20_getCCIPAdmin:test_setCCIPAdmin() (gas: 21590)
BurnMintERC20_grantMintAndBurnRoles:test_GrantMintAndBurnRoles() (gas: 79142)
BurnMintERC20_mint:test_mint() (gas: 101849)
BurnMintERC20_supportsInterface:test_SupportsInterface() (gas: 11218)
BurnMintERC20_transfer:test_transfer() (gas: 42338)
BurnMintERC677_approve:testApproveSuccess() (gas: 55512)
BurnMintERC677_approve:testInvalidAddressReverts() (gas: 10663)
BurnMintERC677_burn:testBasicBurnSuccess() (gas: 172100)
Expand Down
1 change: 1 addition & 0 deletions contracts/scripts/native_solc_compile_all_ccip
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ compileContract ccip/tokenAdminRegistry/RegistryModuleOwnerCustom.sol
compileContract ccip/capability/CCIPHome.sol
compileContract ccip/NonceManager.sol
compileContract shared/token/ERC677/BurnMintERC677.sol
compileContract shared/token/ERC20/BurnMintERC20.sol


# Pools
Expand Down
1 change: 1 addition & 0 deletions contracts/scripts/native_solc_compile_all_shared
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ compileContract () {

compileContract shared/token/ERC677/BurnMintERC677.sol
compileContract shared/token/ERC677/LinkToken.sol
compileContract shared/token/ERC20/BurnMintERC20.sol
compileContract shared/mocks/WERC20Mock.sol
compileContract vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/ERC20.sol
compileContract shared/test/helpers/ChainReaderTester.sol
10 changes: 5 additions & 5 deletions contracts/src/v0.8/ccip/test/TokenSetup.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;

import {BurnMintERC677} from "../../shared/token/ERC677/BurnMintERC677.sol";
import {BurnMintERC20} from "../../shared/token/ERC20/BurnMintERC20.sol";
import {BurnMintTokenPool} from "../pools/BurnMintTokenPool.sol";
import {LockReleaseTokenPool} from "../pools/LockReleaseTokenPool.sol";
import {TokenPool} from "../pools/TokenPool.sol";
Expand All @@ -26,14 +26,14 @@ contract TokenSetup is RouterSetup {
mapping(address sourceToken => address destToken) internal s_destTokenBySourceToken;

function _deploySourceToken(string memory tokenName, uint256 dealAmount, uint8 decimals) internal returns (address) {
BurnMintERC677 token = new BurnMintERC677(tokenName, tokenName, decimals, 0);
BurnMintERC20 token = new BurnMintERC20(tokenName, tokenName, decimals, 0, 0);
s_sourceTokens.push(address(token));
deal(address(token), OWNER, dealAmount);
return address(token);
}

function _deployDestToken(string memory tokenName, uint256 dealAmount) internal returns (address) {
BurnMintERC677 token = new BurnMintERC677(tokenName, tokenName, 18, 0);
BurnMintERC20 token = new BurnMintERC20(tokenName, tokenName, 18, 0, 0);
s_destTokens.push(address(token));
deal(address(token), OWNER, dealAmount);
return address(token);
Expand Down Expand Up @@ -63,8 +63,8 @@ contract TokenSetup is RouterSetup {
}

BurnMintTokenPool pool =
new MaybeRevertingBurnMintTokenPool(BurnMintERC677(token), new address[](0), address(s_mockRMN), router);
BurnMintERC677(token).grantMintAndBurnRoles(address(pool));
new MaybeRevertingBurnMintTokenPool(BurnMintERC20(token), new address[](0), address(s_mockRMN), router);
BurnMintERC20(token).grantMintAndBurnRoles(address(pool));

if (isSourcePool) {
s_sourcePoolByToken[address(token)] = address(pool);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pragma solidity ^0.8.0;

import {IMessageTransmitterWithRelay} from "./interfaces/IMessageTransmitterWithRelay.sol";

import {BurnMintERC677} from "../../../shared/token/ERC677/BurnMintERC677.sol";
import {BurnMintERC20} from "../../../shared/token/ERC20/BurnMintERC20.sol";

// solhint-disable
contract MockE2EUSDCTransmitter is IMessageTransmitterWithRelay {
Expand All @@ -28,7 +28,7 @@ contract MockE2EUSDCTransmitter is IMessageTransmitterWithRelay {
// Next available nonce from this source domain
uint64 public nextAvailableNonce;

BurnMintERC677 internal immutable i_token;
BurnMintERC20 internal immutable i_token;

/**
* @notice Emitted when a new message is dispatched
Expand All @@ -41,7 +41,7 @@ contract MockE2EUSDCTransmitter is IMessageTransmitterWithRelay {
i_localDomain = _localDomain;
s_shouldSucceed = true;

i_token = BurnMintERC677(token);
i_token = BurnMintERC20(token);
}

/// @param message The original message on the source chain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity 0.8.24;
import {IMessageInterceptor} from "../../../interfaces/IMessageInterceptor.sol";
import {IRouter} from "../../../interfaces/IRouter.sol";

import {BurnMintERC677} from "../../../../shared/token/ERC677/BurnMintERC677.sol";
import {BurnMintERC20} from "../../../../shared/token/ERC20/BurnMintERC20.sol";
import {FeeQuoter} from "../../../FeeQuoter.sol";
import {Client} from "../../../libraries/Client.sol";
import {Internal} from "../../../libraries/Internal.sol";
Expand Down Expand Up @@ -416,9 +416,9 @@ contract OnRamp_forwardFromRouter is OnRampSetup {
vm.startPrank(OWNER);

MaybeRevertingBurnMintTokenPool newPool = new MaybeRevertingBurnMintTokenPool(
BurnMintERC677(sourceETH), new address[](0), address(s_mockRMNRemote), address(s_sourceRouter)
BurnMintERC20(sourceETH), new address[](0), address(s_mockRMNRemote), address(s_sourceRouter)
);
BurnMintERC677(sourceETH).grantMintAndBurnRoles(address(newPool));
BurnMintERC20(sourceETH).grantMintAndBurnRoles(address(newPool));
deal(address(sourceETH), address(newPool), type(uint256).max);

// Add TokenPool to OnRamp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ import {IERC20} from "../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/

contract BurnFromMintTokenPool_lockOrBurn is BurnFromMintTokenPoolSetup {
function test_setup_Success() public view {
assertEq(address(s_burnMintERC677), address(s_pool.getToken()));
assertEq(address(s_burnMintERC20), address(s_pool.getToken()));
assertEq(address(s_mockRMN), s_pool.getRmnProxy());
assertEq(false, s_pool.getAllowListEnabled());
assertEq(type(uint256).max, s_burnMintERC677.allowance(address(s_pool), address(s_pool)));
assertEq(type(uint256).max, s_burnMintERC20.allowance(address(s_pool), address(s_pool)));
assertEq("BurnFromMintTokenPool 1.5.0", s_pool.typeAndVersion());
}

function test_PoolBurn_Success() public {
uint256 burnAmount = 20_000e18;

deal(address(s_burnMintERC677), address(s_pool), burnAmount);
assertEq(s_burnMintERC677.balanceOf(address(s_pool)), burnAmount);
deal(address(s_burnMintERC20), address(s_pool), burnAmount);
assertEq(s_burnMintERC20.balanceOf(address(s_pool)), burnAmount);

vm.startPrank(s_burnMintOnRamp);

Expand All @@ -35,25 +35,25 @@ contract BurnFromMintTokenPool_lockOrBurn is BurnFromMintTokenPoolSetup {
emit TokenPool.Burned(address(s_burnMintOnRamp), burnAmount);

bytes4 expectedSignature = bytes4(keccak256("burnFrom(address,uint256)"));
vm.expectCall(address(s_burnMintERC677), abi.encodeWithSelector(expectedSignature, address(s_pool), burnAmount));
vm.expectCall(address(s_burnMintERC20), abi.encodeWithSelector(expectedSignature, address(s_pool), burnAmount));

s_pool.lockOrBurn(
Pool.LockOrBurnInV1({
originalSender: OWNER,
receiver: bytes(""),
amount: burnAmount,
remoteChainSelector: DEST_CHAIN_SELECTOR,
localToken: address(s_burnMintERC677)
localToken: address(s_burnMintERC20)
})
);

assertEq(s_burnMintERC677.balanceOf(address(s_pool)), 0);
assertEq(s_burnMintERC20.balanceOf(address(s_pool)), 0);
}

// Should not burn tokens if cursed.
function test_PoolBurnRevertNotHealthy_Revert() public {
s_mockRMN.setGlobalCursed(true);
uint256 before = s_burnMintERC677.balanceOf(address(s_pool));
uint256 before = s_burnMintERC20.balanceOf(address(s_pool));
vm.startPrank(s_burnMintOnRamp);

vm.expectRevert(TokenPool.CursedByRMN.selector);
Expand All @@ -63,11 +63,11 @@ contract BurnFromMintTokenPool_lockOrBurn is BurnFromMintTokenPoolSetup {
receiver: bytes(""),
amount: 1e5,
remoteChainSelector: DEST_CHAIN_SELECTOR,
localToken: address(s_burnMintERC677)
localToken: address(s_burnMintERC20)
})
);

assertEq(s_burnMintERC677.balanceOf(address(s_pool)), before);
assertEq(s_burnMintERC20.balanceOf(address(s_pool)), before);
}

function test_ChainNotAllowed_Revert() public {
Expand All @@ -78,7 +78,7 @@ contract BurnFromMintTokenPool_lockOrBurn is BurnFromMintTokenPoolSetup {
originalSender: bytes(""),
receiver: OWNER,
amount: 1,
localToken: address(s_burnMintERC677),
localToken: address(s_burnMintERC20),
remoteChainSelector: wrongChainSelector,
sourcePoolAddress: _generateSourceTokenData().sourcePoolAddress,
sourcePoolData: _generateSourceTokenData().extraData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ contract BurnFromMintTokenPoolSetup is BurnMintSetup {
function setUp() public virtual override {
BurnMintSetup.setUp();

s_pool = new BurnFromMintTokenPool(s_burnMintERC677, new address[](0), address(s_mockRMN), address(s_sourceRouter));
s_burnMintERC677.grantMintAndBurnRoles(address(s_pool));
s_pool = new BurnFromMintTokenPool(s_burnMintERC20, new address[](0), address(s_mockRMN), address(s_sourceRouter));
s_burnMintERC20.grantMintAndBurnRoles(address(s_pool));

_applyChainUpdates(address(s_pool));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.24;

import {BurnMintERC677} from "../../../../shared/token/ERC677/BurnMintERC677.sol";
import {BurnMintERC20} from "../../../../shared/token/ERC20/BurnMintERC20.sol";
import {Router} from "../../../Router.sol";
import {BurnMintTokenPool} from "../../../pools/BurnMintTokenPool.sol";
import {TokenPool} from "../../../pools/TokenPool.sol";
import {RouterSetup} from "../../router/Router/RouterSetup.t.sol";

contract BurnMintSetup is RouterSetup {
BurnMintERC677 internal s_burnMintERC677;
BurnMintERC20 internal s_burnMintERC20;
address internal s_burnMintOffRamp = makeAddr("burn_mint_offRamp");
address internal s_burnMintOnRamp = makeAddr("burn_mint_onRamp");

Expand All @@ -18,7 +18,7 @@ contract BurnMintSetup is RouterSetup {
function setUp() public virtual override {
RouterSetup.setUp();

s_burnMintERC677 = new BurnMintERC677("Chainlink Token", "LINK", 18, 0);
s_burnMintERC20 = new BurnMintERC20("Chainlink Token", "LINK", 18, 0, 0);
}

function _applyChainUpdates(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ contract BurnMintTokenPoolSetup is BurnMintSetup {
function setUp() public virtual override {
BurnMintSetup.setUp();

s_pool = new BurnMintTokenPool(s_burnMintERC677, new address[](0), address(s_mockRMN), address(s_sourceRouter));
s_burnMintERC677.grantMintAndBurnRoles(address(s_pool));
s_pool = new BurnMintTokenPool(s_burnMintERC20, new address[](0), address(s_mockRMN), address(s_sourceRouter));
s_burnMintERC20.grantMintAndBurnRoles(address(s_pool));

_applyChainUpdates(address(s_pool));
}
}

contract BurnMintTokenPool_lockOrBurn is BurnMintTokenPoolSetup {
function test_Setup_Success() public view {
assertEq(address(s_burnMintERC677), address(s_pool.getToken()));
assertEq(address(s_burnMintERC20), address(s_pool.getToken()));
assertEq(address(s_mockRMN), s_pool.getRmnProxy());
assertEq(false, s_pool.getAllowListEnabled());
assertEq("BurnMintTokenPool 1.5.0", s_pool.typeAndVersion());
Expand All @@ -33,8 +33,8 @@ contract BurnMintTokenPool_lockOrBurn is BurnMintTokenPoolSetup {
function test_PoolBurn_Success() public {
uint256 burnAmount = 20_000e18;

deal(address(s_burnMintERC677), address(s_pool), burnAmount);
assertEq(s_burnMintERC677.balanceOf(address(s_pool)), burnAmount);
deal(address(s_burnMintERC20), address(s_pool), burnAmount);
assertEq(s_burnMintERC20.balanceOf(address(s_pool)), burnAmount);

vm.startPrank(s_burnMintOnRamp);

Expand All @@ -48,25 +48,25 @@ contract BurnMintTokenPool_lockOrBurn is BurnMintTokenPoolSetup {
emit TokenPool.Burned(address(s_burnMintOnRamp), burnAmount);

bytes4 expectedSignature = bytes4(keccak256("burn(uint256)"));
vm.expectCall(address(s_burnMintERC677), abi.encodeWithSelector(expectedSignature, burnAmount));
vm.expectCall(address(s_burnMintERC20), abi.encodeWithSelector(expectedSignature, burnAmount));

s_pool.lockOrBurn(
Pool.LockOrBurnInV1({
originalSender: OWNER,
receiver: bytes(""),
amount: burnAmount,
remoteChainSelector: DEST_CHAIN_SELECTOR,
localToken: address(s_burnMintERC677)
localToken: address(s_burnMintERC20)
})
);

assertEq(s_burnMintERC677.balanceOf(address(s_pool)), 0);
assertEq(s_burnMintERC20.balanceOf(address(s_pool)), 0);
}

// Should not burn tokens if cursed.
function test_PoolBurnRevertNotHealthy_Revert() public {
s_mockRMN.setGlobalCursed(true);
uint256 before = s_burnMintERC677.balanceOf(address(s_pool));
uint256 before = s_burnMintERC20.balanceOf(address(s_pool));
vm.startPrank(s_burnMintOnRamp);

vm.expectRevert(TokenPool.CursedByRMN.selector);
Expand All @@ -76,11 +76,11 @@ contract BurnMintTokenPool_lockOrBurn is BurnMintTokenPoolSetup {
receiver: bytes(""),
amount: 1e5,
remoteChainSelector: DEST_CHAIN_SELECTOR,
localToken: address(s_burnMintERC677)
localToken: address(s_burnMintERC20)
})
);

assertEq(s_burnMintERC677.balanceOf(address(s_pool)), before);
assertEq(s_burnMintERC20.balanceOf(address(s_pool)), before);
}

function test_ChainNotAllowed_Revert() public {
Expand All @@ -93,7 +93,7 @@ contract BurnMintTokenPool_lockOrBurn is BurnMintTokenPoolSetup {
receiver: bytes(""),
amount: 1,
remoteChainSelector: wrongChainSelector,
localToken: address(s_burnMintERC677)
localToken: address(s_burnMintERC20)
})
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ contract BurnMintTokenPoolSetup is BurnMintSetup {
function setUp() public virtual override {
BurnMintSetup.setUp();

s_pool = new BurnMintTokenPool(s_burnMintERC677, new address[](0), address(s_mockRMN), address(s_sourceRouter));
s_burnMintERC677.grantMintAndBurnRoles(address(s_pool));
s_pool = new BurnMintTokenPool(s_burnMintERC20, new address[](0), address(s_mockRMN), address(s_sourceRouter));
s_burnMintERC20.grantMintAndBurnRoles(address(s_pool));

_applyChainUpdates(address(s_pool));
}
Expand All @@ -36,21 +36,21 @@ contract BurnMintTokenPool_releaseOrMint is BurnMintTokenPoolSetup {
originalSender: bytes(""),
receiver: receiver,
amount: amount,
localToken: address(s_burnMintERC677),
localToken: address(s_burnMintERC20),
remoteChainSelector: DEST_CHAIN_SELECTOR,
sourcePoolAddress: abi.encode(s_remoteBurnMintPool),
sourcePoolData: "",
offchainTokenData: ""
})
);

assertEq(s_burnMintERC677.balanceOf(receiver), amount);
assertEq(s_burnMintERC20.balanceOf(receiver), amount);
}

function test_PoolMintNotHealthy_Revert() public {
// Should not mint tokens if cursed.
s_mockRMN.setGlobalCursed(true);
uint256 before = s_burnMintERC677.balanceOf(OWNER);
uint256 before = s_burnMintERC20.balanceOf(OWNER);
vm.startPrank(s_burnMintOffRamp);

vm.expectRevert(TokenPool.CursedByRMN.selector);
Expand All @@ -59,15 +59,15 @@ contract BurnMintTokenPool_releaseOrMint is BurnMintTokenPoolSetup {
originalSender: bytes(""),
receiver: OWNER,
amount: 1e5,
localToken: address(s_burnMintERC677),
localToken: address(s_burnMintERC20),
remoteChainSelector: DEST_CHAIN_SELECTOR,
sourcePoolAddress: _generateSourceTokenData().sourcePoolAddress,
sourcePoolData: _generateSourceTokenData().extraData,
offchainTokenData: ""
})
);

assertEq(s_burnMintERC677.balanceOf(OWNER), before);
assertEq(s_burnMintERC20.balanceOf(OWNER), before);
}

function test_ChainNotAllowed_Revert() public {
Expand All @@ -79,7 +79,7 @@ contract BurnMintTokenPool_releaseOrMint is BurnMintTokenPoolSetup {
originalSender: bytes(""),
receiver: OWNER,
amount: 1,
localToken: address(s_burnMintERC677),
localToken: address(s_burnMintERC20),
remoteChainSelector: wrongChainSelector,
sourcePoolAddress: _generateSourceTokenData().sourcePoolAddress,
sourcePoolData: _generateSourceTokenData().extraData,
Expand Down
Loading
Loading