basic events

This commit is contained in:
mihaisc 2021-11-04 17:00:43 +02:00
parent dd238aa614
commit b39ecb6e12
33 changed files with 5399 additions and 60855 deletions

View File

@ -1,4 +1,4 @@
node_modules node_modules
data data
src/types src/@types

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,679 +0,0 @@
[
{
"constant": false,
"inputs": [
{
"name": "spender",
"type": "address"
},
{
"name": "amount",
"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": "sender",
"type": "address"
},
{
"name": "recipient",
"type": "address"
},
{
"name": "amount",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "BASE_MARKET_FEE_PERCENTAGE",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "spender",
"type": "address"
},
{
"name": "addedValue",
"type": "uint256"
}
],
"name": "increaseAllowance",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "account",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "spender",
"type": "address"
},
{
"name": "subtractedValue",
"type": "uint256"
}
],
"name": "decreaseAllowance",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "recipient",
"type": "address"
},
{
"name": "amount",
"type": "uint256"
}
],
"name": "transfer",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "BASE_COMMUNITY_FEE_PERCENTAGE",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"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"
},
{
"constant": true,
"inputs": [],
"name": "BASE",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"name": "name",
"type": "string"
},
{
"name": "symbol",
"type": "string"
},
{
"name": "minterAddress",
"type": "address"
},
{
"name": "cap",
"type": "uint256"
},
{
"name": "blob",
"type": "string"
},
{
"name": "feeCollector",
"type": "address"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "consumer",
"type": "address"
},
{
"indexed": true,
"name": "payer",
"type": "address"
},
{
"indexed": false,
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"name": "serviceId",
"type": "uint256"
},
{
"indexed": false,
"name": "timestamp",
"type": "uint256"
},
{
"indexed": true,
"name": "mrktFeeCollector",
"type": "address"
},
{
"indexed": false,
"name": "marketFee",
"type": "uint256"
}
],
"name": "OrderStarted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "orderTxId",
"type": "bytes32"
},
{
"indexed": true,
"name": "consumer",
"type": "address"
},
{
"indexed": false,
"name": "amount",
"type": "uint256"
},
{
"indexed": false,
"name": "serviceId",
"type": "uint256"
},
{
"indexed": true,
"name": "provider",
"type": "address"
},
{
"indexed": false,
"name": "timestamp",
"type": "uint256"
}
],
"name": "OrderFinished",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "currentMinter",
"type": "address"
},
{
"indexed": false,
"name": "newMinter",
"type": "address"
}
],
"name": "MinterProposed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"name": "currentMinter",
"type": "address"
},
{
"indexed": false,
"name": "newMinter",
"type": "address"
}
],
"name": "MinterApproved",
"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"
},
{
"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"
},
{
"constant": false,
"inputs": [
{
"name": "name",
"type": "string"
},
{
"name": "symbol",
"type": "string"
},
{
"name": "minterAddress",
"type": "address"
},
{
"name": "cap",
"type": "uint256"
},
{
"name": "blob",
"type": "string"
},
{
"name": "feeCollector",
"type": "address"
}
],
"name": "initialize",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "account",
"type": "address"
},
{
"name": "value",
"type": "uint256"
}
],
"name": "mint",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "consumer",
"type": "address"
},
{
"name": "amount",
"type": "uint256"
},
{
"name": "serviceId",
"type": "uint256"
},
{
"name": "mrktFeeCollector",
"type": "address"
}
],
"name": "startOrder",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "orderTxId",
"type": "bytes32"
},
{
"name": "consumer",
"type": "address"
},
{
"name": "amount",
"type": "uint256"
},
{
"name": "serviceId",
"type": "uint256"
}
],
"name": "finishOrder",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "newMinter",
"type": "address"
}
],
"name": "proposeMinter",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": false,
"inputs": [],
"name": "approveMinter",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "blob",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "decimals",
"outputs": [
{
"name": "",
"type": "uint8"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "cap",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "account",
"type": "address"
}
],
"name": "isMinter",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "minter",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "isInitialized",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "amount",
"type": "uint256"
},
{
"name": "feePercentage",
"type": "uint256"
}
],
"name": "calculateFee",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "pure",
"type": "function"
}
]

File diff suppressed because one or more lines are too long

View File

@ -1,222 +0,0 @@
[
{
"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"
}
]

View File

@ -1,17 +0,0 @@
[
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]

View File

