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
446
abis/ERC20.json
446
abis/ERC20.json
@ -1,225 +1,225 @@
|
||||
{
|
||||
"contractName": "ERC20",
|
||||
"abi": [
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "approve",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "totalSupply",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transferFrom",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "decimals",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint8"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "balanceOf",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "balance",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "symbol",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transfer",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_spender",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "allowance",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"payable": true,
|
||||
"stateMutability": "payable",
|
||||
"type": "fallback"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Approval",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Transfer",
|
||||
"type": "event"
|
||||
}
|
||||
"contractName": "ERC20",
|
||||
"abi": [
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "name",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "approve",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "totalSupply",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transferFrom",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "decimals",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint8"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "balanceOf",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "balance",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [],
|
||||
"name": "symbol",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": false,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "transfer",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "nonpayable",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"constant": true,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "_owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"name": "_spender",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "allowance",
|
||||
"outputs": [
|
||||
{
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"payable": false,
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
{
|
||||
"payable": true,
|
||||
"stateMutability": "payable",
|
||||
"type": "fallback"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "owner",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "spender",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Approval",
|
||||
"type": "event"
|
||||
},
|
||||
{
|
||||
"anonymous": false,
|
||||
"inputs": [
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "from",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": true,
|
||||
"name": "to",
|
||||
"type": "address"
|
||||
},
|
||||
{
|
||||
"indexed": false,
|
||||
"name": "value",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "Transfer",
|
||||
"type": "event"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -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")
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
- 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
|
||||
|
@ -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
|
||||
|
@ -1,18 +1,18 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"resolveJsonModule": true,
|
||||
"moduleResolution": "node",
|
||||
"lib": ["es2017", "es6", "es7", "dom"],
|
||||
"noUnusedLocals": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"declaration": true,
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"removeComments": true,
|
||||
"experimentalDecorators": true,
|
||||
"preserveConstEnums": true,
|
||||
"typeRoots": ["../node_modules/@types"],
|
||||
"types": ["...", "@types/mocha"],
|
||||
}
|
||||
"compilerOptions": {
|
||||
"resolveJsonModule": true,
|
||||
"moduleResolution": "node",
|
||||
"lib": ["es2017", "es6", "es7", "dom"],
|
||||
"noUnusedLocals": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"declaration": true,
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"removeComments": true,
|
||||
"experimentalDecorators": true,
|
||||
"preserveConstEnums": true,
|
||||
"typeRoots": ["../node_modules/@types"],
|
||||
"types": ["...", "@types/mocha"]
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user