set inital harbTotalSupply value
This commit is contained in:
parent
84d9221c07
commit
92446cf673
2 changed files with 15 additions and 3 deletions
|
|
@ -26,6 +26,14 @@ const networks = {
|
|||
// START_BLOCK: 25895309,
|
||||
SUBGRAPH_NAME: "kraiken-base"
|
||||
},
|
||||
'base2': {
|
||||
NETWORK: 'base',
|
||||
CONTRACT_ADDRESS_HARB: '0x45caa5929f6ee038039984205bdecf968b954820',
|
||||
CONTRACT_ADDRESS_STAKE: '0xed70707fab05d973ad41eae8d17e2bcd36192cfc',
|
||||
START_BLOCK: 26038614,
|
||||
// START_BLOCK: 25895309,
|
||||
SUBGRAPH_NAME: "kraiken-base-test"
|
||||
},
|
||||
};
|
||||
|
||||
// Netzwerk über Kommandozeilenargument auswählen
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import {
|
|||
} from "../generated/Harb/Harb";
|
||||
import { BigInt, Bytes, ethereum, Address, log } from "@graphprotocol/graph-ts";
|
||||
import { Stats } from "../generated/schema";
|
||||
import { getSubgraphConfig } from './chains';
|
||||
|
||||
let stakeTotalSupply: BigInt = BigInt.fromString("10000000000000000000000000");
|
||||
|
||||
|
|
@ -13,8 +14,13 @@ let stakeTotalSupply: BigInt = BigInt.fromString("10000000000000000000000000");
|
|||
function getOrCreateStats(): Stats {
|
||||
let stats = Stats.load(Bytes.fromHexString("0x01") as Bytes);
|
||||
if (stats == null) {
|
||||
log.info("Stats not found, creating a new one", []);
|
||||
stats = new Stats(Bytes.fromHexString("0x01") as Bytes);
|
||||
stats.harbTotalSupply = BigInt.zero();
|
||||
let harb = Harb.bind(getSubgraphConfig().harbergAddress);
|
||||
|
||||
|
||||
|
||||
stats.harbTotalSupply = harb.totalSupply();
|
||||
stats.stakeTotalSupply = stakeTotalSupply;
|
||||
stats.outstandingStake = BigInt.zero();
|
||||
|
||||
|
|
@ -48,8 +54,6 @@ export function handleTransfer(event: TransferEvent): void {
|
|||
// Get a copy of the ring buffer
|
||||
let ringBuffer = stats.ringBuffer;
|
||||
|
||||
const harberg = Harb.bind(event.address);
|
||||
|
||||
if (event.params.from == TAX_POOL_ADDR) {
|
||||
|
||||
// Add the UBI amount to the current hour's total in the ring buffer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue