bring subgraph up to date on latest graph-cli and graph-ts

This commit is contained in:
Leonardo Yvens 2019-10-24 12:33:37 -03:00
parent 4ac483ae13
commit 69f33d52c0
5 changed files with 170 additions and 80 deletions

View File

@ -11,7 +11,7 @@
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 graphprotocol/token-subgraph"
},
"devDependencies": {
"@graphprotocol/graph-cli": "0.14.0",
"@graphprotocol/graph-ts": "0.14.0"
"@graphprotocol/graph-cli": "0.15.3",
"@graphprotocol/graph-ts": "0.15.1"
}
}

View File

@ -2,7 +2,7 @@ import { Address, JSONValue, Value, log, ipfs } from '@graphprotocol/graph-ts'
import { Token } from '../../generated/schema'
import { Unknown } from '../../generated/TokenRegistry/TokenRegistry'
import { BurnableToken, MintableToken, StandardToken } from '../../generated/TokenRegistry/templates'
import { BurnableToken, MintableToken, StandardToken } from '../../generated/templates'
import { REGISTRY_HASH } from '../config'
import { decodeFlags, DEFAULT_DECIMALS, isBurnable, isMintable } from '../helpers/tokens'

View File

@ -1,8 +1,8 @@
import { BigInt, BigDecimal, Bytes, EthereumEvent } from '@graphprotocol/graph-ts'
import { Transfer } from '../../generated/TokenRegistry/templates/StandardToken/ERC20'
import { Burn } from '../../generated/TokenRegistry/templates/BurnableToken/Burnable'
import { Mint } from '../../generated/TokenRegistry/templates/MintableToken/Mintable'
import { Transfer } from '../../generated/templates/StandardToken/ERC20'
import { Burn } from '../../generated/templates/BurnableToken/Burnable'
import { Mint } from '../../generated/templates/MintableToken/Mintable'
import { BurnEvent, MintEvent, Token, TransferEvent } from '../../generated/schema'

View File

@ -1,4 +1,4 @@
specVersion: 0.0.1
specVersion: 0.0.2
schema:
file: ./schema.graphql
dataSources:
@ -27,59 +27,59 @@ dataSources:
- event: 'Unknown(indexed bytes,indexed bytes)'
topic0: '0xa9e319c3b10db96c5cee4bc3ebffa9c5581f222f14a4deb0df7ec2088ccd0974'
handler: initRegistry
templates:
# These data sources templates exist to support the different flags that a token could specify
- name: StandardToken
kind: ethereum/contract
network: mainnet
source:
abi: ERC20
mapping:
kind: ethereum/events
apiVersion: 0.0.3
language: wasm/assemblyscript
file: ./src/mappings/token.ts
entities:
- TransferEvent
abis:
- name: ERC20
file: ./abis/ERC20.json
eventHandlers:
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- name: BurnableToken
kind: ethereum/contract
network: mainnet
source:
abi: Burnable
mapping:
kind: ethereum/events
apiVersion: 0.0.3
language: wasm/assemblyscript
file: ./src/mappings/token.ts
entities:
- BurnEvent
abis:
- name: Burnable
file: ./abis/Burnable.json
eventHandlers:
- event: Burn(indexed address,uint256)
handler: handleBurn
- name: MintableToken
kind: ethereum/contract
network: mainnet
source:
abi: Mintable
mapping:
kind: ethereum/events
apiVersion: 0.0.3
language: wasm/assemblyscript
file: ./src/mappings/token.ts
entities:
- MintEvent
abis:
- name: Mintable
file: ./abis/Mintable.json
eventHandlers:
- event: Mint(indexed address,uint256)
handler: handleMint
templates:
# These data sources templates exist to support the different flags that a token could specify
- name: StandardToken
kind: ethereum/contract
network: mainnet
source:
abi: ERC20
mapping:
kind: ethereum/events
apiVersion: 0.0.3
language: wasm/assemblyscript
file: ./src/mappings/token.ts
entities:
- TransferEvent
abis:
- name: ERC20
file: ./abis/ERC20.json
eventHandlers:
- event: Transfer(indexed address,indexed address,uint256)
handler: handleTransfer
- name: BurnableToken
kind: ethereum/contract
network: mainnet
source:
abi: Burnable
mapping:
kind: ethereum/events
apiVersion: 0.0.3
language: wasm/assemblyscript
file: ./src/mappings/token.ts
entities:
- BurnEvent
abis:
- name: Burnable
file: ./abis/Burnable.json
eventHandlers:
- event: Burn(indexed address,uint256)
handler: handleBurn
- name: MintableToken
kind: ethereum/contract
network: mainnet
source:
abi: Mintable
mapping:
kind: ethereum/events
apiVersion: 0.0.3
language: wasm/assemblyscript
file: ./src/mappings/token.ts
entities:
- MintEvent
abis:
- name: Mintable
file: ./abis/Mintable.json
eventHandlers:
- event: Mint(indexed address,uint256)
handler: handleMint

