Eden subgraph artifacts, host API stub (#15)

* Skip AssemblyScript during TS transpilation

* Eden subgraph build files

* Eden subgraph host API stubs
This commit is contained in:
Ashwin Phatak 2021-09-27 13:46:46 +05:30 committed by nabarun
parent 9e6f6b4519
commit f078db688a
11 changed files with 2661 additions and 20 deletions

View File

@ -0,0 +1,24 @@
//
// Copyright 2021 Vulcanize, Inc.
//
import path from 'path';
import { instantiate } from './index';
describe('eden wasm loader tests', () => {
it('should load the subgraph network wasm', async () => {
const filePath = path.resolve(__dirname, '../test/subgraph/eden/EdenNetwork/EdenNetwork.wasm');
await instantiate(filePath);
});
it('should load the subgraph network distribution wasm', async () => {
const filePath = path.resolve(__dirname, '../test/subgraph/eden/EdenNetworkDistribution/EdenNetworkDistribution.wasm');
await instantiate(filePath);
});
it('should load the subgraph network governance wasm', async () => {
const filePath = path.resolve(__dirname, '../test/subgraph/eden/EdenNetworkGovernance/EdenNetworkGovernance.wasm');
await instantiate(filePath);
});
});

View File

@ -20,28 +20,28 @@ const imports = {
'typeConversion.bytesToHex': () => {
console.log('typeConversion.bytesToHex');
},
'typeConversion.bytesToString': () => {
console.log('typeConversion.bytesToString');
},
// 'typeConversion.bytesToString': () => {
// console.log('typeConversion.bytesToString');
// },
'typeConversion.bigIntToString': () => {
console.log('typeConversion.bigIntToString');
},
'bigDecimal.fromString': () => {
console.log('bigDecimal.fromString');
},
'bigDecimal.times': () => {
console.log('bigDecimal.times');
},
// 'bigDecimal.fromString': () => {
// console.log('bigDecimal.fromString');
// },
// 'bigDecimal.times': () => {
// console.log('bigDecimal.times');
// },
'bigDecimal.dividedBy': () => {
console.log('bigDecimal.dividedBy');
},
'bigDecimal.plus': () => {
console.log('bigDecimal.plus');
},
'bigDecimal.minus': () => {
console.log('bigDecimal.minus');
},
// 'bigDecimal.plus': () => {
// console.log('bigDecimal.plus');
// },
// 'bigDecimal.minus': () => {
// console.log('bigDecimal.minus');
// },
'bigInt.plus': () => {
console.log('bigInt.plus');
@ -55,16 +55,22 @@ const imports = {
'bigInt.dividedBy': () => {
console.log('bigInt.dividedBy');
},
'bigInt.mod': () => {
console.log('bigInt.mod');
// 'bigInt.mod': () => {
// console.log('bigInt.mod');
// },
'bigInt.fromString': () => {
console.log('bigInt.fromString');
},
'log.log': () => {
console.log('log.log');
},
'dataSource.create': () => {
console.log('dataSource.create');
// 'dataSource.create': () => {
// console.log('dataSource.create');
// },
'dataSource.address': () => {
console.log('dataSource.address');
}
},
ethereum: {

View File

@ -0,0 +1,678 @@
[
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "newAdmin",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "oldAdmin",
"type": "address"
}
],
"name": "AdminUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint8",
"name": "slot",
"type": "uint8"
},
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "delegate",
"type": "address"
},
{
"indexed": false,
"internalType": "uint128",
"name": "newBidAmount",
"type": "uint128"
},
{
"indexed": false,
"internalType": "uint128",
"name": "oldBidAmount",
"type": "uint128"
},
{
"indexed": false,
"internalType": "uint16",
"name": "taxNumerator",
"type": "uint16"
},
{
"indexed": false,
"internalType": "uint16",
"name": "taxDenominator",
"type": "uint16"
}
],
"name": "SlotClaimed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint8",
"name": "slot",
"type": "uint8"
},
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newDelegate",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "oldDelegate",
"type": "address"
}
],
"name": "SlotDelegateUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "staker",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "stakeAmount",
"type": "uint256"
}
],
"name": "Stake",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint16",
"name": "newNumerator",
"type": "uint16"
},
{
"indexed": false,
"internalType": "uint16",
"name": "newDenominator",
"type": "uint16"
},
{
"indexed": false,
"internalType": "uint16",
"name": "oldNumerator",
"type": "uint16"
},
{
"indexed": false,
"internalType": "uint16",
"name": "oldDenominator",
"type": "uint16"
}
],
"name": "TaxRateUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "staker",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "unstakedAmount",
"type": "uint256"
}
],
"name": "Unstake",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "withdrawer",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "withdrawalAmount",
"type": "uint256"
}
],
"name": "Withdraw",
"type": "event"
},
{
"inputs": [],
"name": "MIN_BID",
"outputs": [
{
"internalType": "uint128",
"name": "",
"type": "uint128"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "admin",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint8",
"name": "slot",
"type": "uint8"
},
{
"internalType": "uint128",
"name": "bid",
"type": "uint128"
},
{
"internalType": "address",
"name": "delegate",
"type": "address"
}
],
"name": "claimSlot",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint8",
"name": "slot",
"type": "uint8"
},
{
"internalType": "uint128",
"name": "bid",
"type": "uint128"
},
{
"internalType": "address",
"name": "delegate",
"type": "address"
},
{
"internalType": "uint256",
"name": "deadline",
"type": "uint256"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"name": "claimSlotWithPermit",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20Extended",
"name": "_token",
"type": "address"
},
{
"internalType": "contract ILockManager",
"name": "_lockManager",
"type": "address"
},
{
"internalType": "address",
"name": "_admin",
"type": "address"
},
{
"internalType": "uint16",
"name": "_taxNumerator",
"type": "uint16"
},
{
"internalType": "uint16",
"name": "_taxDenominator",
"type": "uint16"
}
],
"name": "initialize",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "lockManager",
"outputs": [
{
"internalType": "contract ILockManager",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "lockedBalance",
"outputs": [
{
"internalType": "uint128",
"name": "",
"type": "uint128"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newAdmin",
"type": "address"
}
],
"name": "setAdmin",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint8",
"name": "slot",
"type": "uint8"
},
{
"internalType": "address",
"name": "delegate",
"type": "address"
}
],
"name": "setSlotDelegate",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint16",
"name": "numerator",
"type": "uint16"
},
{
"internalType": "uint16",
"name": "denominator",
"type": "uint16"
}
],
"name": "setTaxRate",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint8",
"name": "slot",
"type": "uint8"
}
],
"name": "slotBalance",
"outputs": [
{
"internalType": "uint128",
"name": "balance",
"type": "uint128"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"name": "slotBid",
"outputs": [
{
"internalType": "address",
"name": "bidder",
"type": "address"
},
{
"internalType": "uint16",
"name": "taxNumerator",
"type": "uint16"
},
{
"internalType": "uint16",
"name": "taxDenominator",
"type": "uint16"
},
{
"internalType": "uint64",
"name": "periodStart",
"type": "uint64"
},
{
"internalType": "uint128",
"name": "bidAmount",
"type": "uint128"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint8",
"name": "slot",
"type": "uint8"
}
],
"name": "slotCost",
"outputs": [
{
"internalType": "uint128",
"name": "",
"type": "uint128"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint8",
"name": "slot",
"type": "uint8"
}
],
"name": "slotDelegate",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
}
],
"name": "slotExpiration",
"outputs": [
{
"internalType": "uint64",
"name": "",
"type": "uint64"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint8",
"name": "slot",
"type": "uint8"
}
],
"name": "slotForeclosed",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint8",
"name": "slot",
"type": "uint8"
}
],
"name": "slotOwner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint128",
"name": "amount",
"type": "uint128"
}
],
"name": "stake",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint128",
"name": "amount",
"type": "uint128"
},
{
"internalType": "uint256",
"name": "deadline",
"type": "uint256"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"name": "stakeWithPermit",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "stakedBalance",
"outputs": [
{
"internalType": "uint128",
"name": "",
"type": "uint128"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "taxDenominator",
"outputs": [
{
"internalType": "uint16",
"name": "",
"type": "uint16"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "taxNumerator",
"outputs": [
{
"internalType": "uint16",
"name": "",
"type": "uint16"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "token",
"outputs": [
{
"internalType": "contract IERC20Extended",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint128",
"name": "amount",
"type": "uint128"
}
],
"name": "unstake",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint128",
"name": "amount",
"type": "uint128"
}
],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]

View File

@ -0,0 +1,998 @@
[
{
"inputs": [
{
"internalType": "contract IERC20Mintable",
"name": "token_",
"type": "address"
},
{
"internalType": "address",
"name": "governance_",
"type": "address"
},
{
"internalType": "address",
"name": "admin",
"type": "address"
},
{
"internalType": "uint256",
"name": "updateThreshold_",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "totalClaimed",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "totalSlashed",
"type": "uint256"
}
],
"name": "AccountUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "approved",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "ApprovalForAll",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "index",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "totalEarned",
"type": "uint256"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "claimed",
"type": "uint256"
}
],
"name": "Claimed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "to",
"type": "address"
}
],
"name": "GovernanceChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "bytes32",
"name": "merkleRoot",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "uint256",
"name": "distributionNumber",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "metadataURI",
"type": "string"
}
],
"name": "MerkleRootUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "string",
"name": "_value",
"type": "string"
},
{
"indexed": true,
"internalType": "uint256",
"name": "_id",
"type": "uint256"
}
],
"name": "PermanentURI",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "previousAdminRole",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "newAdminRole",
"type": "bytes32"
}
],
"name": "RoleAdminChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleGranted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleRevoked",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "slashed",
"type": "uint256"
}
],
"name": "Slashed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint256",
"name": "updateThreshold",
"type": "uint256"
}
],
"name": "UpdateThresholdChanged",
"type": "event"
},
{
"inputs": [],
"name": "DEFAULT_ADMIN_ROLE",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "DISTRIBUTOR_ROLE",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "SLASHER_ROLE",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "UPDATER_ROLE",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "accountState",
"outputs": [
{
"internalType": "uint256",
"name": "totalClaimed",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "totalSlashed",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "approve",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
},
{
"internalType": "address",
"name": "account",
"type": "address"
},
{
"internalType": "uint256",
"name": "totalEarned",
"type": "uint256"
},
{
"internalType": "bytes32[]",
"name": "merkleProof",
"type": "bytes32[]"
}
],
"name": "claim",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "distributionCount",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "getApproved",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
}
],
"name": "getRoleAdmin",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "governance",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "grantRole",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "hasRole",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "operator",
"type": "address"
}
],
"name": "isApprovedForAll",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "merkleRoot",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "ownerOf",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"name": "previousMerkleRoot",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "renounceRole",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "revokeRole",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "safeTransferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "_data",
"type": "bytes"
}
],
"name": "safeTransferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "setApprovalForAll",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
}
],
"name": "setGovernance",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "to",
"type": "uint256"
}
],
"name": "setUpdateThreshold",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "account",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "slash",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes4",
"name": "interfaceId",
"type": "bytes4"
}
],
"name": "supportsInterface",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "token",
"outputs": [
{
"internalType": "contract IERC20Mintable",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
}
],
"name": "tokenByIndex",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
}
],
"name": "tokenOfOwnerByIndex",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "tokenURI",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "_merkleRoot",
"type": "bytes32"
},
{
"internalType": "string",
"name": "uri",
"type": "string"
},
{
"internalType": "uint256",
"name": "_distributionNumber",
"type": "uint256"
}
],
"name": "updateMerkleRoot",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "updateThreshold",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}
]

