From ae291c53105f60afb3b4bf062cdfb764d4095643 Mon Sep 17 00:00:00 2001 From: Viki Val Date: Mon, 23 Oct 2023 13:10:50 +0200 Subject: [PATCH 1/3] :loud_sound: :bug: logger had extra } on logs with caller --- src/mappings/nfts/burn.ts | 2 +- src/mappings/nfts/change.ts | 2 +- src/mappings/nfts/changeTeam.ts | 2 +- src/mappings/nfts/destroy.ts | 2 +- src/mappings/nfts/lock.ts | 2 +- src/mappings/uniques/burn.ts | 2 +- src/mappings/uniques/change.ts | 2 +- src/mappings/uniques/changeTeam.ts | 2 +- src/mappings/uniques/destroy.ts | 2 +- src/mappings/uniques/lock.ts | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/mappings/nfts/burn.ts b/src/mappings/nfts/burn.ts index 977abfe..d9f9768 100644 --- a/src/mappings/nfts/burn.ts +++ b/src/mappings/nfts/burn.ts @@ -34,7 +34,7 @@ export async function handleTokenBurn(context: Context): Promise { await burnHandler(context, entity) - success(OPERATION, `${id} by ${event.caller}}`) + success(OPERATION, `${id} by ${event.caller}`) await context.store.save(entity) const meta = entity.metadata ?? '' await createEvent(entity, OPERATION, event, meta, context.store) diff --git a/src/mappings/nfts/change.ts b/src/mappings/nfts/change.ts index 5701191..6b48a41 100644 --- a/src/mappings/nfts/change.ts +++ b/src/mappings/nfts/change.ts @@ -15,6 +15,6 @@ export async function handleCollectionOwnerChange(context: Context): Promise { const entity = await get(context.store, CE, event.id) entity.burned = true - success(OPERATION, `${event.id} by ${event.caller}}`) + success(OPERATION, `${event.id} by ${event.caller}`) await context.store.save(entity) } diff --git a/src/mappings/nfts/lock.ts b/src/mappings/nfts/lock.ts index 725c360..387c9e1 100644 --- a/src/mappings/nfts/lock.ts +++ b/src/mappings/nfts/lock.ts @@ -15,6 +15,6 @@ export async function handleCollectionLock(context: Context): Promise { const entity = await get(context.store, CE, event.id) entity.max = event.max - success(OPERATION, `${event.id} by ${event.caller}}`) + success(OPERATION, `${event.id} by ${event.caller}`) await context.store.save(entity) } diff --git a/src/mappings/uniques/burn.ts b/src/mappings/uniques/burn.ts index 2be4c25..03c1bd4 100644 --- a/src/mappings/uniques/burn.ts +++ b/src/mappings/uniques/burn.ts @@ -34,7 +34,7 @@ export async function handleTokenBurn(context: Context): Promise { await burnHandler(context, entity) - success(OPERATION, `${id} by ${event.caller}}`) + success(OPERATION, `${id} by ${event.caller}`) await context.store.save(entity) const meta = entity.metadata ?? '' await createEvent(entity, OPERATION, event, meta, context.store) diff --git a/src/mappings/uniques/change.ts b/src/mappings/uniques/change.ts index 5701191..6b48a41 100644 --- a/src/mappings/uniques/change.ts +++ b/src/mappings/uniques/change.ts @@ -15,6 +15,6 @@ export async function handleCollectionOwnerChange(context: Context): Promise { const entity = await get(context.store, CE, event.id) entity.burned = true - success(OPERATION, `${event.id} by ${event.caller}}`) + success(OPERATION, `${event.id} by ${event.caller}`) await context.store.save(entity) } diff --git a/src/mappings/uniques/lock.ts b/src/mappings/uniques/lock.ts index 725c360..387c9e1 100644 --- a/src/mappings/uniques/lock.ts +++ b/src/mappings/uniques/lock.ts @@ -15,6 +15,6 @@ export async function handleCollectionLock(context: Context): Promise { const entity = await get(context.store, CE, event.id) entity.max = event.max - success(OPERATION, `${event.id} by ${event.caller}}`) + success(OPERATION, `${event.id} by ${event.caller}`) await context.store.save(entity) } From 4b092451cd1ada924d97ec2b0839c92d22b372bb Mon Sep 17 00:00:00 2001 From: daiagi Date: Wed, 25 Oct 2023 09:16:04 +0700 Subject: [PATCH 2/3] float royalty --- src/mappings/nfts/setAttribute.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/mappings/nfts/setAttribute.ts b/src/mappings/nfts/setAttribute.ts index 933983c..0eb969b 100644 --- a/src/mappings/nfts/setAttribute.ts +++ b/src/mappings/nfts/setAttribute.ts @@ -1,7 +1,6 @@ import { getOrFail as get } from '@kodadot1/metasquid/entity' import { CollectionEntity, NFTEntity } from '../../model' import { unwrap } from '../utils/extract' -import { addressOf } from '../utils/helper' import { Context, isNFT } from '../utils/types' import { getAttributeEvent } from './getters' import { attributeFrom, tokenIdOf } from './types' @@ -13,13 +12,12 @@ export async function handleAttributeSet(context: Context): Promise { isNFT(event) ? await get(context.store, NFTEntity, tokenIdOf(event as any)) : await get(context.store, CollectionEntity, event.collectionId) - if (!final.attributes) { final.attributes = [] } if ('royalty' in final && event.trait === 'royalty') { - final.royalty = final.royalty ?? Number.parseInt(event.value as string) + final.royalty = final.royalty ?? Number.parseFloat(event.value as string) } if ('recipient' in final && event.trait === 'recipient') { From 9fbf4f34bcd0bb81b39cf8888b5c249074292c8d Mon Sep 17 00:00:00 2001 From: daiagi Date: Wed, 25 Oct 2023 09:16:35 +0700 Subject: [PATCH 3/3] don't save roaylty to attributes --- src/mappings/nfts/setAttribute.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mappings/nfts/setAttribute.ts b/src/mappings/nfts/setAttribute.ts index 0eb969b..cd6e0d0 100644 --- a/src/mappings/nfts/setAttribute.ts +++ b/src/mappings/nfts/setAttribute.ts @@ -30,7 +30,7 @@ export async function handleAttributeSet(context: Context): Promise { const attribute = final.attributes?.find((attr) => attr.trait === event.trait) if (attribute) { attribute.value = String(event.value) - } else { + } else if (event.trait !== 'royalty' && event.trait !== 'recipient') { const newAttribute = attributeFrom({ trait_type: event.trait, value: String(event.value) }) final.attributes?.push(newAttribute) }