124
yarn.lock
View File

@ -9,10 +9,10 @@
dependencies:
regenerator-runtime "^0.13.2"
"@graphprotocol/graph-cli@0.14.0":
version "0.14.0"
resolved "https://registry.yarnpkg.com/@graphprotocol/graph-cli/-/graph-cli-0.14.0.tgz#61ce53f3087975ec970f0ab28c72ef7a15945d51"
integrity sha512-xW0A0ZVdF8r9IjpIgfg3sAgJ+neMRSRuKd9hmvFdgepuAYJTMNdFppJhHjuqe0y/krg0dw21jhC7/+mlC7X4lQ==
"@graphprotocol/graph-cli@0.15.3":
version "0.15.3"
resolved "https://registry.yarnpkg.com/@graphprotocol/graph-cli/-/graph-cli-0.15.3.tgz#be127af1e3c6c138553b63de772a4e9c2209b55a"
integrity sha512-z/In/CiWpA4Ug73hEHMhssL7cbchI3MnZNBJ3lYf4qkRURLASVaDM9vLSMyRU5wrVw8JdANoij8xKG2e8v+29g==
dependencies:
assemblyscript "https://github.com/AssemblyScript/assemblyscript#36040d5b5312f19a025782b5e36663823494c2f3"
chalk "^2.4.1"
@ -23,7 +23,7 @@
gluegun "^3.0.0"
graphql "^14.0.2"
immutable "^3.8.2"
ipfs-http-client "^33.1.0"
ipfs-http-client "^34.0.0"
jayson "^3.0.2"
js-yaml "^3.13.1"
node-fetch "^2.3.0"
@ -34,10 +34,10 @@
optionalDependencies:
keytar "^4.6.0"
"@graphprotocol/graph-ts@0.14.0":
version "0.14.0"
resolved "https://registry.yarnpkg.com/@graphprotocol/graph-ts/-/graph-ts-0.14.0.tgz#9a0040d04996f1e800c0f477cce32874050c6982"
integrity sha512-PPokgf5/VaZz74+5y3aprPpSNncC4beinw6U1ZyOac8dsd5dVdgKD3oru9Jf1ihTU39bE4oDyKRxqlso2F2dEg==
"@graphprotocol/graph-ts@0.15.1":
version "0.15.1"
resolved "https://registry.yarnpkg.com/@graphprotocol/graph-ts/-/graph-ts-0.15.1.tgz#d6cc85197e45dda9bb4083654c183470ff23333e"
integrity sha512-l5veH44ULpKq1kLudbfJctgxLaLpnLnYiDIIZn+N8UC1SrpqjLhJyRMfm+uH4xTglmAwI74wyynKWktXp44/iw==
dependencies:
assemblyscript "https://github.com/AssemblyScript/assemblyscript#36040d5b5312f19a025782b5e36663823494c2f3"
@ -59,6 +59,13 @@ JSONStream@^1.3.1:
jsonparse "^1.2.0"
through ">=2.2.7 <3"
abort-controller@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392"
integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==
dependencies:
event-target-shim "^5.0.0"
ajv@^6.5.5:
version "6.10.2"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52"
@ -169,6 +176,18 @@ asn1@~0.2.3:
opencollective-postinstall "^2.0.0"
source-map-support "^0.5.11"
"assemblyscript@https://github.com/AssemblyScript/assemblyscript#36040d5b5312f19a025782b5e36663823494c2f3":
version "0.6.0"
uid "36040d5b5312f19a025782b5e36663823494c2f3"
resolved "https://github.com/AssemblyScript/assemblyscript#36040d5b5312f19a025782b5e36663823494c2f3"
dependencies:
"@protobufjs/utf8" "^1.1.0"
binaryen "77.0.0-nightly.20190407"
glob "^7.1.3"
long "^4.0.0"
opencollective-postinstall "^2.0.0"
source-map-support "^0.5.11"
assert-plus@1.0.0, assert-plus@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525"
@ -375,6 +394,14 @@ buffer@^5.2.1:
base64-js "^1.0.2"
ieee754 "^1.1.4"
buffer@^5.4.2:
version "5.4.3"
resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.4.3.tgz#3fbc9c69eb713d323e3fc1a895eee0710c072115"
integrity sha512-zvj65TkFeIt3i6aj5bIvJDzjjQQGs4o/sNoezg1F1kYap9Nu2jcUdpwzRSJTHMMzG0H7bZkn4rNQpImhuxWX2A==
dependencies:
base64-js "^1.0.2"
ieee754 "^1.1.4"
builtin-status-codes@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8"
@ -713,6 +740,11 @@ err-code@^1.1.2:
resolved "https://registry.yarnpkg.com/err-code/-/err-code-1.1.2.tgz#06e0116d3028f6aef4806849eb0ea6a748ae6960"
integrity sha1-BuARbTAo9q70gGhJ6w6mp0iuaWA=
err-code@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/err-code/-/err-code-2.0.0.tgz#452dadddde12356b1dd5a85f33b28ddda377ef2a"
integrity sha512-MsMOijQ4v0xlmrz1fc7lyPEy7jFhoNF7EVaRSP7mPzs20LaFOwG6qNjGRy3Ie85n9DARlcUnB1zbsBv5sJrIvw==
error-ex@^1.3.1:
version "1.3.2"
resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf"
@ -742,6 +774,11 @@ esprima@^4.0.0:
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
event-target-shim@^5.0.0:
version "5.0.1"
resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789"
integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==
evp_bytestokey@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02"
@ -768,6 +805,11 @@ expand-template@^2.0.3:
resolved "https://registry.yarnpkg.com/expand-template/-/expand-template-2.0.3.tgz#6e14b3fcee0f3a6340ecb57d2e8918692052a47c"
integrity sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==
explain-error@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/explain-error/-/explain-error-1.0.4.tgz#a793d3ac0cad4c6ab571e9968fbbab6cb2532929"
integrity sha1-p5PTrAytTGq1cemWj7urbLJTKSk=
extend@~3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa"
@ -1085,22 +1127,24 @@ ipfs-block@~0.8.1:
cids "~0.7.0"
class-is "^1.1.0"
ipfs-http-client@^33.1.0:
version "33.1.1"
resolved "https://registry.yarnpkg.com/ipfs-http-client/-/ipfs-http-client-33.1.1.tgz#6ddc13e86f8db768093290b19537d2388c74dd45"
integrity sha512-iwtLL3lOIzxXJFwLnOEtFUv1cYTuWJ0NauD7rpMEd/y4C7z6fuN6TSF4h547lxMh7sJWv+6Z0PmOA5N8FzUHJw==
ipfs-http-client@^34.0.0:
version "34.0.0"
resolved "https://registry.yarnpkg.com/ipfs-http-client/-/ipfs-http-client-34.0.0.tgz#8804d06a11c22306332a8ffa0949b6f672a0c9c8"
integrity sha512-4RCkk8ix4Dqn6sxqFVwuXWCZ1eLFPsVaj6Ijvu1fs9VYgxgVudsW9PWwarlr4mw1xUCmPWYyXnEbGgzBrfMy0Q==
dependencies:
abort-controller "^3.0.0"
async "^2.6.1"
bignumber.js "^9.0.0"
bl "^3.0.0"
bs58 "^4.0.1"
buffer "^5.2.1"
buffer "^5.4.2"
cids "~0.7.1"
concat-stream "github:hugomrdias/concat-stream#feat/smaller"
debug "^4.1.0"
detect-node "^2.0.4"
end-of-stream "^1.4.1"
err-code "^1.1.2"
err-code "^2.0.0"
explain-error "^1.0.4"
flatmap "0.0.3"
glob "^7.1.3"
ipfs-block "~0.8.1"
@ -1113,9 +1157,12 @@ ipfs-http-client@^33.1.0:
is-stream "^2.0.0"
iso-stream-http "~0.1.2"
iso-url "~0.4.6"
iterable-ndjson "^1.1.0"
just-kebab-case "^1.1.0"
just-map-keys "^1.1.0"
kind-of "^6.0.2"
ky "^0.11.2"
ky-universal "^0.2.2"
lru-cache "^5.1.1"
multiaddr "^6.0.6"
multibase "~0.6.0"
@ -1123,8 +1170,9 @@ ipfs-http-client@^33.1.0:
multihashes "~0.4.14"
ndjson "github:hugomrdias/ndjson#feat/readable-stream3"
once "^1.4.0"
peer-id "~0.12.2"
peer-id "~0.12.3"
peer-info "~0.15.1"
promise-nodeify "^3.0.1"
promisify-es6 "^1.0.3"
pull-defer "~0.2.3"
pull-stream "^3.6.9"
@ -1320,6 +1368,13 @@ isstream@~0.1.2:
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=
iterable-ndjson@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/iterable-ndjson/-/iterable-ndjson-1.1.0.tgz#36f7e8a5bb04fd087d384f29e44fc4280fc014fc"
integrity sha512-OOp1Lb0o3k5MkXHx1YaIY5Z0ELosZfTnBaas9f8opJVcZGBIONA2zY/6CYE+LKkqrSDooIneZbrBGgOZnHPkrg==
dependencies:
string_decoder "^1.2.0"
iterall@^1.2.2:
version "1.2.2"
resolved "https://registry.yarnpkg.com/iterall/-/iterall-1.2.2.tgz#92d70deb8028e0c39ff3164fdbf4d8b088130cd7"
@ -1434,6 +1489,19 @@ kind-of@^6.0.2:
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051"
integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==
ky-universal@^0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/ky-universal/-/ky-universal-0.2.2.tgz#7a36e1a75641a98f878157463513965f799f5bfe"
integrity sha512-fb32o/fKy/ux2ALWa9HU2hvGtfOq7/vn2nH0FpVE+jwNzyTeORlAbj3Fiw+WLMbUlmVqZIWupnLZ2USHvqwZHw==
dependencies:
abort-controller "^3.0.0"
node-fetch "^2.3.0"
ky@^0.11.2:
version "0.11.2"
resolved "https://registry.yarnpkg.com/ky/-/ky-0.11.2.tgz#4ffe6621d9d9ab61bf0f5500542e3a96d1ba0815"
integrity sha512-5Aou5BWue5/mkPqIRqzSWW+0Hkl403pr/2AIrCKYw7cVl/Xoe8Xe4KLBO0PRjbz7GnRe1/8wW1KhqQNFFE7/GQ==
libp2p-crypto-secp256k1@~0.3.0:
version "0.3.1"
resolved "https://registry.yarnpkg.com/libp2p-crypto-secp256k1/-/libp2p-crypto-secp256k1-0.3.1.tgz#4cbeb857f5cfe5fefb1253e6b2994420c0ca166e"
@ -1909,6 +1977,16 @@ peer-id@~0.12.2:
libp2p-crypto "~0.16.1"
multihashes "~0.4.15"
peer-id@~0.12.3:
version "0.12.5"
resolved "https://registry.yarnpkg.com/peer-id/-/peer-id-0.12.5.tgz#b22a1edc5b4aaaa2bb830b265ba69429823e5179"
integrity sha512-3xVWrtIvNm9/OPzaQBgXDrfWNx63AftgFQkvqO6YSZy7sP3Fuadwwbn54F/VO9AnpyW/26i0WRQz9FScivXrmw==
dependencies:
async "^2.6.3"
class-is "^1.1.0"
libp2p-crypto "~0.16.1"
multihashes "~0.4.15"
peer-info@~0.15.1:
version "0.15.1"
resolved "https://registry.yarnpkg.com/peer-info/-/peer-info-0.15.1.tgz#21254a7c516d0dd046b150120b9aaf1b9ad02146"
@ -1978,6 +2056,11 @@ process-nextick-args@~2.0.0:
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"
integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==
promise-nodeify@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/promise-nodeify/-/promise-nodeify-3.0.1.tgz#f0f5d9720ee9ec71dd2bfa92667be504c10229c2"
integrity sha512-ghsSuzZXJX8iO7WVec2z7GI+Xk/EyiD+JZK7AZKhUqYfpLa/Zs4ylUD+CwwnKlG6G3HnkUPMAi6PO7zeqGKssg==
promise@~1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/promise/-/promise-1.3.0.tgz#e5cc9a4c8278e4664ffedc01c7da84842b040175"
@ -2201,7 +2284,7 @@ rsa-unpack@0.0.6:
dependencies:
optimist "~0.3.5"
safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@^5.1.2:
safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@~5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519"
integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==
@ -2368,6 +2451,13 @@ string_decoder@^1.1.1:
dependencies:
safe-buffer "~5.1.0"
string_decoder@^1.2.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e"
integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==
dependencies:
safe-buffer "~5.2.0"
string_decoder@~1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8"