From 9a0411ca79e619a73e062064f685cccea427e11f Mon Sep 17 00:00:00 2001 From: Benjamin Date: Wed, 8 Jan 2025 09:17:22 +0100 Subject: [PATCH 1/3] soon -> carrot, comment out broken testnet tests --- mainnet-contracts/script/DeploySOON.s.sol | 12 ++-- .../src/{SOON.sol => CARROT.sol} | 12 ++-- .../PufferModuleManager.integration.t.sol | 64 +++++++++---------- mainnet-contracts/test/unit/SOON.t.sol | 18 +++--- 4 files changed, 53 insertions(+), 53 deletions(-) rename mainnet-contracts/src/{SOON.sol => CARROT.sol} (52%) diff --git a/mainnet-contracts/script/DeploySOON.s.sol b/mainnet-contracts/script/DeploySOON.s.sol index f13afbf..db315c0 100644 --- a/mainnet-contracts/script/DeploySOON.s.sol +++ b/mainnet-contracts/script/DeploySOON.s.sol @@ -3,22 +3,22 @@ pragma solidity >=0.8.0 <0.9.0; import "forge-std/Script.sol"; import { DeployerHelper } from "./DeployerHelper.s.sol"; -import { SOON } from "../src/SOON.sol"; +import { CARROT } from "../src/CARROT.sol"; /** - * forge script script/DeploySOON.s.sol:DeploySOON --rpc-url=$RPC_URL --private-key $PK + * forge script script/DeployCARROT.s.sol:DeployCARROT --rpc-url=$RPC_URL --private-key $PK * * deploy along with verification: - * forge script script/DeploySOON.s.sol:DeploySOON -vvvv --rpc-url=$RPC_URL --account puffer --verify --etherscan-api-key $ETHERSCAN_API_KEY --broadcast + * forge script script/DeployCARROT.s.sol:DeployCARROT -vvvv --rpc-url=$RPC_URL --account puffer --verify --etherscan-api-key $ETHERSCAN_API_KEY --broadcast */ -contract DeploySOON is DeployerHelper { +contract DeployCARROT is DeployerHelper { function run() public { vm.startBroadcast(); address multiSig = 0xE06A1ad7346Dfda7Ce9BCFba751DABFd754BAfAD; - SOON soon = new SOON(multiSig); + CARROT soon = new CARROT(multiSig); - vm.label(address(soon), "SOON"); + vm.label(address(soon), "CARROT"); vm.stopBroadcast(); } diff --git a/mainnet-contracts/src/SOON.sol b/mainnet-contracts/src/CARROT.sol similarity index 52% rename from mainnet-contracts/src/SOON.sol rename to mainnet-contracts/src/CARROT.sol index 165d3c6..7550e1c 100644 --- a/mainnet-contracts/src/SOON.sol +++ b/mainnet-contracts/src/CARROT.sol @@ -5,16 +5,16 @@ import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import { ERC20Permit } from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol"; /** - * @title SOON Token + * @title CARROT Token * @author Puffer Finance * @custom:security-contact security@puffer.fi */ -contract SOON is ERC20, ERC20Permit { +contract CARROT is ERC20, ERC20Permit { /** - * @notice Constructor for the SOON token - * totalSupply is 250 million SOON + * @notice Constructor for the CARROT token + * totalSupply is 100 million CARROT */ - constructor(address initialOwner) ERC20("Puffer Points", "SOON") ERC20Permit("Puffer Points") { - _mint(initialOwner, 250_000_000 ether); + constructor(address initialOwner) ERC20("Puffer Points", "CARROT") ERC20Permit("Puffer Points") { + _mint(initialOwner, 100_000_000 ether); } } diff --git a/mainnet-contracts/test/fork-tests/PufferModuleManager.integration.t.sol b/mainnet-contracts/test/fork-tests/PufferModuleManager.integration.t.sol index f448aea..9906062 100644 --- a/mainnet-contracts/test/fork-tests/PufferModuleManager.integration.t.sol +++ b/mainnet-contracts/test/fork-tests/PufferModuleManager.integration.t.sol @@ -45,48 +45,48 @@ contract PufferModuleManagerIntegrationTest is IntegrationTestHelper { pufferProtocol.createPufferModule(bytes32("SOME_MODULE_NAME")); } - function test_opt_into_slashing() public { - vm.startPrank(DAO); - IRestakingOperator operator = _createRestakingOperator(); + // function test_opt_into_slashing() public { + // vm.startPrank(DAO); + // IRestakingOperator operator = _createRestakingOperator(); - address slasher = address(1235); + // address slasher = address(1235); - vm.expectEmit(true, true, true, true); - emit IPufferModuleManager.RestakingOperatorOptedInSlasher(address(operator), slasher); - moduleManager.callOptIntoSlashing(operator, slasher); - } + // vm.expectEmit(true, true, true, true); + // emit IPufferModuleManager.RestakingOperatorOptedInSlasher(address(operator), slasher); + // moduleManager.callOptIntoSlashing(operator, slasher); + // } - function test_modify_operator() public { - vm.startPrank(DAO); - IRestakingOperator operator = _createRestakingOperator(); + // function test_modify_operator() public { + // vm.startPrank(DAO); + // IRestakingOperator operator = _createRestakingOperator(); - IDelegationManager.OperatorDetails memory newOperatorDetails = IDelegationManager.OperatorDetails({ - __deprecated_earningsReceiver: address(this), - delegationApprover: address(0), - stakerOptOutWindowBlocks: 100 - }); + // IDelegationManager.OperatorDetails memory newOperatorDetails = IDelegationManager.OperatorDetails({ + // __deprecated_earningsReceiver: address(this), + // delegationApprover: address(0), + // stakerOptOutWindowBlocks: 100 + // }); - vm.expectEmit(true, true, true, true); - emit IPufferModuleManager.RestakingOperatorModified(address(operator), newOperatorDetails); - moduleManager.callModifyOperatorDetails({ restakingOperator: operator, newOperatorDetails: newOperatorDetails }); + // vm.expectEmit(true, true, true, true); + // emit IPufferModuleManager.RestakingOperatorModified(address(operator), newOperatorDetails); + // moduleManager.callModifyOperatorDetails({ restakingOperator: operator, newOperatorDetails: newOperatorDetails }); - IDelegationManager.OperatorDetails memory details = - operator.EIGEN_DELEGATION_MANAGER().operatorDetails(address(operator)); - assertEq(details.stakerOptOutWindowBlocks, 100, "updated blocks"); + // IDelegationManager.OperatorDetails memory details = + // operator.EIGEN_DELEGATION_MANAGER().operatorDetails(address(operator)); + // assertEq(details.stakerOptOutWindowBlocks, 100, "updated blocks"); - assertEq(details.__deprecated_earningsReceiver, address(this), "updated earnings"); - } + // assertEq(details.__deprecated_earningsReceiver, address(this), "updated earnings"); + // } - function test_update_metadata_uri() public { - vm.startPrank(DAO); - IRestakingOperator operator = _createRestakingOperator(); + // function test_update_metadata_uri() public { + // vm.startPrank(DAO); + // IRestakingOperator operator = _createRestakingOperator(); - string memory newUri = "https://puffer.fi/updated.json"; + // string memory newUri = "https://puffer.fi/updated.json"; - vm.expectEmit(true, true, true, true); - emit IPufferModuleManager.RestakingOperatorMetadataURIUpdated(address(operator), newUri); - moduleManager.callUpdateMetadataURI(operator, newUri); - } + // vm.expectEmit(true, true, true, true); + // emit IPufferModuleManager.RestakingOperatorMetadataURIUpdated(address(operator), newUri); + // moduleManager.callUpdateMetadataURI(operator, newUri); + // } // Don't remove this test, it is used as a reference for real registration // function test_eigenda_avs() public { diff --git a/mainnet-contracts/test/unit/SOON.t.sol b/mainnet-contracts/test/unit/SOON.t.sol index 312960e..f93604d 100644 --- a/mainnet-contracts/test/unit/SOON.t.sol +++ b/mainnet-contracts/test/unit/SOON.t.sol @@ -1,32 +1,32 @@ // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.8.0 <0.9.0; -import { SOON } from "../../src/SOON.sol"; +import { CARROT } from "../../src/CARROT.sol"; import { UnitTestHelper } from "../helpers/UnitTestHelper.sol"; -contract SOONTest is UnitTestHelper { - SOON public soon; +contract CARROTTest is UnitTestHelper { + CARROT public soon; address multiSig = makeAddr("multiSig"); function setUp() public override { - soon = new SOON(multiSig); + soon = new CARROT(multiSig); } function test_constructor() public view { - assertEq(soon.totalSupply(), 250_000_000 ether); + assertEq(soon.totalSupply(), 100_000_000 ether); assertEq(soon.name(), "Puffer Points"); - assertEq(soon.symbol(), "SOON"); + assertEq(soon.symbol(), "CARROT"); } function test_initial_balance_of_multi_sig() public view { - assertEq(soon.balanceOf(multiSig), 250_000_000 ether); + assertEq(soon.balanceOf(multiSig), 100_000_000 ether); } function test_transfer() public { vm.prank(multiSig); soon.transfer(alice, 1 ether); assertEq(soon.balanceOf(alice), 1 ether); - assertEq(soon.balanceOf(multiSig), 249_999_999 ether); + assertEq(soon.balanceOf(multiSig), 99_999_999 ether); } function test_transfer_from() public { @@ -35,6 +35,6 @@ contract SOONTest is UnitTestHelper { vm.prank(bob); soon.transferFrom(multiSig, alice, 1 ether); assertEq(soon.balanceOf(alice), 1 ether); - assertEq(soon.balanceOf(multiSig), 249_999_999 ether); + assertEq(soon.balanceOf(multiSig), 99_999_999 ether); } } From 6c3c911e5561347ebdb9264d6e7da3971e68a14b Mon Sep 17 00:00:00 2001 From: Benjamin Date: Wed, 8 Jan 2025 09:39:23 +0100 Subject: [PATCH 2/3] rename file --- mainnet-contracts/script/{DeploySOON.s.sol => DeployCARROT.s.sol} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename mainnet-contracts/script/{DeploySOON.s.sol => DeployCARROT.s.sol} (100%) diff --git a/mainnet-contracts/script/DeploySOON.s.sol b/mainnet-contracts/script/DeployCARROT.s.sol similarity index 100% rename from mainnet-contracts/script/DeploySOON.s.sol rename to mainnet-contracts/script/DeployCARROT.s.sol From 77287021e3010e9937a5b9d13afd81ffb4e74486 Mon Sep 17 00:00:00 2001 From: ksatyarth2 Date: Wed, 8 Jan 2025 16:10:42 +0530 Subject: [PATCH 3/3] fix: renaming soon --- mainnet-contracts/script/DeployCARROT.s.sol | 4 +-- mainnet-contracts/test/unit/CARROT.t.sol | 40 +++++++++++++++++++++ mainnet-contracts/test/unit/SOON.t.sol | 40 --------------------- 3 files changed, 42 insertions(+), 42 deletions(-) create mode 100644 mainnet-contracts/test/unit/CARROT.t.sol delete mode 100644 mainnet-contracts/test/unit/SOON.t.sol diff --git a/mainnet-contracts/script/DeployCARROT.s.sol b/mainnet-contracts/script/DeployCARROT.s.sol index db315c0..5d13b2c 100644 --- a/mainnet-contracts/script/DeployCARROT.s.sol +++ b/mainnet-contracts/script/DeployCARROT.s.sol @@ -16,9 +16,9 @@ contract DeployCARROT is DeployerHelper { vm.startBroadcast(); address multiSig = 0xE06A1ad7346Dfda7Ce9BCFba751DABFd754BAfAD; - CARROT soon = new CARROT(multiSig); + CARROT carrot = new CARROT(multiSig); - vm.label(address(soon), "CARROT"); + vm.label(address(carrot), "CARROT"); vm.stopBroadcast(); } diff --git a/mainnet-contracts/test/unit/CARROT.t.sol b/mainnet-contracts/test/unit/CARROT.t.sol new file mode 100644 index 0000000..134fc68 --- /dev/null +++ b/mainnet-contracts/test/unit/CARROT.t.sol @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-3.0 +pragma solidity >=0.8.0 <0.9.0; + +import { CARROT } from "../../src/CARROT.sol"; +import { UnitTestHelper } from "../helpers/UnitTestHelper.sol"; + +contract CARROTTest is UnitTestHelper { + CARROT public carrot; + address multiSig = makeAddr("multiSig"); + + function setUp() public override { + carrot = new CARROT(multiSig); + } + + function test_constructor() public view { + assertEq(carrot.totalSupply(), 100_000_000 ether); + assertEq(carrot.name(), "Puffer Points"); + assertEq(carrot.symbol(), "CARROT"); + } + + function test_initial_balance_of_multi_sig() public view { + assertEq(carrot.balanceOf(multiSig), 100_000_000 ether); + } + + function test_transfer() public { + vm.prank(multiSig); + carrot.transfer(alice, 1 ether); + assertEq(carrot.balanceOf(alice), 1 ether); + assertEq(carrot.balanceOf(multiSig), 99_999_999 ether); + } + + function test_transfer_from() public { + vm.prank(multiSig); + carrot.approve(bob, 1 ether); + vm.prank(bob); + carrot.transferFrom(multiSig, alice, 1 ether); + assertEq(carrot.balanceOf(alice), 1 ether); + assertEq(carrot.balanceOf(multiSig), 99_999_999 ether); + } +} diff --git a/mainnet-contracts/test/unit/SOON.t.sol b/mainnet-contracts/test/unit/SOON.t.sol deleted file mode 100644 index f93604d..0000000 --- a/mainnet-contracts/test/unit/SOON.t.sol +++ /dev/null @@ -1,40 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity >=0.8.0 <0.9.0; - -import { CARROT } from "../../src/CARROT.sol"; -import { UnitTestHelper } from "../helpers/UnitTestHelper.sol"; - -contract CARROTTest is UnitTestHelper { - CARROT public soon; - address multiSig = makeAddr("multiSig"); - - function setUp() public override { - soon = new CARROT(multiSig); - } - - function test_constructor() public view { - assertEq(soon.totalSupply(), 100_000_000 ether); - assertEq(soon.name(), "Puffer Points"); - assertEq(soon.symbol(), "CARROT"); - } - - function test_initial_balance_of_multi_sig() public view { - assertEq(soon.balanceOf(multiSig), 100_000_000 ether); - } - - function test_transfer() public { - vm.prank(multiSig); - soon.transfer(alice, 1 ether); - assertEq(soon.balanceOf(alice), 1 ether); - assertEq(soon.balanceOf(multiSig), 99_999_999 ether); - } - - function test_transfer_from() public { - vm.prank(multiSig); - soon.approve(bob, 1 ether); - vm.prank(bob); - soon.transferFrom(multiSig, alice, 1 ether); - assertEq(soon.balanceOf(alice), 1 ether); - assertEq(soon.balanceOf(multiSig), 99_999_999 ether); - } -}