From 1f17c002876da131fed5a6123a414e84ab0ec275 Mon Sep 17 00:00:00 2001 From: 0xdavinchee <0xdavinchee@gmail.com> Date: Thu, 21 Sep 2023 19:50:00 +0300 Subject: [PATCH] use a different function name --- .../interfaces/superfluid/ISuperToken.sol | 2 +- .../contracts/superfluid/SuperToken.sol | 2 +- .../superfluid/SuperTokenFactory.sol | 2 +- .../superfluid/SuperToken.NonStandard.test.ts | 29 +++++++++---------- .../superfluid/SuperTokenFactory.test.ts | 7 +---- .../test/foundry/FoundrySuperfluidTester.sol | 2 +- 6 files changed, 19 insertions(+), 25 deletions(-) diff --git a/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol b/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol index 7db9ab26f7..cf75d42d43 100644 --- a/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol +++ b/packages/ethereum-contracts/contracts/interfaces/superfluid/ISuperToken.sol @@ -50,7 +50,7 @@ interface ISuperToken is ISuperfluidToken, IERC20Metadata, IERC777 { /** * @dev Initialize the contract with admin override */ - function initialize( + function initializeWithAdminOverride( IERC20 underlyingToken, uint8 underlyingDecimals, string calldata n, diff --git a/packages/ethereum-contracts/contracts/superfluid/SuperToken.sol b/packages/ethereum-contracts/contracts/superfluid/SuperToken.sol index e4b4459d6e..a67183252d 100644 --- a/packages/ethereum-contracts/contracts/superfluid/SuperToken.sol +++ b/packages/ethereum-contracts/contracts/superfluid/SuperToken.sol @@ -131,7 +131,7 @@ contract SuperToken is } /// @dev Initialize the Super Token proxy with an admin override - function initialize( + function initializeWithAdminOverride( IERC20 underlyingToken, uint8 underlyingDecimals, string calldata n, diff --git a/packages/ethereum-contracts/contracts/superfluid/SuperTokenFactory.sol b/packages/ethereum-contracts/contracts/superfluid/SuperTokenFactory.sol index aabfbc5bfd..67e33a1c15 100644 --- a/packages/ethereum-contracts/contracts/superfluid/SuperTokenFactory.sol +++ b/packages/ethereum-contracts/contracts/superfluid/SuperTokenFactory.sol @@ -232,7 +232,7 @@ abstract contract SuperTokenFactoryBase is } // initialize the token - superToken.initialize( + superToken.initializeWithAdminOverride( underlyingToken, underlyingDecimals, name, diff --git a/packages/ethereum-contracts/test/contracts/superfluid/SuperToken.NonStandard.test.ts b/packages/ethereum-contracts/test/contracts/superfluid/SuperToken.NonStandard.test.ts index 3d5821cac7..7f03b825aa 100644 --- a/packages/ethereum-contracts/test/contracts/superfluid/SuperToken.NonStandard.test.ts +++ b/packages/ethereum-contracts/test/contracts/superfluid/SuperToken.NonStandard.test.ts @@ -98,12 +98,7 @@ describe("SuperToken's Non Standard Functions", function () { it("#1.4 only can initialize once", async () => { await expectRevertedWith( - superToken["initialize(address,uint8,string,string)"]( - ZERO_ADDRESS, - 18, - "name", - "symbol" - ), + superToken.initialize(ZERO_ADDRESS, 18, "name", "symbol"), "Initializable: contract is already initialized" ); }); @@ -751,10 +746,12 @@ describe("SuperToken's Non Standard Functions", function () { customToken, reason ); - await web3tx( - customToken["initialize(address,uint8,string,string)"], - "customToken.initialize" - )(ZERO_ADDRESS, 0, "Custom SuperTestToken", "CSTT"); + await web3tx(customToken.initialize, "customToken.initialize")( + ZERO_ADDRESS, + 0, + "Custom SuperTestToken", + "CSTT" + ); await web3tx(customToken.selfMint, "customToken.selfMint")( alice, @@ -784,7 +781,7 @@ describe("SuperToken's Non Standard Functions", function () { it("#3.4 Custom token can use selfTransferFrom", async () => { console.log("customToken.initialize"); - await customToken["initialize(address,uint8,string,string)"]( + await customToken.initialize( ZERO_ADDRESS, 0, "Custom SuperTestToken", @@ -863,10 +860,12 @@ describe("SuperToken's Non Standard Functions", function () { }); it("#3.5 Custom token can use selfApproveFor", async () => { - await web3tx( - customToken["initialize(address,uint8,string,string)"], - "customToken.initialize" - )(ZERO_ADDRESS, 0, "Custom SuperTestToken", "CSTT"); + await web3tx(customToken.initialize, "customToken.initialize")( + ZERO_ADDRESS, + 0, + "Custom SuperTestToken", + "CSTT" + ); await web3tx(customToken.selfMint, "customToken.selfMint")( alice, diff --git a/packages/ethereum-contracts/test/contracts/superfluid/SuperTokenFactory.test.ts b/packages/ethereum-contracts/test/contracts/superfluid/SuperTokenFactory.test.ts index c12eae65d5..bda66083ff 100644 --- a/packages/ethereum-contracts/test/contracts/superfluid/SuperTokenFactory.test.ts +++ b/packages/ethereum-contracts/test/contracts/superfluid/SuperTokenFactory.test.ts @@ -135,12 +135,7 @@ describe("SuperTokenFactory Contract", function () { ); await expectRevertedWith( - superTokenLogic["initialize(address,uint8,string,string)"]( - ZERO_ADDRESS, - 0, - "", - "" - ), + superTokenLogic.initialize(ZERO_ADDRESS, 0, "", ""), "Initializable: contract is already initialized" ); }); diff --git a/packages/ethereum-contracts/test/foundry/FoundrySuperfluidTester.sol b/packages/ethereum-contracts/test/foundry/FoundrySuperfluidTester.sol index 9fdfadb429..22b3042193 100644 --- a/packages/ethereum-contracts/test/foundry/FoundrySuperfluidTester.sol +++ b/packages/ethereum-contracts/test/foundry/FoundrySuperfluidTester.sol @@ -621,7 +621,7 @@ contract FoundrySuperfluidTester is Test { previousSuperToken.CONSTANT_OUTFLOW_NFT(), previousSuperToken.CONSTANT_INFLOW_NFT() ); - localSuperToken.initialize(underlyingToken, underlyingDecimals, name, symbol, adminOverride); + localSuperToken.initializeWithAdminOverride(underlyingToken, underlyingDecimals, name, symbol, adminOverride); } // Write Helpers - ConstantFlowAgreementV1