removing Vesting and opcFee (#432)

* removing opcFee

* Removing OPCFeeChanged from subgraph.template.yaml

* Adding OPCFeeChanged event back into subgraph.template.yml

* Adding SSContractAdded and SSContractRemoved back in

* Formatting
This commit is contained in:
Jamie Hewitt 2022-05-12 20:31:12 +03:00 committed by GitHub
parent cb7e36fc98
commit 796bff70e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 256 additions and 365 deletions

View File

@ -534,18 +534,4 @@ type Template @entity{
ssTemplates: [String!]
}
type Vested @entity {
id: ID!
amount: BigDecimal!
block: BigInt!
vesting: Vesting!
}
type Vesting @entity {
id: ID!
user: User!
token: Token!
endBlock: BigInt!
amount: BigDecimal!
vestingHistory: [Vested!]! @derivedFrom(field: "vesting")
}

View File

@ -13,12 +13,7 @@ import {
} from '../@types/FactoryRouter/FactoryRouter'
import { BigInt } from '@graphprotocol/graph-ts'
import { Pool } from '../@types/schema'
import {
BPool,
FixedRateExchange,
Dispenser,
SSContract
} from '../@types/templates'
import { BPool, FixedRateExchange, Dispenser } from '../@types/templates'
import { addPool, getOPC, getTemplates } from './utils/globalUtils'
import { weiToDecimal } from './utils/generic'
@ -101,10 +96,8 @@ export function handleTokenRemoved(event: TokenRemoved): void {
opc.approvedTokens = newList
opc.save()
}
export function handleSSContractAdded(event: SSContractAdded): void {
// add token to approvedTokens
SSContract.create(event.params.contractAddress)
const templates = getTemplates()
let existingContracts: string[]
if (!templates.ssTemplates) existingContracts = []
@ -129,6 +122,7 @@ export function handleSSContractRemoved(event: SSContractRemoved): void {
templates.ssTemplates = newList
templates.save()
}
export function handleFixedRateContractAdded(
event: FixedRateContractAdded
): void {

View File

@ -1,47 +0,0 @@
import {
VestingCreated,
Vesting as VestingEvent
} from '../@types/templates/SSContract/SSContract'
import { Vested, Vesting } from '../@types/schema'
import { getUser } from './utils/userUtils'
import { getToken } from './utils/tokenUtils'
import { weiToDecimal } from './utils/generic'
export function handleVestingCreated(event: VestingCreated): void {
const vesting = new Vesting(
event.address
.toHexString()
.concat('-')
.concat(event.params.datatokenAddress.toHexString())
)
const user = getUser(event.params.publisherAddress.toHexString())
vesting.user = user.id
const token = getToken(event.params.datatokenAddress, true)
vesting.token = token.id
vesting.endBlock = event.params.vestingEndBlock
vesting.amount = weiToDecimal(
event.params.totalVestingAmount.toBigDecimal(),
token.decimals
)
vesting.save()
}
export function handleVesting(event: VestingEvent): void {
const vesting = new Vesting(
event.address
.toHexString()
.concat('-')
.concat(event.params.datatokenAddress.toHexString())
)
const vestingHistory = new Vested(
event.transaction.hash.toHex().concat('-').concat(event.logIndex.toString())
)
vestingHistory.block = event.block.number
const token = getToken(event.params.datatokenAddress, true)
vestingHistory.amount = weiToDecimal(
event.params.amountVested.toBigDecimal(),
token.decimals
)
vestingHistory.vesting = vesting.id
vestingHistory.save()
}

View File

@ -263,24 +263,3 @@ templates:
handler: handlePublishMarketFeeChanged
- event: TokenCollected(indexed bytes32,indexed address,indexed address,uint256)
handler: handleTokenCollected
- name: SSContract
kind: ethereum/contract
network: __NETWORK__
source:
abi: SSContract
mapping:
kind: ethereum/events
apiVersion: 0.0.6
language: wasm/assemblyscript
file: ./src/mappings/sscontract.ts
entities:
- SSContract
abis:
- name: SSContract
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/pools/ssContracts/SideStaking.sol/SideStaking.json
eventHandlers:
- event: VestingCreated(indexed address,indexed address,uint256,uint256)
handler: handleVestingCreated
- event: Vesting(indexed address,indexed address,indexed address,uint256)
handler: handleVesting

View File

@ -6,11 +6,11 @@ schema:
dataSources:
- kind: ethereum/contract
name: ERC721Factory
network: rinkeby
network: development
source:
address: '0x6eb0184B64f22fB5e1316221E1eC84988F9E6b12'
address: '0x2f7a30F120f0B7799C8900144eC6d8E4fBbc90ec'
abi: ERC721Factory
startBlock: 10422197
startBlock: 1119
mapping:
kind: ethereum/events
apiVersion: 0.0.6
@ -31,11 +31,11 @@ dataSources:
- kind: ethereum/contract
name: FactoryRouter
network: rinkeby
network: development
source:
address: '0xF1Ef3C2332E44bdA219D9155E9a97201a1b5eC1C'
address: '0x375B009326A0938B8c325Bc2d402a16fe0fBB402'
abi: FactoryRouter
startBlock: 10422197
startBlock: 1119
mapping:
kind: ethereum/events
apiVersion: 0.0.6
@ -73,7 +73,7 @@ dataSources:
templates:
- name: ERC20Template
kind: ethereum/contract
network: rinkeby
network: development
source:
abi: ERC20Template
mapping:
@ -114,7 +114,7 @@ templates:
- name: BPool
kind: ethereum/contract
network: rinkeby
network: development
source:
abi: BPool
mapping:
@ -151,7 +151,7 @@ templates:
- name: ERC721Template
kind: ethereum/contract
network: rinkeby
network: development
source:
abi: ERC721Template
mapping:
@ -198,7 +198,7 @@ templates:
- name: Dispenser
kind: ethereum/contract
network: rinkeby
network: development
source:
abi: Dispenser
mapping:
@ -229,7 +229,7 @@ templates:
- name: FixedRateExchange
kind: ethereum/contract
network: rinkeby
network: development
source:
abi: FixedRateExchange
mapping:
@ -263,24 +263,3 @@ templates:
handler: handlePublishMarketFeeChanged
- event: TokenCollected(indexed bytes32,indexed address,indexed address,uint256)
handler: handleTokenCollected
- name: SSContract
kind: ethereum/contract
network: rinkeby
source:
abi: SSContract
mapping:
kind: ethereum/events
apiVersion: 0.0.6
language: wasm/assemblyscript
file: ./src/mappings/sscontract.ts
entities:
- SSContract
abis:
- name: SSContract
file: ./node_modules/@oceanprotocol/contracts/artifacts/contracts/pools/ssContracts/SideStaking.sol/SideStaking.json
eventHandlers:
- event: VestingCreated(indexed address,indexed address,uint256,uint256)
handler: handleVestingCreated
- event: Vesting(indexed address,indexed address,indexed address,uint256)
handler: handleVesting

View File

@ -13,6 +13,6 @@
"experimentalDecorators": true,
"preserveConstEnums": true,
"typeRoots": ["../node_modules/@types"],
"types": ["...", "@types/mocha"],
"types": ["...", "@types/mocha"]
}
}