From 660b96736971a47c2be8965b395006f5b0960f88 Mon Sep 17 00:00:00 2001 From: Steven Valeri Date: Sun, 21 Jul 2024 20:55:06 -0400 Subject: [PATCH 1/2] feat: cache ptoken --- contracts/PointTokenVault.sol | 7 ++++--- contracts/test/PointTokenVault.t.sol | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/contracts/PointTokenVault.sol b/contracts/PointTokenVault.sol index 83b46b3..443b520 100644 --- a/contracts/PointTokenVault.sol +++ b/contracts/PointTokenVault.sol @@ -249,10 +249,11 @@ contract PointTokenVault is UUPSUpgradeable, AccessControlUpgradeable, Multicall } (string memory name, string memory symbol) = LibString.unpackTwo(_pointsId); // Assume the points id was created using LibString.packTwo. - pTokens[_pointsId] = new PToken{salt: _pointsId}(name, symbol, 18); - emit PTokenDeployed(_pointsId, address(pTokens[_pointsId])); + PToken pToken = new PToken{salt: _pointsId}(name, symbol, 18); + pTokens[_pointsId] = pToken; - return pTokens[_pointsId]; + emit PTokenDeployed(_pointsId, address(pToken)); + return pToken; } // Internal --- diff --git a/contracts/test/PointTokenVault.t.sol b/contracts/test/PointTokenVault.t.sol index 139d06c..f792f31 100644 --- a/contracts/test/PointTokenVault.t.sol +++ b/contracts/test/PointTokenVault.t.sol @@ -42,6 +42,11 @@ contract PointTokenVaultTest is Test { pointTokenVault.grantRole(pointTokenVault.DEFAULT_ADMIN_ROLE(), admin); pointTokenVault.grantRole(pointTokenVault.MERKLE_UPDATER_ROLE(), merkleUpdater); + + + + + pointTokenVault.grantRole(pointTokenVault.OPERATOR_ROLE(), operator); pointTokenVault.grantRole(pointTokenVault.FEE_COLLECTOR_ROLE(), feeCollector); pointTokenVault.revokeRole(pointTokenVault.DEFAULT_ADMIN_ROLE(), address(this)); From 77ebc91cf124f9ffc74ff6679e6e378ec4420f3f Mon Sep 17 00:00:00 2001 From: Steven Valeri Date: Sun, 21 Jul 2024 20:56:28 -0400 Subject: [PATCH 2/2] fix: remove extra spaces --- contracts/test/PointTokenVault.t.sol | 5 ----- 1 file changed, 5 deletions(-) diff --git a/contracts/test/PointTokenVault.t.sol b/contracts/test/PointTokenVault.t.sol index f792f31..139d06c 100644 --- a/contracts/test/PointTokenVault.t.sol +++ b/contracts/test/PointTokenVault.t.sol @@ -42,11 +42,6 @@ contract PointTokenVaultTest is Test { pointTokenVault.grantRole(pointTokenVault.DEFAULT_ADMIN_ROLE(), admin); pointTokenVault.grantRole(pointTokenVault.MERKLE_UPDATER_ROLE(), merkleUpdater); - - - - - pointTokenVault.grantRole(pointTokenVault.OPERATOR_ROLE(), operator); pointTokenVault.grantRole(pointTokenVault.FEE_COLLECTOR_ROLE(), feeCollector); pointTokenVault.revokeRole(pointTokenVault.DEFAULT_ADMIN_ROLE(), address(this));