mirror of
https://github.com/oceanprotocol/ocean-subgraph.git
synced 2024-12-02 05:57:29 +01:00
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:
parent
cb7e36fc98
commit
796bff70e7
@ -534,18 +534,4 @@ type Template @entity{
|
|||||||
ssTemplates: [String!]
|
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")
|
|
||||||
}
|
|
||||||
|
@ -13,12 +13,7 @@ import {
|
|||||||
} from '../@types/FactoryRouter/FactoryRouter'
|
} from '../@types/FactoryRouter/FactoryRouter'
|
||||||
import { BigInt } from '@graphprotocol/graph-ts'
|
import { BigInt } from '@graphprotocol/graph-ts'
|
||||||
import { Pool } from '../@types/schema'
|
import { Pool } from '../@types/schema'
|
||||||
import {
|
import { BPool, FixedRateExchange, Dispenser } from '../@types/templates'
|
||||||
BPool,
|
|
||||||
FixedRateExchange,
|
|
||||||
Dispenser,
|
|
||||||
SSContract
|
|
||||||
} from '../@types/templates'
|
|
||||||
import { addPool, getOPC, getTemplates } from './utils/globalUtils'
|
import { addPool, getOPC, getTemplates } from './utils/globalUtils'
|
||||||
import { weiToDecimal } from './utils/generic'
|
import { weiToDecimal } from './utils/generic'
|
||||||
|
|
||||||
@ -101,10 +96,8 @@ export function handleTokenRemoved(event: TokenRemoved): void {
|
|||||||
opc.approvedTokens = newList
|
opc.approvedTokens = newList
|
||||||
opc.save()
|
opc.save()
|
||||||
}
|
}
|
||||||
|
|
||||||
export function handleSSContractAdded(event: SSContractAdded): void {
|
export function handleSSContractAdded(event: SSContractAdded): void {
|
||||||
// add token to approvedTokens
|
// add token to approvedTokens
|
||||||
SSContract.create(event.params.contractAddress)
|
|
||||||
const templates = getTemplates()
|
const templates = getTemplates()
|
||||||
let existingContracts: string[]
|
let existingContracts: string[]
|
||||||
if (!templates.ssTemplates) existingContracts = []
|
if (!templates.ssTemplates) existingContracts = []
|
||||||
@ -129,6 +122,7 @@ export function handleSSContractRemoved(event: SSContractRemoved): void {
|
|||||||
templates.ssTemplates = newList
|
templates.ssTemplates = newList
|
||||||
templates.save()
|
templates.save()
|
||||||
}
|
}
|
||||||
|
|
||||||
export function handleFixedRateContractAdded(
|
export function handleFixedRateContractAdded(
|
||||||
event: FixedRateContractAdded
|
event: FixedRateContractAdded
|
||||||
): void {
|
): void {
|
||||||
|
@ -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()
|
|
||||||
}
|
|
@ -263,24 +263,3 @@ templates:
|
|||||||
handler: handlePublishMarketFeeChanged
|
handler: handlePublishMarketFeeChanged
|
||||||
- event: TokenCollected(indexed bytes32,indexed address,indexed address,uint256)
|
- event: TokenCollected(indexed bytes32,indexed address,indexed address,uint256)
|
||||||
handler: handleTokenCollected
|
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
|
|
||||||
|
@ -6,11 +6,11 @@ schema:
|
|||||||
dataSources:
|
dataSources:
|
||||||
- kind: ethereum/contract
|
- kind: ethereum/contract
|
||||||
name: ERC721Factory
|
name: ERC721Factory
|
||||||
network: rinkeby
|
network: development
|
||||||
source:
|
source:
|
||||||
address: '0x6eb0184B64f22fB5e1316221E1eC84988F9E6b12'
|
address: '0x2f7a30F120f0B7799C8900144eC6d8E4fBbc90ec'
|
||||||
abi: ERC721Factory
|
abi: ERC721Factory
|
||||||
startBlock: 10422197
|
startBlock: 1119
|
||||||
mapping:
|
mapping:
|
||||||
kind: ethereum/events
|
kind: ethereum/events
|
||||||
apiVersion: 0.0.6
|
apiVersion: 0.0.6
|
||||||
@ -31,11 +31,11 @@ dataSources:
|
|||||||
|
|
||||||
- kind: ethereum/contract
|
- kind: ethereum/contract
|
||||||
name: FactoryRouter
|
name: FactoryRouter
|
||||||
network: rinkeby
|
network: development
|
||||||
source:
|
source:
|
||||||
address: '0xF1Ef3C2332E44bdA219D9155E9a97201a1b5eC1C'
|
address: '0x375B009326A0938B8c325Bc2d402a16fe0fBB402'
|
||||||
abi: FactoryRouter
|
abi: FactoryRouter
|
||||||
startBlock: 10422197
|
startBlock: 1119
|
||||||
mapping:
|
mapping:
|
||||||
kind: ethereum/events
|
kind: ethereum/events
|
||||||
apiVersion: 0.0.6
|
apiVersion: 0.0.6
|
||||||
@ -73,7 +73,7 @@ dataSources:
|
|||||||
templates:
|
templates:
|
||||||
- name: ERC20Template
|
- name: ERC20Template
|
||||||
kind: ethereum/contract
|
kind: ethereum/contract
|
||||||
network: rinkeby
|
network: development
|
||||||
source:
|
source:
|
||||||
abi: ERC20Template
|
abi: ERC20Template
|
||||||
mapping:
|
mapping:
|
||||||
@ -114,7 +114,7 @@ templates:
|
|||||||
|
|
||||||
- name: BPool
|
- name: BPool
|
||||||
kind: ethereum/contract
|
kind: ethereum/contract
|
||||||
network: rinkeby
|
network: development
|
||||||
source:
|
source:
|
||||||
abi: BPool
|
abi: BPool
|
||||||
mapping:
|
mapping:
|
||||||
@ -151,7 +151,7 @@ templates:
|
|||||||
|
|
||||||
- name: ERC721Template
|
- name: ERC721Template
|
||||||
kind: ethereum/contract
|
kind: ethereum/contract
|
||||||
network: rinkeby
|
network: development
|
||||||
source:
|
source:
|
||||||
abi: ERC721Template
|
abi: ERC721Template
|
||||||
mapping:
|
mapping:
|
||||||
@ -198,7 +198,7 @@ templates:
|
|||||||
|
|
||||||
- name: Dispenser
|
- name: Dispenser
|
||||||
kind: ethereum/contract
|
kind: ethereum/contract
|
||||||
network: rinkeby
|
network: development
|
||||||
source:
|
source:
|
||||||
abi: Dispenser
|
abi: Dispenser
|
||||||
mapping:
|
mapping:
|
||||||
@ -229,7 +229,7 @@ templates:
|
|||||||
|
|
||||||
- name: FixedRateExchange
|
- name: FixedRateExchange
|
||||||
kind: ethereum/contract
|
kind: ethereum/contract
|
||||||
network: rinkeby
|
network: development
|
||||||
source:
|
source:
|
||||||
abi: FixedRateExchange
|
abi: FixedRateExchange
|
||||||
mapping:
|
mapping:
|
||||||
@ -263,24 +263,3 @@ templates:
|
|||||||
handler: handlePublishMarketFeeChanged
|
handler: handlePublishMarketFeeChanged
|
||||||
- event: TokenCollected(indexed bytes32,indexed address,indexed address,uint256)
|
- event: TokenCollected(indexed bytes32,indexed address,indexed address,uint256)
|
||||||
handler: handleTokenCollected
|
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
|
|
||||||
|
@ -13,6 +13,6 @@
|
|||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"preserveConstEnums": true,
|
"preserveConstEnums": true,
|
||||||
"typeRoots": ["../node_modules/@types"],
|
"typeRoots": ["../node_modules/@types"],
|
||||||
"types": ["...", "@types/mocha"],
|
"types": ["...", "@types/mocha"]
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user