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

fix: asset names #190

Merged
merged 2 commits into from
Jun 4, 2024
Merged
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
10 changes: 8 additions & 2 deletions src/mappings/services/assetService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export class AssetService extends Asset {
nftClassId: bigint | undefined,
nftItemId: bigint | undefined,
timestamp: Date,
blockchain = '0'
blockchain = '0',
name?: string
) {
logger.info(`Initialising asset ${assetId} for pool ${poolId}`)
const isActive = false
Expand All @@ -31,6 +32,8 @@ export class AssetService extends Asset {
AssetStatus.CREATED
)

asset.name = name

asset.collateralNftClassId = nftClassId
asset.collateralNftItemId = nftItemId

Expand Down Expand Up @@ -64,7 +67,9 @@ export class AssetService extends Asset {
AssetValuationMethod.Cash,
undefined,
undefined,
timestamp
timestamp,
'0',
'Onchain reserve'
)
}

Expand Down Expand Up @@ -173,6 +178,7 @@ export class AssetService extends Asset {
logger.info(`Fetching IPFS asset name for asset ${this.id} `)
if (!this.metadata) return logger.warn('No IPFS metadata')
const metadata = await readIpfs<AssetIpfsMetadata>(this.metadata.match(cid)[0])
this.name = metadata?.name
return metadata?.name ?? null
}

Expand Down
Loading