Skip to content

Commit

Permalink
add timelock function and upgrade xPufETH
Browse files Browse the repository at this point in the history
  • Loading branch information
WalidOfNow committed Jul 1, 2024
1 parent de6833d commit c6e9c19
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
42 changes: 42 additions & 0 deletions mainnet-contracts/script/UpgradeXpufETH.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.0 <0.9.0;

import "forge-std/Script.sol";
import { AccessManager } from "@openzeppelin/contracts/access/manager/AccessManager.sol";
import { stdJson } from "forge-std/StdJson.sol";
import { Multicall } from "@openzeppelin/contracts/utils/Multicall.sol";
import { ERC1967Proxy } from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import { xPufETH } from "src/l2/xPufETH.sol";
import { UUPSUpgradeable } from "@openzeppelin-contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import { BaseScript } from "./BaseScript.s.sol";

/**
* // Check that the simulation
* add --slow if deploying to a mainnet fork like tenderly (its buggy sometimes)
*
* forge script script/UpgradeXpufETH.s.sol:UpgradeXpufETH --rpc-url $RPC_URL --account puffer
*
* forge cache clean
*
* forge script script/UpgradeXpufETH.s.sol:UpgradeXpufETH --rpc-url $RPC_URL --account puffer --broadcast
*/
contract UpgradeXpufETH is BaseScript {
address ACCCESS_MANAGER = 0x8c1686069474410E6243425f4a10177a94EBEE11;
address PUFFER_VAULT = 0xD9A442856C234a39a81a089C06451EBAa4306a72;

address public xPufETHProxy = 0xD7D2802f6b19843ac4DfE25022771FD83b5A7464;

function run() public broadcast {
xPufETH xpufETHImplementation = new xPufETH();

bytes memory upgradeCalldata =
abi.encodeWithSelector(UUPSUpgradeable.upgradeToAndCall.selector, address(xpufETHImplementation), "");

bytes memory timelockCalladata =
abi.encodeWithSelector(AccessManager.execute.selector, xPufETHProxy, upgradeCalldata);

console.logBytes(timelockCalladata);

console.log("xpufETH implementation:", address(xpufETHImplementation));
}
}
9 changes: 9 additions & 0 deletions mainnet-contracts/src/l2/xPufETH.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ contract xPufETH is xPufETHStorage, IXERC20, AccessManagedUpgradeable, ERC20Perm
__ERC20Permit_init("xPufETH");
}

/**
* @notice Returns the address of the lockbox
*/
function lockbox() external view returns (address) {
xPufETH storage $ = _getXPufETHStorage();

return $.lockbox;
}

/**
* @notice Mints tokens for a user
* @dev Can only be called by a bridge
Expand Down

0 comments on commit c6e9c19

Please sign in to comment.