Removed tx hash.
This commit is contained in:
parent
b19740389d
commit
e79e9d35f7
|
@ -121,7 +121,6 @@ type Nft @entity{
|
|||
type NftData @entity{
|
||||
"nft address+key"
|
||||
id: ID!
|
||||
tx: String!
|
||||
nft: Nft!
|
||||
key: Bytes
|
||||
value: Bytes
|
||||
|
@ -354,7 +353,6 @@ type OPC @entity {
|
|||
"fee in percent taken by OPC from providerFees"
|
||||
providerFee: BigDecimal
|
||||
approvedTokens: [Token!]
|
||||
tx: String!
|
||||
}
|
||||
|
||||
enum NftUpdateType {
|
||||
|
@ -388,7 +386,6 @@ type NftUpdate @entity {
|
|||
|
||||
type Template @entity{
|
||||
id: ID!
|
||||
tx: String!
|
||||
fixedRateTemplates: [String!]
|
||||
dispenserTemplates: [String!]
|
||||
ssTemplates: [String!]
|
||||
|
@ -471,7 +468,6 @@ type VeDelegation @entity {
|
|||
cancelTime: BigInt!
|
||||
expireTime: BigInt!
|
||||
block: Int!
|
||||
tx: String!
|
||||
}
|
||||
|
||||
type VeOCEAN @entity {
|
||||
|
@ -555,7 +551,6 @@ enum DFHistoryType {
|
|||
type DFAvailableClaim @entity {
|
||||
"id = {userId}-{tokenId}"
|
||||
id: ID!
|
||||
txId: String!
|
||||
receiver: DFReward!
|
||||
amount: BigDecimal!
|
||||
token: Token!
|
||||
|
@ -578,7 +573,6 @@ type DFHistory @entity {
|
|||
type DFReward @entity {
|
||||
"id = {user address}"
|
||||
id: ID!
|
||||
txId: String!
|
||||
receiver: User!
|
||||
availableClaims: [DFAvailableClaim!] @derivedFrom(field: "receiver")
|
||||
history: [DFHistory!] @derivedFrom(field: "receiver")
|
||||
|
@ -590,7 +584,7 @@ type NftTransferHistory @entity {
|
|||
nft: Nft!
|
||||
oldOwner: User!
|
||||
newOwner: User!
|
||||
txId: String!
|
||||
txId: String
|
||||
timestamp: Int!
|
||||
block: Int!
|
||||
}
|
||||
|
|
|
@ -9,10 +9,7 @@ export function handleAllocated(event: Allocated): void {
|
|||
// loop all allocations
|
||||
const token = getToken(event.params.tokenAddress, false)
|
||||
for (let i = 0; i < event.params.tos.length; i++) {
|
||||
const reward = getDFReward(
|
||||
event.params.tos[i],
|
||||
event.transaction.hash.toHex()
|
||||
)
|
||||
const reward = getDFReward(event.params.tos[i])
|
||||
|
||||
const history = new DFHistory(
|
||||
event.params.tos[i].toHexString() +
|
||||
|
@ -36,8 +33,7 @@ export function handleAllocated(event: Allocated): void {
|
|||
// update available claims
|
||||
const claim = getDFAvailableClaim(
|
||||
event.params.tos[i],
|
||||
event.params.tokenAddress,
|
||||
event.transaction.hash.toHex()
|
||||
event.params.tokenAddress
|
||||
)
|
||||
claim.amount = claim.amount.plus(history.amount)
|
||||
claim.save()
|
||||
|
@ -47,7 +43,7 @@ export function handleAllocated(event: Allocated): void {
|
|||
export function handleClaimed(event: Claimed): void {
|
||||
// loop all allocations
|
||||
const token = getToken(event.params.tokenAddress, false)
|
||||
const reward = getDFReward(event.params.to, event.transaction.hash.toHex())
|
||||
const reward = getDFReward(event.params.to)
|
||||
const history = new DFHistory(
|
||||
event.transaction.hash.toHex() + '-' + event.logIndex.toString()
|
||||
)
|
||||
|
@ -64,11 +60,7 @@ export function handleClaimed(event: Claimed): void {
|
|||
history.save()
|
||||
|
||||
// update available claims
|
||||
const claim = getDFAvailableClaim(
|
||||
event.params.to,
|
||||
event.params.tokenAddress,
|
||||
event.transaction.hash.toHex()
|
||||
)
|
||||
const claim = getDFAvailableClaim(event.params.to, event.params.tokenAddress)
|
||||
claim.amount = claim.amount.minus(history.amount)
|
||||
claim.save()
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@ export function handleActivate(event: DispenserActivated): void {
|
|||
)
|
||||
const dispenser = getDispenser(dispenserID)
|
||||
dispenser.active = true
|
||||
dispenser.tx = event.transaction.hash.toHex()
|
||||
dispenser.save()
|
||||
}
|
||||
|
||||
|
@ -68,7 +67,6 @@ export function handleDeactivate(event: DispenserDeactivated): void {
|
|||
)
|
||||
const dispenser = getDispenser(dispenserID)
|
||||
dispenser.active = false
|
||||
dispenser.tx = event.transaction.hash.toHex()
|
||||
dispenser.save()
|
||||
}
|
||||
|
||||
|
@ -78,7 +76,6 @@ export function handleAllowedSwapperChanged(
|
|||
const dispenserID = getDispenserGraphID(event.address, event.params.datatoken)
|
||||
const dispenser = getDispenser(dispenserID)
|
||||
dispenser.allowedSwapper = event.params.newAllowedSwapper.toHex()
|
||||
dispenser.tx = event.transaction.hash.toHex()
|
||||
dispenser.save()
|
||||
}
|
||||
|
||||
|
@ -114,6 +111,5 @@ export function handleOwnerWinthdraw(event: OwnerWithdrawed): void {
|
|||
const dispenserID = getDispenserGraphID(event.address, event.params.datatoken)
|
||||
const dispenser = getDispenser(dispenserID)
|
||||
dispenser.balance = decimal.ZERO
|
||||
dispenser.tx = event.transaction.hash.toHex()
|
||||
dispenser.save()
|
||||
}
|
||||
|
|
|
@ -149,7 +149,6 @@ export function handlePublishMarketFeeChanged(
|
|||
event.params.PublishMarketFeeAmount.toBigDecimal(),
|
||||
decimals
|
||||
)
|
||||
token.tx = event.transaction.hash.toHex()
|
||||
token.save()
|
||||
// TODO - shold we have a history
|
||||
}
|
||||
|
@ -164,7 +163,6 @@ export function handleAddedMinter(event: AddedMinter): void {
|
|||
if (!existingRoles.includes(event.params.user.toHexString()))
|
||||
existingRoles.push(event.params.user.toHexString())
|
||||
token.minter = existingRoles
|
||||
token.tx = event.transaction.hash.toHex()
|
||||
token.save()
|
||||
}
|
||||
|
||||
|
@ -181,7 +179,6 @@ export function handleRemovedMinter(event: RemovedMinter): void {
|
|||
if (role !== event.params.user.toHexString()) newList.push(role)
|
||||
}
|
||||
token.minter = newList
|
||||
token.tx = event.transaction.hash.toHex()
|
||||
token.save()
|
||||
}
|
||||
|
||||
|
@ -193,7 +190,6 @@ export function handleAddedPaymentManager(event: AddedPaymentManager): void {
|
|||
if (!existingRoles.includes(event.params.user.toHexString()))
|
||||
existingRoles.push(event.params.user.toHexString())
|
||||
token.paymentManager = existingRoles
|
||||
token.tx = event.transaction.hash.toHex()
|
||||
token.save()
|
||||
}
|
||||
export function handleRemovedPaymentManager(
|
||||
|
@ -211,7 +207,6 @@ export function handleRemovedPaymentManager(
|
|||
if (role !== event.params.user.toHexString()) newList.push(role)
|
||||
}
|
||||
token.paymentManager = newList
|
||||
token.tx = event.transaction.hash.toHex()
|
||||
token.save()
|
||||
}
|
||||
export function handleCleanedPermissions(event: CleanedPermissions): void {
|
||||
|
@ -222,14 +217,12 @@ export function handleCleanedPermissions(event: CleanedPermissions): void {
|
|||
const nft = Nft.load(token.nft as string)
|
||||
if (nft) token.paymentCollector = nft.owner
|
||||
else token.paymentCollector = '0x0000000000000000000000000000000000000000'
|
||||
token.tx = event.transaction.hash.toHex()
|
||||
token.save()
|
||||
}
|
||||
|
||||
export function handleNewPaymentCollector(event: NewPaymentCollector): void {
|
||||
const token = getToken(event.address, true)
|
||||
token.paymentCollector = event.params._newPaymentCollector.toHexString()
|
||||
token.tx = event.transaction.hash.toHex()
|
||||
token.save()
|
||||
}
|
||||
|
||||
|
@ -252,7 +245,6 @@ export function handleProviderFee(event: ProviderFee): void {
|
|||
if (order) {
|
||||
order.providerFee = providerFee
|
||||
order.providerFeeValidUntil = event.params.validUntil
|
||||
order.tx = event.transaction.hash.toHex()
|
||||
order.save()
|
||||
return
|
||||
}
|
||||
|
@ -261,7 +253,6 @@ export function handleProviderFee(event: ProviderFee): void {
|
|||
if (orderReuse) {
|
||||
orderReuse.providerFee = providerFee
|
||||
orderReuse.providerFeeValidUntil = event.params.validUntil
|
||||
orderReuse.tx = event.transaction.hash.toHex()
|
||||
orderReuse.save()
|
||||
} else {
|
||||
orderReuse = new OrderReuse(event.transaction.hash.toHex())
|
||||
|
|
|
@ -35,7 +35,6 @@ export function handleOPCFeeChanged(event: OPCFeeChanged): void {
|
|||
event.params.newProviderFee.toBigDecimal(),
|
||||
decimals
|
||||
)
|
||||
opc.tx = event.transaction.hash.toHex()
|
||||
opc.save()
|
||||
}
|
||||
|
||||
|
@ -73,7 +72,6 @@ export function handleTokenAdded(event: TokenAdded): void {
|
|||
}
|
||||
|
||||
opc.approvedTokens = existingTokens
|
||||
opc.tx = event.transaction.hash.toHex()
|
||||
|
||||
opc.save()
|
||||
}
|
||||
|
@ -91,13 +89,11 @@ export function handleTokenRemoved(event: TokenRemoved): void {
|
|||
if (role != event.params.token.toHexString()) newList.push(role)
|
||||
}
|
||||
opc.approvedTokens = newList
|
||||
opc.tx = event.transaction.hash.toHex()
|
||||
opc.save()
|
||||
}
|
||||
export function handleSSContractAdded(event: SSContractAdded): void {
|
||||
// add token to approvedTokens
|
||||
const templates = getTemplates()
|
||||
templates.tx = event.transaction.hash.toHex()
|
||||
let existingContracts: string[]
|
||||
if (!templates.ssTemplates) existingContracts = []
|
||||
else existingContracts = templates.ssTemplates as string[]
|
||||
|
@ -108,7 +104,6 @@ export function handleSSContractAdded(event: SSContractAdded): void {
|
|||
}
|
||||
export function handleSSContractRemoved(event: SSContractRemoved): void {
|
||||
const templates = getTemplates()
|
||||
templates.tx = event.transaction.hash.toHex()
|
||||
const newList: string[] = []
|
||||
let existingContracts: string[]
|
||||
if (!templates.ssTemplates) existingContracts = []
|
||||
|
@ -129,7 +124,6 @@ export function handleFixedRateContractAdded(
|
|||
FixedRateExchange.create(event.params.contractAddress)
|
||||
// add token to approvedTokens
|
||||
const templates = getTemplates()
|
||||
templates.tx = event.transaction.hash.toHex()
|
||||
let existingContracts: string[]
|
||||
if (!templates.fixedRateTemplates) existingContracts = []
|
||||
else existingContracts = templates.fixedRateTemplates as string[]
|
||||
|
@ -142,7 +136,6 @@ export function handleFixedRateContractRemoved(
|
|||
event: FixedRateContractRemoved
|
||||
): void {
|
||||
const templates = getTemplates()
|
||||
templates.tx = event.transaction.hash.toHex()
|
||||
const newList: string[] = []
|
||||
let existingContracts: string[]
|
||||
if (!templates.fixedRateTemplates) existingContracts = []
|
||||
|
@ -162,7 +155,6 @@ export function handleDispenserContractAdded(
|
|||
Dispenser.create(event.params.contractAddress)
|
||||
|
||||
const templates = getTemplates()
|
||||
templates.tx = event.transaction.hash.toHex()
|
||||
let existingContracts: string[]
|
||||
if (!templates.dispenserTemplates) existingContracts = []
|
||||
else existingContracts = templates.dispenserTemplates as string[]
|
||||
|
@ -175,7 +167,6 @@ export function handleDispenserContractRemoved(
|
|||
event: DispenserContractRemoved
|
||||
): void {
|
||||
const templates = getTemplates()
|
||||
templates.tx = event.transaction.hash.toHex()
|
||||
const newList: string[] = []
|
||||
let existingContracts: string[]
|
||||
if (!templates.dispenserTemplates) existingContracts = []
|
||||
|
|
|
@ -89,7 +89,6 @@ export function handleMintStateChanged(event: ExchangeMintStateChanged): void {
|
|||
)
|
||||
const fixedRateExchange = getFixedRateExchange(fixedRateId)
|
||||
fixedRateExchange.withMint = event.params.withMint
|
||||
fixedRateExchange.tx = event.transaction.hash.toHex()
|
||||
fixedRateExchange.save()
|
||||
}
|
||||
|
||||
|
@ -227,7 +226,6 @@ export function handleSwap(event: Swapped): void {
|
|||
)
|
||||
datatoken.lastPriceToken = priceToken.id
|
||||
datatoken.lastPriceValue = fixedRateExchange.price
|
||||
datatoken.tx = event.transaction.hash.toHex()
|
||||
datatoken.save()
|
||||
}
|
||||
|
||||
|
@ -246,7 +244,6 @@ export function handlePublishMarketFeeChanged(
|
|||
event.params.swapFee.toBigDecimal(),
|
||||
BigInt.fromI32(18).toI32()
|
||||
)
|
||||
fixedRateExchange.tx = event.transaction.hash.toHex()
|
||||
fixedRateExchange.save()
|
||||
}
|
||||
}
|
||||
|
@ -264,7 +261,6 @@ export function handleTokenCollected(event: TokenCollected): void {
|
|||
fixedRateExchange.baseTokenBalance.minus(
|
||||
weiToDecimal(event.params.amount.toBigDecimal(), baseToken.decimals)
|
||||
)
|
||||
fixedRateExchange.tx = event.transaction.hash.toHex()
|
||||
fixedRateExchange.save()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,33 +2,30 @@ import { Address, BigDecimal } from '@graphprotocol/graph-ts'
|
|||
import { DFAvailableClaim, DFReward } from '../../@types/schema'
|
||||
import { getUser } from './userUtils'
|
||||
|
||||
export function createDFReward(address: Address, txId: String): DFReward {
|
||||
export function createDFReward(address: Address): DFReward {
|
||||
const dfRewards = new DFReward(address.toHexString())
|
||||
const user = getUser(address.toHexString())
|
||||
dfRewards.txId = txId
|
||||
dfRewards.receiver = user.id
|
||||
dfRewards.save()
|
||||
return dfRewards
|
||||
}
|
||||
|
||||
export function getDFReward(address: Address, txId: String): DFReward {
|
||||
export function getDFReward(address: Address): DFReward {
|
||||
let dfRewards = DFReward.load(address.toHexString())
|
||||
if (dfRewards === null) {
|
||||
dfRewards = createDFReward(address, txId)
|
||||
dfRewards = createDFReward(address)
|
||||
}
|
||||
return dfRewards
|
||||
}
|
||||
|
||||
export function getDFAvailableClaim(
|
||||
user: Address,
|
||||
token: Address,
|
||||
txId: String
|
||||
token: Address
|
||||
): DFAvailableClaim {
|
||||
const id = user.toHexString() + '-' + token.toHexString()
|
||||
let dfClaim = DFAvailableClaim.load(id)
|
||||
if (dfClaim == null) {
|
||||
dfClaim = new DFAvailableClaim(id)
|
||||
dfClaim.txId = txId
|
||||
dfClaim.receiver = user.toHexString()
|
||||
dfClaim.amount = BigDecimal.zero()
|
||||
dfClaim.token = token.toHexString()
|
||||
|
|
|
@ -24,7 +24,6 @@ export function handleDelegation(event: DelegateBoost): void {
|
|||
veDelegation.cancelTime = _cancelTime
|
||||
veDelegation.expireTime = _expireTime
|
||||
veDelegation.block = event.block.number.toI32()
|
||||
veDelegation.tx = event.transaction.hash.toHex()
|
||||
veDelegation.save()
|
||||
}
|
||||
|
||||
|
@ -43,7 +42,6 @@ export function handleExtendBoost(event: ExtendBoost): void {
|
|||
veDelegation.amount = _amount
|
||||
veDelegation.cancelTime = _cancelTime
|
||||
veDelegation.expireTime = _expireTime
|
||||
veDelegation.tx = event.transaction.hash.toHex()
|
||||
veDelegation.save()
|
||||
}
|
||||
|
||||
|
@ -62,5 +60,4 @@ export function handleBurnBoost(event: BurnBoost): void {
|
|||
// delete
|
||||
const veDelegation = getveDelegation(_tokenId.toHex())
|
||||
veDelegation.amount = BigInt.zero()
|
||||
veDelegation.tx = event.transaction.hash.toHex()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue