Skip to content

Commit

Permalink
Add token id to CRT notifications (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
WRadoslaw authored Apr 8, 2024
1 parent ba75a4b commit b3d3553
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
21 changes: 21 additions & 0 deletions schema/notifications.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,9 @@ type CreatorTokenIssued @variant {
"symbol of the token"
tokenSymbol: String!

"id of the token"
tokenId: String!

"channel Id used for link"
channelId: String!
}
Expand All @@ -441,6 +444,9 @@ type CreatorTokenSaleStarted @variant {
"symbol of the token"
tokenSymbol: String!

"id of the token"
tokenId: String!

"channel Id used for link"
channelId: String!
}
Expand All @@ -452,6 +458,9 @@ type CreatorTokenMarketStarted @variant {
"symbol of the token"
tokenSymbol: String!

"id of the token"
tokenId: String!

"channel Id used for link"
channelId: String!
}
Expand All @@ -474,6 +483,9 @@ type CreatorTokenMarketMint @variant {

"symbol of the token"
tokenSymbol: String!

"id of the token"
tokenId: String!
}

type CreatorTokenMarketBurn @variant {
Expand All @@ -494,6 +506,9 @@ type CreatorTokenMarketBurn @variant {

"symbol of the token"
tokenSymbol: String!

"id of the token"
tokenId: String!
}

type CreatorTokenSaleMint @variant {
Expand All @@ -514,6 +529,9 @@ type CreatorTokenSaleMint @variant {

"symbol of the token"
tokenSymbol: String!

"id of the token"
tokenId: String!
}

type CreatorTokenRevenueShareStarted @variant {
Expand Down Expand Up @@ -543,6 +561,9 @@ type CreatorTokenRevenueSharePlanned @variant {
"symbol of the token"
tokenSymbol: String!

"id of the token"
tokenId: String!

"block on which split is planned to start"
plannedAt: Int!

Expand Down
7 changes: 7 additions & 0 deletions src/mappings/token/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export async function processCreatorTokenIssuedEvent({
// CreatorTokenIssued event is dispatch after TokenIssued
const notificationData = new CreatorTokenIssued({
tokenSymbol: parseCreatorTokenSymbol(token),
tokenId: token.id,
channelId: channelId.toString(),
channelTitle: parseChannelTitle(channel),
})
Expand Down Expand Up @@ -242,6 +243,7 @@ export async function processAmmActivatedEvent({

const notificationData = new CreatorTokenMarketStarted({
tokenSymbol: parseCreatorTokenSymbol(token),
tokenId: token.id,
channelId: tokenChannel.channelId,
channelTitle: parseChannelTitle(channel),
})
Expand Down Expand Up @@ -326,6 +328,7 @@ export async function processTokenSaleInitializedEvent({

const notificationData = new CreatorTokenSaleStarted({
tokenSymbol: parseCreatorTokenSymbol(token),
tokenId: token.id,
channelId: tokenChannel.channelId,
channelTitle: parseChannelTitle(channel),
})
Expand Down Expand Up @@ -412,6 +415,7 @@ export async function processTokensBoughtOnAmmEvent({
const notificationData = new CreatorTokenMarketMint({
channelId: tokenChannel.channelId,
tokenSymbol: parseCreatorTokenSymbol(token),
tokenId: token.id,
mintedTokenAmount: crtMinted,
minterHandle: minter?.handle ?? 'Someone',
paiedJoyAmount: joysDeposited,
Expand Down Expand Up @@ -477,6 +481,7 @@ export async function processTokensSoldOnAmmEvent({
const notificationData = new CreatorTokenMarketBurn({
channelId: tokenChannel.channelId,
tokenSymbol: parseCreatorTokenSymbol(token),
tokenId: token.id,
burnedTokenAmount: crtBurned,
burnerHandle: burnerMember?.handle ?? 'Someone',
receivedJoyAmount: joysRecovered,
Expand Down Expand Up @@ -551,6 +556,7 @@ export async function processTokensPurchasedOnSaleEvent({
const notificationData = new CreatorTokenSaleMint({
channelId: tokenChannel.channelId,
tokenSymbol: parseCreatorTokenSymbol(token),
tokenId: token.id,
mintedTokenAmount: amountPurchased,
minterHandle: minterMember?.handle ?? 'Someone',
paiedJoyAmount: sale.pricePerUnit * amountPurchased,
Expand Down Expand Up @@ -658,6 +664,7 @@ export async function processRevenueSplitIssuedEvent({
channelId: channel.id,
plannedAt: startBlock,
tokenSymbol: parseCreatorTokenSymbol(token),
tokenId: token.id,
})

await notifyTokenHolders(overlay, tokenId.toString(), revenueSharePlannedNotification, event)
Expand Down

0 comments on commit b3d3553

Please sign in to comment.