Skip to content

Commit

Permalink
fix: code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
vibhurajeev committed Feb 22, 2022
1 parent 812be39 commit 9640998
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
9 changes: 4 additions & 5 deletions child/src/mappings/child-erc1155.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { BigInt } from '@graphprotocol/graph-ts'
import { TransferBatch, TransferSingle } from '../../generated/ChildERC1155/ChildERC1155'
import { TransactionEntity, GlobalTransferCounter } from '../../generated/schema'
//import { BigDecimal, BigInt } from '@graphprotocol/graph-ts'
import { toDecimal } from '../helpers/numbers'

const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'

Expand All @@ -19,7 +18,7 @@ function getGlobalTransferCounter(): GlobalTransferCounter {

export function handleSingleTransfer(event: TransferSingle): void {

// Try to get what's current global plasma counter's state
// Try to get what's current global counter's state
// when called for very first time, it'll be `0`
let counter = getGlobalTransferCounter()
let updated = counter.current.plus(BigInt.fromI32(1))
Expand All @@ -40,13 +39,13 @@ export function handleSingleTransfer(event: TransferSingle): void {
transactionEntity.timestamp = event.block.timestamp
transactionEntity.transaction = event.transaction.hash
transactionEntity.token = event.address
transactionEntity.tokenType = "ERC1155"
transactionEntity.tokenType = 'ERC1155'
transactionEntity.isPos = true
transactionEntity.save()
}

export function handleBatchTransfer(event: TransferBatch): void {
// Try to get what's current global plasma counter's state
// Try to get what's current global counter's state
// when called for very first time, it'll be `0`
let counter = getGlobalTransferCounter()
let updated = counter.current.plus(BigInt.fromI32(1))
Expand All @@ -67,7 +66,7 @@ export function handleBatchTransfer(event: TransferBatch): void {
transactionEntity.timestamp = event.block.timestamp
transactionEntity.transaction = event.transaction.hash
transactionEntity.token = event.address
transactionEntity.tokenType = "ERC1155"
transactionEntity.tokenType = 'ERC1155'
transactionEntity.isPos = true
transactionEntity.save()
}
9 changes: 4 additions & 5 deletions child/src/mappings/child-erc20.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { BigInt, Address } from '@graphprotocol/graph-ts'
import { LogTransfer, Withdraw, Transfer } from '../../generated/ChildERC20/ChildERC20'
import { TransactionEntity, GlobalTransferCounter } from '../../generated/schema'
import { toDecimal } from '../helpers/numbers'

const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'

Expand Down Expand Up @@ -36,7 +35,7 @@ export function handleLogTransfer(event: LogTransfer): void {

export function handleWithdraw(event: Withdraw): void {

// Try to get what's current global plasma counter's state
// Try to get what's current globalcounter's state
// when called for very first time, it'll be `0`
let counter = getGlobalTransferCounter()
let updated = counter.current.plus(BigInt.fromI32(1))
Expand All @@ -55,14 +54,14 @@ export function handleWithdraw(event: Withdraw): void {
transactionEntity.transaction = event.transaction.hash
transactionEntity.token = event.address
transactionEntity.type = 'withdraw'
transactionEntity.tokenType = "ERC20"
transactionEntity.tokenType = 'ERC20'
transactionEntity.isPos = false
transactionEntity.save()
}

export function handleTransfer(event: Transfer): void {

// Try to get what's current global transfer counter's state
// Try to get what's current global counter's state
// when called for very first time, it'll be `0`
let counter = getGlobalTransferCounter()
let updated = counter.current.plus(BigInt.fromI32(1))
Expand All @@ -82,7 +81,7 @@ export function handleTransfer(event: Transfer): void {
transactionEntity.timestamp = event.block.timestamp
transactionEntity.transaction = event.transaction.hash
transactionEntity.token = event.address
transactionEntity.tokenType = "ERC20"
transactionEntity.tokenType = 'ERC20'
transactionEntity.isPos = true
transactionEntity.save()
}
5 changes: 2 additions & 3 deletions child/src/mappings/child-erc721.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { BigInt } from '@graphprotocol/graph-ts'
import { Transfer } from '../../generated/ChildERC721/ChildERC721'
import { TransactionEntity, GlobalTransferCounter } from '../../generated/schema'
//import { BigDecimal, BigInt } from '@graphprotocol/graph-ts'
import { toDecimal } from '../helpers/numbers'

const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'

Expand Down Expand Up @@ -34,7 +33,7 @@ function getGlobalTransferCounter(): GlobalTransferCounter {

export function handleTransfer(event: Transfer): void {

// Try to get what's current global plasma counter's state
// Try to get what's current global counter's state
// when called for very first time, it'll be `0`
let counter = getGlobalTransferCounter()
let updated = counter.current.plus(BigInt.fromI32(1))
Expand All @@ -54,7 +53,7 @@ export function handleTransfer(event: Transfer): void {
transactionEntity.timestamp = event.block.timestamp
transactionEntity.transaction = event.transaction.hash
transactionEntity.token = event.address
transactionEntity.tokenType = "ERC721"
transactionEntity.tokenType = 'ERC721'
transactionEntity.isPos = true
transactionEntity.save()
}

0 comments on commit 9640998

Please sign in to comment.