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

@ -1,225 +1,225 @@
{ {
"contractName": "ERC20", "contractName": "ERC20",
"abi": [ "abi": [
{ {
"constant": true, "constant": true,
"inputs": [], "inputs": [],
"name": "name", "name": "name",
"outputs": [ "outputs": [
{ {
"name": "", "name": "",
"type": "string" "type": "string"
} }
], ],
"payable": false, "payable": false,
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{ {
"constant": false, "constant": false,
"inputs": [ "inputs": [
{ {
"name": "_spender", "name": "_spender",
"type": "address" "type": "address"
}, },
{ {
"name": "_value", "name": "_value",
"type": "uint256" "type": "uint256"
} }
], ],
"name": "approve", "name": "approve",
"outputs": [ "outputs": [
{ {
"name": "", "name": "",
"type": "bool" "type": "bool"
} }
], ],
"payable": false, "payable": false,
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
{ {
"constant": true, "constant": true,
"inputs": [], "inputs": [],
"name": "totalSupply", "name": "totalSupply",
"outputs": [ "outputs": [
{ {
"name": "", "name": "",
"type": "uint256" "type": "uint256"
} }
], ],
"payable": false, "payable": false,
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{ {
"constant": false, "constant": false,
"inputs": [ "inputs": [
{ {
"name": "_from", "name": "_from",
"type": "address" "type": "address"
}, },
{ {
"name": "_to", "name": "_to",
"type": "address" "type": "address"
}, },
{ {
"name": "_value", "name": "_value",
"type": "uint256" "type": "uint256"
} }
], ],
"name": "transferFrom", "name": "transferFrom",
"outputs": [ "outputs": [
{ {
"name": "", "name": "",
"type": "bool" "type": "bool"
} }
], ],
"payable": false, "payable": false,
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
{ {
"constant": true, "constant": true,
"inputs": [], "inputs": [],
"name": "decimals", "name": "decimals",
"outputs": [ "outputs": [
{ {
"name": "", "name": "",
"type": "uint8" "type": "uint8"
} }
], ],
"payable": false, "payable": false,
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{ {
"constant": true, "constant": true,
"inputs": [ "inputs": [
{ {
"name": "_owner", "name": "_owner",
"type": "address" "type": "address"
} }
], ],
"name": "balanceOf", "name": "balanceOf",
"outputs": [ "outputs": [
{ {
"name": "balance", "name": "balance",
"type": "uint256" "type": "uint256"
} }
], ],
"payable": false, "payable": false,
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{ {
"constant": true, "constant": true,
"inputs": [], "inputs": [],
"name": "symbol", "name": "symbol",
"outputs": [ "outputs": [
{ {
"name": "", "name": "",
"type": "string" "type": "string"
} }
], ],
"payable": false, "payable": false,
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{ {
"constant": false, "constant": false,
"inputs": [ "inputs": [
{ {
"name": "_to", "name": "_to",
"type": "address" "type": "address"
}, },
{ {
"name": "_value", "name": "_value",
"type": "uint256" "type": "uint256"
} }
], ],
"name": "transfer", "name": "transfer",
"outputs": [ "outputs": [
{ {
"name": "", "name": "",
"type": "bool" "type": "bool"
} }
], ],
"payable": false, "payable": false,
"stateMutability": "nonpayable", "stateMutability": "nonpayable",
"type": "function" "type": "function"
}, },
{ {
"constant": true, "constant": true,
"inputs": [ "inputs": [
{ {
"name": "_owner", "name": "_owner",
"type": "address" "type": "address"
}, },
{ {
"name": "_spender", "name": "_spender",
"type": "address" "type": "address"
} }
], ],
"name": "allowance", "name": "allowance",
"outputs": [ "outputs": [
{ {
"name": "", "name": "",
"type": "uint256" "type": "uint256"
} }
], ],
"payable": false, "payable": false,
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{ {
"payable": true, "payable": true,
"stateMutability": "payable", "stateMutability": "payable",
"type": "fallback" "type": "fallback"
}, },
{ {
"anonymous": false, "anonymous": false,
"inputs": [ "inputs": [
{ {
"indexed": true, "indexed": true,
"name": "owner", "name": "owner",
"type": "address" "type": "address"
}, },
{ {
"indexed": true, "indexed": true,
"name": "spender", "name": "spender",
"type": "address" "type": "address"
}, },
{ {
"indexed": false, "indexed": false,
"name": "value", "name": "value",
"type": "uint256" "type": "uint256"
} }
], ],
"name": "Approval", "name": "Approval",
"type": "event" "type": "event"
}, },
{ {
"anonymous": false, "anonymous": false,
"inputs": [ "inputs": [
{ {
"indexed": true, "indexed": true,
"name": "from", "name": "from",
"type": "address" "type": "address"
}, },
{ {
"indexed": true, "indexed": true,
"name": "to", "name": "to",
"type": "address" "type": "address"
}, },
{ {
"indexed": false, "indexed": false,
"name": "value", "name": "value",
"type": "uint256" "type": "uint256"
} }
], ],
"name": "Transfer", "name": "Transfer",
"type": "event" "type": "event"
} }
] ]
} }

View File

@ -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")
}

View File

@ -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 {

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 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

View File

@ -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

View File

@ -1,18 +1,18 @@
{ {
"compilerOptions": { "compilerOptions": {
"resolveJsonModule": true, "resolveJsonModule": true,
"moduleResolution": "node", "moduleResolution": "node",
"lib": ["es2017", "es6", "es7", "dom"], "lib": ["es2017", "es6", "es7", "dom"],
"noUnusedLocals": true, "noUnusedLocals": true,
"esModuleInterop": true, "esModuleInterop": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"declaration": true, "declaration": true,
"module": "commonjs", "module": "commonjs",
"target": "es5", "target": "es5",
"removeComments": true, "removeComments": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"preserveConstEnums": true, "preserveConstEnums": true,
"typeRoots": ["../node_modules/@types"], "typeRoots": ["../node_modules/@types"],
"types": ["...", "@types/mocha"], "types": ["...", "@types/mocha"]
}
} }
}