Skip to content

Commit

Permalink
fix: wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
sogipec committed Jan 14, 2025
1 parent d32d36d commit 0f72685
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
12 changes: 6 additions & 6 deletions contracts/partners/tokenWrappers/PufferPointTokenWrapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ contract PufferPointTokenWrapper is UUPSHelper, ERC20Upgradeable {
/*//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
VARIABLES
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
/// @notice `Core` contract handling access control
IAccessControlManager public core;
/// @notice `accessControlManager` contract handling access control
IAccessControlManager public accessControlManager;
/// @notice Merkl main functions
address public distributor;
address public feeRecipient;
Expand Down Expand Up @@ -72,7 +72,7 @@ contract PufferPointTokenWrapper is UUPSHelper, ERC20Upgradeable {
__UUPSUpgradeable_init();
if (address(_accessControlManager) == address(0)) revert Errors.ZeroAddress();
underlying = _underlying;
core = _accessControlManager;
accessControlManager = _accessControlManager;
cliffDuration = _cliffDuration;
distributionCreator = _distributionCreator;
distributor = IDistributionCreator(_distributionCreator).distributor();
Expand Down Expand Up @@ -173,18 +173,18 @@ contract PufferPointTokenWrapper is UUPSHelper, ERC20Upgradeable {

/// @notice Checks whether the `msg.sender` has the governor role or the guardian role
modifier onlyGovernor() {
if (!core.isGovernor(msg.sender)) revert Errors.NotGovernor();
if (!accessControlManager.isGovernor(msg.sender)) revert Errors.NotGovernor();
_;
}

/// @notice Checks whether the `msg.sender` has the governor role or the guardian role
modifier onlyGuardian() {
if (!core.isGovernorOrGuardian(msg.sender)) revert Errors.NotGovernorOrGuardian();
if (!accessControlManager.isGovernorOrGuardian(msg.sender)) revert Errors.NotGovernorOrGuardian();
_;
}

/// @inheritdoc UUPSUpgradeable
function _authorizeUpgrade(address) internal view override onlyGovernorUpgrader(core) {}
function _authorizeUpgrade(address) internal view override onlyGovernorUpgrader(accessControlManager) {}

/// @notice Recovers any ERC20 token
/// @dev Governance only, to trigger only if something went wrong
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"foundry:compile": "forge build --optimize --optimizer-runs 1000",
"foundry:coverage": "forge coverage --ir-minimum --report lcov && yarn lcov:clean && yarn lcov:generate-html",
"foundry:script": "forge script -vvvv",
"foundry:deploy": "forge script --broadcast --verify -vvvv",
"foundry:deploy": "source .env && forge script --broadcast --verify -vvvv",
"foundry:gas": "forge test --gas-report",
"foundry:run": "docker run -it --rm -v $(pwd):/app -w /app ghcr.io/foundry-rs/foundry sh",
"foundry:setup": "curl -L https://foundry.paradigm.xyz | bash && foundryup && git submodule update --init --recursive",
Expand Down
19 changes: 16 additions & 3 deletions scripts/deployPufferPointTokenWrapper.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,24 @@ import { IAccessControlManager } from "../contracts/interfaces/IAccessControlMan
import { MockToken } from "../contracts/mock/MockToken.sol";

contract DeployPufferPointTokenWrapper is BaseScript {
function run() public broadcast {
console.log("DEPLOYER_ADDRESS:", broadcaster);
function run() public {
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY");
vm.startBroadcast(deployerPrivateKey);
/*
address underlying = 0x282A69142bac47855C3fbE1693FcC4bA3B4d5Ed6;
uint32 cliffDuration = 1 weeks;
uint32 cliffDuration = 500;
// uint32 cliffDuration = 1 weeks;
IAccessControlManager manager = IAccessControlManager(0x0E632a15EbCBa463151B5367B4fCF91313e389a6);
address distributionCreator = 0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd;
*/

// ARBITRUM TEST
// aglaMerkl
address underlying = 0xE0688A2FE90d0f93F17f273235031062a210d691;
uint32 cliffDuration = 500;
// uint32 cliffDuration = 1 weeks;
IAccessControlManager manager = IAccessControlManager(0xA86CC1ae2D94C6ED2aB3bF68fB128c2825673267);
address distributionCreator = 0x8BB4C975Ff3c250e0ceEA271728547f3802B36Fd;

// Deploy implementation
PufferPointTokenWrapper implementation = new PufferPointTokenWrapper();
Expand All @@ -35,5 +47,6 @@ contract DeployPufferPointTokenWrapper is BaseScript {

// Initialize
PufferPointTokenWrapper(address(proxy)).initialize(underlying, cliffDuration, manager, distributionCreator);
vm.stopBroadcast();
}
}

0 comments on commit 0f72685

Please sign in to comment.