From 9aee6d04a6119b0621078f9270e383b66b54e6ce Mon Sep 17 00:00:00 2001 From: Josh Date: Mon, 11 Nov 2024 11:30:26 -0500 Subject: [PATCH] remove automatic mint and burn role granting in BurnMintERC20 constructor --- contracts/gas-snapshots/ccip.gas-snapshot | 16 ++++++++-------- contracts/gas-snapshots/shared.gas-snapshot | 12 ++++++------ .../BurnMintERC20.constructor.t.sol | 2 -- .../v0.8/shared/token/ERC20/BurnMintERC20.sol | 2 -- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/contracts/gas-snapshots/ccip.gas-snapshot b/contracts/gas-snapshots/ccip.gas-snapshot index 7160cd10bd6..e3974d6af16 100644 --- a/contracts/gas-snapshots/ccip.gas-snapshot +++ b/contracts/gas-snapshots/ccip.gas-snapshot @@ -173,20 +173,20 @@ FeeQuoter_getValidatedFee:test_NotAFeeToken_Revert() (gas: 21280) FeeQuoter_getValidatedFee:test_SingleTokenMessage_Success() (gas: 114442) FeeQuoter_getValidatedFee:test_TooManyTokens_Revert() (gas: 23473) FeeQuoter_getValidatedFee:test_ZeroDataAvailabilityMultiplier_Success() (gas: 63843) -FeeQuoter_getValidatedTokenPrice:test_GetValidatedTokenPriceFromFeedErc20Above18Decimals_Success() (gas: 1968881) -FeeQuoter_getValidatedTokenPrice:test_GetValidatedTokenPriceFromFeedErc20Below18Decimals_Success() (gas: 1968839) -FeeQuoter_getValidatedTokenPrice:test_GetValidatedTokenPriceFromFeedFeedAt0Decimals_Success() (gas: 1948958) -FeeQuoter_getValidatedTokenPrice:test_GetValidatedTokenPriceFromFeedFeedAt18Decimals_Success() (gas: 1968613) -FeeQuoter_getValidatedTokenPrice:test_GetValidatedTokenPriceFromFeedFlippedDecimals_Success() (gas: 1968817) -FeeQuoter_getValidatedTokenPrice:test_GetValidatedTokenPriceFromFeedMaxInt224Value_Success() (gas: 1968629) +FeeQuoter_getValidatedTokenPrice:test_GetValidatedTokenPriceFromFeedErc20Above18Decimals_Success() (gas: 1919674) +FeeQuoter_getValidatedTokenPrice:test_GetValidatedTokenPriceFromFeedErc20Below18Decimals_Success() (gas: 1919632) +FeeQuoter_getValidatedTokenPrice:test_GetValidatedTokenPriceFromFeedFeedAt0Decimals_Success() (gas: 1899751) +FeeQuoter_getValidatedTokenPrice:test_GetValidatedTokenPriceFromFeedFeedAt18Decimals_Success() (gas: 1919406) +FeeQuoter_getValidatedTokenPrice:test_GetValidatedTokenPriceFromFeedFlippedDecimals_Success() (gas: 1919610) +FeeQuoter_getValidatedTokenPrice:test_GetValidatedTokenPriceFromFeedMaxInt224Value_Success() (gas: 1919422) FeeQuoter_getValidatedTokenPrice:test_GetValidatedTokenPriceFromFeedOverStalenessPeriod_Success() (gas: 65210) FeeQuoter_getValidatedTokenPrice:test_GetValidatedTokenPriceFromFeed_Success() (gas: 65090) FeeQuoter_getValidatedTokenPrice:test_GetValidatedTokenPrice_Success() (gas: 58872) -FeeQuoter_getValidatedTokenPrice:test_OverflowFeedPrice_Revert() (gas: 1968255) +FeeQuoter_getValidatedTokenPrice:test_OverflowFeedPrice_Revert() (gas: 1919048) FeeQuoter_getValidatedTokenPrice:test_StaleFeeToken_Success() (gas: 61821) FeeQuoter_getValidatedTokenPrice:test_TokenNotSupportedFeed_Revert() (gas: 116926) FeeQuoter_getValidatedTokenPrice:test_TokenNotSupported_Revert() (gas: 14160) -FeeQuoter_getValidatedTokenPrice:test_UnderflowFeedPrice_Revert() (gas: 1966932) +FeeQuoter_getValidatedTokenPrice:test_UnderflowFeedPrice_Revert() (gas: 1917725) FeeQuoter_onReport:test_OnReport_StaleUpdate_SkipPriceUpdate_Success() (gas: 43936) FeeQuoter_onReport:test_onReport_InvalidForwarder_Reverts() (gas: 23657) FeeQuoter_onReport:test_onReport_Success() (gas: 80700) diff --git a/contracts/gas-snapshots/shared.gas-snapshot b/contracts/gas-snapshots/shared.gas-snapshot index c4b3bbf1b5e..605f2d944a9 100644 --- a/contracts/gas-snapshots/shared.gas-snapshot +++ b/contracts/gas-snapshots/shared.gas-snapshot @@ -9,25 +9,25 @@ AuthorizedCallers_constructor:test_ZeroAddressNotAllowed_Revert() (gas: 64390) AuthorizedCallers_constructor:test_constructor_Success() (gas: 674931) BurnMintERC20approve:test_Approve_Success() (gas: 55564) BurnMintERC20approve:test_InvalidAddress_Reverts() (gas: 10663) -BurnMintERC20burn:test_BasicBurn_Success() (gas: 135713) +BurnMintERC20burn:test_BasicBurn_Success() (gas: 153474) BurnMintERC20burn:test_BurnFromZeroAddress_Reverts() (gas: 43655) BurnMintERC20burn:test_ExceedsBalance_Reverts() (gas: 21711) -BurnMintERC20burn:test_SenderNotBurner_Reverts() (gas: 19837) +BurnMintERC20burn:test_SenderNotBurner_Reverts() (gas: 19578) BurnMintERC20burnFrom:test_BurnFrom_Success() (gas: 57874) BurnMintERC20burnFrom:test_ExceedsBalance_Reverts() (gas: 35788) BurnMintERC20burnFrom:test_InsufficientAllowance_Reverts() (gas: 21720) -BurnMintERC20burnFrom:test_SenderNotBurner_Reverts() (gas: 19804) +BurnMintERC20burnFrom:test_SenderNotBurner_Reverts() (gas: 19545) BurnMintERC20burnFromAlias:test_BurnFrom_Success() (gas: 57918) BurnMintERC20burnFromAlias:test_ExceedsBalance_Reverts() (gas: 35821) BurnMintERC20burnFromAlias:test_InsufficientAllowance_Reverts() (gas: 21762) -BurnMintERC20burnFromAlias:test_SenderNotBurner_Reverts() (gas: 19846) -BurnMintERC20constructor:test_Constructor_Success() (gas: 1762798) +BurnMintERC20burnFromAlias:test_SenderNotBurner_Reverts() (gas: 19587) +BurnMintERC20constructor:test_Constructor_Success() (gas: 1708881) BurnMintERC20decreaseApproval:test_DecreaseApproval_Success() (gas: 31192) BurnMintERC20getCCIPAdmin:test_getCCIPAdmin_Success() (gas: 10525) BurnMintERC20getCCIPAdmin:test_setCCIPAdmin_Success() (gas: 21612) BurnMintERC20grantMintAndBurnRoles:test_GrantMintAndBurnRoles_Success() (gas: 79321) BurnMintERC20increaseApproval:test_IncreaseApproval_Success() (gas: 44163) -BurnMintERC20mint:test_BasicMint_Success() (gas: 57263) +BurnMintERC20mint:test_BasicMint_Success() (gas: 101665) BurnMintERC20mint:test_MaxSupplyExceeded_Reverts() (gas: 50037) BurnMintERC20mint:test_SenderNotMinter_Reverts() (gas: 11479) BurnMintERC20supportsInterface:test_SupportsInterface_Success() (gas: 11217) diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.constructor.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.constructor.t.sol index f6850b5c135..4dc81317d77 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.constructor.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.constructor.t.sol @@ -21,8 +21,6 @@ contract BurnMintERC20constructor is BurnMintERC20Setup { assertEq(maxSupply, s_burnMintERC20.maxSupply()); assertTrue(s_burnMintERC20.hasRole(s_burnMintERC20.DEFAULT_ADMIN_ROLE(), s_alice)); - assertTrue(s_burnMintERC20.hasRole(s_burnMintERC20.MINTER_ROLE(), s_alice)); - assertTrue(s_burnMintERC20.hasRole(s_burnMintERC20.BURNER_ROLE(), s_alice)); assertEq(s_burnMintERC20.balanceOf(s_alice), 1e18); assertEq(s_burnMintERC20.totalSupply(), 1e18); } diff --git a/contracts/src/v0.8/shared/token/ERC20/BurnMintERC20.sol b/contracts/src/v0.8/shared/token/ERC20/BurnMintERC20.sol index 820fb725392..0846dc73e09 100644 --- a/contracts/src/v0.8/shared/token/ERC20/BurnMintERC20.sol +++ b/contracts/src/v0.8/shared/token/ERC20/BurnMintERC20.sol @@ -58,8 +58,6 @@ contract BurnMintERC20 is IBurnMintERC20, IGetCCIPAdmin, IERC165, ERC20Burnable, // Set up the owner as the initial minter and burner _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); - _grantRole(MINTER_ROLE, msg.sender); - _grantRole(BURNER_ROLE, msg.sender); } /// @inheritdoc IERC165