From 1a9b00fd83cc49e1590999ae90b7715bbf6c7bcf Mon Sep 17 00:00:00 2001 From: Timepunk <45543880+0xTimepunk@users.noreply.github.com> Date: Tue, 23 Jan 2024 16:21:49 +0000 Subject: [PATCH 1/4] feat: add name and symbol to SP --- foundry.toml | 4 ++-- lib/ERC1155A | 2 +- script/Abstract.Deploy.Single.s.sol | 4 +++- src/SuperPositions.sol | 9 ++++++++- src/forms/ERC4626FormImplementation.sol | 4 ++-- test/utils/BaseSetup.sol | 4 +++- 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/foundry.toml b/foundry.toml index 049f0609c..218285c8d 100644 --- a/foundry.toml +++ b/foundry.toml @@ -16,7 +16,7 @@ verbosity = 0 ffi = false libs = ["lib"] fs_permissions = [{ access = "read-write", path = "./script/" }] -remappings = ["solmate/=lib/ERC1155A/lib/solmate/src/"] +remappings = ["solmate/=lib/ERC1155A/lib/solmate/src/","ERC1155A/=lib/ERC1155A/src/"] [profile.localdev] solc_version = "0.8.23" # Override for the solc version (setting this ignores `auto_detect_solc`) @@ -30,7 +30,7 @@ verbosity = 0 ffi = false libs = ["lib"] fs_permissions = [{ access = "read-write", path = "./script/" }] -remappings = ["solmate/=lib/ERC1155A/lib/solmate/src/"] +remappings = ["solmate/=lib/ERC1155A/lib/solmate/src/","ERC1155A/=lib/ERC1155A/src/"] [profile.coverage] fuzz = { runs = 1, max_test_rejects = 350_000 } diff --git a/lib/ERC1155A b/lib/ERC1155A index f46fa5420..05e542175 160000 --- a/lib/ERC1155A +++ b/lib/ERC1155A @@ -1 +1 @@ -Subproject commit f46fa542026b860717d48bd1c09acbb8b68a0b57 +Subproject commit 05e542175bda12d7a7fa723ede554542b424ce8c diff --git a/script/Abstract.Deploy.Single.s.sol b/script/Abstract.Deploy.Single.s.sol index ed946f23d..16d443506 100644 --- a/script/Abstract.Deploy.Single.s.sol +++ b/script/Abstract.Deploy.Single.s.sol @@ -574,7 +574,9 @@ abstract contract AbstractDeploySingle is Script { vars.superPositions = address( new SuperPositions{ salt: salt }( "https://ipfs-gateway.superform.xyz/ipns/k51qzi5uqu5dg90fqdo9j63m556wlddeux4mlgyythp30zousgh3huhyzouyq8/JSON/", - vars.superRegistry + vars.superRegistry, + "SuperPositions", + "SP" ) ); diff --git a/src/SuperPositions.sol b/src/SuperPositions.sol index a6dfe56cc..29ea933a8 100644 --- a/src/SuperPositions.sol +++ b/src/SuperPositions.sol @@ -119,7 +119,14 @@ contract SuperPositions is ISuperPositions, ERC1155A, Broadcastable { /// @param dynamicURI_ URL for external metadata of ERC1155 SuperPositions /// @param superRegistry_ the superform registry contract - constructor(string memory dynamicURI_, address superRegistry_) { + constructor( + string memory dynamicURI_, + address superRegistry_, + string memory name_, + string memory symbol_ + ) + ERC1155A(name_, symbol_) + { if (block.chainid > type(uint64).max) { revert Error.BLOCK_CHAIN_ID_OUT_OF_BOUNDS(); } diff --git a/src/forms/ERC4626FormImplementation.sol b/src/forms/ERC4626FormImplementation.sol index ee752acf5..906018c92 100644 --- a/src/forms/ERC4626FormImplementation.sol +++ b/src/forms/ERC4626FormImplementation.sol @@ -135,12 +135,12 @@ abstract contract ERC4626FormImplementation is BaseForm, LiquidityHandler { /// @inheritdoc BaseForm function superformYieldTokenName() external view virtual override returns (string memory) { - return string(abi.encodePacked("Superform ", IERC20Metadata(vault).name())); + return string(abi.encodePacked("Superposition ", IERC20Metadata(vault).name())); } /// @inheritdoc BaseForm function superformYieldTokenSymbol() external view virtual override returns (string memory) { - return string(abi.encodePacked("SUP-", IERC20Metadata(vault).symbol())); + return string(abi.encodePacked("SP-", IERC20Metadata(vault).symbol())); } /// @inheritdoc BaseForm diff --git a/test/utils/BaseSetup.sol b/test/utils/BaseSetup.sol index 7cb4a542e..4b250428f 100644 --- a/test/utils/BaseSetup.sol +++ b/test/utils/BaseSetup.sol @@ -690,7 +690,9 @@ abstract contract BaseSetup is DSTest, StdInvariant, Test { vars.superPositions = address( new SuperPositions{ salt: salt }( "https://ipfs-gateway.superform.xyz/ipns/k51qzi5uqu5dg90fqdo9j63m556wlddeux4mlgyythp30zousgh3huhyzouyq8/JSON/", - vars.superRegistry + vars.superRegistry, + "SuperPositions", + "SP" ) ); From 44ff36749c27596b03a34af092f62508d3a86729 Mon Sep 17 00:00:00 2001 From: Timepunk <45543880+0xTimepunk@users.noreply.github.com> Date: Tue, 23 Jan 2024 16:29:33 +0000 Subject: [PATCH 2/4] fix: tests --- test/unit/superform-forms/superform-form.ERC4626Form.t.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/superform-forms/superform-form.ERC4626Form.t.sol b/test/unit/superform-forms/superform-form.ERC4626Form.t.sol index 766f68bbe..f6f8feb6b 100644 --- a/test/unit/superform-forms/superform-form.ERC4626Form.t.sol +++ b/test/unit/superform-forms/superform-form.ERC4626Form.t.sol @@ -86,7 +86,7 @@ contract SuperformERC4626FormTest is ProtocolActions { string memory symbol = ERC4626Form(payable(superformCreated)).superformYieldTokenSymbol(); - assertEq(symbol, "SUP-Mock"); + assertEq(symbol, "SP-Mock"); } function test_superformVaultSharesAmountToUnderlyingAmount() public { @@ -357,7 +357,7 @@ contract SuperformERC4626FormTest is ProtocolActions { string memory tokenName = ERC4626Form(payable(superformCreated)).superformYieldTokenName(); - assertEq(tokenName, "Superform Mock Vault"); + assertEq(tokenName, "Superposition Mock Vault"); } function test_superformDirectDepositWithoutAllowance() public { From b7bc311cffbf2a203a6afcc037bb524c6ef2f49b Mon Sep 17 00:00:00 2001 From: vikramarun <33469661+vikramarun@users.noreply.github.com> Date: Tue, 23 Jan 2024 11:42:24 -0500 Subject: [PATCH 3/4] chore: modify name and symbol --- src/forms/ERC4626FormImplementation.sol | 4 ++-- test/unit/superform-forms/superform-form.ERC4626Form.t.sol | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/forms/ERC4626FormImplementation.sol b/src/forms/ERC4626FormImplementation.sol index 906018c92..0d563a171 100644 --- a/src/forms/ERC4626FormImplementation.sol +++ b/src/forms/ERC4626FormImplementation.sol @@ -135,12 +135,12 @@ abstract contract ERC4626FormImplementation is BaseForm, LiquidityHandler { /// @inheritdoc BaseForm function superformYieldTokenName() external view virtual override returns (string memory) { - return string(abi.encodePacked("Superposition ", IERC20Metadata(vault).name())); + return string(abi.encodePacked(IERC20Metadata(vault).name(), " SuperPosition")); } /// @inheritdoc BaseForm function superformYieldTokenSymbol() external view virtual override returns (string memory) { - return string(abi.encodePacked("SP-", IERC20Metadata(vault).symbol())); + return string(abi.encodePacked("sp-", IERC20Metadata(vault).symbol())); } /// @inheritdoc BaseForm diff --git a/test/unit/superform-forms/superform-form.ERC4626Form.t.sol b/test/unit/superform-forms/superform-form.ERC4626Form.t.sol index f6f8feb6b..eadef39ec 100644 --- a/test/unit/superform-forms/superform-form.ERC4626Form.t.sol +++ b/test/unit/superform-forms/superform-form.ERC4626Form.t.sol @@ -86,7 +86,7 @@ contract SuperformERC4626FormTest is ProtocolActions { string memory symbol = ERC4626Form(payable(superformCreated)).superformYieldTokenSymbol(); - assertEq(symbol, "SP-Mock"); + assertEq(symbol, "sp-Mock"); } function test_superformVaultSharesAmountToUnderlyingAmount() public { @@ -357,7 +357,7 @@ contract SuperformERC4626FormTest is ProtocolActions { string memory tokenName = ERC4626Form(payable(superformCreated)).superformYieldTokenName(); - assertEq(tokenName, "Superposition Mock Vault"); + assertEq(tokenName, "Mock Vault SuperPosition"); } function test_superformDirectDepositWithoutAllowance() public { From 61cb3c86219d9acdbd459e83dd75202800e9e09b Mon Sep 17 00:00:00 2001 From: vikramarun <33469661+vikramarun@users.noreply.github.com> Date: Tue, 23 Jan 2024 11:54:21 -0500 Subject: [PATCH 4/4] chore: transmuted erc20 same name as superposition --- src/SuperPositions.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SuperPositions.sol b/src/SuperPositions.sol index 29ea933a8..ce7535e69 100644 --- a/src/SuperPositions.sol +++ b/src/SuperPositions.sol @@ -376,8 +376,8 @@ contract SuperPositions is ISuperPositions, ERC1155A, Broadcastable { } (address superform,,) = id.getSuperform(); - string memory name = string.concat("SuperPositions AERC20 ", IBaseForm(superform).superformYieldTokenName()); - string memory symbol = string.concat("aERC20-", IBaseForm(superform).superformYieldTokenSymbol()); + string memory name = IBaseForm(superform).superformYieldTokenName(); + string memory symbol = IBaseForm(superform).superformYieldTokenSymbol(); uint8 decimal = uint8(IBaseForm(superform).getVaultDecimals()); aErc20Token = address(new aERC20(name, symbol, decimal)); /// @dev broadcast and deploy to the other destination chains