-
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.
Merge branch 'ccip-develop' into feature/lbtc-init
- Loading branch information
Showing
25 changed files
with
1,917 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@chainlink/contracts-ccip", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "Chainlink CCIP smart contracts", | ||
"author": "Chainlink devs", | ||
"license": "BUSL-1.1", | ||
|
@@ -21,16 +21,13 @@ | |
"prepare": "chmod +x .husky/prepare.sh && ./.husky/prepare.sh", | ||
"prepublishOnly": "pnpm compile && ./scripts/prepublish_generate_abi_folder", | ||
"publish-beta": "pnpm publish --tag beta", | ||
"publish-prod": "npm dist-tag add @chainlink/[email protected].0 latest", | ||
"publish-prod": "npm dist-tag add @chainlink/[email protected].1 latest", | ||
"solhint:ccip": "solhint --max-warnings 0 \"./src/v0.8/ccip/**/*.sol\"", | ||
"solhint": "solhint --max-warnings 0 \"./src/v0.8/**/*.sol\"" | ||
}, | ||
"files": [ | ||
"src/v0.8/ccip/**/*.sol", | ||
"src/v0.8/shared/access/ConfirmedOwner.sol", | ||
"src/v0.8/shared/access/ConfirmedOwnerWithProposal.sol", | ||
"src/v0.8/shared/access/OwnerIsCreator.sol", | ||
"src/v0.8/shared/access/AuthorizedCallers.sol", | ||
"src/v0.8/shared/access/*.sol", | ||
"src/v0.8/shared/call/CallWithExactGas.sol", | ||
"src/v0.8/shared/enumerable/EnumerableMapBytes32.sol", | ||
"src/v0.8/shared/enumerable/EnumerableMapAddresses.sol", | ||
|
@@ -45,7 +42,6 @@ | |
"src/v0.8/shared/token/ERC677/BurnMintERC677.sol", | ||
"src/v0.8/shared/util/SortedSetValidationUtil.sol", | ||
"src/v0.8/liquiditymanager/interfaces/ILiquidityContainer.sol", | ||
"src/v0.8/keystone/interfaces/ICapabilityConfiguration.sol", | ||
"src/v0.8/vendor/openzeppelin-solidity", | ||
"src/v0.8/vendor/Context.sol", | ||
"src/v0.8/vendor/Pausable.sol", | ||
|
@@ -61,7 +57,10 @@ | |
"!src/v0.8/ccip/ocr/MultiOCR3Base.sol", | ||
"!src/v0.8/ccip/NonceManager.sol", | ||
"!src/v0.8/ccip/MultiAggregateRateLimiter.sol", | ||
"!src/v0.8/ccip/capability" | ||
"!src/v0.8/ccip/capability", | ||
"!src/v0.8/ccip/FeeQuoter.sol", | ||
"!src/v0.8/ccip/interfaces/encodingutils/ICCIPEncodingUtils.sol", | ||
"!src/v0.8/ccip/rmn" | ||
], | ||
"pnpm": { | ||
"_comment": "See https://github.com/ethers-io/ethers.js/discussions/2849#discussioncomment-2696454", | ||
|
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
26 changes: 26 additions & 0 deletions
26
...racts/src/v0.8/ccip/test/tokenAdminRegistry/FactoryBurnMintERC20/BurnMintERC20Setup.t.sol
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,26 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
import {FactoryBurnMintERC20} from "../../../tokenAdminRegistry/TokenPoolFactory/FactoryBurnMintERC20.sol"; | ||
import {BaseTest} from "../../BaseTest.t.sol"; | ||
|
||
contract BurnMintERC20Setup is BaseTest { | ||
FactoryBurnMintERC20 internal s_burnMintERC20; | ||
|
||
address internal s_mockPool = makeAddr("s_mockPool"); | ||
uint256 internal s_amount = 1e18; | ||
|
||
address internal s_alice; | ||
|
||
function setUp() public virtual override { | ||
BaseTest.setUp(); | ||
|
||
s_alice = makeAddr("alice"); | ||
|
||
s_burnMintERC20 = new FactoryBurnMintERC20("Chainlink Token", "LINK", 18, 1e27, 0, s_alice); | ||
|
||
// Set s_mockPool to be a burner and minter | ||
s_burnMintERC20.grantMintAndBurnRoles(s_mockPool); | ||
deal(address(s_burnMintERC20), OWNER, s_amount); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...v0.8/ccip/test/tokenAdminRegistry/FactoryBurnMintERC20/FactoryBurnMintERC20.approve.t.sol
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,27 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol"; | ||
|
||
contract FactoryBurnMintERC20_approve is BurnMintERC20Setup { | ||
function test_Approve_Success() public { | ||
uint256 balancePre = s_burnMintERC20.balanceOf(STRANGER); | ||
uint256 sendingAmount = s_amount / 2; | ||
|
||
s_burnMintERC20.approve(STRANGER, sendingAmount); | ||
|
||
changePrank(STRANGER); | ||
|
||
s_burnMintERC20.transferFrom(OWNER, STRANGER, sendingAmount); | ||
|
||
assertEq(sendingAmount + balancePre, s_burnMintERC20.balanceOf(STRANGER)); | ||
} | ||
|
||
// Reverts | ||
|
||
function test_InvalidAddress_Reverts() public { | ||
vm.expectRevert(); | ||
|
||
s_burnMintERC20.approve(address(s_burnMintERC20), s_amount); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...rc/v0.8/ccip/test/tokenAdminRegistry/FactoryBurnMintERC20/FactoryBurnMintERC20.burn.t.sol
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,45 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
import {IERC20} from "../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol"; | ||
import {FactoryBurnMintERC20} from "../../../tokenAdminRegistry/TokenPoolFactory/FactoryBurnMintERC20.sol"; | ||
import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol"; | ||
|
||
contract FactoryBurnMintERC20_burn is BurnMintERC20Setup { | ||
function test_BasicBurn_Success() public { | ||
s_burnMintERC20.grantBurnRole(OWNER); | ||
deal(address(s_burnMintERC20), OWNER, s_amount); | ||
|
||
vm.expectEmit(); | ||
emit IERC20.Transfer(OWNER, address(0), s_amount); | ||
|
||
s_burnMintERC20.burn(s_amount); | ||
|
||
assertEq(0, s_burnMintERC20.balanceOf(OWNER)); | ||
} | ||
|
||
// Revert | ||
|
||
function test_SenderNotBurner_Reverts() public { | ||
vm.expectRevert(abi.encodeWithSelector(FactoryBurnMintERC20.SenderNotBurner.selector, OWNER)); | ||
|
||
s_burnMintERC20.burnFrom(STRANGER, s_amount); | ||
} | ||
|
||
function test_ExceedsBalance_Reverts() public { | ||
changePrank(s_mockPool); | ||
|
||
vm.expectRevert("ERC20: burn amount exceeds balance"); | ||
|
||
s_burnMintERC20.burn(s_amount * 2); | ||
} | ||
|
||
function test_BurnFromZeroAddress_Reverts() public { | ||
s_burnMintERC20.grantBurnRole(address(0)); | ||
changePrank(address(0)); | ||
|
||
vm.expectRevert("ERC20: burn from the zero address"); | ||
|
||
s_burnMintERC20.burn(0); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...0.8/ccip/test/tokenAdminRegistry/FactoryBurnMintERC20/FactoryBurnMintERC20.burnFrom.t.sol
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,47 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
import {FactoryBurnMintERC20} from "../../../tokenAdminRegistry/TokenPoolFactory/FactoryBurnMintERC20.sol"; | ||
import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol"; | ||
|
||
contract FactoryBurnMintERC20_burnFrom is BurnMintERC20Setup { | ||
function setUp() public virtual override { | ||
BurnMintERC20Setup.setUp(); | ||
} | ||
|
||
function test_BurnFrom_Success() public { | ||
s_burnMintERC20.approve(s_mockPool, s_amount); | ||
|
||
changePrank(s_mockPool); | ||
|
||
s_burnMintERC20.burnFrom(OWNER, s_amount); | ||
|
||
assertEq(0, s_burnMintERC20.balanceOf(OWNER)); | ||
} | ||
|
||
// Reverts | ||
|
||
function test_SenderNotBurner_Reverts() public { | ||
vm.expectRevert(abi.encodeWithSelector(FactoryBurnMintERC20.SenderNotBurner.selector, OWNER)); | ||
|
||
s_burnMintERC20.burnFrom(OWNER, s_amount); | ||
} | ||
|
||
function test_InsufficientAllowance_Reverts() public { | ||
changePrank(s_mockPool); | ||
|
||
vm.expectRevert("ERC20: insufficient allowance"); | ||
|
||
s_burnMintERC20.burnFrom(OWNER, s_amount); | ||
} | ||
|
||
function test_ExceedsBalance_Reverts() public { | ||
s_burnMintERC20.approve(s_mockPool, s_amount * 2); | ||
|
||
changePrank(s_mockPool); | ||
|
||
vm.expectRevert("ERC20: burn amount exceeds balance"); | ||
|
||
s_burnMintERC20.burnFrom(OWNER, s_amount * 2); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...cip/test/tokenAdminRegistry/FactoryBurnMintERC20/FactoryBurnMintERC20.burnFromAlias.t.sol
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,47 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
import {FactoryBurnMintERC20} from "../../../tokenAdminRegistry/TokenPoolFactory/FactoryBurnMintERC20.sol"; | ||
import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol"; | ||
|
||
contract FactoryBurnMintERC20_burnFromAlias is BurnMintERC20Setup { | ||
function setUp() public virtual override { | ||
BurnMintERC20Setup.setUp(); | ||
} | ||
|
||
function test_BurnFrom_Success() public { | ||
s_burnMintERC20.approve(s_mockPool, s_amount); | ||
|
||
changePrank(s_mockPool); | ||
|
||
s_burnMintERC20.burn(OWNER, s_amount); | ||
|
||
assertEq(0, s_burnMintERC20.balanceOf(OWNER)); | ||
} | ||
|
||
// Reverts | ||
|
||
function test_SenderNotBurner_Reverts() public { | ||
vm.expectRevert(abi.encodeWithSelector(FactoryBurnMintERC20.SenderNotBurner.selector, OWNER)); | ||
|
||
s_burnMintERC20.burn(OWNER, s_amount); | ||
} | ||
|
||
function test_InsufficientAllowance_Reverts() public { | ||
changePrank(s_mockPool); | ||
|
||
vm.expectRevert("ERC20: insufficient allowance"); | ||
|
||
s_burnMintERC20.burn(OWNER, s_amount); | ||
} | ||
|
||
function test_ExceedsBalance_Reverts() public { | ||
s_burnMintERC20.approve(s_mockPool, s_amount * 2); | ||
|
||
changePrank(s_mockPool); | ||
|
||
vm.expectRevert("ERC20: burn amount exceeds balance"); | ||
|
||
s_burnMintERC20.burn(OWNER, s_amount * 2); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
.../ccip/test/tokenAdminRegistry/FactoryBurnMintERC20/FactoryBurnMintERC20.constructor.t.sol
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,26 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
import {FactoryBurnMintERC20} from "../../../tokenAdminRegistry/TokenPoolFactory/FactoryBurnMintERC20.sol"; | ||
import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol"; | ||
|
||
contract FactoryBurnMintERC20_constructor is BurnMintERC20Setup { | ||
function test_Constructor_Success() public { | ||
string memory name = "Chainlink token v2"; | ||
string memory symbol = "LINK2"; | ||
uint8 decimals = 19; | ||
uint256 maxSupply = 1e33; | ||
|
||
s_burnMintERC20 = new FactoryBurnMintERC20(name, symbol, decimals, maxSupply, 1e18, s_alice); | ||
|
||
assertEq(name, s_burnMintERC20.name()); | ||
assertEq(symbol, s_burnMintERC20.symbol()); | ||
assertEq(decimals, s_burnMintERC20.decimals()); | ||
assertEq(maxSupply, s_burnMintERC20.maxSupply()); | ||
|
||
assertTrue(s_burnMintERC20.isMinter(s_alice)); | ||
assertTrue(s_burnMintERC20.isBurner(s_alice)); | ||
assertEq(s_burnMintERC20.balanceOf(s_alice), 1e18); | ||
assertEq(s_burnMintERC20.totalSupply(), 1e18); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
.../test/tokenAdminRegistry/FactoryBurnMintERC20/FactoryBurnMintERC20.decreaseApproval.t.sol
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,14 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol"; | ||
|
||
contract FactoryBurnMintERC20_decreaseApproval is BurnMintERC20Setup { | ||
function test_DecreaseApproval_Success() public { | ||
s_burnMintERC20.approve(s_mockPool, s_amount); | ||
uint256 allowance = s_burnMintERC20.allowance(OWNER, s_mockPool); | ||
assertEq(allowance, s_amount); | ||
s_burnMintERC20.decreaseApproval(s_mockPool, s_amount); | ||
assertEq(s_burnMintERC20.allowance(OWNER, s_mockPool), allowance - s_amount); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...ccip/test/tokenAdminRegistry/FactoryBurnMintERC20/FactoryBurnMintERC20.getCCIPAdmin.t.sol
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,22 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.24; | ||
|
||
import {FactoryBurnMintERC20} from "../../../tokenAdminRegistry/TokenPoolFactory/FactoryBurnMintERC20.sol"; | ||
import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol"; | ||
|
||
contract FactoryBurnMintERC20_getCCIPAdmin is BurnMintERC20Setup { | ||
function test_getCCIPAdmin_Success() public view { | ||
assertEq(s_alice, s_burnMintERC20.getCCIPAdmin()); | ||
} | ||
|
||
function test_setCCIPAdmin_Success() public { | ||
address newAdmin = makeAddr("newAdmin"); | ||
|
||
vm.expectEmit(); | ||
emit FactoryBurnMintERC20.CCIPAdminTransferred(s_alice, newAdmin); | ||
|
||
s_burnMintERC20.setCCIPAdmin(newAdmin); | ||
|
||
assertEq(newAdmin, s_burnMintERC20.getCCIPAdmin()); | ||
} | ||
} |
Oops, something went wrong.