View File

@ -0,0 +1,505 @@
[
{
"inputs": [
{
"internalType": "address",
"name": "_admin",
"type": "address"
},
{
"internalType": "address[]",
"name": "_blockProducers",
"type": "address[]"
},
{
"internalType": "address[]",
"name": "_collectors",
"type": "address[]"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "producer",
"type": "address"
}
],
"name": "BlockProducerAdded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "producer",
"type": "address"
}
],
"name": "BlockProducerRemoved",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "producer",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "collector",
"type": "address"
}
],
"name": "BlockProducerRewardCollectorChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [],
"name": "RewardScheduleChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "previousAdminRole",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes32",
"name": "newAdminRole",
"type": "bytes32"
}
],
"name": "RoleAdminChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleGranted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "RoleRevoked",
"type": "event"
},
{
"inputs": [],
"name": "DEFAULT_ADMIN_ROLE",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "DELEGATOR_ROLE",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "GOV_ROLE",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "REWARD_SCHEDULE_ENTRY_LENGTH",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "producer",
"type": "address"
}
],
"name": "add",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address[]",
"name": "producers",
"type": "address[]"
}
],
"name": "addBatch",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "blockProducer",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "producer",
"type": "address"
},
{
"internalType": "address",
"name": "collector",
"type": "address"
}
],
"name": "delegate",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address[]",
"name": "producers",
"type": "address[]"
},
{
"internalType": "address[]",
"name": "collectors",
"type": "address[]"
}
],
"name": "delegateBatch",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
}
],
"name": "getRoleAdmin",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "grantRole",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "hasRole",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "producer",
"type": "address"
}
],
"name": "remove",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address[]",
"name": "producers",
"type": "address[]"
}
],
"name": "removeBatch",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "renounceRole",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "role",
"type": "bytes32"
},
{
"internalType": "address",
"name": "account",
"type": "address"
}
],
"name": "revokeRole",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "rewardCollector",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "rewardScheduleEntries",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
}
],
"name": "rewardScheduleEntry",
"outputs": [
{
"components": [
{
"internalType": "uint64",
"name": "startTime",
"type": "uint64"
},
{
"internalType": "uint64",
"name": "epochDuration",
"type": "uint64"
},
{
"internalType": "uint128",
"name": "rewardsPerEpoch",
"type": "uint128"
}
],
"internalType": "struct IGovernance.RewardScheduleEntry",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes",
"name": "set",
"type": "bytes"
}
],
"name": "setRewardSchedule",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes4",
"name": "interfaceId",
"type": "bytes4"
}
],
"name": "supportsInterface",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
}
]

