Skip to content

Commit

Permalink
fix: cleaning osgno and deposit from files
Browse files Browse the repository at this point in the history
  • Loading branch information
Wagalidoom committed Sep 10, 2024
1 parent 8705829 commit 9842f76
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 267 deletions.
14 changes: 0 additions & 14 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,5 @@ type User @entity {
voteWeight: BigInt!
gno: BigInt!
lgno: BigInt!
deposit: BigInt!
sgno: BigInt!
osgnoShare: BigInt!
osgnoAsset: BigInt!

}

type VaultState @entity {
id: ID!
profitAccrued: BigInt!
_totalShares: BigInt!
_totalAssets: BigInt!
lastUpdatedTimeStamp: BigInt!
avgRewardPerSecond: BigInt!
feePercent: Int!
}
2 changes: 0 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ export const ONE_BI = BigInt.fromI32(1);
export const ZERO_BD = BigDecimal.fromString("0");
export const ONE_BD = BigDecimal.fromString("1");
export const BI_18 = BigInt.fromI32(18);
export const WAD = BigInt.fromString("1000000000000000000");
export const OSGNO_MAX_FEE_PERCENT = BigInt.fromI32(10000);

export function arrayRemove(
array: string[],
Expand Down
21 changes: 0 additions & 21 deletions src/deposit.ts

This file was deleted.

25 changes: 1 addition & 24 deletions src/gno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
saveOrRemove as saveOrRemoveUser,
} from "./helpers/user";

import { ADDRESS_ZERO, DEPOSIT_ADDRESS, ZERO_BI } from "./constants";
import { ADDRESS_ZERO } from "./constants";

export function handleTransfer(event: Transfer): void {
const to = event.params.to;
Expand All @@ -17,29 +17,6 @@ export function handleTransfer(event: Transfer): void {
saveOrRemoveUser(userFrom);
}

// HANDLE FOR DEPOSIT WITHDRAWAL CLAIM, NEED FURTHER TESTS

// Decreasing deposit balance to prevent untracked withdrawal from deposit contract
// Temporary solution as this approach does not fully account for rewards generated by the validator
// if (from.toHexString() == DEPOSIT_ADDRESS.toHexString()) {
// const userTo = loadOrCreateUser(to);

// if (userTo.deposit > ZERO_BI) {
// // To avoid a negative result that could throw an error
// if (userTo.deposit <= event.params.value) {
// userTo.voteWeight = userTo.voteWeight.minus(userTo.deposit);
// userTo.voteWeight = userTo.voteWeight.plus(event.params.value);
// userTo.deposit = ZERO_BI;
// } else {
// userTo.voteWeight = userTo.voteWeight.minus(event.params.value);
// userTo.deposit = userTo.deposit.minus(event.params.value);
// }
// userTo.gno = userTo.gno.plus(event.params.value);
// saveOrRemoveUser(userTo);
// }
// }


if (to.toHexString() != ADDRESS_ZERO.toHexString()) {
const userTo = loadOrCreateUser(to);
userTo.gno = userTo.gno.plus(event.params.value);
Expand Down
17 changes: 0 additions & 17 deletions src/helpers/osgnoVault.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/helpers/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ export function loadOrCreate(address: Address): User {
user.gno = BigInt.fromI32(0);
user.lgno = BigInt.fromI32(0);
user.sgno = BigInt.fromI32(0);
user.osgnoShare = BigInt.fromI32(0);
user.osgnoAsset = BigInt.fromI32(0);
user.deposit = BigInt.fromI32(0);
if (id != ADDRESS_ZERO.toHexString()) {
user.save();
log.info("created user {}", [id]);
Expand Down
65 changes: 0 additions & 65 deletions src/osgno.ts

This file was deleted.

53 changes: 0 additions & 53 deletions src/osgnoVault.ts

This file was deleted.

68 changes: 0 additions & 68 deletions subgraph-gnosis-chain.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,6 @@ dataSources:
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
file: ./src/lgno.ts
- kind: ethereum
name: ds-deposit
network: gnosis
source:
address: "0x0B98057eA310F4d31F2a452B414647007d1645d9"
abi: SBCDepositContract
startBlock: 19469077
mapping:
kind: ethereum/events
apiVersion: 0.0.6
language: wasm/assemblyscript
entities:
- User
abis:
- name: SBCDepositContract
file: ./abis/SBCDepositContract.json
eventHandlers:
- event: DepositEvent(bytes,bytes,bytes,bytes,bytes)
handler: handleDeposit
file: ./src/deposit.ts
- kind: ethereum
name: ds-sgno
network: gnosis
Expand All @@ -82,54 +62,6 @@ dataSources:
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
file: ./src/sgno.ts
- kind: ethereum
name: ds-osgno
network: gnosis
source:
address: "0xF490c80aAE5f2616d3e3BDa2483E30C4CB21d1A0"
abi: ERC20
startBlock: 34778547
mapping:
kind: ethereum/events
apiVersion: 0.0.6
language: wasm/assemblyscript
entities:
- User
abis:
- name: ERC20
file: ./abis/ERC20.json
eventHandlers:
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
file: ./src/osgno.ts
- kind: ethereum
name: ds-osgno-vault
network: gnosis
source:
address: "0x60B2053d7f2a0bBa70fe6CDd88FB47b579B9179a"
abi: OsTokenVaultController
startBlock: 34778543
mapping:
kind: ethereum/events
apiVersion: 0.0.6
language: wasm/assemblyscript
entities:
- User
abis:
- name: OsTokenVaultController
file: ./abis/OsTokenVaultController.json
eventHandlers:
- event: Burn(indexed address,indexed address,uint256,uint256)
handler: handleBurn
- event: Mint(indexed address,indexed address,uint256,uint256)
handler: handleMint
- event: StateUpdated(uint256,uint256,uint256)
handler: handleStateUpdated
- event: AvgRewardPerSecondUpdated(uint256)
handler: handleAvgRewardPerSecondUpdated
- event: FeePercentUpdated(uint16)
handler: handleFeePercentUpdated
file: ./src/osgnoVault.ts

# Balancer
# - kind: ethereum/contract
Expand Down

0 comments on commit 9842f76

Please sign in to comment.