@ -1,17 +0,0 @@
[
{
"constant": true,
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]

1174
abis/ERC20Template.json Normal file

File diff suppressed because one or more lines are too long

1095
abis/ERC721Factory.json Normal file

File diff suppressed because one or more lines are too long

790
abis/FactoryRouter.json Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@ services:
postgres_pass: let-me-in postgres_pass: let-me-in
postgres_db: graph-node postgres_db: graph-node
ipfs: 'ipfs:5001' ipfs: 'ipfs:5001'
ethereum: 'rinkeby:https://rinkeby.infura.io/v3/${INFURA_PROJECT_ID}' ethereum: 'barge:http://172.15.0.3:8545'
RUST_LOG: info RUST_LOG: info
ipfs: ipfs:
image: ipfs/go-ipfs:v0.4.23 image: ipfs/go-ipfs:v0.4.23

541
package-lock.json generated
View File

@ -22,7 +22,7 @@
"auto-changelog": "^2.3.0", "auto-changelog": "^2.3.0",
"chai": "^4.3.4", "chai": "^4.3.4",
"chai-spies": "^1.0.0", "chai-spies": "^1.0.0",
"eslint": "^8.0.1", "eslint": "^7.32.0",
"eslint-config-oceanprotocol": "^1.5.0", "eslint-config-oceanprotocol": "^1.5.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.24.2", "eslint-plugin-import": "^2.24.2",
@ -1284,14 +1284,14 @@
"deprecated": "Please use @ensdomains/ens-contracts" "deprecated": "Please use @ensdomains/ens-contracts"
}, },
"node_modules/@eslint/eslintrc": { "node_modules/@eslint/eslintrc": {
"version": "1.0.3", "version": "0.4.3",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.0.3.tgz", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz",
"integrity": "sha512-DHI1wDPoKCBPoLZA3qDR91+3te/wDSc1YhKg3jR8NxKKRJq2hwHwcWv31cSwSYvIBrmbENoYMWcenW8uproQqg==", "integrity": "sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"ajv": "^6.12.4", "ajv": "^6.12.4",
"debug": "^4.3.2", "debug": "^4.1.1",
"espree": "^9.0.0", "espree": "^7.3.0",
"globals": "^13.9.0", "globals": "^13.9.0",
"ignore": "^4.0.6", "ignore": "^4.0.6",
"import-fresh": "^3.2.1", "import-fresh": "^3.2.1",
@ -1300,7 +1300,7 @@
"strip-json-comments": "^3.1.1" "strip-json-comments": "^3.1.1"
}, },
"engines": { "engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0" "node": "^10.12.0 || >=12.0.0"
} }
}, },
"node_modules/@ethereum-navigator/atlas": { "node_modules/@ethereum-navigator/atlas": {
@ -3704,9 +3704,9 @@
} }
}, },
"node_modules/@humanwhocodes/config-array": { "node_modules/@humanwhocodes/config-array": {
"version": "0.6.0", "version": "0.5.0",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.6.0.tgz", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz",
"integrity": "sha512-JQlEKbcgEUjBFhLIF4iqM7u/9lwgHRBcpHrmUNCALK0Q3amXN6lxdoXLnF0sm11E9VqTmBALR87IlUg1bZ8A9A==", "integrity": "sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@humanwhocodes/object-schema": "^1.2.0", "@humanwhocodes/object-schema": "^1.2.0",
@ -11104,6 +11104,15 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/astral-regex": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz",
"integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/async": { "node_modules/async": {
"version": "2.6.3", "version": "2.6.3",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz",
@ -15101,36 +15110,37 @@
} }
}, },
"node_modules/eslint": { "node_modules/eslint": {
"version": "8.0.1", "version": "7.32.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.0.1.tgz", "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz",
"integrity": "sha512-LsgcwZgQ72vZ+SMp4K6pAnk2yFDWL7Ti4pJaRvsZ0Hsw2h8ZjUIW38a9AFn2cZXdBMlScMFYYgsSp4ttFI/0bA==", "integrity": "sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"@eslint/eslintrc": "^1.0.3", "@babel/code-frame": "7.12.11",
"@humanwhocodes/config-array": "^0.6.0", "@eslint/eslintrc": "^0.4.3",
"@humanwhocodes/config-array": "^0.5.0",
"ajv": "^6.10.0", "ajv": "^6.10.0",
"chalk": "^4.0.0", "chalk": "^4.0.0",
"cross-spawn": "^7.0.2", "cross-spawn": "^7.0.2",
"debug": "^4.3.2", "debug": "^4.0.1",
"doctrine": "^3.0.0", "doctrine": "^3.0.0",
"enquirer": "^2.3.5", "enquirer": "^2.3.5",
"escape-string-regexp": "^4.0.0", "escape-string-regexp": "^4.0.0",
"eslint-scope": "^6.0.0", "eslint-scope": "^5.1.1",
"eslint-utils": "^3.0.0", "eslint-utils": "^2.1.0",
"eslint-visitor-keys": "^3.0.0", "eslint-visitor-keys": "^2.0.0",
"espree": "^9.0.0", "espree": "^7.3.1",
"esquery": "^1.4.0", "esquery": "^1.4.0",
"esutils": "^2.0.2", "esutils": "^2.0.2",
"fast-deep-equal": "^3.1.3", "fast-deep-equal": "^3.1.3",
"file-entry-cache": "^6.0.1", "file-entry-cache": "^6.0.1",
"functional-red-black-tree": "^1.0.1", "functional-red-black-tree": "^1.0.1",
"glob-parent": "^6.0.1", "glob-parent": "^5.1.2",
"globals": "^13.6.0", "globals": "^13.6.0",
"ignore": "^4.0.6", "ignore": "^4.0.6",
"import-fresh": "^3.0.0", "import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4", "imurmurhash": "^0.1.4",
"is-glob": "^4.0.0", "is-glob": "^4.0.0",
"js-yaml": "^4.1.0", "js-yaml": "^3.13.1",
"json-stable-stringify-without-jsonify": "^1.0.1", "json-stable-stringify-without-jsonify": "^1.0.1",
"levn": "^0.4.1", "levn": "^0.4.1",
"lodash.merge": "^4.6.2", "lodash.merge": "^4.6.2",
@ -15138,10 +15148,11 @@
"natural-compare": "^1.4.0", "natural-compare": "^1.4.0",
"optionator": "^0.9.1", "optionator": "^0.9.1",
"progress": "^2.0.0", "progress": "^2.0.0",
"regexpp": "^3.2.0", "regexpp": "^3.1.0",
"semver": "^7.2.1", "semver": "^7.2.1",
"strip-ansi": "^6.0.0", "strip-ansi": "^6.0.0",
"strip-json-comments": "^3.1.0", "strip-json-comments": "^3.1.0",
"table": "^6.0.9",
"text-table": "^0.2.0", "text-table": "^0.2.0",
"v8-compile-cache": "^2.0.3" "v8-compile-cache": "^2.0.3"
}, },
@ -15149,7 +15160,7 @@
"eslint": "bin/eslint.js" "eslint": "bin/eslint.js"
}, },
"engines": { "engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0" "node": "^10.12.0 || >=12.0.0"
}, },
"funding": { "funding": {
"url": "https://opencollective.com/eslint" "url": "https://opencollective.com/eslint"
@ -16365,12 +16376,6 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/eslint/node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true
},
"node_modules/eslint/node_modules/chalk": { "node_modules/eslint/node_modules/chalk": {
"version": "4.1.2", "version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
@ -16387,71 +16392,28 @@
"url": "https://github.com/chalk/chalk?sponsor=1" "url": "https://github.com/chalk/chalk?sponsor=1"
} }
}, },
"node_modules/eslint/node_modules/eslint-scope": { "node_modules/eslint/node_modules/eslint-utils": {
"version": "6.0.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-6.0.0.tgz", "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz",
"integrity": "sha512-uRDL9MWmQCkaFus8RF5K9/L/2fn+80yoW3jkD53l4shjCh26fCtvJGasxjUqP5OT87SYTxCVA3BwTUzuELx9kA==", "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"esrecurse": "^4.3.0", "eslint-visitor-keys": "^1.1.0"
"estraverse": "^5.2.0"
}, },
"engines": { "engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0" "node": ">=6"
},
"funding": {
"url": "https://github.com/sponsors/mysticatea"
} }
}, },
"node_modules/eslint/node_modules/eslint-visitor-keys": { "node_modules/eslint/node_modules/eslint-utils/node_modules/eslint-visitor-keys": {
"version": "3.0.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.0.0.tgz", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
"integrity": "sha512-mJOZa35trBTb3IyRmo8xmKBZlxf+N7OnUl4+ZhJHs/r+0770Wh/LEACE2pqMGMe27G/4y8P2bYGk4J70IC5k1Q==", "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0" "node": ">=4"
}
},
"node_modules/eslint/node_modules/estraverse": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz",
"integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==",
"dev": true,
"engines": {
"node": ">=4.0"
}
},
"node_modules/eslint/node_modules/glob-parent": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
"integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",
"dev": true,
"dependencies": {
"is-glob": "^4.0.3"
},
"engines": {
"node": ">=10.13.0"
}
},
"node_modules/eslint/node_modules/is-glob": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
"dev": true,
"dependencies": {
"is-extglob": "^2.1.1"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/eslint/node_modules/js-yaml": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"dev": true,
"dependencies": {
"argparse": "^2.0.1"
},
"bin": {
"js-yaml": "bin/js-yaml.js"
} }
}, },
"node_modules/eslint/node_modules/strip-ansi": { "node_modules/eslint/node_modules/strip-ansi": {
@ -16467,38 +16429,26 @@
} }
}, },
"node_modules/espree": { "node_modules/espree": {
"version": "9.0.0", "version": "7.3.1",
"resolved": "https://registry.npmjs.org/espree/-/espree-9.0.0.tgz", "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz",
"integrity": "sha512-r5EQJcYZ2oaGbeR0jR0fFVijGOcwai07/690YRXLINuhmVeRY4UKSAsQPe/0BNuDgwP7Ophoc1PRsr2E3tkbdQ==", "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"acorn": "^8.5.0", "acorn": "^7.4.0",
"acorn-jsx": "^5.3.1", "acorn-jsx": "^5.3.1",
"eslint-visitor-keys": "^3.0.0" "eslint-visitor-keys": "^1.3.0"
}, },
"engines": { "engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0" "node": "^10.12.0 || >=12.0.0"
}
},
"node_modules/espree/node_modules/acorn": {
"version": "8.5.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.5.0.tgz",
"integrity": "sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q==",
"dev": true,
"bin": {
"acorn": "bin/acorn"
},
"engines": {
"node": ">=0.4.0"
} }
}, },
"node_modules/espree/node_modules/eslint-visitor-keys": { "node_modules/espree/node_modules/eslint-visitor-keys": {
"version": "3.0.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.0.0.tgz", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
"integrity": "sha512-mJOZa35trBTb3IyRmo8xmKBZlxf+N7OnUl4+ZhJHs/r+0770Wh/LEACE2pqMGMe27G/4y8P2bYGk4J70IC5k1Q==", "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0" "node": ">=4"
} }
}, },
"node_modules/esprima": { "node_modules/esprima": {
@ -19459,9 +19409,9 @@
} }
}, },
"node_modules/globals": { "node_modules/globals": {
"version": "13.11.0", "version": "13.12.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-13.11.0.tgz", "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz",
"integrity": "sha512-08/xrJ7wQjK9kkkRoI3OFUBbLx4f+6x3SGwcPvQ0QH6goFDrOU2oyAWrmh3dJezu65buo+HBMzAMQy6rovVC3g==", "integrity": "sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg==",
"dev": true, "dev": true,
"dependencies": { "dependencies": {
"type-fest": "^0.20.2" "type-fest": "^0.20.2"
@ -24108,6 +24058,12 @@
"integrity": "sha1-j/TexTLYJIavWVc8OURZFOlEp/E=", "integrity": "sha1-j/TexTLYJIavWVc8OURZFOlEp/E=",
"dev": true "dev": true
}, },
"node_modules/lodash.truncate": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz",
"integrity": "sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=",
"dev": true
},
"node_modules/lodash.uppercase": { "node_modules/lodash.uppercase": {
"version": "4.3.0", "version": "4.3.0",
"resolved": "https://registry.npmjs.org/lodash.uppercase/-/lodash.uppercase-4.3.0.tgz", "resolved": "https://registry.npmjs.org/lodash.uppercase/-/lodash.uppercase-4.3.0.tgz",
@ -30754,6 +30710,32 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/slice-ansi": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz",
"integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==",
"dev": true,
"dependencies": {
"ansi-styles": "^4.0.0",
"astral-regex": "^2.0.0",
"is-fullwidth-code-point": "^3.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/slice-ansi?sponsor=1"
}
},
"node_modules/slice-ansi/node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/snake-case": { "node_modules/snake-case": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/snake-case/-/snake-case-2.1.0.tgz", "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-2.1.0.tgz",
@ -32074,6 +32056,104 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/table": {
"version": "6.7.2",
"resolved": "https://registry.npmjs.org/table/-/table-6.7.2.tgz",
"integrity": "sha512-UFZK67uvyNivLeQbVtkiUs8Uuuxv24aSL4/Vil2PJVtMgU8Lx0CYkP12uCGa3kjyQzOSgV1+z9Wkb82fCGsO0g==",
"dev": true,
"dependencies": {
"ajv": "^8.0.1",
"lodash.clonedeep": "^4.5.0",
"lodash.truncate": "^4.4.2",
"slice-ansi": "^4.0.0",
"string-width": "^4.2.3",
"strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/table/node_modules/ajv": {
"version": "8.6.3",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.6.3.tgz",
"integrity": "sha512-SMJOdDP6LqTkD0Uq8qLi+gMwSt0imXLSV080qFVwJCpH9U6Mb+SUGHAXM0KNbcBPguytWyvFxcHgMLe2D2XSpw==",
"dev": true,
"dependencies": {
"fast-deep-equal": "^3.1.1",
"json-schema-traverse": "^1.0.0",
"require-from-string": "^2.0.2",
"uri-js": "^4.2.2"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/epoberezkin"
}
},
"node_modules/table/node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/table/node_modules/emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"dev": true
},
"node_modules/table/node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/table/node_modules/json-schema-traverse": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
"dev": true
},
"node_modules/table/node_modules/require-from-string": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
"integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/table/node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/table/node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"dependencies": {
"ansi-regex": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/taffydb": { "node_modules/taffydb": {
"version": "2.7.3", "version": "2.7.3",
"resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.7.3.tgz", "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.7.3.tgz",
@ -37922,14 +38002,14 @@
"integrity": "sha512-bvaTH34PMCbv6anRa9I/0zjLJgY4EuznbEMgbV77JBCQ9KNC46rzi0avuxpOfu+xDjPEtSFGqVEOr5GlUSGudA==" "integrity": "sha512-bvaTH34PMCbv6anRa9I/0zjLJgY4EuznbEMgbV77JBCQ9KNC46rzi0avuxpOfu+xDjPEtSFGqVEOr5GlUSGudA=="
}, },
"@eslint/eslintrc": { "@eslint/eslintrc": {
"version": "1.0.3", "version": "0.4.3",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.0.3.tgz", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz",
"integrity": "sha512-DHI1wDPoKCBPoLZA3qDR91+3te/wDSc1YhKg3jR8NxKKRJq2hwHwcWv31cSwSYvIBrmbENoYMWcenW8uproQqg==", "integrity": "sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw==",
"dev": true, "dev": true,
"requires": { "requires": {
"ajv": "^6.12.4", "ajv": "^6.12.4",
"debug": "^4.3.2", "debug": "^4.1.1",
"espree": "^9.0.0", "espree": "^7.3.0",
"globals": "^13.9.0", "globals": "^13.9.0",
"ignore": "^4.0.6", "ignore": "^4.0.6",
"import-fresh": "^3.2.1", "import-fresh": "^3.2.1",
@ -39899,9 +39979,9 @@
} }
}, },
"@humanwhocodes/config-array": { "@humanwhocodes/config-array": {
"version": "0.6.0", "version": "0.5.0",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.6.0.tgz", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.5.0.tgz",
"integrity": "sha512-JQlEKbcgEUjBFhLIF4iqM7u/9lwgHRBcpHrmUNCALK0Q3amXN6lxdoXLnF0sm11E9VqTmBALR87IlUg1bZ8A9A==", "integrity": "sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@humanwhocodes/object-schema": "^1.2.0", "@humanwhocodes/object-schema": "^1.2.0",
@ -46185,6 +46265,12 @@
"integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=",
"optional": true "optional": true
}, },
"astral-regex": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz",
"integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==",
"dev": true
},
"async": { "async": {
"version": "2.6.3", "version": "2.6.3",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz", "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz",
@ -49496,36 +49582,37 @@
} }
}, },
"eslint": { "eslint": {
"version": "8.0.1", "version": "7.32.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.0.1.tgz", "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.32.0.tgz",
"integrity": "sha512-LsgcwZgQ72vZ+SMp4K6pAnk2yFDWL7Ti4pJaRvsZ0Hsw2h8ZjUIW38a9AFn2cZXdBMlScMFYYgsSp4ttFI/0bA==", "integrity": "sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@eslint/eslintrc": "^1.0.3", "@babel/code-frame": "7.12.11",
"@humanwhocodes/config-array": "^0.6.0", "@eslint/eslintrc": "^0.4.3",
"@humanwhocodes/config-array": "^0.5.0",
"ajv": "^6.10.0", "ajv": "^6.10.0",
"chalk": "^4.0.0", "chalk": "^4.0.0",
"cross-spawn": "^7.0.2", "cross-spawn": "^7.0.2",
"debug": "^4.3.2", "debug": "^4.0.1",
"doctrine": "^3.0.0", "doctrine": "^3.0.0",
"enquirer": "^2.3.5", "enquirer": "^2.3.5",
"escape-string-regexp": "^4.0.0", "escape-string-regexp": "^4.0.0",
"eslint-scope": "^6.0.0", "eslint-scope": "^5.1.1",
"eslint-utils": "^3.0.0", "eslint-utils": "^2.1.0",
"eslint-visitor-keys": "^3.0.0", "eslint-visitor-keys": "^2.0.0",
"espree": "^9.0.0", "espree": "^7.3.1",
"esquery": "^1.4.0", "esquery": "^1.4.0",
"esutils": "^2.0.2", "esutils": "^2.0.2",
"fast-deep-equal": "^3.1.3", "fast-deep-equal": "^3.1.3",
"file-entry-cache": "^6.0.1", "file-entry-cache": "^6.0.1",
"functional-red-black-tree": "^1.0.1", "functional-red-black-tree": "^1.0.1",
"glob-parent": "^6.0.1", "glob-parent": "^5.1.2",
"globals": "^13.6.0", "globals": "^13.6.0",
"ignore": "^4.0.6", "ignore": "^4.0.6",
"import-fresh": "^3.0.0", "import-fresh": "^3.0.0",
"imurmurhash": "^0.1.4", "imurmurhash": "^0.1.4",
"is-glob": "^4.0.0", "is-glob": "^4.0.0",
"js-yaml": "^4.1.0", "js-yaml": "^3.13.1",
"json-stable-stringify-without-jsonify": "^1.0.1", "json-stable-stringify-without-jsonify": "^1.0.1",
"levn": "^0.4.1", "levn": "^0.4.1",
"lodash.merge": "^4.6.2", "lodash.merge": "^4.6.2",
@ -49533,10 +49620,11 @@
"natural-compare": "^1.4.0", "natural-compare": "^1.4.0",
"optionator": "^0.9.1", "optionator": "^0.9.1",
"progress": "^2.0.0", "progress": "^2.0.0",
"regexpp": "^3.2.0", "regexpp": "^3.1.0",
"semver": "^7.2.1", "semver": "^7.2.1",
"strip-ansi": "^6.0.0", "strip-ansi": "^6.0.0",
"strip-json-comments": "^3.1.0", "strip-json-comments": "^3.1.0",
"table": "^6.0.9",
"text-table": "^0.2.0", "text-table": "^0.2.0",
"v8-compile-cache": "^2.0.3" "v8-compile-cache": "^2.0.3"
}, },
@ -49547,12 +49635,6 @@
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true "dev": true
}, },
"argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true
},
"chalk": { "chalk": {
"version": "4.1.2", "version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
@ -49563,53 +49645,21 @@
"supports-color": "^7.1.0" "supports-color": "^7.1.0"
} }
}, },
"eslint-scope": { "eslint-utils": {
"version": "6.0.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-6.0.0.tgz", "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz",
"integrity": "sha512-uRDL9MWmQCkaFus8RF5K9/L/2fn+80yoW3jkD53l4shjCh26fCtvJGasxjUqP5OT87SYTxCVA3BwTUzuELx9kA==", "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==",
"dev": true, "dev": true,
"requires": { "requires": {
"esrecurse": "^4.3.0", "eslint-visitor-keys": "^1.1.0"
"estraverse": "^5.2.0"
}
}, },
"dependencies": {
"eslint-visitor-keys": { "eslint-visitor-keys": {
"version": "3.0.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.0.0.tgz", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
"integrity": "sha512-mJOZa35trBTb3IyRmo8xmKBZlxf+N7OnUl4+ZhJHs/r+0770Wh/LEACE2pqMGMe27G/4y8P2bYGk4J70IC5k1Q==", "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
"dev": true "dev": true
},
"estraverse": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz",
"integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==",
"dev": true
},
"glob-parent": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
"integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",
"dev": true,
"requires": {
"is-glob": "^4.0.3"
} }
},
"is-glob": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
"dev": true,
"requires": {
"is-extglob": "^2.1.1"
}
},
"js-yaml": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"dev": true,
"requires": {
"argparse": "^2.0.1"
} }
}, },
"strip-ansi": { "strip-ansi": {
@ -50520,26 +50570,20 @@
"dev": true "dev": true
}, },
"espree": { "espree": {
"version": "9.0.0", "version": "7.3.1",
"resolved": "https://registry.npmjs.org/espree/-/espree-9.0.0.tgz", "resolved": "https://registry.npmjs.org/espree/-/espree-7.3.1.tgz",
"integrity": "sha512-r5EQJcYZ2oaGbeR0jR0fFVijGOcwai07/690YRXLINuhmVeRY4UKSAsQPe/0BNuDgwP7Ophoc1PRsr2E3tkbdQ==", "integrity": "sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g==",
"dev": true, "dev": true,
"requires": { "requires": {
"acorn": "^8.5.0", "acorn": "^7.4.0",
"acorn-jsx": "^5.3.1", "acorn-jsx": "^5.3.1",
"eslint-visitor-keys": "^3.0.0" "eslint-visitor-keys": "^1.3.0"
}, },
"dependencies": { "dependencies": {
"acorn": {
"version": "8.5.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.5.0.tgz",
"integrity": "sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q==",
"dev": true
},
"eslint-visitor-keys": { "eslint-visitor-keys": {
"version": "3.0.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.0.0.tgz", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz",
"integrity": "sha512-mJOZa35trBTb3IyRmo8xmKBZlxf+N7OnUl4+ZhJHs/r+0770Wh/LEACE2pqMGMe27G/4y8P2bYGk4J70IC5k1Q==", "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==",
"dev": true "dev": true
} }
} }
@ -52937,9 +52981,9 @@
} }
}, },
"globals": { "globals": {
"version": "13.11.0", "version": "13.12.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-13.11.0.tgz", "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz",
"integrity": "sha512-08/xrJ7wQjK9kkkRoI3OFUBbLx4f+6x3SGwcPvQ0QH6goFDrOU2oyAWrmh3dJezu65buo+HBMzAMQy6rovVC3g==", "integrity": "sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg==",
"dev": true, "dev": true,
"requires": { "requires": {
"type-fest": "^0.20.2" "type-fest": "^0.20.2"
@ -56721,6 +56765,12 @@
"integrity": "sha1-j/TexTLYJIavWVc8OURZFOlEp/E=", "integrity": "sha1-j/TexTLYJIavWVc8OURZFOlEp/E=",
"dev": true "dev": true
}, },
"lodash.truncate": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz",
"integrity": "sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=",
"dev": true
},
"lodash.uppercase": { "lodash.uppercase": {
"version": "4.3.0", "version": "4.3.0",
"resolved": "https://registry.npmjs.org/lodash.uppercase/-/lodash.uppercase-4.3.0.tgz", "resolved": "https://registry.npmjs.org/lodash.uppercase/-/lodash.uppercase-4.3.0.tgz",
@ -62144,6 +62194,25 @@
"integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
"devOptional": true "devOptional": true
}, },
"slice-ansi": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz",
"integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==",
"dev": true,
"requires": {
"ansi-styles": "^4.0.0",
"astral-regex": "^2.0.0",
"is-fullwidth-code-point": "^3.0.0"
},
"dependencies": {
"is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true
}
}
},
"snake-case": { "snake-case": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/snake-case/-/snake-case-2.1.0.tgz", "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-2.1.0.tgz",
@ -63229,6 +63298,84 @@
"node-fetch": "^2.6.1" "node-fetch": "^2.6.1"
} }
}, },
"table": {
"version": "6.7.2",
"resolved": "https://registry.npmjs.org/table/-/table-6.7.2.tgz",
"integrity": "sha512-UFZK67uvyNivLeQbVtkiUs8Uuuxv24aSL4/Vil2PJVtMgU8Lx0CYkP12uCGa3kjyQzOSgV1+z9Wkb82fCGsO0g==",
"dev": true,
"requires": {
"ajv": "^8.0.1",
"lodash.clonedeep": "^4.5.0",
"lodash.truncate": "^4.4.2",
"slice-ansi": "^4.0.0",
"string-width": "^4.2.3",
"strip-ansi": "^6.0.1"
},
"dependencies": {
"ajv": {
"version": "8.6.3",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.6.3.tgz",
"integrity": "sha512-SMJOdDP6LqTkD0Uq8qLi+gMwSt0imXLSV080qFVwJCpH9U6Mb+SUGHAXM0KNbcBPguytWyvFxcHgMLe2D2XSpw==",
"dev": true,
"requires": {
"fast-deep-equal": "^3.1.1",
"json-schema-traverse": "^1.0.0",
"require-from-string": "^2.0.2",
"uri-js": "^4.2.2"
}
},
"ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"dev": true
},
"emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"dev": true
},
"is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true
},
"json-schema-traverse": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==",
"dev": true
},
"require-from-string": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
"integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
"dev": true
},
"string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dev": true,
"requires": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
}
},
"strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dev": true,
"requires": {
"ansi-regex": "^5.0.1"
}
}
}
},
"taffydb": { "taffydb": {
"version": "2.7.3", "version": "2.7.3",
"resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.7.3.tgz", "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.7.3.tgz",

View File

@ -8,10 +8,8 @@ type Token @entity {
supply: BigDecimal # supply: BigDecimal #
isDatatoken: Boolean! # isDatatoken: Boolean! #
factory: DatatokenFactory #
owner: String # address of ERC721 that owns the token, valid only for datatokens owner: String # address of ERC721 that owns the token, valid only for datatokens
minter: [String] # array of addresses with minter role, can be user wallet address, dispenser etc. minter: [User!] # array of addresses with minter role, can be user wallet address, dispenser etc.
feeManager: String # TODO: maybe we change name , depends on audit results . It's the address that collects the payments (NOT fees) feeManager: String # TODO: maybe we change name , depends on audit results . It's the address that collects the payments (NOT fees)
publishMarketFeeAddress: String # address of the market where the datatoken was created. This address collects market fees. publishMarketFeeAddress: String # address of the market where the datatoken was created. This address collects market fees.
publishMarketFeeToken: String # adreess of fee token (can be Ocean, ETH, etc.) publishMarketFeeToken: String # adreess of fee token (can be Ocean, ETH, etc.)
@ -26,53 +24,35 @@ type Token @entity {
block: Int # Block number when it was created block: Int # Block number when it was created
} }
type TokenValue { type TokenValuePair @entity {
id : ID!
token : Token! token : Token!
value : BigDecimal! value : BigDecimal!
} }
type NftToken @entity{ type Nft @entity{
id: ID! # id: ID! # nft address
symbol: String! # symbol: String! #
name: String! # name: String! #
address: String!
tokenUri: String! # tokenUri: String! #
owner: String! owner: String! # owner of the nft
address: String! #
providerUrl: String # provider url that can decrypt the ddo providerUrl: String # provider url that can decrypt the ddo
assetState: Int! # state of the asset (described in docs) assetState: Int! # state of the asset (described in docs)
managerRole: [String] managerRole: [String!]
erc20DeployerRole: [String] erc20DeployerRole: [String!]
storeUpdateRole: [String] storeUpdateRole: [String!]
metadataRole: [String] # addresses that can update the metadata metadataRole: [String!] # addresses that can update the metadata
}
#TODO: do we need factories in general? We can move statistics on global object, check if we use them in a way template: String! # template address
type PoolFactory @entity { createTime: Int! # Block time pool was created
id: ID! tx: Bytes # Pool creation transaction id
totalValueLocked: [TokenValue] # total value locked represented in the base token block: Int # Block number when it was created
totalLiquidity: [TokenValue] # total liquidity for each base token
totalSwapVolume: [TokenValue] # total swap volume for each base token
totalSwapFee: [TokenValue] # All the swap fee in Ocean
poolCount: Int! # Number of pools
finalizedPoolCount: Int! # Number of finalized pools
orderCount: BigInt # Number of total consumes
totalOrderVolume: BigDecimal # probably remove due to inconsistencies and imposibility to calculate
pools: [Pool!] @derivedFrom(field: "factoryID")
}
type DatatokenFactory @entity {
id: ID!
tokenCount: Int! # Number of datatokens
datatokens: [Tokens!] @derivedFrom(field: "factory")
} }
type Pool @entity { type Pool @entity {
id: ID! # Pool address id: ID! # Pool address
poolFactory: PoolFactory! # Pool factory
owner: String! # Owner address, pool controller owner: String! # Owner address, pool controller
isPublicSwap: Boolean! # if swap/trade is activated, probably always true isPublicSwap: Boolean! # if swap/trade is activated, probably always true
@ -86,16 +66,16 @@ type Pool @entity {
poolFee: BigDecimal! # Pool Fee percent, fee goes to all liquidity providers : SWAP, JOIN , EXIT poolFee: BigDecimal! # Pool Fee percent, fee goes to all liquidity providers : SWAP, JOIN , EXIT
opfFee: BigDecimal! # OPF Fee percent, fee that goes to Ocean Protocol Foundation : SWAP opfFee: BigDecimal! # OPF Fee percent, fee that goes to Ocean Protocol Foundation : SWAP
marketFee: BigDecimal! # Market fee percent, fee that goes to the market where the pool was created : SWAP marketFee: BigDecimal! # Market fee percent, fee that goes to the market where the pool was created : SWAP
totalPoolFee: [TokenValue!]! # actual value of fee collected in both tokens totalPoolFee: [TokenValuePair!]! # actual value of fee collected in both tokens
totalOpfFee: [TokenValue!]! # actual value of fee collected in both tokens totalOpfFee: [TokenValuePair!]! # actual value of fee collected in both tokens
totalMarketFee: [TokenValue!]! # actual value of fee collected in both tokens totalMarketFee: [TokenValuePair!]! # actual value of fee collected in both tokens
currentOpfFee: [TokenValue!]! # fee after collection totalFee - colectedFee currentOpfFee: [TokenValuePair!]! # fee after collection totalFee - colectedFee
currentMarketFee: [TokenValue!]! # fee after collection totalFee - colectedFee currentMarketFee: [TokenValuePair!]! # fee after collection totalFee - colectedFee
totalWeight: BigDecimal! # it's always 100 totalWeight: BigDecimal! # it's always 100
totalShares: BigDecimal! # Total pool token shares totalShares: BigDecimal! # Total pool token shares
totalSwapVolume: [TokenValue!]! # total tokens that were swaped totalSwapVolume: [TokenValuePair!]! # total tokens that were swaped
spotPrice: BigDecimal! # spot price spotPrice: BigDecimal! # spot price
@ -109,8 +89,8 @@ type Pool @entity {
block: Int # Block number when it was created block: Int # Block number when it was created
# split in basetokne and datatoken like in fre # split in basetokne and datatoken like in fre
tokens: [PoolToken!] @derivedFrom(field: "poolId") tokens: [PoolToken!] @derivedFrom(field: "pool")
shares: [PoolShare!] @derivedFrom(field: "poolId") shares: [PoolShare!] @derivedFrom(field: "pool")
transactions: [PoolTransaction!] @derivedFrom(field: "pool") transactions: [PoolTransaction!] @derivedFrom(field: "pool")
} }
@ -152,7 +132,7 @@ type PoolTransaction @entity {
gasPrice: BigDecimal! gasPrice: BigDecimal!
# change to baseToken and dataToken # change to baseToken and dataToken
tokens: [TokenValue!] # tokens transfered , if value is negative it means it was removed. tokens: [TokenValuePair!] # tokens transfered , if value is negative it means it was removed.
} }
type Order @entity { # renamed from TokenOrder to Order type Order @entity { # renamed from TokenOrder to Order
@ -196,7 +176,7 @@ type TokenTransaction @entity {
type User @entity { type User @entity {
id: ID! id: ID!
sharesOwned: [PoolShare!] @derivedFrom(field: "user") sharesOwned: [PoolShare!] @derivedFrom(field: "user")
tokenBalancesOwned: [TokenValue!] tokenBalancesOwned: [TokenValuePair!]
tokensOwned: [Token!] @derivedFrom(field: "minter") tokensOwned: [Token!] @derivedFrom(field: "minter")
poolTransactions: [PoolTransaction!] @derivedFrom(field: "user") poolTransactions: [PoolTransaction!] @derivedFrom(field: "user")
orders: [Order!] @derivedFrom(field: "payer") orders: [Order!] @derivedFrom(field: "payer")
@ -205,7 +185,7 @@ type User @entity {
type FixedRateExchange @entity { type FixedRateExchange @entity {
id: ID! # fixed rate exchange id id: ID! # fixed rate exchange id
exchangeOwner: User! owner: User!
datatoken: Token! datatoken: Token!
baseToken: Token! baseToken: Token!
price: BigDecimal! price: BigDecimal!
@ -263,7 +243,7 @@ type Dispenser @entity {
maxBalance: BigDecimal! # max balance of requester. If the balance is higher, the dispense is rejected maxBalance: BigDecimal! # max balance of requester. If the balance is higher, the dispense is rejected
balance: BigDecimal! # how many tokens are left balance: BigDecimal! # how many tokens are left
dispenses: [DispenserTransaction!] @derivedFrom(field: "dispenserId") dispenses: [DispenserTransaction!] @derivedFrom(field: "dispenser")
} }
type DispenserTransaction @entity { type DispenserTransaction @entity {
@ -300,20 +280,21 @@ type PoolSnapshotTokenValue @entity {
type Global @entity { type Global @entity {
id: ID! id: ID!
totalValueLocked: [TokenValuePair] # total value locked represented in the base token , basically 2x liqudity for each base token totalValueLocked: [TokenValuePair!] # total value locked represented in the base token , basically 2x liqudity for each base token
totalLiquidity: [TokenValuePair] # total liquidity for each base token totalLiquidity: [TokenValuePair!] # total liquidity for each base token
totalSwapVolume: [TokenValuePair] # total swap volume for each base token. pools and fre totalSwapVolume: [TokenValuePair!] # total swap volume for each base token. pools and fre
orderCount: BigInt # Number of total consumes, pools + fre orderCount: BigInt # Number of total consumes, pools + fre
poolCount: Int! # Number of pools for all factories poolCount: Int! # Number of pools for all factories
finalizedPoolCount: Int! # Number of finalized pools for all factories finalizedPoolCount: Int! # Number of finalized pools for all factories
totalOrderVolume: BigDecimal # probably remove due to inconsistencies and imposibility to calculate
} }
type MetadataUpdate @entity { type MetadataUpdate @entity {
id: ID! # update tx + datatokenAddress id: ID! # update tx + datatokenAddress
datatokenId: Datatoken! datatoken: Token!
datatokenAddress: String! datatokenAddress: String!
userAddress: String! userAddress: String!

View File

@ -4,46 +4,25 @@ var fs = require('fs')
async function replaceContractAddresses() { async function replaceContractAddresses() {
// load barge addresses first // load barge addresses first
try { try {
const data = JSON.parse(fs.readFileSync(process.env.ADDRESS_FILE, 'utf8')) const data = JSON.parse(
fs.readFileSync(
'/home/mihai/.ocean/ocean-contracts/artifacts/address.json',
'utf8'
)
)
const { const {
DTFactory, DTFactory,
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
BFactory, ERC721Factory
// eslint-disable-next-line no-unused-vars
FixedRateExchange,
// eslint-disable-next-line no-unused-vars
Metadata,
// eslint-disable-next-line no-unused-vars
Dispenser
} = data.development } = data.development
let subgraph = fs.readFileSync('subgraph.yaml', 'utf8') let subgraph = fs.readFileSync('subgraph.yaml', 'utf8')
if (!data) { if (!data) {
return false return false
} }
// BFactory // ERC721Factory
subgraph = subgraph.replace( subgraph = subgraph.replace(
/0xbe0083053744ECb871510C88dC0f6b77Da162706/g, /0x17d55A3501999FFBF9b0623cDB258611419d01F5/g,
BFactory ERC721Factory
)
// dt factory
subgraph = subgraph.replace(
/0x57317f97E9EA49eBd19f7c9bB7c180b8cDcbDeB9/g,
DTFactory
)
// metadata
subgraph = subgraph.replace(
/0x1a4b70d8c9DcA47cD6D0Fb3c52BB8634CA1C0Fdf/g,
Metadata
)
// fixed rate exchgage
subgraph = subgraph.replace(
/0x608d05214E42722B94a54cF6114d4840FCfF84e1/g,
FixedRateExchange
)
// dispenser
subgraph = subgraph.replace(
/0xDEfD0018969cd2d4E648209F876ADe184815f038/g,
Dispenser
) )
// network // network
subgraph = subgraph.replace(/network: mainnet/g, 'network: barge') subgraph = subgraph.replace(/network: mainnet/g, 'network: barge')

View File

@ -1,31 +1,4 @@
import { import { BigDecimal, BigInt, dataSource } from '@graphprotocol/graph-ts'
BigDecimal,
BigInt,
Bytes,
dataSource,
Address,
ethereum,
log
} from '@graphprotocol/graph-ts'
import {
Pool as PoolEntity,
User,
PoolToken,
PoolShare,
PoolTransaction,
PoolFactory,
Datatoken,
TokenBalance,
TokenTransaction,
PoolTransactionTokenValues,
Global
} from './@types/schema'
import { Pool } from './@types/templates/Pool/Pool'
import { ERC20 } from './@types/templates/Pool/ERC20'
import { ERC20SymbolBytes } from './@types/templates/Pool/ERC20SymbolBytes'
import { ERC20NameBytes } from './@types/templates/Pool/ERC20NameBytes'
export const ZERO_BD = BigDecimal.fromString('0.0') export const ZERO_BD = BigDecimal.fromString('0.0')
export const MINUS_1_BD = BigDecimal.fromString('-1.0') export const MINUS_1_BD = BigDecimal.fromString('-1.0')
@ -62,36 +35,36 @@ export function getOceanAddress(): string {
export const OCEAN: string = getOceanAddress() export const OCEAN: string = getOceanAddress()
export function getGlobalStats(): Global { // export function getGlobalStats(): Global {
let gStats: Global | null = Global.load('1') // let gStats: Global | null = Global.load('1')
if (gStats == null) { // if (gStats == null) {
gStats = new Global('1') // gStats = new Global('1')
gStats.totalOceanLiquidity = ZERO_BD // gStats.totalOceanLiquidity = ZERO_BD
gStats.totalSwapVolume = ZERO_BD // gStats.totalSwapVolume = ZERO_BD
gStats.totalValueLocked = ZERO_BD // gStats.totalValueLocked = ZERO_BD
gStats.totalOrderVolume = ZERO_BD // gStats.totalOrderVolume = ZERO_BD
gStats.orderCount = BigInt.fromI32(0) // gStats.orderCount = BigInt.fromI32(0)
gStats.poolCount = 0 // gStats.poolCount = 0
} // }
return gStats // return gStats
} // }
export function hexToDecimal(hexString: string, decimals: i32): BigDecimal { // export function hexToDecimal(hexString: string, decimals: i32): BigDecimal {
const bytes = Bytes.fromHexString(hexString.toString()).reverse() as Bytes // const bytes = Bytes.fromHexString(hexString.toString()).reverse() as Bytes
const bi = BigInt.fromUnsignedBytes(bytes) // const bi = BigInt.fromUnsignedBytes(bytes)
const scale = BigInt.fromI32(10) // const scale = BigInt.fromI32(10)
.pow(decimals as u8) // .pow(decimals as u8)
.toBigDecimal() // .toBigDecimal()
return bi.divDecimal(scale) // return bi.divDecimal(scale)
} // }
export function bigIntToDecimal(amount: BigInt, decimals: i32): BigDecimal { // export function bigIntToDecimal(amount: BigInt, decimals: i32): BigDecimal {
const scale = BigInt.fromI32(10) // const scale = BigInt.fromI32(10)
.pow(decimals as u8) // .pow(decimals as u8)
.toBigDecimal() // .toBigDecimal()
return amount.toBigDecimal().div(scale) // return amount.toBigDecimal().div(scale)
} // }
export function tokenToDecimal(amount: BigDecimal, decimals: i32): BigDecimal { export function tokenToDecimal(amount: BigDecimal, decimals: i32): BigDecimal {
const scale = BigInt.fromI32(10) const scale = BigInt.fromI32(10)
@ -100,379 +73,379 @@ export function tokenToDecimal(amount: BigDecimal, decimals: i32): BigDecimal {
return amount.div(scale) return amount.div(scale)
} }
export function decimalToBigInt(value: BigDecimal): BigInt { // export function decimalToBigInt(value: BigDecimal): BigInt {
value.truncate(18) // value.truncate(18)
const scale = BigInt.fromI32(10).pow((value.exp.toI32() + 18) as u8) // const scale = BigInt.fromI32(10).pow((value.exp.toI32() + 18) as u8)
return value.digits.times(scale) // return value.digits.times(scale)
} // }
export function isNullEthValue(value: string): boolean { // export function isNullEthValue(value: string): boolean {
return ( // return (
value == // value ==
'0x0000000000000000000000000000000000000000000000000000000000000001' // '0x0000000000000000000000000000000000000000000000000000000000000001'
) // )
} // }
export function getTokenSymbol(tokenAddress: Address): string { // export function getTokenSymbol(tokenAddress: Address): string {
const contract = ERC20.bind(tokenAddress) // const contract = ERC20.bind(tokenAddress)
const contractSymbolBytes = ERC20SymbolBytes.bind(tokenAddress) // const contractSymbolBytes = ERC20SymbolBytes.bind(tokenAddress)
// try types string and bytes32 for symbol // // try types string and bytes32 for symbol
let symbolValue = 'unknown' // let symbolValue = 'unknown'
const symbolResult = contract.try_symbol() // const symbolResult = contract.try_symbol()
if (symbolResult.reverted) { // if (symbolResult.reverted) {
const symbolResultBytes = contractSymbolBytes.try_symbol() // const symbolResultBytes = contractSymbolBytes.try_symbol()
if (!symbolResultBytes.reverted) { // if (!symbolResultBytes.reverted) {
// for broken pairs that have no symbol function exposed // // for broken pairs that have no symbol function exposed
if (!isNullEthValue(symbolResultBytes.value.toHexString())) { // if (!isNullEthValue(symbolResultBytes.value.toHexString())) {
symbolValue = symbolResultBytes.value.toString() // symbolValue = symbolResultBytes.value.toString()
} // }
} // }
} else { // } else {
symbolValue = symbolResult.value // symbolValue = symbolResult.value
} // }
return symbolValue // return symbolValue
} // }
export function getTokenName(tokenAddress: Address): string { // export function getTokenName(tokenAddress: Address): string {
const contract = ERC20.bind(tokenAddress) // const contract = ERC20.bind(tokenAddress)
const contractNameBytes = ERC20NameBytes.bind(tokenAddress) // const contractNameBytes = ERC20NameBytes.bind(tokenAddress)
// try types string and bytes32 for name // // try types string and bytes32 for name
let nameValue = 'unknown' // let nameValue = 'unknown'
const nameResult = contract.try_name() // const nameResult = contract.try_name()
if (nameResult.reverted) { // if (nameResult.reverted) {
const nameResultBytes = contractNameBytes.try_name() // const nameResultBytes = contractNameBytes.try_name()
if (!nameResultBytes.reverted) { // if (!nameResultBytes.reverted) {
// for broken exchanges that have no name function exposed // // for broken exchanges that have no name function exposed
if (!isNullEthValue(nameResultBytes.value.toHexString())) { // if (!isNullEthValue(nameResultBytes.value.toHexString())) {
nameValue = nameResultBytes.value.toString() // nameValue = nameResultBytes.value.toString()
} // }
} // }
} else { // } else {
nameValue = nameResult.value // nameValue = nameResult.value
} // }
return nameValue // return nameValue
} // }
export function getTokenDecimals(tokenAddress: Address): i32 { // export function getTokenDecimals(tokenAddress: Address): i32 {
const contract = ERC20.bind(tokenAddress) // const contract = ERC20.bind(tokenAddress)
let decimals = 18 // let decimals = 18
const decimalCall = contract.try_decimals() // const decimalCall = contract.try_decimals()
if (!decimalCall.reverted) { // if (!decimalCall.reverted) {
decimals = decimalCall.value // decimals = decimalCall.value
} // }
return decimals // return decimals
} // }
export function updatePoolTokenBalance( // export function updatePoolTokenBalance(
poolToken: PoolToken, // poolToken: PoolToken,
balance: BigDecimal, // balance: BigDecimal,
source: string // source: string
): void { // ): void {
if (!poolToken) return // if (!poolToken) return
if (balance < ZERO_BD || poolToken.balance < ZERO_BD) { // if (balance < ZERO_BD || poolToken.balance < ZERO_BD) {
poolToken.balance = balance // poolToken.balance = balance
} // }
} // }
export function createUserEntity(address: string): void { // export function createUserEntity(address: string): void {
if (User.load(address) == null) { // if (User.load(address) == null) {
const user = new User(address) // const user = new User(address)
user.nrSales = 0 // user.nrSales = 0
user.save() // user.save()
} // }
} // }
export function createPoolShareEntity( // export function createPoolShareEntity(
id: string, // id: string,
pool: string, // pool: string,
user: string // user: string
): void { // ): void {
const poolShare = new PoolShare(id) // const poolShare = new PoolShare(id)
createUserEntity(user) // createUserEntity(user)
poolShare.userAddress = user // poolShare.userAddress = user
poolShare.poolId = pool // poolShare.poolId = pool
poolShare.balance = ZERO_BD // poolShare.balance = ZERO_BD
poolShare.save() // poolShare.save()
} // }
export function createPoolTokenEntity( // export function createPoolTokenEntity(
id: string, // id: string,
pool: string, // pool: string,
address: Address // address: Address
): void { // ): void {
const datatoken = Datatoken.load(address.toHexString()) // const datatoken = Datatoken.load(address.toHexString())
const poolToken = new PoolToken(id) // const poolToken = new PoolToken(id)
poolToken.poolId = pool // poolToken.poolId = pool
poolToken.isDatatoken = !!datatoken // poolToken.isDatatoken = !!datatoken
poolToken.tokenId = datatoken ? datatoken.id : '' // poolToken.tokenId = datatoken ? datatoken.id : ''
poolToken.address = address.toHexString() // poolToken.address = address.toHexString()
poolToken.balance = ZERO_BD // poolToken.balance = ZERO_BD
poolToken.denormWeight = ZERO_BD // poolToken.denormWeight = ZERO_BD
poolToken.symbol = getTokenSymbol(address) // poolToken.symbol = getTokenSymbol(address)
poolToken.name = getTokenName(address) // poolToken.name = getTokenName(address)
poolToken.decimals = getTokenDecimals(address) // poolToken.decimals = getTokenDecimals(address)
poolToken.save() // poolToken.save()
} // }
export function updatePoolTransactionToken( // export function updatePoolTransactionToken(
poolTx: string, // poolTx: string,
poolTokenId: string, // poolTokenId: string,
amount: BigDecimal, // amount: BigDecimal,
balance: BigDecimal, // balance: BigDecimal,
feeValue: BigDecimal // feeValue: BigDecimal
): void { // ): void {
const ptx = PoolTransaction.load(poolTx) // const ptx = PoolTransaction.load(poolTx)
const poolToken = PoolToken.load(poolTokenId) // const poolToken = PoolToken.load(poolTokenId)
if (!ptx) { // if (!ptx) {
log.error('Cannot load PoolTransaction {}', [poolTx]) // log.error('Cannot load PoolTransaction {}', [poolTx])
return // return
} // }
if (!poolToken) { // if (!poolToken) {
log.error('Cannot load PoolToken {}', [poolTokenId]) // log.error('Cannot load PoolToken {}', [poolTokenId])
return // return
} // }
const pool = PoolEntity.load(poolToken.poolId) // const pool = PoolEntity.load(poolToken.poolId)
if (!pool) { // if (!pool) {
log.error('Cannot load PoolEntity {}', [poolToken.poolId]) // log.error('Cannot load PoolEntity {}', [poolToken.poolId])
return // return
} // }
const ptxTokenValuesId = poolTx.concat('-').concat(poolTokenId) // const ptxTokenValuesId = poolTx.concat('-').concat(poolTokenId)
let ptxTokenValues = PoolTransactionTokenValues.load(ptxTokenValuesId) // let ptxTokenValues = PoolTransactionTokenValues.load(ptxTokenValuesId)
if (ptxTokenValues == null) { // if (ptxTokenValues == null) {
ptxTokenValues = new PoolTransactionTokenValues(ptxTokenValuesId) // ptxTokenValues = new PoolTransactionTokenValues(ptxTokenValuesId)
log.warning('created PoolTransactionTokenValues for {}', [ptxTokenValuesId]) // log.warning('created PoolTransactionTokenValues for {}', [ptxTokenValuesId])
} // }
if (!ptxTokenValues) return // if (!ptxTokenValues) return
ptxTokenValues.txId = poolTx // ptxTokenValues.txId = poolTx
ptxTokenValues.poolToken = poolTokenId // ptxTokenValues.poolToken = poolTokenId
ptxTokenValues.poolAddress = poolToken.poolId // ptxTokenValues.poolAddress = poolToken.poolId
const ptxUserAddress = ptx.userAddress // const ptxUserAddress = ptx.userAddress
ptxTokenValues.userAddress = ptxUserAddress ? ptxUserAddress : '' // ptxTokenValues.userAddress = ptxUserAddress ? ptxUserAddress : ''
const poolTokenAddress = poolToken.address // const poolTokenAddress = poolToken.address
ptxTokenValues.tokenAddress = poolTokenAddress ? poolTokenAddress : '' // ptxTokenValues.tokenAddress = poolTokenAddress ? poolTokenAddress : ''
ptxTokenValues.value = amount // ptxTokenValues.value = amount
ptxTokenValues.tokenReserve = balance // ptxTokenValues.tokenReserve = balance
ptxTokenValues.feeValue = feeValue // ptxTokenValues.feeValue = feeValue
if (amount.lt(ZERO_BD)) { // if (amount.lt(ZERO_BD)) {
ptxTokenValues.type = 'out' // ptxTokenValues.type = 'out'
} else { // } else {
ptxTokenValues.type = 'in' // ptxTokenValues.type = 'in'
} // }
ptxTokenValues.save() // ptxTokenValues.save()
if (ptxTokenValues.tokenAddress == OCEAN) { // if (ptxTokenValues.tokenAddress == OCEAN) {
const factory = PoolFactory.load('1') // const factory = PoolFactory.load('1')
if (factory !== null) { // if (factory !== null) {
factory.totalOceanLiquidity = factory.totalOceanLiquidity // factory.totalOceanLiquidity = factory.totalOceanLiquidity
.plus(ptxTokenValues.tokenReserve) // .plus(ptxTokenValues.tokenReserve)
.minus(pool.oceanReserve) // .minus(pool.oceanReserve)
const gStats: Global = getGlobalStats() // const gStats: Global = getGlobalStats()
if (gStats !== null) { // if (gStats !== null) {
gStats.totalOceanLiquidity = factory.totalOceanLiquidity // gStats.totalOceanLiquidity = factory.totalOceanLiquidity
gStats.save() // gStats.save()
} // }
ptx.oceanReserve = ptxTokenValues.tokenReserve // ptx.oceanReserve = ptxTokenValues.tokenReserve
pool.oceanReserve = ptxTokenValues.tokenReserve // pool.oceanReserve = ptxTokenValues.tokenReserve
factory.save() // factory.save()
} // }
} else { // } else {
ptx.datatokenReserve = ptxTokenValues.tokenReserve // ptx.datatokenReserve = ptxTokenValues.tokenReserve
pool.datatokenReserve = ptxTokenValues.tokenReserve // pool.datatokenReserve = ptxTokenValues.tokenReserve
} // }
ptx.save() // ptx.save()
pool.save() // pool.save()
} // }
export function calcSpotPrice( // export function calcSpotPrice(
balanceIn: BigDecimal, // balanceIn: BigDecimal,
wIn: BigDecimal, // wIn: BigDecimal,
balanceOut: BigDecimal, // balanceOut: BigDecimal,
wOut: BigDecimal, // wOut: BigDecimal,
swapFee: BigDecimal // swapFee: BigDecimal
): BigDecimal { // ): BigDecimal {
if (balanceIn <= ZERO_BD || balanceOut <= ZERO_BD) return MINUS_1_BD // if (balanceIn <= ZERO_BD || balanceOut <= ZERO_BD) return MINUS_1_BD
const numer = balanceIn.div(wIn) // const numer = balanceIn.div(wIn)
const denom = balanceOut.div(wOut) // const denom = balanceOut.div(wOut)
if (denom <= ZERO_BD) return MINUS_1_BD // if (denom <= ZERO_BD) return MINUS_1_BD
const ratio = numer.div(denom) // const ratio = numer.div(denom)
const scale = ONE_BD.div(ONE_BD.minus(swapFee)) // const scale = ONE_BD.div(ONE_BD.minus(swapFee))
const price = ratio.times(scale) // const price = ratio.times(scale)
price.truncate(18) // price.truncate(18)
return price // return price
} // }
export function createPoolTransaction( // export function createPoolTransaction(
event: ethereum.Event, // event: ethereum.Event,
// eslint-disable-next-line camelcase // // eslint-disable-next-line camelcase
event_type: string, // event_type: string,
userAddress: string // userAddress: string
): void { // ): void {
const poolId = event.address.toHex() // const poolId = event.address.toHex()
const pool = PoolEntity.load(poolId) // const pool = PoolEntity.load(poolId)
if (!pool) return // if (!pool) return
const ptx = event.transaction.hash.toHexString() // const ptx = event.transaction.hash.toHexString()
const ocnToken = PoolToken.load(poolId.concat('-').concat(OCEAN)) // const ocnToken = PoolToken.load(poolId.concat('-').concat(OCEAN))
const dtToken = PoolToken.load( // const dtToken = PoolToken.load(
poolId.concat('-').concat(pool.datatokenAddress) // poolId.concat('-').concat(pool.datatokenAddress)
) // )
if (ocnToken == null || dtToken == null) { // if (ocnToken == null || dtToken == null) {
return // return
} // }
let poolTx = PoolTransaction.load(ptx) // let poolTx = PoolTransaction.load(ptx)
if (poolTx != null) { // if (poolTx != null) {
return // return
} // }
poolTx = new PoolTransaction(ptx) // poolTx = new PoolTransaction(ptx)
poolTx.poolAddress = poolId // poolTx.poolAddress = poolId
poolTx.userAddress = userAddress // poolTx.userAddress = userAddress
poolTx.poolAddressStr = poolId // poolTx.poolAddressStr = poolId
poolTx.userAddressStr = userAddress // poolTx.userAddressStr = userAddress
poolTx.sharesTransferAmount = ZERO_BD // poolTx.sharesTransferAmount = ZERO_BD
poolTx.sharesBalance = ZERO_BD // poolTx.sharesBalance = ZERO_BD
// pool.datatokenReserve = dtToken.balance // // pool.datatokenReserve = dtToken.balance
// pool.oceanReserve = ocnToken.balance // // pool.oceanReserve = ocnToken.balance
// Initial reserve values, will be updated in `updatePoolTransactionToken` // // Initial reserve values, will be updated in `updatePoolTransactionToken`
poolTx.datatokenReserve = dtToken.balance // poolTx.datatokenReserve = dtToken.balance
poolTx.oceanReserve = ocnToken.balance // poolTx.oceanReserve = ocnToken.balance
const p = Pool.bind(Address.fromString(poolId)) // const p = Pool.bind(Address.fromString(poolId))
const priceResult = p.try_calcInGivenOut( // const priceResult = p.try_calcInGivenOut(
decimalToBigInt(ocnToken.balance), // decimalToBigInt(ocnToken.balance),
decimalToBigInt(ocnToken.denormWeight), // decimalToBigInt(ocnToken.denormWeight),
decimalToBigInt(dtToken.balance), // decimalToBigInt(dtToken.balance),
decimalToBigInt(dtToken.denormWeight), // decimalToBigInt(dtToken.denormWeight),
ONE_BASE_18, // ONE_BASE_18,
decimalToBigInt(pool.swapFee) // decimalToBigInt(pool.swapFee)
) // )
poolTx.consumePrice = priceResult.reverted // poolTx.consumePrice = priceResult.reverted
? MINUS_1_BD // ? MINUS_1_BD
: bigIntToDecimal(priceResult.value, 18) // : bigIntToDecimal(priceResult.value, 18)
const priceSpot = p.try_calcSpotPrice( // const priceSpot = p.try_calcSpotPrice(
decimalToBigInt(ocnToken.balance), // decimalToBigInt(ocnToken.balance),
decimalToBigInt(ocnToken.denormWeight), // decimalToBigInt(ocnToken.denormWeight),
decimalToBigInt(dtToken.balance), // decimalToBigInt(dtToken.balance),
decimalToBigInt(dtToken.denormWeight), // decimalToBigInt(dtToken.denormWeight),
decimalToBigInt(pool.swapFee) // decimalToBigInt(pool.swapFee)
) // )
poolTx.spotPrice = priceSpot.reverted // poolTx.spotPrice = priceSpot.reverted
? ZERO_BD // ? ZERO_BD
: bigIntToDecimal(priceSpot.value, 18) // : bigIntToDecimal(priceSpot.value, 18)
pool.consumePrice = poolTx.consumePrice // pool.consumePrice = poolTx.consumePrice
pool.spotPrice = poolTx.spotPrice // pool.spotPrice = poolTx.spotPrice
const oldValueLocked = pool.valueLocked // const oldValueLocked = pool.valueLocked
const spotPrice = pool.spotPrice >= ZERO_BD ? pool.spotPrice : ZERO_BD // const spotPrice = pool.spotPrice >= ZERO_BD ? pool.spotPrice : ZERO_BD
pool.valueLocked = poolTx.oceanReserve.plus( // pool.valueLocked = poolTx.oceanReserve.plus(
poolTx.datatokenReserve.times(spotPrice) // poolTx.datatokenReserve.times(spotPrice)
) // )
const factory = PoolFactory.load('1') // const factory = PoolFactory.load('1')
if (!factory) return // if (!factory) return
if (factory.totalValueLocked !== null) { // if (factory.totalValueLocked !== null) {
const tvl = factory.totalValueLocked // const tvl = factory.totalValueLocked
factory.totalValueLocked = tvl // factory.totalValueLocked = tvl
? tvl.minus(oldValueLocked).plus(pool.valueLocked) // ? tvl.minus(oldValueLocked).plus(pool.valueLocked)
: BigDecimal.fromString('0') // : BigDecimal.fromString('0')
} // }
const gStats: Global = getGlobalStats() // const gStats: Global = getGlobalStats()
if (gStats !== null) { // if (gStats !== null) {
gStats.totalValueLocked = factory.totalValueLocked // gStats.totalValueLocked = factory.totalValueLocked
gStats.save() // gStats.save()
} // }
pool.transactionCount = pool.transactionCount.plus(BigInt.fromI32(1)) // pool.transactionCount = pool.transactionCount.plus(BigInt.fromI32(1))
pool.save() // pool.save()
factory.save() // factory.save()
poolTx.tx = event.transaction.hash // poolTx.tx = event.transaction.hash
// eslint-disable-next-line camelcase // // eslint-disable-next-line camelcase
poolTx.event = event_type // poolTx.event = event_type
poolTx.block = event.block.number.toI32() // poolTx.block = event.block.number.toI32()
poolTx.timestamp = event.block.timestamp.toI32() // poolTx.timestamp = event.block.timestamp.toI32()
// Property 'gasUsed' does not exist on type '~lib/@graphprotocol/graph-ts/chain/ethereum/ethereum.Transaction' // // Property 'gasUsed' does not exist on type '~lib/@graphprotocol/graph-ts/chain/ethereum/ethereum.Transaction'
// poolTx.gasUsed = event.transaction.gasUsed.toBigDecimal() // // poolTx.gasUsed = event.transaction.gasUsed.toBigDecimal()
poolTx.gasPrice = event.transaction.gasPrice.toBigDecimal() // poolTx.gasPrice = event.transaction.gasPrice.toBigDecimal()
poolTx.save() // poolTx.save()
} // }
export function decrPoolCount(finalized: boolean): void { // export function decrPoolCount(finalized: boolean): void {
const factory = PoolFactory.load('1') // const factory = PoolFactory.load('1')
if (!factory) return // if (!factory) return
factory.poolCount -= 1 // factory.poolCount -= 1
if (finalized) factory.finalizedPoolCount -= 1 // if (finalized) factory.finalizedPoolCount -= 1
factory.save() // factory.save()
} // }
export function saveTokenTransaction( // export function saveTokenTransaction(
event: ethereum.Event, // event: ethereum.Event,
eventName: string // eventName: string
): void { // ): void {
const tx = event.transaction.hash // const tx = event.transaction.hash
.toHexString() // .toHexString()
.concat('-') // .concat('-')
.concat(event.logIndex.toString()) // .concat(event.logIndex.toString())
const userAddress = event.transaction.from.toHex() // const userAddress = event.transaction.from.toHex()
let transaction = TokenTransaction.load(tx) // let transaction = TokenTransaction.load(tx)
if (transaction == null) { // if (transaction == null) {
transaction = new TokenTransaction(tx) // transaction = new TokenTransaction(tx)
} // }
transaction.event = eventName // transaction.event = eventName
transaction.datatokenAddress = event.address.toHex() // transaction.datatokenAddress = event.address.toHex()
transaction.userAddress = userAddress // transaction.userAddress = userAddress
// transaction.gasUsed = event.transaction.gasUsed.toBigDecimal() // // transaction.gasUsed = event.transaction.gasUsed.toBigDecimal()
transaction.gasPrice = event.transaction.gasPrice.toBigDecimal() // transaction.gasPrice = event.transaction.gasPrice.toBigDecimal()
transaction.tx = event.transaction.hash // transaction.tx = event.transaction.hash
transaction.timestamp = event.block.timestamp.toI32() // transaction.timestamp = event.block.timestamp.toI32()
transaction.block = event.block.number.toI32() // transaction.block = event.block.number.toI32()
transaction.save() // transaction.save()
createUserEntity(userAddress) // createUserEntity(userAddress)
} // }
export function updateTokenBalance( // export function updateTokenBalance(
id: string, // id: string,
token: string, // token: string,
user: string, // user: string,
amount: BigDecimal // amount: BigDecimal
): void { // ): void {
let tokenBalance = TokenBalance.load(id) // let tokenBalance = TokenBalance.load(id)
if (tokenBalance == null) { // if (tokenBalance == null) {
tokenBalance = new TokenBalance(id) // tokenBalance = new TokenBalance(id)
createUserEntity(user) // createUserEntity(user)
tokenBalance.userAddress = user // tokenBalance.userAddress = user
tokenBalance.datatokenId = token // tokenBalance.datatokenId = token
tokenBalance.balance = ZERO_BD // tokenBalance.balance = ZERO_BD
} // }
tokenBalance.balance = tokenBalance.balance.plus(amount) // tokenBalance.balance = tokenBalance.balance.plus(amount)
tokenBalance.save() // tokenBalance.save()
} // }

View File

@ -0,0 +1,9 @@
import {
MinterApproved,
OrderStarted
} from '../@types/ERC20Template/ERC20Template'
// TODO: no events in contracts
export function handleMinterApproved(event: MinterApproved): void {}
// TODO: to complicated at this point, return after basic events implemented ¯\_(ツ)_/¯
export function handleOrderStarted(event: OrderStarted): void {}

View File

@ -0,0 +1,33 @@
import { log } from '@graphprotocol/graph-ts'
import { NFTCreated, TokenCreated } from '../@types/ERC721Factory/ERC721Factory'
import { Nft, Token } from '../@types/schema'
import { ZERO_BD } from '../helpers'
export function handleNftCreated(event: NFTCreated): void {
const nft = new Nft(event.params.newTokenAddress.toHexString())
nft.owner = event.params.admin.toHexString()
nft.address = event.params.newTokenAddress.toHexString()
nft.name = event.params.tokenName.toHex()
nft.symbol = ''
nft.createTime = event.block.timestamp.toI32()
nft.tx = event.transaction.hash
nft.block = event.block.number.toI32()
nft.save()
}
export function handleNewToken(event: TokenCreated): void {
const token = new Token(event.params.newTokenAddress.toHexString())
token.isDatatoken = true
token.address = event.params.newTokenAddress.toHexString()
token.createTime = event.block.timestamp.toI32()
token.tx = event.transaction.hash
token.block = event.block.number.toI32()
token.name = event.params.tokenName.toString()
token.decimals = 18
token.supply = ZERO_BD
log.info('dt name {} ', [event.params.tokenName.toString()])
token.save()
}

View File

@ -0,0 +1,11 @@
import { NewPool } from '../@types/ERC20Template/ERC20Template'
import { Pool } from '../@types/schema'
export function handleNewPool(event: NewPool): void {
const newPool = new Pool(event.params.poolAddress.toHex())
newPool.createTime = event.block.timestamp.toI32()
newPool.tx = event.transaction.hash
newPool.block = event.block.number.toI32()
newPool.save()
}

View File

@ -0,0 +1,23 @@
import { BigInt } from '@graphprotocol/graph-ts'
import { ExchangeCreated } from '../@types/FixedRateExchange/FixedRateExchange'
import { FixedRateExchange } from '../@types/schema'
import { tokenToDecimal } from '../helpers'
export function handleExchangeCreated(event: ExchangeCreated): void {
const fixedRateExchange = new FixedRateExchange(
event.params.exchangeId.toHexString()
)
fixedRateExchange.owner = event.params.exchangeOwner.toHexString()
fixedRateExchange.datatoken = event.params.dataToken.toHexString()
fixedRateExchange.baseToken = event.params.baseToken.toHexString()
// fixedRateExchange.baseTokenSymbol = getTokenSymbol(event.params.baseToken)
fixedRateExchange.active = false
fixedRateExchange.price = tokenToDecimal(
event.params.fixedRate.toBigDecimal(),
BigInt.fromI32(18).toI32()
)
fixedRateExchange.save()
}

View File

@ -1,135 +0,0 @@
import { BigInt, ethereum, log } from '@graphprotocol/graph-ts'
import {
ExchangeCreated,
ExchangeActivated,
ExchangeDeactivated,
ExchangeRateChanged,
Swapped
} from '../@types/FixedRateExchange/FixedRateExchange'
import {
FixedRateExchange,
FixedRateExchangeUpdate,
FixedRateExchangeSwap
} from '../@types/schema'
import { getTokenSymbol, tokenToDecimal } from '../helpers'
export function handleExchangeCreated(event: ExchangeCreated): void {
const fixedrateexchange = new FixedRateExchange(
event.params.exchangeId.toHexString()
)
fixedrateexchange.exchangeOwner = event.params.exchangeOwner.toHexString()
fixedrateexchange.datatoken = event.params.dataToken.toHexString()
fixedrateexchange.baseToken = event.params.baseToken.toHexString()
fixedrateexchange.baseTokenSymbol = getTokenSymbol(event.params.baseToken)
fixedrateexchange.active = false
log.info('new exchange with datatoken {} and base token {} ', [
fixedrateexchange.datatoken,
fixedrateexchange.baseToken
])
log.info('for new exchange {} for rate {}', [
event.params.exchangeId.toHexString(),
event.params.fixedRate.toString()
])
fixedrateexchange.rate = tokenToDecimal(
event.params.fixedRate.toBigDecimal(),
BigInt.fromI32(18).toI32()
)
fixedrateexchange.save()
}
function _processActiveUpdated(
event: ethereum.Event,
exchangeId: string,
active: boolean
): void {
const tx = event.transaction.hash
const id = tx.toHexString().concat('-').concat(exchangeId)
const fixedrateexchange = FixedRateExchange.load(exchangeId)
const freupdate = new FixedRateExchangeUpdate(id)
freupdate.exchangeId = exchangeId
if (fixedrateexchange) {
freupdate.oldRate = fixedrateexchange.rate
freupdate.newRate = fixedrateexchange.rate
freupdate.oldActive = fixedrateexchange.active
fixedrateexchange.active = active
fixedrateexchange.save()
}
freupdate.newActive = active
freupdate.block = event.block.number.toI32()
freupdate.timestamp = event.block.timestamp.toI32()
freupdate.tx = tx
freupdate.save()
}
export function handleExchangeActivated(event: ExchangeActivated): void {
_processActiveUpdated(event, event.params.exchangeId.toHexString(), true)
}
export function handleExchangeDeactivated(event: ExchangeDeactivated): void {
_processActiveUpdated(event, event.params.exchangeId.toHexString(), false)
}
export function handleExchangeRateChanged(event: ExchangeRateChanged): void {
const tx = event.transaction.hash
const id = tx
.toHexString()
.concat('-')
.concat(event.params.exchangeId.toHexString())
const fixedrateexchange = FixedRateExchange.load(
event.params.exchangeId.toHexString()
)
if (!fixedrateexchange) {
log.error('Cannot update unknown FRE {}', [
event.params.exchangeId.toHexString()
])
return
}
const freupdate = new FixedRateExchangeUpdate(id)
freupdate.exchangeId = fixedrateexchange.id
freupdate.oldRate = fixedrateexchange.rate
log.info('for new exchange {} for rate {}', [
id,
event.params.newRate.toString()
])
freupdate.newRate = tokenToDecimal(
event.params.newRate.toBigDecimal(),
BigInt.fromI32(18).toI32()
)
freupdate.oldActive = fixedrateexchange.active
freupdate.newActive = fixedrateexchange.active
freupdate.block = event.block.number.toI32()
freupdate.timestamp = event.block.timestamp.toI32()
freupdate.tx = tx
freupdate.save()
fixedrateexchange.rate = freupdate.newRate
fixedrateexchange.save()
}
export function handleSwapped(event: Swapped): void {
const tx = event.transaction.hash
const id = tx
.toHexString()
.concat('-')
.concat(event.params.exchangeId.toHexString())
const freSwap = new FixedRateExchangeSwap(id)
freSwap.exchangeId = event.params.exchangeId.toHexString()
freSwap.by = event.params.by.toHexString()
freSwap.baseTokenAmount = tokenToDecimal(
event.params.baseTokenSwappedAmount.toBigDecimal(),
BigInt.fromI32(18).toI32()
)
freSwap.dataTokenAmount = tokenToDecimal(
event.params.dataTokenSwappedAmount.toBigDecimal(),
BigInt.fromI32(18).toI32()
)
freSwap.block = event.block.number.toI32()
freSwap.timestamp = event.block.timestamp.toI32()
freSwap.tx = tx
freSwap.save()
}

View File

@ -14,9 +14,9 @@ import {
DispenserTransaction, DispenserTransaction,
User, User,
Datatoken Datatoken
} from '../@types/schema' } from '../../@types/schema'
import { tokenToDecimal } from '../helpers' import { tokenToDecimal } from '../../helpers'
function _processDispenserUpdate( function _processDispenserUpdate(
event: ethereum.Event, event: ethereum.Event,

577
src/mappings/old/pool.ts Normal file
View File

@ -0,0 +1,577 @@
// import { BigInt, Address, BigDecimal, log } from '@graphprotocol/graph-ts'
// import {
// LOG_CALL,
// LOG_JOIN,
// LOG_EXIT,
// LOG_SWAP,
// Transfer,
// Pool as PoolEntity
// } from '../@types/templates/Pool/Pool'
// import {
// PoolFactory,
// Pool,
// PoolToken,
// PoolShare,
// Datatoken,
// PoolTransaction,
// Global
// } from '../@types/schema'
// import {
// hexToDecimal,
// tokenToDecimal,
// createPoolShareEntity,
// createPoolTokenEntity,
// ZERO_BD,
// MINUS_1_BD,
// decrPoolCount,
// updatePoolTransactionToken,
// createPoolTransaction,
// OCEAN,
// updatePoolTokenBalance,
// getOceanAddress,
// getGlobalStats,
// bigIntToDecimal
// } from '../helpers'
// /************************************
// ********** Pool Controls ***********
// ************************************/
// export function handleSetSwapFee(
// event: LOG_CALL,
// swapFeeStr: string | null = null
// ): void {
// const poolId = event.address.toHex()
// const pool = Pool.load(poolId)
// if (!pool) return
// if (!swapFeeStr) {
// swapFeeStr = event.params.data.toHexString().slice(-40)
// }
// if (swapFeeStr !== null) pool.swapFee = hexToDecimal(swapFeeStr, 18)
// pool.save()
// }
// export function handleSetController(event: LOG_CALL): void {
// const poolId = event.address.toHex()
// const pool = Pool.load(poolId)
// if (!pool) return
// pool.controller = Address.fromString(
// event.params.data.toHexString().slice(-40)
// )
// pool.save()
// }
// export function handleSetPublicSwap(event: LOG_CALL): void {
// const poolId = event.address.toHex()
// const pool = Pool.load(poolId)
// if (!pool) return
// pool.publicSwap = event.params.data.toHexString().slice(-1) == '1'
// pool.save()
// }
// export function handleFinalize(event: LOG_CALL): void {
// const poolId = event.address.toHex()
// const pool = Pool.load(poolId)
// if (!pool) {
// log.error('Cannot handle finalize for unknown pool {} ', [poolId])
// return
// }
// if (pool.tokenCount == BigInt.fromI32(0)) {
// log.error('Cannot mark pool {} finalized, because we have 0 tokenCount', [
// poolId
// ])
// return
// }
// pool.finalized = true
// pool.symbol = 'BPT'
// pool.publicSwap = true
// pool.save()
// const factory = PoolFactory.load('1')
// if (!factory) return
// factory.finalizedPoolCount = factory.finalizedPoolCount + 1
// factory.save()
// }
// export function _handleRebind(
// event: LOG_CALL,
// poolId: string,
// tokenAddress: string,
// balanceStr: string,
// denormWeightStr: string
// ): void {
// const pool = Pool.load(poolId)
// if (!pool) return
// const decimals = BigInt.fromI32(18).toI32()
// if (tokenAddress != OCEAN) {
// pool.datatokenAddress = tokenAddress
// }
// pool.tokenCount = pool.tokenCount.plus(BigInt.fromI32(1))
// const address = Address.fromString(tokenAddress)
// const denormWeight = hexToDecimal(denormWeightStr, decimals)
// const poolTokenId = poolId.concat('-').concat(address.toHexString())
// let poolToken = PoolToken.load(poolTokenId)
// if (poolToken == null) {
// createPoolTokenEntity(poolTokenId, poolId, address)
// poolToken = PoolToken.load(poolTokenId)
// pool.totalWeight = pool.totalWeight.plus(denormWeight)
// } else {
// const oldWeight = poolToken.denormWeight
// if (denormWeight > oldWeight) {
// pool.totalWeight = pool.totalWeight.plus(denormWeight).minus(oldWeight)
// } else {
// pool.totalWeight = pool.totalWeight.minus(oldWeight).minus(denormWeight)
// }
// }
// if (!poolToken) return
// poolToken.denormWeight =
// denormWeight !== null ? denormWeight : BigDecimal.fromString('0')
// const balance = hexToDecimal(balanceStr, decimals)
// updatePoolTokenBalance(poolToken as PoolToken, balance, '_handleRebind')
// poolToken.save()
// if (balance.equals(ZERO_BD)) {
// decrPoolCount(pool.finalized)
// pool.active = false
// }
// pool.save()
// }
// export function handleRebind(event: LOG_CALL): void {
// const poolId = event.address.toHex()
// _handleRebind(
// event,
// poolId,
// event.params.data.toHexString().slice(34, 74),
// event.params.data.toHexString().slice(74, 138),
// event.params.data.toHexString().slice(138)
// )
// }
// export function handleSetup(event: LOG_CALL): void {
// if (PoolTransaction.load(event.transaction.hash.toHexString()) != null) {
// return
// }
// const poolId = event.address.toHex()
// const data = event.params.data.toHexString()
// // First 2 chars are 0x
// // Next there is 8 chars
// // Next starts the data each params occupies exactly 64 chars
// // Each value is padded with 0s to the left
// // For an Address, need to remove the leading 24 zeros, because the address itself is 40 chars
// // For numbers we donot need to remove the leading zeros because they have no effect being on the left of the number
// // skip 8 then take the last 40 (2 + 8 + 24 = 34) to (2 + 8 + 64 = 74)
// const dataTokenAddress = Address.fromString(data.slice(34, 74)).toHexString()
// const dataTokenAmount = data.slice(74, 138) // 74+64
// const dataTokenWeight = data.slice(138, 202) // (74+64,74+(2*64)
// const baseTokenAddress = Address.fromString(
// data.slice(202 + 24, 266)
// ).toHexString() // (74+(2*64)+24, 74+(3*64))
// const baseTokenAmount = data.slice(266, 330) // (74+(3*64),74+(4*64))
// const baseTokenWeight = data.slice(330, 394) // (74+(4*64),74+(5*64))
// const swapFee = data.slice(394) // (74+(5*64), END)
// if (baseTokenAddress != OCEAN) {
// log.error('baseTokenAddress is not Ocean, but is {}', [baseTokenAddress])
// return
// }
// const poolTokenId = poolId.concat('-').concat(baseTokenAddress)
// const poolToken = PoolToken.load(poolTokenId)
// if (!poolToken) return
// _handleRebind(
// event,
// poolId,
// dataTokenAddress,
// dataTokenAmount,
// dataTokenWeight
// )
// _handleRebind(
// event,
// poolId,
// baseTokenAddress,
// baseTokenAmount,
// baseTokenWeight
// )
// handleSetSwapFee(event, swapFee)
// handleFinalize(event)
// createPoolTransaction(event, 'setup', event.transaction.from.toHex())
// // update base token
// let amount = hexToDecimal(baseTokenAmount, 18)
// const poolTokenBalance = poolToken.balance
// const balance = poolTokenBalance
// ? poolTokenBalance
// : BigDecimal.fromString('0')
// updatePoolTransactionToken(
// event.transaction.hash.toHexString(),
// poolTokenId,
// amount,
// balance,
// ZERO_BD
// )
// // update the datatoken
// const poolDataToken = PoolToken.load(
// poolId.concat('-').concat(dataTokenAddress)
// )
// if (poolDataToken !== null) {
// amount = hexToDecimal(dataTokenAmount, 18)
// updatePoolTransactionToken(
// event.transaction.hash.toHexString(),
// poolId.concat('-').concat(dataTokenAddress),
// amount,
// poolDataToken.balance,
// ZERO_BD
// )
// }
// }
// /************************************
// ********** JOINS & EXITS ***********
// ************************************/
// export function handleJoinPool(event: LOG_JOIN): void {
// const poolId = event.address.toHex()
// const address = event.params.tokenIn.toHex()
// const ptx = event.transaction.hash.toHexString()
// const poolTokenId = poolId.concat('-').concat(address)
// const poolToken = PoolToken.load(poolTokenId)
// const pool = Pool.load(poolId)
// const datatoken = Datatoken.load(poolTokenId)
// const poolTx = PoolTransaction.load(ptx)
// if (poolTx !== null) return
// if (!pool || !poolToken || !datatoken) return
// if (pool.finalized == false) {
// return
// }
// pool.joinCount = pool.joinCount.plus(BigInt.fromI32(1))
// pool.save()
// const decimals =
// datatoken == null ? BigInt.fromI32(18).toI32() : datatoken.decimals
// const tokenAmountIn = tokenToDecimal(
// event.params.tokenAmountIn.toBigDecimal(),
// decimals
// )
// updatePoolTokenBalance(
// poolToken as PoolToken,
// poolToken.balance.plus(tokenAmountIn),
// 'handleJoinPool'
// )
// poolToken.save()
// createPoolTransaction(event, 'join', event.params.caller.toHexString())
// updatePoolTransactionToken(
// event.transaction.hash.toHexString(),
// poolTokenId,
// tokenAmountIn,
// poolToken.balance,
// tokenAmountIn.times(pool.swapFee)
// )
// }
// export function handleExitPool(event: LOG_EXIT): void {
// const poolId = event.address.toHex()
// const address = event.params.tokenOut.toHex()
// const poolTokenId = poolId.concat('-').concat(address.toString())
// const pool = Pool.load(poolId)
// const poolToken = PoolToken.load(poolTokenId)
// const datatoken = Datatoken.load(poolTokenId)
// if (!poolToken || !pool || !datatoken) {
// return
// }
// const decimals =
// datatoken == null ? BigInt.fromI32(18).toI32() : datatoken.decimals
// const tokenAmountOut = tokenToDecimal(
// event.params.tokenAmountOut.toBigDecimal(),
// decimals
// )
// const newAmount = poolToken.balance.minus(tokenAmountOut)
// updatePoolTokenBalance(poolToken as PoolToken, newAmount, 'handleExitPool')
// poolToken.save()
// pool.exitCount = pool.exitCount.plus(BigInt.fromI32(1))
// if (newAmount.equals(ZERO_BD)) {
// decrPoolCount(pool.finalized)
// pool.active = false
// }
// pool.save()
// createPoolTransaction(event, 'exit', event.params.caller.toHexString())
// updatePoolTransactionToken(
// event.transaction.hash.toHexString(),
// poolTokenId,
// tokenAmountOut.times(MINUS_1_BD),
// poolToken.balance,
// tokenAmountOut.times(pool.swapFee)
// )
// }
// /************************************
// ************** SWAPS ***************
// ************************************/
// export function handleSwap(event: LOG_SWAP): void {
// const poolId = event.address.toHex()
// const ptx = event.transaction.hash.toHexString()
// const tokenIn = event.params.tokenIn.toHex()
// const poolTokenInId = poolId.concat('-').concat(tokenIn.toString())
// const poolTokenIn = PoolToken.load(poolTokenInId)
// if (!poolTokenIn) {
// return
// }
// const dtIn = Datatoken.load(tokenIn)
// const tokenAmountIn = tokenToDecimal(
// event.params.tokenAmountIn.toBigDecimal(),
// dtIn == null ? 18 : dtIn.decimals
// )
// const newAmountIn = poolTokenIn.balance.plus(tokenAmountIn)
// updatePoolTokenBalance(
// poolTokenIn as PoolToken,
// newAmountIn,
// 'handleSwap.tokenIn'
// )
// poolTokenIn.save()
// const tokenOut = event.params.tokenOut.toHex()
// const poolTokenOutId = poolId.concat('-').concat(tokenOut.toString())
// const poolTokenOut = PoolToken.load(poolTokenOutId)
// const pool = Pool.load(poolId)
// const factory = PoolFactory.load('1')
// const dtOut = Datatoken.load(tokenOut)
// if (!poolTokenOut || !dtOut || !factory || !pool) return
// const tokenAmountOut = tokenToDecimal(
// event.params.tokenAmountOut.toBigDecimal(),
// dtOut == null ? 18 : dtOut.decimals
// )
// const newAmountOut = poolTokenOut.balance.minus(tokenAmountOut)
// updatePoolTokenBalance(
// poolTokenOut as PoolToken,
// newAmountOut,
// 'handleSwap.tokenOut'
// )
// poolTokenOut.save()
// pool.swapCount = pool.swapCount.plus(BigInt.fromI32(1))
// if (newAmountIn.equals(ZERO_BD) || newAmountOut.equals(ZERO_BD)) {
// decrPoolCount(pool.finalized)
// pool.active = false
// }
// if (tokenIn === getOceanAddress()) {
// pool.totalSwapVolume = pool.totalSwapVolume.plus(tokenAmountIn)
// factory.totalSwapVolume = factory.totalSwapVolume.plus(tokenAmountIn)
// } else {
// pool.totalSwapVolume = pool.totalSwapVolume.plus(tokenAmountOut)
// factory.totalSwapVolume = factory.totalSwapVolume.plus(tokenAmountOut)
// }
// factory.save()
// pool.save()
// const gStats: Global = getGlobalStats()
// if (gStats !== null) {
// gStats.totalSwapVolume = factory.totalSwapVolume
// gStats.save()
// }
// createPoolTransaction(event, 'swap', event.params.caller.toHexString())
// updatePoolTransactionToken(
// ptx,
// poolTokenIn.id,
// tokenAmountIn,
// poolTokenIn.balance,
// tokenAmountIn.times(pool.swapFee)
// )
// updatePoolTransactionToken(
// ptx,
// poolTokenOut.id,
// tokenAmountOut.times(MINUS_1_BD),
// poolTokenOut.balance,
// BigDecimal.fromString('0.0')
// )
// }
// /************************************
// *********** POOL SHARES ************
// ************************************/
// export function handleTransfer(event: Transfer): void {
// const poolId = event.address.toHex()
// const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
// const isMint = event.params.from.toHex() == ZERO_ADDRESS
// const isBurn = event.params.to.toHex() == ZERO_ADDRESS
// const poolShareFromId = poolId.concat('-').concat(event.params.from.toHex())
// let poolShareFrom = PoolShare.load(poolShareFromId)
// const poolShareToId = poolId.concat('-').concat(event.params.to.toHex())
// let poolShareTo = PoolShare.load(poolShareToId)
// const poolShareToBalance = poolShareTo == null ? ZERO_BD : poolShareTo.balance
// const pool = Pool.load(poolId)
// if (!pool) return
// const poolTx = PoolTransaction.load(event.transaction.hash.toHexString())
// const value = tokenToDecimal(event.params.value.toBigDecimal(), 18)
// if (isMint) {
// if (poolShareTo == null) {
// createPoolShareEntity(poolShareToId, poolId, event.params.to.toHex())
// poolShareTo = PoolShare.load(poolShareToId)
// }
// if (poolShareTo !== null) {
// poolShareTo.balance = poolShareTo.balance.plus(value)
// poolShareTo.save()
// }
// pool.totalShares = pool.totalShares.plus(value)
// if (poolTx != null) {
// poolTx.sharesTransferAmount = value
// if (poolShareTo !== null) poolTx.sharesBalance = poolShareTo.balance
// }
// } else if (isBurn) {
// if (poolShareFrom == null) {
// createPoolShareEntity(poolShareFromId, poolId, event.params.from.toHex())
// poolShareFrom = PoolShare.load(poolShareFromId)
// }
// pool.totalShares = pool.totalShares.minus(value)
// if (poolTx !== null) {
// poolTx.sharesTransferAmount = poolTx.sharesTransferAmount.minus(value)
// }
// if (poolTx !== null && poolShareFrom !== null) {
// poolTx.sharesBalance = poolShareFrom.balance
// }
// if (poolShareFrom !== null) {
// poolShareFrom.balance = poolShareFrom.balance.minus(value)
// poolShareFrom.save()
// }
// } else {
// if (poolShareTo == null) {
// createPoolShareEntity(poolShareToId, poolId, event.params.to.toHex())
// poolShareTo = PoolShare.load(poolShareToId)
// }
// if (poolShareTo !== null) {
// poolShareTo.balance = poolShareTo.balance.plus(value)
// poolShareTo.save()
// }
// if (poolShareFrom == null) {
// createPoolShareEntity(poolShareFromId, poolId, event.params.from.toHex())
// poolShareFrom = PoolShare.load(poolShareFromId)
// }
// if (poolShareFrom !== null) {
// poolShareFrom.balance = poolShareFrom.balance.minus(value)
// poolShareFrom.save()
// }
// }
// if (
// poolShareTo != null &&
// poolShareTo.balance.notEqual(ZERO_BD) &&
// poolShareToBalance.equals(ZERO_BD)
// ) {
// pool.holderCount = pool.holderCount.plus(BigInt.fromI32(1))
// }
// if (
// poolShareFrom !== null &&
// poolShareFrom.balance.equals(ZERO_BD) &&
// poolShareFrom.balance.notEqual(ZERO_BD)
// ) {
// pool.holderCount = pool.holderCount.plus(BigInt.fromI32(1))
// }
// if (poolTx !== null) {
// poolTx.save()
// }
// pool.save()
// }
// /************************************
// *********** GULP ************
// ************************************/
// export function handleGulp(event: LOG_CALL): void {
// const poolId = event.address.toHex()
// const ptx = event.transaction.hash.toHexString()
// // we need to check the contract balance & compare with our internal balances
// const pool = Pool.load(poolId)
// const poolEbtity = PoolEntity.bind(Address.fromString(poolId))
// if (!pool) {
// log.warning('Gulp called, but cannot load pool {}', [poolId])
// return
// }
// const ocnToken = PoolToken.load(poolId.concat('-').concat(OCEAN))
// const dtToken = PoolToken.load(
// poolId.concat('-').concat(pool.datatokenAddress)
// )
// // get the balances from the contract
// // for ocean
// if (ocnToken) {
// const ocnTokenBalance = ocnToken.balance
// const balanceAttempt = poolEbtity.try_getBalance(Address.fromString(OCEAN))
// if (!balanceAttempt.reverted) {
// const contractBalance = bigIntToDecimal(balanceAttempt.value, 18)
// if (
// ocnToken.balance.notEqual(contractBalance) &&
// contractBalance.ge(ZERO_BD)
// ) {
// // we have a difference. let's absorb that
// createPoolTransaction(event, 'gulp', event.params.caller.toHexString())
// ocnToken.balance = contractBalance
// ocnToken.save()
// updatePoolTransactionToken(
// ptx,
// ocnToken.id,
// contractBalance.minus(ocnTokenBalance),
// contractBalance,
// ZERO_BD
// )
// }
// }
// }
// // for dt
// if (dtToken) {
// const dtTokenBalance = dtToken.balance
// const balanceAttempt = poolEbtity.try_getBalance(
// Address.fromString(pool.datatokenAddress)
// )
// if (!balanceAttempt.reverted) {
// const contractBalance = bigIntToDecimal(balanceAttempt.value, 18)
// if (
// dtToken.balance.notEqual(contractBalance) &&
// contractBalance.ge(ZERO_BD)
// ) {
// // we have a difference. let's absorb that
// createPoolTransaction(event, 'gulp', event.params.caller.toHexString())
// dtToken.balance = contractBalance
// dtToken.save()
// updatePoolTransactionToken(
// ptx,
// dtToken.id,
// contractBalance.minus(dtTokenBalance),
// contractBalance,
// ZERO_BD
// )
// }
// }
// }
// }

View File

@ -1,577 +0,0 @@
import { BigInt, Address, BigDecimal, log } from '@graphprotocol/graph-ts'
import {
LOG_CALL,
LOG_JOIN,
LOG_EXIT,
LOG_SWAP,
Transfer,
Pool as PoolEntity
} from '../@types/templates/Pool/Pool'
import {
PoolFactory,
Pool,
PoolToken,
PoolShare,
Datatoken,
PoolTransaction,
Global
} from '../@types/schema'
import {
hexToDecimal,
tokenToDecimal,
createPoolShareEntity,
createPoolTokenEntity,
ZERO_BD,
MINUS_1_BD,
decrPoolCount,
updatePoolTransactionToken,
createPoolTransaction,
OCEAN,
updatePoolTokenBalance,
getOceanAddress,
getGlobalStats,
bigIntToDecimal
} from '../helpers'
/************************************
********** Pool Controls ***********
************************************/
export function handleSetSwapFee(
event: LOG_CALL,
swapFeeStr: string | null = null
): void {
const poolId = event.address.toHex()
const pool = Pool.load(poolId)
if (!pool) return
if (!swapFeeStr) {
swapFeeStr = event.params.data.toHexString().slice(-40)
}
if (swapFeeStr !== null) pool.swapFee = hexToDecimal(swapFeeStr, 18)
pool.save()
}
export function handleSetController(event: LOG_CALL): void {
const poolId = event.address.toHex()
const pool = Pool.load(poolId)
if (!pool) return
pool.controller = Address.fromString(
event.params.data.toHexString().slice(-40)
)
pool.save()
}
export function handleSetPublicSwap(event: LOG_CALL): void {
const poolId = event.address.toHex()
const pool = Pool.load(poolId)
if (!pool) return
pool.publicSwap = event.params.data.toHexString().slice(-1) == '1'
pool.save()
}
export function handleFinalize(event: LOG_CALL): void {
const poolId = event.address.toHex()
const pool = Pool.load(poolId)
if (!pool) {
log.error('Cannot handle finalize for unknown pool {} ', [poolId])
return
}
if (pool.tokenCount == BigInt.fromI32(0)) {
log.error('Cannot mark pool {} finalized, because we have 0 tokenCount', [
poolId
])
return
}
pool.finalized = true
pool.symbol = 'BPT'
pool.publicSwap = true
pool.save()
const factory = PoolFactory.load('1')
if (!factory) return
factory.finalizedPoolCount = factory.finalizedPoolCount + 1
factory.save()
}
export function _handleRebind(
event: LOG_CALL,
poolId: string,
tokenAddress: string,
balanceStr: string,
denormWeightStr: string
): void {
const pool = Pool.load(poolId)
if (!pool) return
const decimals = BigInt.fromI32(18).toI32()
if (tokenAddress != OCEAN) {
pool.datatokenAddress = tokenAddress
}
pool.tokenCount = pool.tokenCount.plus(BigInt.fromI32(1))
const address = Address.fromString(tokenAddress)
const denormWeight = hexToDecimal(denormWeightStr, decimals)
const poolTokenId = poolId.concat('-').concat(address.toHexString())
let poolToken = PoolToken.load(poolTokenId)
if (poolToken == null) {
createPoolTokenEntity(poolTokenId, poolId, address)
poolToken = PoolToken.load(poolTokenId)
pool.totalWeight = pool.totalWeight.plus(denormWeight)
} else {
const oldWeight = poolToken.denormWeight
if (denormWeight > oldWeight) {
pool.totalWeight = pool.totalWeight.plus(denormWeight).minus(oldWeight)
} else {
pool.totalWeight = pool.totalWeight.minus(oldWeight).minus(denormWeight)
}
}
if (!poolToken) return
poolToken.denormWeight =
denormWeight !== null ? denormWeight : BigDecimal.fromString('0')
const balance = hexToDecimal(balanceStr, decimals)
updatePoolTokenBalance(poolToken as PoolToken, balance, '_handleRebind')
poolToken.save()
if (balance.equals(ZERO_BD)) {
decrPoolCount(pool.finalized)
pool.active = false
}
pool.save()
}
export function handleRebind(event: LOG_CALL): void {
const poolId = event.address.toHex()
_handleRebind(
event,
poolId,
event.params.data.toHexString().slice(34, 74),
event.params.data.toHexString().slice(74, 138),
event.params.data.toHexString().slice(138)
)
}
export function handleSetup(event: LOG_CALL): void {
if (PoolTransaction.load(event.transaction.hash.toHexString()) != null) {
return
}
const poolId = event.address.toHex()
const data = event.params.data.toHexString()
// First 2 chars are 0x
// Next there is 8 chars
// Next starts the data each params occupies exactly 64 chars
// Each value is padded with 0s to the left
// For an Address, need to remove the leading 24 zeros, because the address itself is 40 chars
// For numbers we donot need to remove the leading zeros because they have no effect being on the left of the number
// skip 8 then take the last 40 (2 + 8 + 24 = 34) to (2 + 8 + 64 = 74)
const dataTokenAddress = Address.fromString(data.slice(34, 74)).toHexString()
const dataTokenAmount = data.slice(74, 138) // 74+64
const dataTokenWeight = data.slice(138, 202) // (74+64,74+(2*64)
const baseTokenAddress = Address.fromString(
data.slice(202 + 24, 266)
).toHexString() // (74+(2*64)+24, 74+(3*64))
const baseTokenAmount = data.slice(266, 330) // (74+(3*64),74+(4*64))
const baseTokenWeight = data.slice(330, 394) // (74+(4*64),74+(5*64))
const swapFee = data.slice(394) // (74+(5*64), END)
if (baseTokenAddress != OCEAN) {
log.error('baseTokenAddress is not Ocean, but is {}', [baseTokenAddress])
return
}
const poolTokenId = poolId.concat('-').concat(baseTokenAddress)
const poolToken = PoolToken.load(poolTokenId)
if (!poolToken) return
_handleRebind(
event,
poolId,
dataTokenAddress,
dataTokenAmount,
dataTokenWeight
)
_handleRebind(
event,
poolId,
baseTokenAddress,
baseTokenAmount,
baseTokenWeight
)
handleSetSwapFee(event, swapFee)
handleFinalize(event)
createPoolTransaction(event, 'setup', event.transaction.from.toHex())
// update base token
let amount = hexToDecimal(baseTokenAmount, 18)
const poolTokenBalance = poolToken.balance
const balance = poolTokenBalance
? poolTokenBalance
: BigDecimal.fromString('0')
updatePoolTransactionToken(
event.transaction.hash.toHexString(),
poolTokenId,
amount,
balance,
ZERO_BD
)
// update the datatoken
const poolDataToken = PoolToken.load(
poolId.concat('-').concat(dataTokenAddress)
)
if (poolDataToken !== null) {
amount = hexToDecimal(dataTokenAmount, 18)
updatePoolTransactionToken(
event.transaction.hash.toHexString(),
poolId.concat('-').concat(dataTokenAddress),
amount,
poolDataToken.balance,
ZERO_BD
)
}
}
/************************************
********** JOINS & EXITS ***********
************************************/
export function handleJoinPool(event: LOG_JOIN): void {
const poolId = event.address.toHex()
const address = event.params.tokenIn.toHex()
const ptx = event.transaction.hash.toHexString()
const poolTokenId = poolId.concat('-').concat(address)
const poolToken = PoolToken.load(poolTokenId)
const pool = Pool.load(poolId)
const datatoken = Datatoken.load(poolTokenId)
const poolTx = PoolTransaction.load(ptx)
if (poolTx !== null) return
if (!pool || !poolToken || !datatoken) return
if (pool.finalized == false) {
return
}
pool.joinCount = pool.joinCount.plus(BigInt.fromI32(1))
pool.save()
const decimals =
datatoken == null ? BigInt.fromI32(18).toI32() : datatoken.decimals
const tokenAmountIn = tokenToDecimal(
event.params.tokenAmountIn.toBigDecimal(),
decimals
)
updatePoolTokenBalance(
poolToken as PoolToken,
poolToken.balance.plus(tokenAmountIn),
'handleJoinPool'
)
poolToken.save()
createPoolTransaction(event, 'join', event.params.caller.toHexString())
updatePoolTransactionToken(
event.transaction.hash.toHexString(),
poolTokenId,
tokenAmountIn,
poolToken.balance,
tokenAmountIn.times(pool.swapFee)
)
}
export function handleExitPool(event: LOG_EXIT): void {
const poolId = event.address.toHex()
const address = event.params.tokenOut.toHex()
const poolTokenId = poolId.concat('-').concat(address.toString())
const pool = Pool.load(poolId)
const poolToken = PoolToken.load(poolTokenId)
const datatoken = Datatoken.load(poolTokenId)
if (!poolToken || !pool || !datatoken) {
return
}
const decimals =
datatoken == null ? BigInt.fromI32(18).toI32() : datatoken.decimals
const tokenAmountOut = tokenToDecimal(
event.params.tokenAmountOut.toBigDecimal(),
decimals
)
const newAmount = poolToken.balance.minus(tokenAmountOut)
updatePoolTokenBalance(poolToken as PoolToken, newAmount, 'handleExitPool')
poolToken.save()
pool.exitCount = pool.exitCount.plus(BigInt.fromI32(1))
if (newAmount.equals(ZERO_BD)) {
decrPoolCount(pool.finalized)
pool.active = false
}
pool.save()
createPoolTransaction(event, 'exit', event.params.caller.toHexString())
updatePoolTransactionToken(
event.transaction.hash.toHexString(),
poolTokenId,
tokenAmountOut.times(MINUS_1_BD),
poolToken.balance,
tokenAmountOut.times(pool.swapFee)
)
}
/************************************
************** SWAPS ***************
************************************/
export function handleSwap(event: LOG_SWAP): void {
const poolId = event.address.toHex()
const ptx = event.transaction.hash.toHexString()
const tokenIn = event.params.tokenIn.toHex()
const poolTokenInId = poolId.concat('-').concat(tokenIn.toString())
const poolTokenIn = PoolToken.load(poolTokenInId)
if (!poolTokenIn) {
return
}
const dtIn = Datatoken.load(tokenIn)
const tokenAmountIn = tokenToDecimal(
event.params.tokenAmountIn.toBigDecimal(),
dtIn == null ? 18 : dtIn.decimals
)
const newAmountIn = poolTokenIn.balance.plus(tokenAmountIn)
updatePoolTokenBalance(
poolTokenIn as PoolToken,
newAmountIn,
'handleSwap.tokenIn'
)
poolTokenIn.save()
const tokenOut = event.params.tokenOut.toHex()
const poolTokenOutId = poolId.concat('-').concat(tokenOut.toString())
const poolTokenOut = PoolToken.load(poolTokenOutId)
const pool = Pool.load(poolId)
const factory = PoolFactory.load('1')
const dtOut = Datatoken.load(tokenOut)
if (!poolTokenOut || !dtOut || !factory || !pool) return
const tokenAmountOut = tokenToDecimal(
event.params.tokenAmountOut.toBigDecimal(),
dtOut == null ? 18 : dtOut.decimals
)
const newAmountOut = poolTokenOut.balance.minus(tokenAmountOut)
updatePoolTokenBalance(
poolTokenOut as PoolToken,
newAmountOut,
'handleSwap.tokenOut'
)
poolTokenOut.save()
pool.swapCount = pool.swapCount.plus(BigInt.fromI32(1))
if (newAmountIn.equals(ZERO_BD) || newAmountOut.equals(ZERO_BD)) {
decrPoolCount(pool.finalized)
pool.active = false
}
if (tokenIn === getOceanAddress()) {
pool.totalSwapVolume = pool.totalSwapVolume.plus(tokenAmountIn)
factory.totalSwapVolume = factory.totalSwapVolume.plus(tokenAmountIn)
} else {
pool.totalSwapVolume = pool.totalSwapVolume.plus(tokenAmountOut)
factory.totalSwapVolume = factory.totalSwapVolume.plus(tokenAmountOut)
}
factory.save()
pool.save()
const gStats: Global = getGlobalStats()
if (gStats !== null) {
gStats.totalSwapVolume = factory.totalSwapVolume
gStats.save()
}
createPoolTransaction(event, 'swap', event.params.caller.toHexString())
updatePoolTransactionToken(
ptx,
poolTokenIn.id,
tokenAmountIn,
poolTokenIn.balance,
tokenAmountIn.times(pool.swapFee)
)
updatePoolTransactionToken(
ptx,
poolTokenOut.id,
tokenAmountOut.times(MINUS_1_BD),
poolTokenOut.balance,
BigDecimal.fromString('0.0')
)
}
/************************************
*********** POOL SHARES ************
************************************/
export function handleTransfer(event: Transfer): void {
const poolId = event.address.toHex()
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
const isMint = event.params.from.toHex() == ZERO_ADDRESS
const isBurn = event.params.to.toHex() == ZERO_ADDRESS
const poolShareFromId = poolId.concat('-').concat(event.params.from.toHex())
let poolShareFrom = PoolShare.load(poolShareFromId)
const poolShareToId = poolId.concat('-').concat(event.params.to.toHex())
let poolShareTo = PoolShare.load(poolShareToId)
const poolShareToBalance = poolShareTo == null ? ZERO_BD : poolShareTo.balance
const pool = Pool.load(poolId)
if (!pool) return
const poolTx = PoolTransaction.load(event.transaction.hash.toHexString())
const value = tokenToDecimal(event.params.value.toBigDecimal(), 18)
if (isMint) {
if (poolShareTo == null) {
createPoolShareEntity(poolShareToId, poolId, event.params.to.toHex())
poolShareTo = PoolShare.load(poolShareToId)
}
if (poolShareTo !== null) {
poolShareTo.balance = poolShareTo.balance.plus(value)
poolShareTo.save()
}
pool.totalShares = pool.totalShares.plus(value)
if (poolTx != null) {
poolTx.sharesTransferAmount = value
if (poolShareTo !== null) poolTx.sharesBalance = poolShareTo.balance
}
} else if (isBurn) {
if (poolShareFrom == null) {
createPoolShareEntity(poolShareFromId, poolId, event.params.from.toHex())
poolShareFrom = PoolShare.load(poolShareFromId)
}
pool.totalShares = pool.totalShares.minus(value)
if (poolTx !== null) {
poolTx.sharesTransferAmount = poolTx.sharesTransferAmount.minus(value)
}
if (poolTx !== null && poolShareFrom !== null) {
poolTx.sharesBalance = poolShareFrom.balance
}
if (poolShareFrom !== null) {
poolShareFrom.balance = poolShareFrom.balance.minus(value)
poolShareFrom.save()
}
} else {
if (poolShareTo == null) {
createPoolShareEntity(poolShareToId, poolId, event.params.to.toHex())
poolShareTo = PoolShare.load(poolShareToId)
}
if (poolShareTo !== null) {
poolShareTo.balance = poolShareTo.balance.plus(value)
poolShareTo.save()
}
if (poolShareFrom == null) {
createPoolShareEntity(poolShareFromId, poolId, event.params.from.toHex())
poolShareFrom = PoolShare.load(poolShareFromId)
}
if (poolShareFrom !== null) {
poolShareFrom.balance = poolShareFrom.balance.minus(value)
poolShareFrom.save()
}
}
if (
poolShareTo != null &&
poolShareTo.balance.notEqual(ZERO_BD) &&
poolShareToBalance.equals(ZERO_BD)
) {
pool.holderCount = pool.holderCount.plus(BigInt.fromI32(1))
}
if (
poolShareFrom !== null &&
poolShareFrom.balance.equals(ZERO_BD) &&
poolShareFrom.balance.notEqual(ZERO_BD)
) {
pool.holderCount = pool.holderCount.plus(BigInt.fromI32(1))
}
if (poolTx !== null) {
poolTx.save()
}
pool.save()
}
/************************************
*********** GULP ************
************************************/
export function handleGulp(event: LOG_CALL): void {
const poolId = event.address.toHex()
const ptx = event.transaction.hash.toHexString()
// we need to check the contract balance & compare with our internal balances
const pool = Pool.load(poolId)
const poolEbtity = PoolEntity.bind(Address.fromString(poolId))
if (!pool) {
log.warning('Gulp called, but cannot load pool {}', [poolId])
return
}
const ocnToken = PoolToken.load(poolId.concat('-').concat(OCEAN))
const dtToken = PoolToken.load(
poolId.concat('-').concat(pool.datatokenAddress)
)
// get the balances from the contract
// for ocean
if (ocnToken) {
const ocnTokenBalance = ocnToken.balance
const balanceAttempt = poolEbtity.try_getBalance(Address.fromString(OCEAN))
if (!balanceAttempt.reverted) {
const contractBalance = bigIntToDecimal(balanceAttempt.value, 18)
if (
ocnToken.balance.notEqual(contractBalance) &&
contractBalance.ge(ZERO_BD)
) {
// we have a difference. let's absorb that
createPoolTransaction(event, 'gulp', event.params.caller.toHexString())
ocnToken.balance = contractBalance
ocnToken.save()
updatePoolTransactionToken(
ptx,
ocnToken.id,
contractBalance.minus(ocnTokenBalance),
contractBalance,
ZERO_BD
)
}
}
}
// for dt
if (dtToken) {
const dtTokenBalance = dtToken.balance
const balanceAttempt = poolEbtity.try_getBalance(
Address.fromString(pool.datatokenAddress)
)
if (!balanceAttempt.reverted) {
const contractBalance = bigIntToDecimal(balanceAttempt.value, 18)
if (
dtToken.balance.notEqual(contractBalance) &&
contractBalance.ge(ZERO_BD)
) {
// we have a difference. let's absorb that
createPoolTransaction(event, 'gulp', event.params.caller.toHexString())
dtToken.balance = contractBalance
dtToken.save()
updatePoolTransactionToken(
ptx,
dtToken.id,
contractBalance.minus(dtTokenBalance),
contractBalance,
ZERO_BD
)
}
}
}
}

View File

@ -1,213 +1,89 @@
specVersion: 0.0.2 specVersion: 0.0.3
description: Ocean provides data sharing through IDOs description: Ocean provides data sharing through IDOs
repository: https://github.com/oceanprotocol/ocean-subgraph repository: https://github.com/oceanprotocol/ocean-subgraph
schema: schema:
file: ./schema.graphql file: ./schema.graphql
dataSources: dataSources:
- kind: ethereum/contract - kind: ethereum/contract
name: Factory name: ERC721Factory
network: mainnet network: barge
source: source:
address: '0xbe0083053744ECb871510C88dC0f6b77Da162706' address: '0x0599a4a2873B38D836E10302De1ca4834F7BDF4E'
abi: Factory abi: ERC721Factory
startBlock: 11105585 startBlock: 0
mapping: mapping:
kind: ethereum/events kind: ethereum/events
apiVersion: 0.0.5 apiVersion: 0.0.5
language: wasm/assemblyscript language: wasm/assemblyscript
file: ./src/mappings/factory.ts file: ./src/mappings/erc721Factory.ts
entities: entities:
- PoolFactory - ERC721Factory
abis: abis:
- name: Factory - name: ERC721Factory
file: ./abis/BFactory.json file: ./abis/ERC721Factory.json
eventHandlers: eventHandlers:
- event: BPoolRegistered(address,indexed address) - event: NFTCreated(indexed address,indexed address,indexed string,address)
handler: handleNewPool handler: handleNftCreated
- kind: ethereum/contract - event: TokenCreated(indexed address,indexed address,indexed string)
name: DTFactory
network: mainnet
source:
address: '0x57317f97E9EA49eBd19f7c9bB7c180b8cDcbDeB9'
abi: DTFactory
startBlock: 11105560
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/dtfactory.ts
entities:
- DatatokenFactory
abis:
- name: DTFactory
file: ./abis/DTFactory.json
eventHandlers:
- event: TokenRegistered(indexed address,string,string,uint256,indexed address,indexed string)
handler: handleNewToken handler: handleNewToken
- kind: ethereum/contract
name: Metadata
network: mainnet
source:
address: '0x1a4b70d8c9DcA47cD6D0Fb3c52BB8634CA1C0Fdf'
abi: Metadata
startBlock: 11105610
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/metadata.ts
entities:
- Metadata
abis:
- name: Metadata
file: ./abis/Metadata.json
eventHandlers:
- event: MetadataCreated(indexed address,indexed address,bytes,bytes)
handler: handleMetadataCreated
- event: MetadataUpdated(indexed address,indexed address,bytes,bytes)
handler: handleMetadataUpdated
- kind: ethereum/contract - kind: ethereum/contract
name: FixedRateExchange name: FixedRateExchange
network: mainnet network: barge
source: source:
address: '0x608d05214E42722B94a54cF6114d4840FCfF84e1' address: '0x2356DeCd8CFB6c6f2bf46b5ED4531818B4662337'
abi: FixedRateExchange abi: FixedRateExchange
startBlock: 11105610 startBlock: 0
mapping: mapping:
kind: ethereum/events kind: ethereum/events
apiVersion: 0.0.5 apiVersion: 0.0.5
language: wasm/assemblyscript language: wasm/assemblyscript
file: ./src/mappings/fixedrateexchange.ts file: ./src/mappings/fixedRateExchange.ts
entities: entities:
- FixedRateExchange - FixedRateExchange
abis: abis:
- name: FixedRateExchange - name: FixedRateExchange
file: ./abis/FixedRateExchange.json file: ./abis/FixedRateExchange.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20SymbolBytes
file: ./abis/ERC20SymbolBytes.json
- name: ERC20NameBytes
file: ./abis/ERC20NameBytes.json
eventHandlers: eventHandlers:
- event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256) - event: ExchangeCreated(indexed bytes32,indexed address,indexed address,address,uint256)
handler: handleExchangeCreated handler: handleExchangeCreated
- event: ExchangeActivated(indexed bytes32,indexed address)
handler: handleExchangeActivated
- event: ExchangeDeactivated(indexed bytes32,indexed address)
handler: handleExchangeDeactivated
- event: ExchangeRateChanged(indexed bytes32,indexed address,uint256)
handler: handleExchangeRateChanged
- event: Swapped(indexed bytes32,indexed address,uint256,uint256)
handler: handleSwapped
- kind: ethereum/contract - kind: ethereum/contract
name: Dispenser name: FactoryRouter
network: mainnet network: barge
source: source:
address: '0xDEfD0018969cd2d4E648209F876ADe184815f038' address: '0x5509dc151e25BdA96d508A5994654980b7574883'
abi: Dispenser abi: FactoryRouter
startBlock: 12398958 startBlock: 0
mapping: mapping:
kind: ethereum/events kind: ethereum/events
apiVersion: 0.0.5 apiVersion: 0.0.5
language: wasm/assemblyscript language: wasm/assemblyscript
file: ./src/mappings/dispenser.ts file: ./src/mappings/factoryRouter.ts
entities: entities:
- Dispenser - FactoryRouter
abis: abis:
- name: Dispenser - name: FactoryRouter
file: ./abis/Dispenser.json file: ./abis/FactoryRouter.json
eventHandlers: eventHandlers:
- event: Activated(indexed address) - event: NewPool(indexed address,bool)
handler: handleDispenserActivated handler: handleNewPool
- event: Deactivated(indexed address)
handler: handleDispenserDeactivated
- event: AcceptedMinter(indexed address)
handler: handleDispenserAcceptedMinter
- event: RemovedMinter(indexed address)
handler: handleDispenserRemovedMinter
- event: TokensDispensed(indexed address,indexed address,uint256)
handler: handleDispenserTokensDispensed
- event: OwnerWithdrawed(indexed address,indexed address,uint256)
handler: handleDispenserOwnerWithdrawed
templates: templates:
- kind: ethereum/contract - name: ERC20Template
name: Pool kind: ethereum/contract
network: mainnet network: barge
source: source:
abi: Pool abi: ERC20Template
mapping: mapping:
kind: ethereum/events kind: ethereum/events
apiVersion: 0.0.5 apiVersion: 0.0.5
language: wasm/assemblyscript language: wasm/assemblyscript
file: ./src/mappings/pool.ts file: ./src/mappings/erc20Template.ts
entities: entities:
- Pool - ERC20Template
- PoolFactory
- Swap
abis: abis:
- name: Pool - name: ERC20Template
file: ./abis/BPool.json file: ./abis/ERC20Template.json
- name: BToken
file: ./abis/BToken.json
- name: ERC20
file: ./abis/ERC20.json
- name: ERC20SymbolBytes
file: ./abis/ERC20SymbolBytes.json
- name: ERC20NameBytes
file: ./abis/ERC20NameBytes.json
eventHandlers: eventHandlers:
- event: LOG_CALL(indexed bytes4,indexed address,bytes) - event: OrderStarted(indexed address,address,uint256,uint256,uint256,indexed address,indexed address,uint256)
topic0: '0x34e1990700000000000000000000000000000000000000000000000000000000'
handler: handleSetSwapFee
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x92eefe9b00000000000000000000000000000000000000000000000000000000'
handler: handleSetController
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x49b5955200000000000000000000000000000000000000000000000000000000'
handler: handleSetPublicSwap
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x4bb278f300000000000000000000000000000000000000000000000000000000'
handler: handleFinalize
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0xd1d7bc9100000000000000000000000000000000000000000000000000000000'
handler: handleSetup
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x3fdddaa200000000000000000000000000000000000000000000000000000000'
handler: handleRebind
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0xe4e1e53800000000000000000000000000000000000000000000000000000000'
handler: handleRebind
- event: LOG_CALL(indexed bytes4,indexed address,bytes)
topic0: '0x8c28cbe800000000000000000000000000000000000000000000000000000000'
handler: handleGulp
- event: LOG_JOIN(indexed address,indexed address,uint256)
handler: handleJoinPool
- event: LOG_EXIT(indexed address,indexed address,uint256)
handler: handleExitPool
- event: LOG_SWAP(indexed address,indexed address,indexed address,uint256,uint256)
handler: handleSwap
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- kind: ethereum/contract
name: DataToken
network: mainnet
source:
abi: DataToken
mapping:
kind: ethereum/events
apiVersion: 0.0.5
language: wasm/assemblyscript
file: ./src/mappings/datatoken.ts
entities:
- DataToken
- DatatokenFactory
abis:
- name: DataToken
file: ./abis/DataTokenTemplate.json
eventHandlers:
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- event: OrderStarted(indexed address,indexed address,uint256,uint256,uint256,indexed address,uint256)
handler: handleOrderStarted handler: handleOrderStarted
- event: MinterApproved(address,address)
handler: handleMinterApproved