View File

@ -0,0 +1,330 @@
type Producer @entity {
# Address
id: ID!
# Currently added (true) or removed (false)
active: Boolean!
# Address of collector
rewardCollector: Bytes
# Total rewards, does not include pending rewards
rewards: BigInt!
# Total number of blocks produced by this producer, not including in the pending epoch
confirmedBlocks: BigInt!
# Blocks produced in pending epoch
pendingEpochBlocks: BigInt!
}
type ProducerSet @entity {
# Governance address
id: ID!
# All registered (active and inactive) producers
producers: [Producer!]!
}
enum ProducerSetChangeType {
Added
Removed
}
type ProducerSetChange @entity {
# Transaction
id: ID!
# Block change occured in (effective next block)
blockNumber: BigInt!
# Producer address
producer: Bytes!
# Set change type
changeType: ProducerSetChangeType!
}
type ProducerRewardCollectorChange @entity {
# Transaction
id: ID!
# Block change occured in (effective next block)
blockNumber: BigInt!
# Producer address
producer: Bytes!
# Address of collector
rewardCollector: Bytes!
}
type RewardScheduleEntry @entity {
# ID of transaction applying schedule plus index (e.g. 0xfoo+index1)
id: ID!
# Timestamp of reward start
startTime: BigInt!
# Duration of epochs
epochDuration: BigInt!
# Rewards per epoch
rewardsPerEpoch: BigInt!
}
type RewardSchedule @entity {
# Governance address
id: ID!
# Current block reward schedule
rewardScheduleEntries: [RewardScheduleEntry!]!
# Last finished epoch
lastEpoch: Epoch
# Current pending epoch
pendingEpoch: Epoch
# Active reward schedule entry
activeRewardScheduleEntry: RewardScheduleEntry
}
type ProducerEpoch @entity {
# Producer address + epoch, e.g. 0xf00+epochX
id: ID!
# Producer address
address: Bytes!
# Epoch
epoch: Epoch!
# Total cumulative rewards for producer (replicated to merkle tree)
totalRewards: BigInt!
# Blocks produced by this producer during this epoch
blocksProduced: BigInt!
# Ratio of blocks produced compared to those by all registered producers [0.0, 1.0]
blocksProducedRatio: BigDecimal!
}
type Block @entity {
# Block hash
id: ID!
# If produced by an active producer
fromActiveProducer: Boolean!
# Block properties
hash: Bytes!
parentHash: Bytes!
unclesHash: Bytes!
author: Bytes!
stateRoot: Bytes!
transactionsRoot: Bytes!
receiptsRoot: Bytes!
number: BigInt!
gasUsed: BigInt!
gasLimit: BigInt!
timestamp: BigInt!
difficulty: BigInt!
totalDifficulty: BigInt!
size: BigInt
}
type Epoch @entity {
# Governance address + epoch e.g. 0xf00+epochX
id: ID!
# If epoch has been finished
finalized: Boolean!
# Epoch number
epochNumber: BigInt!
# Start block
startBlock: Block
# End block
endBlock: Block
# Producer blocks
producerBlocks: BigInt!
# All blocks
allBlocks: BigInt!
# Ratio of producer blocks to all blocks [0.0, 1.0]
producerBlocksRatio: BigDecimal!
# Snapshot of rewards
producerRewards: [ProducerEpoch!]! @derivedFrom(field: "epoch")
}
type SlotClaim @entity {
# Transaction
id: ID!
# Slot
slot: Slot!
# Owner address
owner: Bytes!
# Winning bid
winningBid: BigInt!
# Old bid
oldBid: BigInt!
# Timestamp of when slot ownership started
startTime: BigInt!
# Timestamp of when slot ownership expires
expirationTime: BigInt!
# Tax rate per day
taxRatePerDay: BigDecimal!
}
type Slot @entity {
# Address of network contract + slot index, e.g. "0xF00-0"
id: ID!
# Owner address
owner: Bytes!
# Delegate address
delegate: Bytes!
# Winning bid
winningBid: BigInt!
# Old bid
oldBid: BigInt!
# Timestamp of when slot ownership started
startTime: BigInt!
# Timestamp of when slot ownership expires
expirationTime: BigInt!
# Tax rate per day
taxRatePerDay: BigDecimal!
# Slot claims
claims: [SlotClaim]! @derivedFrom(field: "slot")
}
type Staker @entity {
# Address of staker
id: ID!
# Amount staked
staked: BigInt!
# Zero-based (zero being highest) rank of non-zero stakers, or null for a zero stake
rank: BigInt
}
type Network @entity {
# Address of contract
id: ID!
slot0: Slot
slot1: Slot
slot2: Slot
stakers: [Staker!]!
# Number of non-zero stakers
numStakers: BigInt
# Total amount staked
totalStaked: BigInt!
# Percentiles (0-99) of staker amounts
stakedPercentiles: [BigInt!]!
}
type Distributor @entity {
# Address of distributor contract
id: ID!
# The current distribution
currentDistribution: Distribution
}
type Distribution @entity {
# Transaction
id: ID!
# Distributor
distributor: Distributor!
# Timestamp distribution was applied
timestamp: BigInt!
# Distribution number
distributionNumber: BigInt!
# Root of the merkle tree containing total earned rewards
merkleRoot: Bytes!
# Metadata URI
metadataURI: String!
}
type Claim @entity {
# Transaction
id: ID!
# Timestamp claim was made
timestamp: BigInt!
# Index in the merkle tree
index: BigInt!
# Account
account: Account!
# Total amount earned
totalEarned: BigInt!
# Claimed amount by this claim
claimed: BigInt!
}
type Slash @entity {
# Transaction
id: ID!
# Timestamp slash was made
timestamp: BigInt!
# Account
account: Account!
# Slashed amount by this slash
slashed: BigInt!
}
type Account @entity {
# Account address
id: ID!
# Total amount claimed
totalClaimed: BigInt!
# Total amount slashed
totalSlashed: BigInt!
# All claims
claims: [Claim!]! @derivedFrom(field: "account")
# All slashes
slashes: [Slash!]! @derivedFrom(field: "account")
}

