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

Carrot #90

Merged
merged 3 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 25 additions & 0 deletions mainnet-contracts/script/DeployCARROT.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.0 <0.9.0;

import "forge-std/Script.sol";
import { DeployerHelper } from "./DeployerHelper.s.sol";
import { CARROT } from "../src/CARROT.sol";

/**
* forge script script/DeployCARROT.s.sol:DeployCARROT --rpc-url=$RPC_URL --private-key $PK
*
* deploy along with verification:
* forge script script/DeployCARROT.s.sol:DeployCARROT -vvvv --rpc-url=$RPC_URL --account puffer --verify --etherscan-api-key $ETHERSCAN_API_KEY --broadcast
*/
contract DeployCARROT is DeployerHelper {
function run() public {
vm.startBroadcast();
address multiSig = 0xE06A1ad7346Dfda7Ce9BCFba751DABFd754BAfAD;

CARROT carrot = new CARROT(multiSig);

vm.label(address(carrot), "CARROT");

vm.stopBroadcast();
}
}
25 changes: 0 additions & 25 deletions mainnet-contracts/script/DeploySOON.s.sol

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
// }
tdenisenko marked this conversation as resolved.
Show resolved Hide resolved

// Don't remove this test, it is used as a reference for real registration
// function test_eigenda_avs() public {
Expand Down
40 changes: 40 additions & 0 deletions mainnet-contracts/test/unit/CARROT.t.sol
Original file line number Diff line number Diff line change
@@ -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);
}
}
40 changes: 0 additions & 40 deletions mainnet-contracts/test/unit/SOON.t.sol

This file was deleted.

Loading