Skip to content

Commit

Permalink
refactor: put lsp4TokenType param before lsp8TokenIdType on deplo…
Browse files Browse the repository at this point in the history
…yment
  • Loading branch information
CJ42 committed Nov 24, 2023
1 parent 54a623c commit 00f9fce
Show file tree
Hide file tree
Showing 74 changed files with 321 additions and 261 deletions.
13 changes: 7 additions & 6 deletions contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,18 @@ abstract contract LSP7DigitalAsset is
{
/**
* @notice Sets the token-Metadata
* @param name_ The name of the token
* @param symbol_ The symbol of the token
* @param newOwner_ The owner of the the token-Metadata
* @param isNonDivisible_ Specify if the LSP7 token is a fungible or non-fungible token
* @param name_ The name of the token.
* @param symbol_ The symbol of the token.
* @param newOwner_ The owner of the the token-Metadata.
* @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection).
* @param isNonDivisible_ Specify if the LSP7 token is a fungible or non-fungible token.
*/
constructor(
string memory name_,
string memory symbol_,
address newOwner_,
bool isNonDivisible_,
uint256 lsp4TokenType_
uint256 lsp4TokenType_,
bool isNonDivisible_
) LSP4DigitalAssetMetadata(name_, symbol_, newOwner_, lsp4TokenType_) {
_isNonDivisible = isNonDivisible_;
}
Expand Down
8 changes: 4 additions & 4 deletions contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ abstract contract LSP7DigitalAssetInitAbstract is
string memory name_,
string memory symbol_,
address newOwner_,
bool isNonDivisible_,
uint256 lsp4TokenType_
uint256 lsp4TokenType_,
bool isNonDivisible_
) internal virtual onlyInitializing {
_isNonDivisible = isNonDivisible_;

LSP4DigitalAssetMetadataInitAbstract._initialize(
name_,
symbol_,
newOwner_,
lsp4TokenType_
);

_isNonDivisible = isNonDivisible_;
}

// fallback function
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract contract LSP7CompatibleERC20 is IERC20Metadata, LSP7DigitalAsset {
string memory symbol_,
address newOwner_,
uint256 lsp4TokenType_
) LSP7DigitalAsset(name_, symbol_, newOwner_, false, lsp4TokenType_) {}
) LSP7DigitalAsset(name_, symbol_, newOwner_, lsp4TokenType_, false) {}

/**
* @inheritdoc IERC20Metadata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ abstract contract LSP7CompatibleERC20InitAbstract is
name_,
symbol_,
newOwner_,
false,
lsp4TokenType_
lsp4TokenType_,
false
);
}

Expand Down
9 changes: 5 additions & 4 deletions contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,21 @@ contract LSP7Mintable is LSP7DigitalAsset, ILSP7Mintable {
* @param symbol_ The symbol of the token.
* @param newOwner_ The owner of the token contract.
* @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection).
* @param isNonDivisible_ Specify if the LSP7 token is a fungible or non-fungible token.
*/
constructor(
string memory name_,
string memory symbol_,
address newOwner_,
bool isNonDivisible_,
uint256 lsp4TokenType_
uint256 lsp4TokenType_,
bool isNonDivisible_
)
LSP7DigitalAsset(
name_,
symbol_,
newOwner_,
isNonDivisible_,
lsp4TokenType_
lsp4TokenType_,
isNonDivisible_
)
{}

