base deployment

This commit is contained in:
EmberSpirit007 2025-02-06 21:38:40 +01:00
parent 31bc86fcd5
commit 84d9221c07
5 changed files with 30 additions and 14 deletions

View file

@ -8,6 +8,13 @@ yarn build
yarn deploy
```
## deployment-script
networks are defined in deploy.js
This solution overwrites the subgraph.yaml with the template and enables the possible to upgrade the same contract on different chains
```
node deploy.js base
```
## queries
for stats
@ -29,3 +36,4 @@ for stats
}
```

View file

@ -18,6 +18,14 @@ const networks = {
START_BLOCK: 6746241,
SUBGRAPH_NAME: "harb"
},
'base': {
NETWORK: 'base',
CONTRACT_ADDRESS_HARB: '0x45caa5929f6ee038039984205bdecf968b954820',
CONTRACT_ADDRESS_STAKE: '0xed70707fab05d973ad41eae8d17e2bcd36192cfc',
START_BLOCK: 26038614,
// START_BLOCK: 25895309,
SUBGRAPH_NAME: "kraiken-base"
},
};
// Netzwerk über Kommandozeilenargument auswählen

View file

@ -24,13 +24,13 @@ export function getSubgraphConfig(): SubgraphConfig {
// subgraph does not support case switch with strings, hence this if else block
if (selectedNetwork == BASE_NETWORK_NAME) {
return {
harbergAddress: Address.fromString('0x1F98431c8aD98523631AE4a59f267346ea31F984'),
stakeAddress: Address.fromString('0x17c14d2c404d167802b16c450d3c99f88f2c4f4d'),
harbergAddress: Address.fromString('0x45caa5929f6ee038039984205bdecf968b954820'),
stakeAddress: Address.fromString('0xed70707fab05d973ad41eae8d17e2bcd36192cfc'),
}
} else if (selectedNetwork == BASE_SEPOLIA_NETWORK_NAME) {
return {
harbergAddress: Address.fromString('0x54838DC097E7fC4736B801bF1c1FCf1597348265'),
stakeAddress: Address.fromString('0xd7728173F73C748944d29EA77b56f09b8FEc8F33'),
harbergAddress: Address.fromString('0x22c264Ecf8D4E49D1E3CabD8DD39b7C4Ab51C1B8'),
stakeAddress: Address.fromString('0xe28020BCdEeAf2779dd47c670A8eFC2973316EE2'),
}
} else {
throw new Error('Unsupported Network')

View file

@ -22,7 +22,7 @@ export function handlePositionCreated(event: PositionCreatedEvent): void {
position.creationTime = event.block.timestamp.toI32();
position.lastTaxTime = event.block.timestamp.toI32();
position.taxRate = BigDecimal.fromString(taxRates[event.params.taxRate.toI32()]);
position.harbDeposit = event.params.harbDeposit;
position.harbDeposit = event.params.harbergDeposit;
position.status = "Active";
position.snatched = 0;
position.payout = BigInt.fromString("0");
@ -44,7 +44,7 @@ export function handlePositionRemoved(event: PositionRemovedEvent): void {
position.status = "Closed";
let harb = Harb.bind(getSubgraphConfig().harbergAddress);
position.totalSupplyEnd = harb.totalSupply();
position.payout = position.payout.plus(event.params.harbPayout);
// position.payout = position.payout.plus(event.params.harbPayout);
position.save();
}
let stake = Stake.bind(event.address);
@ -59,10 +59,10 @@ export function handlePositionShrunk(event: PositionShrunkEvent): void {
let position = Position.load(Bytes.fromI32(event.params.positionId.toI32()));
if (position != null) {
position.share = event.params.newShares.toBigDecimal().div(totalSupply);
position.harbDeposit = position.harbDeposit.minus(event.params.harbPayout);
position.harbDeposit = position.harbDeposit.minus(event.params.harbergPayout);
position.snatched = position.snatched++;
position.payout = position.payout.plus(event.params.harbPayout);
// position.payout = position.payout.plus(event.params.harbPayout);
position.save();
}
}

View file

@ -6,11 +6,11 @@ schema:
dataSources:
- kind: ethereum
name: Harb
network: base-sepolia
network: base
source:
address: "0x22c264Ecf8D4E49D1E3CabD8DD39b7C4Ab51C1B8"
address: "0x45caa5929f6ee038039984205bdecf968b954820"
abi: Harb
startBlock: 20940337
startBlock: 26038614
mapping:
kind: ethereum/events
apiVersion: 0.0.7
@ -29,11 +29,11 @@ dataSources:
file: ./src/harb.ts
- kind: ethereum
name: Stake
network: base-sepolia
network: base
source:
address: "0xe28020BCdEeAf2779dd47c670A8eFC2973316EE2"
address: "0xed70707fab05d973ad41eae8d17e2bcd36192cfc"
abi: Stake
startBlock: 20940337
startBlock: 26038614
mapping:
kind: ethereum/events
apiVersion: 0.0.7