Skip to content

Commit

Permalink
refactor!: rename LSP8 deployment param to tokenIdFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ42 committed Dec 13, 2023
1 parent 21ab900 commit f8e0c40
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
26 changes: 13 additions & 13 deletions src/lib/classes/lsp8-identifiable-digital-asset.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('LSP8IdentifiableDigitalAsset', () => {
controllerAddress: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
name: 'TOKEN',
symbol: 'TKN',
tokenIdType: LSP8_TOKEN_ID_FORMAT.UNIQUE_ID,
tokenIdFormat: LSP8_TOKEN_ID_FORMAT.UNIQUE_ID,
tokenType: LSP4_TOKEN_TYPES.NFT,
});

Expand All @@ -67,7 +67,7 @@ describe('LSP8IdentifiableDigitalAsset', () => {
controllerAddress: signer.address,
name: 'TOKEN',
symbol: 'TKN',
tokenIdType: LSP8_TOKEN_ID_FORMAT.UNIQUE_ID,
tokenIdFormat: LSP8_TOKEN_ID_FORMAT.UNIQUE_ID,
tokenType: LSP4_TOKEN_TYPES.NFT,
},
{
Expand Down Expand Up @@ -98,7 +98,7 @@ describe('LSP8IdentifiableDigitalAsset', () => {
controllerAddress: signer.address,
name: 'TOKEN',
symbol: 'TKN',
tokenIdType: LSP8_TOKEN_ID_FORMAT.UNIQUE_ID,
tokenIdFormat: LSP8_TOKEN_ID_FORMAT.UNIQUE_ID,
tokenType: LSP4_TOKEN_TYPES.NFT,
},
{
Expand Down Expand Up @@ -170,7 +170,7 @@ describe('LSP8IdentifiableDigitalAsset', () => {
name: 'TOKEN',
symbol: 'TKN',
tokenType: LSP4_TOKEN_TYPES.NFT,
tokenIdType: LSP8_TOKEN_ID_FORMAT.UNIQUE_ID,
tokenIdFormat: LSP8_TOKEN_ID_FORMAT.UNIQUE_ID,
},
{
LSP8IdentifiableDigitalAsset: { version: baseContract.address },
Expand All @@ -191,7 +191,7 @@ describe('LSP8IdentifiableDigitalAsset', () => {
name: 'TOKEN',
symbol: 'TKN',
tokenType: LSP4_TOKEN_TYPES.NFT,
tokenIdType: LSP8_TOKEN_ID_FORMAT.UNIQUE_ID,
tokenIdFormat: LSP8_TOKEN_ID_FORMAT.UNIQUE_ID,
},
{
LSP8IdentifiableDigitalAsset: {
Expand Down Expand Up @@ -223,7 +223,7 @@ describe('LSP8IdentifiableDigitalAsset', () => {
name: 'TOKEN',
symbol: 'TKN',
tokenType: LSP4_TOKEN_TYPES.NFT,
tokenIdType: LSP8_TOKEN_ID_FORMAT.UNIQUE_ID,
tokenIdFormat: LSP8_TOKEN_ID_FORMAT.UNIQUE_ID,
},
{
LSP8IdentifiableDigitalAsset: {
Expand Down Expand Up @@ -268,7 +268,7 @@ describe('LSP8IdentifiableDigitalAsset', () => {
const name = 'TOKEN';
const symbol = 'TKN';
const tokenType = LSP4_TOKEN_TYPES.NFT;
const tokenIdType = LSP8_TOKEN_ID_FORMAT.UNIQUE_ID;
const tokenIdFormat = LSP8_TOKEN_ID_FORMAT.UNIQUE_ID;

const expectedLSP4Value =
'0x6f357c6a7fedfaf6ebf7908ff7e1fffc988678c706f12bff90e4a34b2408af71d0392597697066733a2f2f516d56384d6e4a4c333659673562574d5a4e5053474e504a516f42524c64436255314d473942706e44414757626f';
Expand All @@ -291,7 +291,7 @@ describe('LSP8IdentifiableDigitalAsset', () => {
symbol,
tokenType,
digitalAssetMetadata: lsp4Metadata,
tokenIdType,
tokenIdFormat,
});

expect(lsp8DigitalAsset.LSP8IdentifiableDigitalAsset.address).toBeDefined();
Expand All @@ -317,18 +317,18 @@ describe('LSP8IdentifiableDigitalAsset', () => {
});

it('should have correct name, symbol and token ID type set', async () => {
const [retrievedName, retrievedSymbol, retrievedTokenIdType] =
const [retrievedName, retrievedSymbol, retrievedtokenIdFormat] =
await digitalAsset.getDataBatch([
ERC725YDataKeys.LSP4.LSP4TokenName,
ERC725YDataKeys.LSP4.LSP4TokenSymbol,
ERC725YDataKeys.LSP8.LSP8TokenIdFormat,
]);

const tokenIdTypeDecoded = ethers.BigNumber.from(retrievedTokenIdType).toNumber();
const tokenIdFormatDecoded = ethers.BigNumber.from(retrievedtokenIdFormat).toNumber();

expect(ethers.utils.toUtf8String(retrievedName)).toEqual(name);
expect(ethers.utils.toUtf8String(retrievedSymbol)).toEqual(symbol);
expect(tokenIdTypeDecoded).toEqual(tokenIdType);
expect(tokenIdFormatDecoded).toEqual(tokenIdFormat);
});
});

Expand All @@ -342,7 +342,7 @@ describe('LSP8IdentifiableDigitalAsset', () => {
'0xFCA72D5763b8cFc686C2285099D5F35a2F094E9f',
'0x591c236982b089Ad4B60758C075fA50Ec53CD674',
];
const tokenIdType = LSP8_TOKEN_ID_FORMAT.UNIQUE_ID;
const tokenIdFormat = LSP8_TOKEN_ID_FORMAT.UNIQUE_ID;

let lspFactory: LSPFactory;

Expand All @@ -363,7 +363,7 @@ describe('LSP8IdentifiableDigitalAsset', () => {
symbol,
tokenType,
creators,
tokenIdType,
tokenIdFormat,
});

digitalAsset = LSP8Mintable__factory.connect(
Expand Down
2 changes: 1 addition & 1 deletion src/lib/interfaces/digital-asset-deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export interface LSP7DigitalAssetDeploymentOptions extends DigitalAssetDeploymen

export interface LSP8IdentifiableDigitalAssetDeploymentOptions
extends DigitalAssetDeploymentOptions {
tokenIdType: number | string;
tokenIdFormat: number | string;
}

export interface DeployedLSP8IdentifiableDigitalAsset {
Expand Down
10 changes: 5 additions & 5 deletions src/lib/services/digital-asset.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ async function deployLSP8IdentifiableDigitalAsset(
digitalAssetDeploymentOptions.symbol,
controllerAddress,
lsp4TokenType,
digitalAssetDeploymentOptions.tokenIdType
digitalAssetDeploymentOptions.tokenIdFormat
);
}

Expand All @@ -296,7 +296,7 @@ async function deployLSP8IdentifiableDigitalAsset(
digitalAssetDeploymentOptions.symbol,
controllerAddress,
lsp4TokenType,
digitalAssetDeploymentOptions.tokenIdType
digitalAssetDeploymentOptions.tokenIdFormat
);
};

Expand All @@ -315,7 +315,7 @@ function initializeLSP8Proxy(
digitalAssetDeploymentReceipt$: Observable<DeploymentEventProxyContract>,
digitalAssetDeploymentOptions: LSP8IdentifiableDigitalAssetDeploymentOptions
) {
const { name, symbol, tokenIdType, tokenType } = digitalAssetDeploymentOptions;
const { name, symbol, tokenIdFormat, tokenType } = digitalAssetDeploymentOptions;

const lsp4TokenType = typeof tokenType === 'string' ? LSP4_TOKEN_TYPES[tokenType] : tokenType;

Expand All @@ -333,15 +333,15 @@ function initializeLSP8Proxy(
symbol,
controllerAddress,
lsp4TokenType,
tokenIdType
tokenIdFormat
);

const transaction = await contract.initialize(
name,
symbol,
controllerAddress,
lsp4TokenType,
tokenIdType,
tokenIdFormat,
{
gasLimit: gasEstimate.add(GAS_BUFFER),
gasPrice: GAS_PRICE,
Expand Down

0 comments on commit f8e0c40

Please sign in to comment.