Expand Down
9 changes: 5 additions & 4 deletions contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,21 @@ contract LSP7MintableInit is LSP7MintableInitAbstract {
* @param symbol_ The symbol of the token.
* @param newOwner_ The owner of the token contract.
* @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection).
* @param isNonDivisible_ Specify if the LSP7 token is a fungible or non-fungible token.
*/
function initialize(
string memory name_,
string memory symbol_,
address newOwner_,
bool isNonDivisible_,
uint256 lsp4TokenType_
uint256 lsp4TokenType_,
bool isNonDivisible_
) external virtual initializer {
LSP7MintableInitAbstract._initialize(
name_,
symbol_,
newOwner_,
isNonDivisible_,
lsp4TokenType_
lsp4TokenType_,
isNonDivisible_
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,21 @@ abstract contract LSP7MintableInitAbstract is
* @param symbol_ The symbol of the token.
* @param newOwner_ The owner of the token contract.
* @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection).
* @param isNonDivisible_ Specify if the LSP7 token is a fungible or non-fungible token.
*/
function _initialize(
string memory name_,
string memory symbol_,
address newOwner_,
bool isNonDivisible_,
uint256 lsp4TokenType_
uint256 lsp4TokenType_,
bool isNonDivisible_
) internal virtual override onlyInitializing {
LSP7DigitalAssetInitAbstract._initialize(
name_,
symbol_,
newOwner_,
isNonDivisible_,
lsp4TokenType_
lsp4TokenType_,
isNonDivisible_
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ abstract contract LSP8IdentifiableDigitalAsset is
{
/**
* @notice Deploying a LSP8IdentifiableDigitalAsset with name `name_`, symbol `symbol_`, owned by address `newOwner_`
* with tokenId type `tokenIdType_`.
* with tokenId type `lsp8TokenIdType_`.
*
* @dev Deploy a `LSP8IdentifiableDigitalAsset` contract and set the tokenId type inside the ERC725Y storage of the contract.
* This will also set the token `name_` and `symbol_` under the ERC725Y data keys `LSP4TokenName` and `LSP4TokenSymbol`.
*
* @param name_ The name of the token
* @param symbol_ The symbol of the token
* @param newOwner_ The owner of the the token-Metadata
* @param tokenIdType_ The type of tokenIds (= NFTs) that this contract will create.
* Available options are: NUMBER = `0`; STRING = `1`; UNIQUE_ID = `2`; HASH = `3`; ADDRESS = `4`.
* @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection).
* @param lsp8TokenIdType_ The type of tokenIds (= NFTs) that this contract will create.
* Available options are: NUMBER = `0`; STRING = `1`; UNIQUE_ID = `2`; HASH = `3`; ADDRESS = `4`.
*
* @custom:warning Make sure the tokenId type provided on deployment is correct, as it can only be set once
* and cannot be changed in the ERC725Y storage after the contract has been deployed.
Expand All @@ -76,12 +76,12 @@ abstract contract LSP8IdentifiableDigitalAsset is
string memory name_,
string memory symbol_,
address newOwner_,
uint256 tokenIdType_,
uint256 lsp4TokenType_
uint256 lsp4TokenType_,
uint256 lsp8TokenIdType_
) LSP4DigitalAssetMetadata(name_, symbol_, newOwner_, lsp4TokenType_) {
LSP4DigitalAssetMetadata._setData(
_LSP8_TOKENID_TYPE_KEY,
abi.encode(tokenIdType_)
abi.encode(lsp8TokenIdType_)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ abstract contract LSP8IdentifiableDigitalAssetInitAbstract is
* @param name_ The name of the token
* @param symbol_ The symbol of the token
* @param newOwner_ The owner of the the token-Metadata
* @param tokenIdType_ The type of tokenIds (= NFTs) that this contract will create.
* Available options are: NUMBER = `0`; STRING = `1`; UNIQUE_ID = `2`; HASH = `3`; ADDRESS = `4`.
* @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection).
* @param lsp8TokenIdType_ The type of tokenIds (= NFTs) that this contract will create.
* Available options are: NUMBER = `0`; STRING = `1`; UNIQUE_ID = `2`; HASH = `3`; ADDRESS = `4`.
*
* @custom:warning Make sure the tokenId type provided on deployment is correct, as it can only be set once
* and cannot be changed in the ERC725Y storage after the contract has been initialized.
Expand All @@ -73,8 +73,8 @@ abstract contract LSP8IdentifiableDigitalAssetInitAbstract is
string memory name_,
string memory symbol_,
address newOwner_,
uint256 tokenIdType_,
uint256 lsp4TokenType_
uint256 lsp4TokenType_,
uint256 lsp8TokenIdType_
) internal virtual onlyInitializing {
LSP4DigitalAssetMetadataInitAbstract._initialize(
name_,
Expand All @@ -85,7 +85,7 @@ abstract contract LSP8IdentifiableDigitalAssetInitAbstract is

LSP4DigitalAssetMetadataInitAbstract._setData(
_LSP8_TOKENID_TYPE_KEY,
abi.encode(tokenIdType_)
abi.encode(lsp8TokenIdType_)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,22 @@ abstract contract LSP8CompatibleERC721 is
* @param symbol_ The symbol of the token.
* @param newOwner_ The owner of the token contract.
* @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection).
* @param lsp8TokenIdType_ The type of tokenIds (= NFTs) that this contract will create.
* Available options are: NUMBER = `0`; STRING = `1`; UNIQUE_ID = `2`; HASH = `3`; ADDRESS = `4`.
*/
constructor(
string memory name_,
string memory symbol_,
address newOwner_,
uint256 tokenIdType_,
uint256 lsp4TokenType_
uint256 lsp4TokenType_,
uint256 lsp8TokenIdType_
)
LSP8IdentifiableDigitalAsset(
name_,
symbol_,
newOwner_,
tokenIdType_,
lsp4TokenType_
lsp4TokenType_,
lsp8TokenIdType_
)
{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,23 @@ abstract contract LSP8CompatibleERC721InitAbstract is
* @param symbol_ The symbol of the token.
* @param newOwner_ The owner of the token contract.
* @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection).
* @param lsp8TokenIdType_ The type of tokenIds (= NFTs) that this contract will create.
* Available options are: NUMBER = `0`; STRING = `1`; UNIQUE_ID = `2`; HASH = `3`; ADDRESS = `4`.
*/

function _initialize(
string memory name_,
string memory symbol_,
address newOwner_,
uint256 tokenIdType_,
uint256 lsp4TokenType_
uint256 lsp4TokenType_,
uint256 lsp8TokenIdType_
) internal virtual override onlyInitializing {
LSP8IdentifiableDigitalAssetInitAbstract._initialize(
name_,
symbol_,
newOwner_,
tokenIdType_,
lsp4TokenType_
lsp4TokenType_,
lsp8TokenIdType_
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,22 @@ contract LSP8CompatibleERC721Mintable is LSP8CompatibleERC721 {
* @param symbol_ The symbol of the token.
* @param newOwner_ The owner of the token contract.
* @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection).
* @param lsp8TokenIdType_ The type of tokenIds (= NFTs) that this contract will create.
* Available options are: NUMBER = `0`; STRING = `1`; UNIQUE_ID = `2`; HASH = `3`; ADDRESS = `4`.
*/
constructor(
string memory name_,
string memory symbol_,
address newOwner_,
uint256 tokenIdType_,
uint256 lsp4TokenType_
uint256 lsp4TokenType_,
uint256 lsp8TokenIdType_
)
LSP8CompatibleERC721(
name_,
symbol_,
newOwner_,
tokenIdType_,
lsp4TokenType_
lsp4TokenType_,
lsp8TokenIdType_
)
{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,22 @@ contract LSP8CompatibleERC721MintableInit is
* @param symbol_ The symbol of the token.
* @param newOwner_ The owner of the token contract.
* @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection).
* @param lsp8TokenIdType_ The type of tokenIds (= NFTs) that this contract will create.
* Available options are: NUMBER = `0`; STRING = `1`; UNIQUE_ID = `2`; HASH = `3`; ADDRESS = `4`.
*/
function initialize(
string memory name_,
string memory symbol_,
address newOwner_,
uint256 tokenIdType_,
uint256 lsp4TokenType_
uint256 lsp4TokenType_,
uint256 lsp8TokenIdType_
) external virtual initializer {
LSP8CompatibleERC721MintableInitAbstract._initialize(
name_,
symbol_,
newOwner_,
tokenIdType_,
lsp4TokenType_
lsp4TokenType_,
lsp8TokenIdType_
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ contract LSP8CompatibleERC721MintableInitAbstract is
string memory name_,
string memory symbol_,
address newOwner_,
uint256 tokenIdType_,
uint256 lsp4TokenType_
uint256 lsp4TokenType_,
uint256 lsp8TokenIdType_
) internal virtual override onlyInitializing {
LSP8CompatibleERC721InitAbstract._initialize(
name_,
symbol_,
newOwner_,
tokenIdType_,
lsp4TokenType_
lsp4TokenType_,
lsp8TokenIdType_
);
}

Expand Down
10 changes: 6 additions & 4 deletions contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,22 @@ contract LSP8Mintable is LSP8IdentifiableDigitalAsset, ILSP8Mintable {
* @param symbol_ The symbol of the token.
* @param newOwner_ The owner of the token contract.
* @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection).
* @param lsp8TokenIdType_ The type of tokenIds (= NFTs) that this contract will create.
* Available options are: NUMBER = `0`; STRING = `1`; UNIQUE_ID = `2`; HASH = `3`; ADDRESS = `4`.
*/
constructor(
string memory name_,
string memory symbol_,
address newOwner_,
uint256 tokenIdType_,
uint256 lsp4TokenType_
uint256 lsp4TokenType_,
uint256 lsp8TokenIdType_
)
LSP8IdentifiableDigitalAsset(
name_,
symbol_,
newOwner_,
tokenIdType_,
lsp4TokenType_
lsp4TokenType_,
lsp8TokenIdType_
)
{}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,22 @@ contract LSP8MintableInit is LSP8MintableInitAbstract {
* @param symbol_ The symbol of the token.
* @param newOwner_ The owner of the token contract.
* @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection).
* @param lsp8TokenIdType_ The type of tokenIds (= NFTs) that this contract will create.
* Available options are: NUMBER = `0`; STRING = `1`; UNIQUE_ID = `2`; HASH = `3`; ADDRESS = `4`.
*/
function initialize(
string memory name_,
string memory symbol_,
address newOwner_,
uint256 tokenIdType_,
uint256 lsp4TokenType_
uint256 lsp4TokenType_,
uint256 lsp8TokenIdType_
) external virtual initializer {
LSP8MintableInitAbstract._initialize(
name_,
symbol_,
newOwner_,
tokenIdType_,
lsp4TokenType_
lsp4TokenType_,
lsp8TokenIdType_
);
}
}
Loading

0 comments on commit 00f9fce

Please sign in to comment.