View File

@ -0,0 +1,100 @@
specVersion: 0.0.2
schema:
file: schema.graphql
dataSources:
- kind: ethereum/contract
name: EdenNetworkGovernance
network: mainnet
source:
address: "0x726aDC632871Ff796379da14F9D5aeb199bEd505"
abi: Governance
startBlock: 12948292
mapping:
kind: ethereum/events
apiVersion: 0.0.4
language: wasm/assemblyScript
entities:
- Producer
- ProducerSet
- ProducerSetChange
- ProducerRewardCollectorChange
- RewardScheduleEntry
- RewardSchedule
- ProducerEpoch
- Block
- Epoch
abis:
- name: Governance
file: EdenNetworkGovernance/abis/DistributorGovernance.json
eventHandlers:
- event: BlockProducerAdded(indexed address)
handler: blockProducerAdded
- event: BlockProducerRemoved(indexed address)
handler: blockProducerRemoved
- event: BlockProducerRewardCollectorChanged(indexed address,indexed address)
handler: blockProducerRewardCollectorChanged
- event: RewardScheduleChanged()
handler: rewardScheduleChanged
blockHandlers:
- handler: handleBlock
file: EdenNetworkGovernance/EdenNetworkGovernance.wasm
- kind: ethereum/contract
name: EdenNetwork
network: mainnet
source:
address: "0x9E3382cA57F4404AC7Bf435475EAe37e87D1c453"
abi: EdenNetwork
startBlock: 12948381
mapping:
kind: ethereum/events
apiVersion: 0.0.4
language: wasm/assemblyScript
entities:
- Slot
- Staker
- Network
- SlotClaim
abis:
- name: EdenNetwork
file: EdenNetwork/abis/EdenNetwork.json
eventHandlers:
- event: SlotClaimed(indexed uint8,indexed address,indexed
address,uint128,uint128,uint16,uint16)
handler: slotClaimed
- event: SlotDelegateUpdated(indexed uint8,indexed address,indexed address,address)
handler: slotDelegateUpdated
- event: Stake(indexed address,uint256)
handler: stake
- event: Unstake(indexed address,uint256)
handler: unstake
file: EdenNetwork/EdenNetwork.wasm
- kind: ethereum/contract
name: EdenNetworkDistribution
network: mainnet
source:
address: "0x2Ae0f92498346B9e011ED15d8C98142DCF62F774"
abi: Distribution
startBlock: 12948356
mapping:
kind: ethereum/events
apiVersion: 0.0.4
language: wasm/assemblyScript
entities:
- Distributor
- Distribution
- Claim
- Slash
- Account
abis:
- name: Distribution
file: EdenNetworkDistribution/abis/MerkleDistributor.json
eventHandlers:
- event: Claimed(uint256,uint256,indexed address,uint256)
handler: claimed
- event: Slashed(indexed address,uint256)
handler: slashed
- event: MerkleRootUpdated(bytes32,uint256,string)
handler: merkleRootUpdated
- event: AccountUpdated(indexed address,uint256,uint256)
handler: accountUpdated
file: EdenNetworkDistribution/EdenNetworkDistribution.wasm

View File

@ -97,5 +97,5 @@
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
},
"exclude": ["dist"]
"exclude": ["assembly", "dist"]
}