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: pass event entity arg to notifyTokenHolders function in ProjectToken.RevenueSplitIssued #323

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
8 changes: 4 additions & 4 deletions src/mappings/token/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
},
}: EventHandlerContext<'ProjectToken.TokenIssued'>) {
// create token
const totalSupply = initialAllocation.reduce((acc, [_, allocation]) => {

Check warning on line 80 in src/mappings/token/index.ts

View workflow job for this annotation

GitHub Actions / Local build, linting and formatting (ubuntu-latest, 16.x)

'_' is defined but never used
return acc + allocation.amount
}, BigInt(0))

Expand Down Expand Up @@ -384,7 +384,7 @@
buyerAccount.totalAmount += crtMinted
}

const activeAmm = await overlay.getRepository(AmmCurve).getByIdOrFail(token.currentAmmSaleId!)

Check warning on line 387 in src/mappings/token/index.ts

View workflow job for this annotation

GitHub Actions / Local build, linting and formatting (ubuntu-latest, 16.x)

Forbidden non-null assertion

activeAmm.mintedByAmm += crtMinted
const tx = overlay.getRepository(AmmTransaction).new({
Expand Down Expand Up @@ -443,7 +443,7 @@
.getOneByRelationOrFail('tokenId', tokenId.toString())
const channel = await overlay.getRepository(Channel).getByIdOrFail(tokenChannel.channelId)
token.totalSupply -= crtBurned
const activeAmm = await overlay.getRepository(AmmCurve).getByIdOrFail(token.currentAmmSaleId!)

Check warning on line 446 in src/mappings/token/index.ts

View workflow job for this annotation

GitHub Actions / Local build, linting and formatting (ubuntu-latest, 16.x)

Forbidden non-null assertion
const ammId = activeAmm.id

const sellerAccount = await getTokenAccountByMemberByTokenOrFail(overlay, memberId, tokenId)
Expand Down Expand Up @@ -515,7 +515,7 @@
}

const token = await overlay.getRepository(CreatorToken).getByIdOrFail(tokenId.toString())
const sale = await overlay.getRepository(Sale).getByIdOrFail(token.currentSaleId!)

Check warning on line 518 in src/mappings/token/index.ts

View workflow job for this annotation

GitHub Actions / Local build, linting and formatting (ubuntu-latest, 16.x)

Forbidden non-null assertion
sale.tokensSold += amountPurchased

const tx = overlay.getRepository(SaleTransaction).new({
Expand Down Expand Up @@ -574,7 +574,7 @@
},
}: EventHandlerContext<'ProjectToken.UpcomingTokenSaleUpdated'>) {
const token = await overlay.getRepository(CreatorToken).getByIdOrFail(tokenId.toString())
const sale = await overlay.getRepository(Sale).getByIdOrFail(token.currentSaleId!)

Check warning on line 577 in src/mappings/token/index.ts

View workflow job for this annotation

GitHub Actions / Local build, linting and formatting (ubuntu-latest, 16.x)

Forbidden non-null assertion

if (newStart) {
sale.startBlock = newStart
Expand Down Expand Up @@ -625,7 +625,7 @@

token.currentRevenueShareId = id

overlay.getRepository(Event).new({
const event = overlay.getRepository(Event).new({
...genericEventFields(overlay, block, indexInBlock, extrinsicHash),
data: new CreatorTokenRevenueSplitIssuedEventData({
token: tokenId.toString(),
Expand All @@ -646,7 +646,7 @@
overlay,
tokenId.toString(),
revenueShareStartedNotification,
undefined,
event,
startBlock // schedule for start block
)

Expand All @@ -660,7 +660,7 @@
tokenSymbol: parseCreatorTokenSymbol(token),
})

await notifyTokenHolders(overlay, tokenId.toString(), revenueSharePlannedNotification)
await notifyTokenHolders(overlay, tokenId.toString(), revenueSharePlannedNotification, event)
}

const revenueSharedEndedNotification = new CreatorTokenRevenueShareEnded({
Expand All @@ -674,7 +674,7 @@
overlay,
tokenId.toString(),
revenueSharedEndedNotification,
undefined,
event,
endsAt // schedule for end block
)
}
Expand All @@ -692,13 +692,13 @@
export async function processAmmDeactivatedEvent({
overlay,
event: {
asV2002: [tokenId, , burnedAmount],

Check warning on line 695 in src/mappings/token/index.ts

View workflow job for this annotation

GitHub Actions / Local build, linting and formatting (ubuntu-latest, 16.x)

'burnedAmount' is defined but never used
},
}: EventHandlerContext<'ProjectToken.AmmDeactivated'>) {
const token = await overlay.getRepository(CreatorToken).getByIdOrFail(tokenId.toString())
token.status = TokenStatus.IDLE

const activeAmm = await overlay.getRepository(AmmCurve).getByIdOrFail(token.currentAmmSaleId!)

Check warning on line 701 in src/mappings/token/index.ts

View workflow job for this annotation

GitHub Actions / Local build, linting and formatting (ubuntu-latest, 16.x)

Forbidden non-null assertion
activeAmm.finalized = true

token.currentAmmSaleId = null
Expand Down Expand Up @@ -737,12 +737,12 @@
},
}: EventHandlerContext<'ProjectToken.TokenSaleFinalized'>) {
const token = await overlay.getRepository(CreatorToken).getByIdOrFail(tokenId.toString())
const sale = await overlay.getRepository(Sale).getByIdOrFail(token.currentSaleId!)

Check warning on line 740 in src/mappings/token/index.ts

View workflow job for this annotation

GitHub Actions / Local build, linting and formatting (ubuntu-latest, 16.x)

Forbidden non-null assertion
sale.finalized = true

const sourceAccount = await overlay
.getRepository(TokenAccount)
.getByIdOrFail(sale.fundsSourceAccountId!)

Check warning on line 745 in src/mappings/token/index.ts

View workflow job for this annotation

GitHub Actions / Local build, linting and formatting (ubuntu-latest, 16.x)

Forbidden non-null assertion
sourceAccount.totalAmount += quantityLeft

token.status = TokenStatus.IDLE
Expand Down Expand Up @@ -784,7 +784,7 @@
const token = await overlay.getRepository(CreatorToken).getByIdOrFail(tokenId.toString())
const revenueShare = await overlay
.getRepository(RevenueShare)
.getByIdOrFail(token.currentRevenueShareId!)

Check warning on line 787 in src/mappings/token/index.ts

View workflow job for this annotation

GitHub Actions / Local build, linting and formatting (ubuntu-latest, 16.x)

Forbidden non-null assertion
revenueShare.finalized = true
token.currentRevenueShareId = null
}
Expand Down
Loading