Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add name and symbol to SP #455

Merged
merged 4 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand All @@ -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 }
Expand Down
4 changes: 3 additions & 1 deletion script/Abstract.Deploy.Single.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
);

Expand Down
13 changes: 10 additions & 3 deletions src/SuperPositions.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -369,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
Expand Down
4 changes: 2 additions & 2 deletions src/forms/ERC4626FormImplementation.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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(IERC20Metadata(vault).name(), " SuperPosition"));
}

/// @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
Expand Down
4 changes: 2 additions & 2 deletions test/unit/superform-forms/superform-form.ERC4626Form.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -357,7 +357,7 @@ contract SuperformERC4626FormTest is ProtocolActions {

string memory tokenName = ERC4626Form(payable(superformCreated)).superformYieldTokenName();

assertEq(tokenName, "Superform Mock Vault");
assertEq(tokenName, "Mock Vault SuperPosition");
}

function test_superformDirectDepositWithoutAllowance() public {
Expand Down
4 changes: 3 additions & 1 deletion test/utils/BaseSetup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
);

Expand Down
Loading