diff --git a/.gitignore b/.gitignore index 8261c8d3..48cb62f1 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ node_modules coverage coverage.json typechain +typechain-types #Hardhat files cache @@ -21,4 +22,4 @@ artifacts #Generated files RolloverBatch.json -RedeemBatch.json \ No newline at end of file +RedeemBatch.json diff --git a/spot-staking-subgraph/schema.graphql b/spot-staking-subgraph/schema.graphql index c8095c09..61e1d6f3 100644 --- a/spot-staking-subgraph/schema.graphql +++ b/spot-staking-subgraph/schema.graphql @@ -46,6 +46,7 @@ type BillBrokerSwap @entity { "-" id: ID! vault: BillBroker! + timestamp: BigInt! nonce: BigInt! type: String! swapAmt: BigDecimal! @@ -94,4 +95,4 @@ type CharmVaultDailyStat @entity { token1Fees: BigDecimal! totalFeeVal: BigDecimal! feeYield: BigDecimal! -} \ No newline at end of file +} diff --git a/spot-staking-subgraph/src/billBroker.ts b/spot-staking-subgraph/src/billBroker.ts index 4603dac3..c43664be 100644 --- a/spot-staking-subgraph/src/billBroker.ts +++ b/spot-staking-subgraph/src/billBroker.ts @@ -97,7 +97,7 @@ export function fetchBillBrokerDailyStat(vault: BillBroker, timestamp: BigInt): return dailyStat as BillBrokerDailyStat } -export function fetchBillBrokerSwap(vault: BillBroker, nonce: BigInt): BillBrokerSwap { +function fetchBillBrokerSwap(vault: BillBroker, nonce: BigInt): BillBrokerSwap { let id = vault.id.concat('-').concat(nonce.toString()) let swap = BillBrokerSwap.load(id) if (swap === null) { @@ -108,6 +108,7 @@ export function fetchBillBrokerSwap(vault: BillBroker, nonce: BigInt): BillBroke swap.swapAmt = BIGDECIMAL_ZERO swap.feeAmt = BIGDECIMAL_ZERO swap.tx = '0x' + swap.timestamp = BIGINT_ZERO swap.save() } return swap as BillBrokerSwap @@ -162,6 +163,7 @@ export function handleSwapPerpsForUSD(event: SwapPerpsForUSD): void { swap.type = 'perps' swap.swapAmt = formatBalance(event.params.perpAmtIn, vault.perpDecimals) swap.tx = event.transaction.hash.toHex() + swap.timestamp = event.block.timestamp swap.save() let vaultContract = BillBrokerABI.bind(stringToAddress(vault.id)) @@ -213,6 +215,7 @@ export function handleSwapUSDForPerps(event: SwapUSDForPerps): void { swap.type = 'usd' swap.swapAmt = formatBalance(event.params.usdAmtIn, vault.perpDecimals) swap.tx = event.transaction.hash.toHex() + swap.timestamp = event.block.timestamp swap.save() let vaultContract = BillBrokerABI.bind(stringToAddress(vault.id))