From d962865edb41c5a68cb15bb70f12114824a86283 Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Thu, 25 Jan 2024 10:37:24 +0400 Subject: [PATCH 01/17] Bump graph-cli to fix incompatibility --- .vscode/settings.json | 2 +- package.json | 4 +- yarn.lock | 277 ++++-------------------------------------- 3 files changed, 25 insertions(+), 258 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index eb70fd38..c6e64f55 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,7 +3,7 @@ "eslint.packageManager": "yarn", "eslint.format.enable": true, "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" }, "cSpell.words": [ "arbitrum", diff --git a/package.json b/package.json index b66118aa..76905256 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ }, "dependencies": { "@apollo/client": "^3.8.4", - "@graphprotocol/graph-cli": "^0.57.0", + "@graphprotocol/graph-cli": "^0.67.0", "@graphprotocol/graph-ts": "^0.31.0", "assemblyscript-json": "^1.1.0", "commander": "^9.4.0", @@ -49,4 +49,4 @@ "ramda": "^0.27.2", "yargs-parser": "^18.1.1" } -} +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 9e11e987..f42070de 100644 --- a/yarn.lock +++ b/yarn.lock @@ -274,10 +274,10 @@ graphql-import-node "^0.0.5" js-yaml "^4.1.0" -"@graphprotocol/graph-cli@^0.57.0": - version "0.57.0" - resolved "https://registry.yarnpkg.com/@graphprotocol/graph-cli/-/graph-cli-0.57.0.tgz#dca0327f83b6fc081416cca1cc9f9d005dc10d03" - integrity sha512-UQ+4a4qTeGYdIWHNINtwTiL7izuRe4smgSeGmTxQQMSeebehTgrpa6NV3brGWcYsmN1Bo5egM4D9stkQtRnxeA== +"@graphprotocol/graph-cli@^0.67.0": + version "0.67.2" + resolved "https://registry.yarnpkg.com/@graphprotocol/graph-cli/-/graph-cli-0.67.2.tgz#4c8fcc52a0817454b50860cb7925b8d28fd94b91" + integrity sha512-seQyK8Fkqw0+TxWOtqVGkicLqEbCR5DQPRooo+8iqRtmZu12wDJ85n63t2abaUF//iFT7cRT4oA2OQdFXK8Vog== dependencies: "@float-capital/float-subgraph-uncrashable" "^0.0.0-alpha.4" "@oclif/core" "2.8.6" @@ -293,14 +293,13 @@ dockerode "2.5.8" fs-extra "9.1.0" glob "9.3.5" - gluegun "5.1.2" + gluegun "5.1.6" graphql "15.5.0" immutable "4.2.1" ipfs-http-client "55.0.0" jayson "4.0.0" js-yaml "3.14.1" - prettier "1.19.1" - request "2.88.2" + prettier "3.0.3" semver "7.4.0" sync-request "6.1.0" tmp-promise "3.0.3" @@ -894,7 +893,7 @@ acorn@^8.9.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw== -ajv@^6.12.3, ajv@^6.12.4: +ajv@^6.12.4: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -1005,13 +1004,6 @@ asap@~2.0.6: resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" integrity sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA== -asn1@~0.2.3: - version "0.2.6" - resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.6.tgz#0d3a7bb6e64e02a90c0303b31f292868ea09a08d" - integrity sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ== - dependencies: - safer-buffer "~2.1.0" - asn1js@^3.0.1, asn1js@^3.0.5: version "3.0.5" resolved "https://registry.yarnpkg.com/asn1js/-/asn1js-3.0.5.tgz#5ea36820443dbefb51cc7f88a2ebb5b462114f38" @@ -1043,11 +1035,6 @@ assemblyscript@0.19.23: long "^5.2.0" source-map-support "^0.5.20" -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" - integrity sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw== - astral-regex@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" @@ -1068,16 +1055,6 @@ at-least-node@^1.0.0: resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg== -aws-sign2@~0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" - integrity sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA== - -aws4@^1.8.0: - version "1.12.0" - resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.12.0.tgz#ce1c9d143389679e253b314241ea9aa5cec980d3" - integrity sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg== - axios@^0.21.1, axios@^0.21.4: version "0.21.4" resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575" @@ -1102,13 +1079,6 @@ base64-js@^1.3.1: resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== -bcrypt-pbkdf@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" - integrity sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w== - dependencies: - tweetnacl "^0.14.3" - binary-extensions@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" @@ -1451,7 +1421,7 @@ colors@1.4.0, colors@^1.1.2: resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== -combined-stream@^1.0.6, combined-stream@~1.0.6: +combined-stream@^1.0.6: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== @@ -1488,11 +1458,6 @@ concat-stream@^1.6.0, concat-stream@^1.6.2, concat-stream@~1.6.2: readable-stream "^2.2.2" typedarray "^0.0.6" -core-util-is@1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" - integrity sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ== - core-util-is@~1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" @@ -1561,13 +1526,6 @@ d@1, d@^1.0.1: es5-ext "^0.10.50" type "^1.0.1" -dashdash@^1.12.0: - version "1.14.1" - resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" - integrity sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g== - dependencies: - assert-plus "^1.0.0" - debug@4.3.4, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" @@ -1682,15 +1640,7 @@ dreamopt@~0.8.0: dependencies: wordwrap ">=0.0.2" -ecc-jsbn@~0.1.1: - version "0.1.2" - resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" - integrity sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw== - dependencies: - jsbn "~0.1.0" - safer-buffer "^2.1.0" - -ejs@3.1.6, ejs@^3.1.7, ejs@^3.1.8: +ejs@3.1.8, ejs@^3.1.7, ejs@^3.1.8: version "3.1.8" resolved "https://registry.yarnpkg.com/ejs/-/ejs-3.1.8.tgz#758d32910c78047585c7ef1f92f9ee041c1c190b" integrity sha512-/sXZeMlhS0ArkfX2Aw780gJzXSMPnKjtspYZv+f3NiKLlubezAHDU5+9xz6gd3/NhG3txQCo6xlglmTS+oTGEQ== @@ -2015,21 +1965,6 @@ ext@^1.1.2: dependencies: type "^2.7.2" -extend@~3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" - integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== - -extsprintf@1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" - integrity sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g== - -extsprintf@^1.2.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.1.tgz#8d172c064867f235c0c84a596806d279bf4bcc07" - integrity sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA== - eyes@^0.1.8: version "0.1.8" resolved "https://registry.yarnpkg.com/eyes/-/eyes-0.1.8.tgz#62cf120234c683785d902348a800ef3e0cc20bc0" @@ -2163,11 +2098,6 @@ follow-redirects@^1.14.0: resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== -forever-agent@~0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" - integrity sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw== - form-data@^2.2.0: version "2.5.1" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.5.1.tgz#f2cbec57b5e59e23716e128fe44d4e5dd23895f4" @@ -2177,15 +2107,6 @@ form-data@^2.2.0: combined-stream "^1.0.6" mime-types "^2.1.12" -form-data@~2.3.2: - version "2.3.3" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" - integrity sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.6" - mime-types "^2.1.12" - fs-constants@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" @@ -2261,13 +2182,6 @@ get-stream@^6.0.0: resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== -getpass@^0.1.1: - version "0.1.7" - resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" - integrity sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng== - dependencies: - assert-plus "^1.0.0" - glob-parent@^5.1.2, glob-parent@~5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" @@ -2323,10 +2237,10 @@ globby@^11.1.0: merge2 "^1.4.1" slash "^3.0.0" -gluegun@5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/gluegun/-/gluegun-5.1.2.tgz#ffa0beda0fb6bbc089a867157b08602beae2c8cf" - integrity sha512-Cwx/8S8Z4YQg07a6AFsaGnnnmd8mN17414NcPS3OoDtZRwxgsvwRNJNg69niD6fDa8oNwslCG0xH7rEpRNNE/g== +gluegun@5.1.6: + version "5.1.6" + resolved "https://registry.yarnpkg.com/gluegun/-/gluegun-5.1.6.tgz#74ec13193913dc610f5c1a4039972c70c96a7bad" + integrity sha512-9zbi4EQWIVvSOftJWquWzr9gLX2kaDgPkNR5dYWbM53eVvCI3iKuxLlnKoHC0v4uPoq+Kr/+F569tjoFbA4DSA== dependencies: apisauce "^2.1.5" app-module-path "^2.2.0" @@ -2334,7 +2248,7 @@ gluegun@5.1.2: colors "1.4.0" cosmiconfig "7.0.1" cross-spawn "7.0.3" - ejs "3.1.6" + ejs "3.1.8" enquirer "2.3.6" execa "5.1.1" fs-jetpack "4.3.1" @@ -2396,19 +2310,6 @@ graphql@^16.8.1: resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.8.1.tgz#1930a965bef1170603702acdb68aedd3f3cf6f07" integrity sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw== -har-schema@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" - integrity sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q== - -har-validator@~5.1.3: - version "5.1.5" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.5.tgz#1f0803b9f8cb20c0fa13822df1ecddb36bde1efd" - integrity sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w== - dependencies: - ajv "^6.12.3" - har-schema "^2.0.0" - has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" @@ -2491,15 +2392,6 @@ http-response-object@^3.0.1: dependencies: "@types/node" "^10.0.3" -http-signature@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" - integrity sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ== - dependencies: - assert-plus "^1.0.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - human-signals@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" @@ -2753,11 +2645,6 @@ is-stream@^2.0.0: resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== -is-typedarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" - integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA== - is-wsl@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" @@ -2790,11 +2677,6 @@ isomorphic-ws@^4.0.1: resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz#55fd4cd6c5e6491e76dc125938dd863f5cd4f2dc" integrity sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w== -isstream@~0.1.2: - version "0.1.2" - resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" - integrity sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g== - it-all@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/it-all/-/it-all-1.0.6.tgz#852557355367606295c4c3b7eff0136f07749335" @@ -2893,11 +2775,6 @@ js-yaml@^4.1.0: dependencies: argparse "^2.0.1" -jsbn@~0.1.0: - version "0.1.1" - resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" - integrity sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg== - json-buffer@3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" @@ -2922,17 +2799,12 @@ json-schema-traverse@^0.4.1: resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== -json-schema@0.4.0: - version "0.4.0" - resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.4.0.tgz#f7de4cf6efab838ebaeb3236474cbba5a1930ab5" - integrity sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA== - json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== -json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: +json-stringify-safe@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== @@ -2956,16 +2828,6 @@ jsonparse@^1.2.0: resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" integrity sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg== -jsprim@^1.2.2: - version "1.4.2" - resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.2.tgz#712c65533a15c878ba59e9ed5f0e26d5b77c5feb" - integrity sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw== - dependencies: - assert-plus "1.0.0" - extsprintf "1.3.0" - json-schema "0.4.0" - verror "1.10.0" - keccak@^3.0.0: version "3.0.3" resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.3.tgz#4bc35ad917be1ef54ff246f904c2bbbf9ac61276" @@ -3195,7 +3057,7 @@ mime-db@1.52.0: resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -mime-types@^2.1.12, mime-types@~2.1.19: +mime-types@^2.1.12: version "2.1.35" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== @@ -3401,11 +3263,6 @@ number-to-bn@1.7.0: bn.js "4.11.6" strip-hex-prefix "1.0.0" -oauth-sign@~0.9.0: - version "0.9.0" - resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" - integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== - object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" @@ -3575,11 +3432,6 @@ pbkdf2@^3.0.17: safe-buffer "^5.0.1" sha.js "^2.4.8" -performance-now@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" - integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow== - picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" @@ -3595,10 +3447,10 @@ prelude-ls@^1.2.1: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== -prettier@1.19.1: - version "1.19.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" - integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== +prettier@3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.3.tgz#432a51f7ba422d1469096c0fdc28e235db8f9643" + integrity sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg== prettier@^2.6.2: version "2.8.8" @@ -3645,11 +3497,6 @@ protobufjs@^6.10.2: "@types/node" ">=13.7.0" long "^4.0.0" -psl@^1.1.28: - version "1.9.0" - resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7" - integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag== - pump@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/pump/-/pump-1.0.3.tgz#5dfe8311c33bbf6fc18261f9f34702c47c08a954" @@ -3663,7 +3510,7 @@ punycode@^1.3.2: resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" integrity sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ== -punycode@^2.1.0, punycode@^2.1.1: +punycode@^2.1.0: version "2.3.0" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f" integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA== @@ -3687,11 +3534,6 @@ qs@^6.4.0: dependencies: side-channel "^1.0.4" -qs@~6.5.2: - version "6.5.3" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.3.tgz#3aeeffc91967ef6e35c0e488ef46fb296ab76aad" - integrity sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA== - queue-microtask@^1.2.2: version "1.2.3" resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" @@ -3774,32 +3616,6 @@ redeyed@~2.1.0: dependencies: esprima "~4.0.0" -request@2.88.2: - version "2.88.2" - resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" - integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== - dependencies: - aws-sign2 "~0.7.0" - aws4 "^1.8.0" - caseless "~0.12.0" - combined-stream "~1.0.6" - extend "~3.0.2" - forever-agent "~0.6.1" - form-data "~2.3.2" - har-validator "~5.1.3" - http-signature "~1.2.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.19" - oauth-sign "~0.9.0" - performance-now "^2.1.0" - qs "~6.5.2" - safe-buffer "^5.1.2" - tough-cookie "~2.5.0" - tunnel-agent "^0.6.0" - uuid "^3.3.2" - resolve-from@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" @@ -3874,7 +3690,7 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1: resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -"safer-buffer@>= 2.1.2 < 3.0.0", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: +"safer-buffer@>= 2.1.2 < 3.0.0": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== @@ -3990,21 +3806,6 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== -sshpk@^1.7.0: - version "1.17.0" - resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.17.0.tgz#578082d92d4fe612b13007496e543fa0fbcbe4c5" - integrity sha512-/9HIEs1ZXGhSPE8X6Ccm7Nam1z8KcoCqPdI7ecm1N33EzAetWahvQWVqLZtaZQ+IDKX4IyA2o0gBzqIMkAagHQ== - dependencies: - asn1 "~0.2.3" - assert-plus "^1.0.0" - bcrypt-pbkdf "^1.0.0" - dashdash "^1.12.0" - ecc-jsbn "~0.1.1" - getpass "^0.1.1" - jsbn "~0.1.0" - safer-buffer "^2.0.2" - tweetnacl "~0.14.0" - stream-to-it@^0.2.2: version "0.2.4" resolved "https://registry.yarnpkg.com/stream-to-it/-/stream-to-it-0.2.4.tgz#d2fd7bfbd4a899b4c0d6a7e6a533723af5749bd0" @@ -4231,14 +4032,6 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" -tough-cookie@~2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" - integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== - dependencies: - psl "^1.1.28" - punycode "^2.1.1" - tr46@~0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" @@ -4312,18 +4105,6 @@ tsutils@^3.21.0: dependencies: tslib "^1.8.1" -tunnel-agent@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" - integrity sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w== - dependencies: - safe-buffer "^5.0.1" - -tweetnacl@^0.14.3, tweetnacl@~0.14.0: - version "0.14.5" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" - integrity sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA== - type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" @@ -4395,11 +4176,6 @@ util-deprecate@^1.0.1, util-deprecate@~1.0.1: resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== -uuid@^3.3.2: - version "3.4.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" - integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== - uuid@^8.3.2: version "8.3.2" resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" @@ -4415,15 +4191,6 @@ varint@^6.0.0: resolved "https://registry.yarnpkg.com/varint/-/varint-6.0.0.tgz#9881eb0ce8feaea6512439d19ddf84bf551661d0" integrity sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg== -verror@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400" - integrity sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw== - dependencies: - assert-plus "^1.0.0" - core-util-is "1.0.2" - extsprintf "^1.2.0" - wabt@1.0.24: version "1.0.24" resolved "https://registry.yarnpkg.com/wabt/-/wabt-1.0.24.tgz#c02e0b5b4503b94feaf4a30a426ef01c1bea7c6c" From 3f2da65b8e2087082a8808d776186b87647c06c7 Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Thu, 25 Jan 2024 10:49:55 +0400 Subject: [PATCH 02/17] Bump matchstick version --- bin/subgraph/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/subgraph/src/index.ts b/bin/subgraph/src/index.ts index 91fdecb4..5dba8f3d 100644 --- a/bin/subgraph/src/index.ts +++ b/bin/subgraph/src/index.ts @@ -243,7 +243,7 @@ program console.info("*** Running graph test"); spawnProcess( - `yarn graph test --version 0.5.3 ${options.recompile == true ? "--recompile" : ""}`, + `yarn graph test --version 0.6.0 ${options.recompile == true ? "--recompile" : ""}`, (testExitCode: number) => { if (testExitCode > 0) { process.exit(testExitCode); From bea228c830478218ca0c291ca941fb5a9d250111 Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Thu, 25 Jan 2024 10:50:08 +0400 Subject: [PATCH 03/17] Add test for burnt OHM --- .../ethereum/tests/OhmCalculations.test.ts | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/subgraphs/ethereum/tests/OhmCalculations.test.ts b/subgraphs/ethereum/tests/OhmCalculations.test.ts index 44df29d6..d40486b6 100644 --- a/subgraphs/ethereum/tests/OhmCalculations.test.ts +++ b/subgraphs/ethereum/tests/OhmCalculations.test.ts @@ -78,8 +78,8 @@ const TIMESTAMP = BigInt.fromString("1000"); const AUCTION_CLOSE_TIMESTAMP_PRE_EXPIRY = BigInt.fromString("999"); const AUCTION_CLOSE_TIMESTAMP_POST_EXPIRY = BigInt.fromString("980"); -function setUpGnosisAuction(payoutCapacity: BigDecimal = PAYOUT_CAPACITY, termSeconds: BigInt = BOND_TERM, bidQuantity: BigDecimal | null = null, auctionCloseTimestamp: BigInt | null = null, auctionOpenTimestamp: BigInt = AUCTION_OPEN_TIMESTAMP): void { - const record = new GnosisAuction(AUCTION_ID); +function setUpGnosisAuction(auctionId: string = AUCTION_ID, payoutCapacity: BigDecimal = PAYOUT_CAPACITY, termSeconds: BigInt = BOND_TERM, bidQuantity: BigDecimal | null = null, auctionCloseTimestamp: BigInt | null = null, auctionOpenTimestamp: BigInt = AUCTION_OPEN_TIMESTAMP): void { + const record = new GnosisAuction(auctionId); record.payoutCapacity = payoutCapacity; record.termSeconds = termSeconds; record.auctionOpenTimestamp = auctionOpenTimestamp; @@ -179,7 +179,7 @@ describe("Vesting Bonds", () => { test("closed auction/before bond expiry/with balance in GnosisEasyAuction", () => { // Mock auction payoutCapacity and bidQuantity (GnosisAuction) - setUpGnosisAuction(PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_PRE_EXPIRY); + setUpGnosisAuction(AUCTION_ID, PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_PRE_EXPIRY); // Mock contract values for the BondManager mockContracts(); @@ -203,7 +203,7 @@ describe("Vesting Bonds", () => { test("closed auction/before bond expiry/with balance in BondManager", () => { // Mock auction payoutCapacity and bidQuantity (GnosisAuction) - setUpGnosisAuction(PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_PRE_EXPIRY); + setUpGnosisAuction(AUCTION_ID, PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_PRE_EXPIRY); // Mock contract values for the BondManager mockContracts(); @@ -227,7 +227,7 @@ describe("Vesting Bonds", () => { test("closed auction/after bond expiry", () => { // Mock auction payoutCapacity and bidQuantity (GnosisAuction) - setUpGnosisAuction(PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_POST_EXPIRY); + setUpGnosisAuction(AUCTION_ID, PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_POST_EXPIRY); // Mock contract values for the BondManager mockContracts(); @@ -239,13 +239,31 @@ describe("Vesting Bonds", () => { // No effect on supply from the teller, as bond tokens are no longer vesting assert.assertTrue(recordsMap.has(CONTRACT_TELLER) == false); - // supply decreased by bid quantity in bond manager due to vesting user deposits + // supply decreased by bid quantity in bond manager due to burnable deposits const bondManagerRecord = recordsMap.get(BOND_MANAGER); assert.stringEquals(bondManagerRecord.supplyBalance.toString(), BID_QUANTITY.times(BigDecimal.fromString("-1")).toString()); assert.stringEquals(bondManagerRecord.type, TYPE_BONDS_DEPOSITS); assert.i32Equals(records.length, 1); }); + + test("closed auction/after bond expiry/all burned", () => { + // Mock auction payoutCapacity and bidQuantity (GnosisAuction) + setUpGnosisAuction(AUCTION_ID, PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_POST_EXPIRY); + + // Mock contract values for the BondManager + mockContracts(); + mockContractBalances(BigDecimal.zero(), BID_QUANTITY, BigDecimal.zero()); + + const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); + const recordsMap = tokenSupplyRecordsToMap(records); + + // No effect on supply from the teller, as bond tokens are no longer vesting + assert.assertTrue(recordsMap.has(CONTRACT_TELLER) == false); + + // Burnable deposits are burned, which offsets the "burnable" entries + assert.i32Equals(records.length, 0); + }); }); describe("Treasury OHM", () => { From dcb4d6bb8dff057b43d87ad7cd9f4be54f5f029a Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Thu, 25 Jan 2024 07:40:37 +0000 Subject: [PATCH 04/17] Add tests for burnt OHM in Bond Manager --- .../ethereum/tests/OhmCalculations.test.ts | 200 ++++++++++++++++-- 1 file changed, 182 insertions(+), 18 deletions(-) diff --git a/subgraphs/ethereum/tests/OhmCalculations.test.ts b/subgraphs/ethereum/tests/OhmCalculations.test.ts index d40486b6..f2ac6f93 100644 --- a/subgraphs/ethereum/tests/OhmCalculations.test.ts +++ b/subgraphs/ethereum/tests/OhmCalculations.test.ts @@ -31,6 +31,14 @@ function tokenSupplyRecordsToMap(records: TokenSupply[]): Map { mockContractBalances(BigDecimal.zero(), BigDecimal.zero(), PAYOUT_CAPACITY); const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); - const recordsMap = tokenSupplyRecordsToMap(records); // supply decreased by payoutCapacity in teller - const tellerRecord = recordsMap.get(CONTRACT_TELLER); + const tellerRecord: TokenSupply = records[0]; + assert.stringEquals(getNonNullableString(tellerRecord.sourceAddress), CONTRACT_TELLER.toLowerCase()); + assert.stringEquals(getNonNullableString(tellerRecord.pool) || "", AUCTION_ID); assert.stringEquals(tellerRecord.supplyBalance.toString(), PAYOUT_CAPACITY.times(BigDecimal.fromString("-1")).toString()); assert.stringEquals(tellerRecord.type, TYPE_BONDS_PREMINTED); // No supply impact from Gnosis contract - assert.assertTrue(recordsMap.has(BOND_MANAGER) == false); assert.i32Equals(records.length, 1); }); @@ -164,15 +172,15 @@ describe("Vesting Bonds", () => { mockContractBalances(gnosisBalance, BigDecimal.zero(), PAYOUT_CAPACITY); const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); - const recordsMap = tokenSupplyRecordsToMap(records); // supply decreased by payoutCapacity in teller - const tellerRecord = recordsMap.get(CONTRACT_TELLER); + const tellerRecord: TokenSupply = records[0]; + assert.stringEquals(getNonNullableString(tellerRecord.sourceAddress), CONTRACT_TELLER.toLowerCase()); + assert.stringEquals(getNonNullableString(tellerRecord.pool) || "", AUCTION_ID); assert.stringEquals(tellerRecord.supplyBalance.toString(), PAYOUT_CAPACITY.times(BigDecimal.fromString("-1")).toString()); assert.stringEquals(tellerRecord.type, TYPE_BONDS_PREMINTED); // No supply impact from Gnosis contract - assert.assertTrue(recordsMap.has(BOND_MANAGER) == false); assert.i32Equals(records.length, 1); }); @@ -186,15 +194,18 @@ describe("Vesting Bonds", () => { mockContractBalances(BID_QUANTITY, BigDecimal.zero(), PAYOUT_CAPACITY); const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); - const recordsMap = tokenSupplyRecordsToMap(records); // supply decreased by payout capacity in bond teller due to vesting tokens - const tellerRecord = recordsMap.get(CONTRACT_TELLER); + const tellerRecord: TokenSupply = records[1]; + assert.stringEquals(getNonNullableString(tellerRecord.sourceAddress), CONTRACT_TELLER.toLowerCase()); + assert.stringEquals(getNonNullableString(tellerRecord.pool) || "", AUCTION_ID); assert.stringEquals(tellerRecord.supplyBalance.toString(), PAYOUT_CAPACITY.times(BigDecimal.fromString("-1")).toString()); assert.stringEquals(tellerRecord.type, TYPE_BONDS_VESTING_TOKENS); // supply decreased by bid quantity in bond manager due to vesting user deposits - const bondManagerRecord = recordsMap.get(BOND_MANAGER); + const bondManagerRecord: TokenSupply = records[0]; + assert.stringEquals(getNonNullableString(bondManagerRecord.sourceAddress), BOND_MANAGER.toLowerCase()); + assert.stringEquals(getNonNullableString(bondManagerRecord.pool), AUCTION_ID); assert.stringEquals(bondManagerRecord.supplyBalance.toString(), BID_QUANTITY.times(BigDecimal.fromString("-1")).toString()); assert.stringEquals(bondManagerRecord.type, TYPE_BONDS_VESTING_DEPOSITS); @@ -210,15 +221,18 @@ describe("Vesting Bonds", () => { mockContractBalances(BigDecimal.zero(), BID_QUANTITY, PAYOUT_CAPACITY); const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); - const recordsMap = tokenSupplyRecordsToMap(records); // supply decreased by payout capacity in bond teller due to vesting tokens - const tellerRecord = recordsMap.get(CONTRACT_TELLER); + const tellerRecord: TokenSupply = records[1]; + assert.stringEquals(getNonNullableString(tellerRecord.sourceAddress), CONTRACT_TELLER.toLowerCase()); + assert.stringEquals(getNonNullableString(tellerRecord.pool) || "", AUCTION_ID); assert.stringEquals(tellerRecord.supplyBalance.toString(), PAYOUT_CAPACITY.times(BigDecimal.fromString("-1")).toString()); assert.stringEquals(tellerRecord.type, TYPE_BONDS_VESTING_TOKENS); // supply decreased by bid quantity in bond manager due to vesting user deposits - const bondManagerRecord = recordsMap.get(BOND_MANAGER); + const bondManagerRecord: TokenSupply = records[0]; + assert.stringEquals(getNonNullableString(bondManagerRecord.sourceAddress), BOND_MANAGER.toLowerCase()); + assert.stringEquals(getNonNullableString(bondManagerRecord.pool), AUCTION_ID); assert.stringEquals(bondManagerRecord.supplyBalance.toString(), BID_QUANTITY.times(BigDecimal.fromString("-1")).toString()); assert.stringEquals(bondManagerRecord.type, TYPE_BONDS_VESTING_DEPOSITS); @@ -234,13 +248,13 @@ describe("Vesting Bonds", () => { mockContractBalances(BigDecimal.zero(), BID_QUANTITY, PAYOUT_CAPACITY); const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); - const recordsMap = tokenSupplyRecordsToMap(records); // No effect on supply from the teller, as bond tokens are no longer vesting - assert.assertTrue(recordsMap.has(CONTRACT_TELLER) == false); // supply decreased by bid quantity in bond manager due to burnable deposits - const bondManagerRecord = recordsMap.get(BOND_MANAGER); + const bondManagerRecord = records[0]; + assert.stringEquals(getNonNullableString(bondManagerRecord.sourceAddress), BOND_MANAGER.toLowerCase()); + assert.stringEquals(getNonNullableString(bondManagerRecord.pool), AUCTION_ID); assert.stringEquals(bondManagerRecord.supplyBalance.toString(), BID_QUANTITY.times(BigDecimal.fromString("-1")).toString()); assert.stringEquals(bondManagerRecord.type, TYPE_BONDS_DEPOSITS); @@ -253,17 +267,167 @@ describe("Vesting Bonds", () => { // Mock contract values for the BondManager mockContracts(); - mockContractBalances(BigDecimal.zero(), BID_QUANTITY, BigDecimal.zero()); + mockContractBalances(BigDecimal.zero(), BigDecimal.zero(), PAYOUT_CAPACITY); // Bid capacity is burned const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); - const recordsMap = tokenSupplyRecordsToMap(records); // No effect on supply from the teller, as bond tokens are no longer vesting - assert.assertTrue(recordsMap.has(CONTRACT_TELLER) == false); + + // No entries for the Bond Manager + + // Burnable deposits are burned, which offsets the "burnable" entries + assert.i32Equals(records.length, 0); + }); + + test("closed auction/after bond expiry/all burned/multiple auctions", () => { + // Mock auction payoutCapacity and bidQuantity (GnosisAuction) + setUpGnosisAuction(AUCTION_ID, PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_POST_EXPIRY); + setUpGnosisAuction("2", PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_POST_EXPIRY); + + // Mock contract values for the BondManager + mockContracts(); + mockContractBalances(BigDecimal.zero(), BigDecimal.zero(), PAYOUT_CAPACITY); // All of the bid capacity is burned + + const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); + + // No effect on supply from the teller, as bond tokens are no longer vesting + + // No entries for the Bond Manager // Burnable deposits are burned, which offsets the "burnable" entries assert.i32Equals(records.length, 0); }); + + test("closed auction/after bond expiry/partial burned", () => { + // Mock auction payoutCapacity and bidQuantity (GnosisAuction) + setUpGnosisAuction(AUCTION_ID, PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_POST_EXPIRY); // Will be burnable + setUpGnosisAuction("2", PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_POST_EXPIRY); // Will be burnable + + // Mock contract values for the BondManager + mockContracts(); + mockContractBalances(BigDecimal.zero(), BID_QUANTITY, PAYOUT_CAPACITY); // Half of the bid capacity is burned + + const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); + + // Remaining payout capacity is split between the two + const bondManagerRecord = records[0]; + assert.stringEquals(getNonNullableString(bondManagerRecord.sourceAddress), BOND_MANAGER.toLowerCase()); + assert.stringEquals(getNonNullableString(bondManagerRecord.pool), AUCTION_ID); + assert.stringEquals(bondManagerRecord.supplyBalance.toString(), BID_QUANTITY.times(BigDecimal.fromString("-1")).times(BigDecimal.fromString("0.5")).toString()); + assert.stringEquals(bondManagerRecord.type, TYPE_BONDS_DEPOSITS); + + const bondManagerRecordTwo = records[1]; + assert.stringEquals(getNonNullableString(bondManagerRecordTwo.sourceAddress), BOND_MANAGER.toLowerCase()); + assert.stringEquals(getNonNullableString(bondManagerRecordTwo.pool), "2"); + assert.stringEquals(bondManagerRecordTwo.supplyBalance.toString(), BID_QUANTITY.times(BigDecimal.fromString("-1")).times(BigDecimal.fromString("0.5")).toString()); + assert.stringEquals(bondManagerRecordTwo.type, TYPE_BONDS_DEPOSITS); + + assert.i32Equals(records.length, 2); + }); + + test("closed auction/multiple auctions/mixed bond expiry", () => { + const auctionTwoBidQuantity = BigDecimal.fromString("500"); + + // Mock auction payoutCapacity and bidQuantity (GnosisAuction) + setUpGnosisAuction(AUCTION_ID, PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_PRE_EXPIRY); // Will be vesting + setUpGnosisAuction("2", PAYOUT_CAPACITY, BOND_TERM, auctionTwoBidQuantity, AUCTION_CLOSE_TIMESTAMP_POST_EXPIRY); // Will be burnable + + // Mock contract values for the BondManager + mockContracts(); + mockContractBalances(BigDecimal.zero(), BID_QUANTITY.plus(auctionTwoBidQuantity), PAYOUT_CAPACITY); + + const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); + + const tellerRecordOne: TokenSupply = records[1]; + assert.stringEquals(getNonNullableString(tellerRecordOne.sourceAddress), CONTRACT_TELLER.toLowerCase()); + assert.stringEquals(getNonNullableString(tellerRecordOne.pool) || "", AUCTION_ID); + assert.stringEquals(tellerRecordOne.supplyBalance.toString(), PAYOUT_CAPACITY.times(BigDecimal.fromString("-1")).toString()); + assert.stringEquals(tellerRecordOne.type, TYPE_BONDS_VESTING_TOKENS); + + // supply decreased by bid quantity in bond manager due to vesting user deposits + const bondManagerRecordOne: TokenSupply = records[0]; + assert.stringEquals(getNonNullableString(bondManagerRecordOne.sourceAddress), BOND_MANAGER.toLowerCase()); + assert.stringEquals(getNonNullableString(bondManagerRecordOne.pool), AUCTION_ID); + assert.stringEquals(bondManagerRecordOne.supplyBalance.toString(), BID_QUANTITY.times(BigDecimal.fromString("-1")).toString()); + assert.stringEquals(bondManagerRecordOne.type, TYPE_BONDS_VESTING_DEPOSITS); + + // Remaining payout capacity is burnable + const bondManagerRecordTwo = records[2]; + assert.stringEquals(getNonNullableString(bondManagerRecordTwo.sourceAddress), BOND_MANAGER.toLowerCase()); + assert.stringEquals(getNonNullableString(bondManagerRecordTwo.pool), AUCTION_ID); + assert.stringEquals(bondManagerRecordTwo.supplyBalance.toString(), auctionTwoBidQuantity.times(BigDecimal.fromString("-1")).toString()); + assert.stringEquals(bondManagerRecordTwo.type, TYPE_BONDS_DEPOSITS); + + assert.i32Equals(records.length, 3); + }); + + test("closed auction/multiple auctions/mixed bond expiry/partial burned", () => { + const auctionTwoBidQuantity = BigDecimal.fromString("500"); + const remainingBidCapacity = auctionTwoBidQuantity.div(BigDecimal.fromString("2")); + + // Mock auction payoutCapacity and bidQuantity (GnosisAuction) + setUpGnosisAuction(AUCTION_ID, PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_PRE_EXPIRY); // Will be vesting + setUpGnosisAuction("2", PAYOUT_CAPACITY, BOND_TERM, auctionTwoBidQuantity, AUCTION_CLOSE_TIMESTAMP_POST_EXPIRY); // Will be burnable + + // Mock contract values for the BondManager + mockContracts(); + mockContractBalances(BigDecimal.zero(), BID_QUANTITY.plus(remainingBidCapacity), PAYOUT_CAPACITY); + + const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); + + const tellerRecordOne: TokenSupply = records[1]; + assert.stringEquals(getNonNullableString(tellerRecordOne.sourceAddress), CONTRACT_TELLER.toLowerCase()); + assert.stringEquals(getNonNullableString(tellerRecordOne.pool) || "", AUCTION_ID); + assert.stringEquals(tellerRecordOne.supplyBalance.toString(), PAYOUT_CAPACITY.times(BigDecimal.fromString("-1")).toString()); + assert.stringEquals(tellerRecordOne.type, TYPE_BONDS_VESTING_TOKENS); + + // supply decreased by bid quantity in bond manager due to vesting user deposits + const bondManagerRecordOne: TokenSupply = records[0]; + assert.stringEquals(getNonNullableString(bondManagerRecordOne.sourceAddress), BOND_MANAGER.toLowerCase()); + assert.stringEquals(getNonNullableString(bondManagerRecordOne.pool), AUCTION_ID); + assert.stringEquals(bondManagerRecordOne.supplyBalance.toString(), BID_QUANTITY.times(BigDecimal.fromString("-1")).toString()); + assert.stringEquals(bondManagerRecordOne.type, TYPE_BONDS_VESTING_DEPOSITS); + + // Remaining payout capacity is partially burned + const bondManagerRecordTwo = records[2]; + assert.stringEquals(getNonNullableString(bondManagerRecordTwo.sourceAddress), BOND_MANAGER.toLowerCase()); + assert.stringEquals(getNonNullableString(bondManagerRecordTwo.pool), AUCTION_ID); + assert.stringEquals(bondManagerRecordTwo.supplyBalance.toString(), remainingBidCapacity.times(BigDecimal.fromString("-1")).toString()); + assert.stringEquals(bondManagerRecordTwo.type, TYPE_BONDS_DEPOSITS); + + assert.i32Equals(records.length, 3); + }); + + test("closed auction/multiple auctions/mixed bond expiry/all burned", () => { + const auctionTwoBidQuantity = BigDecimal.fromString("500"); + + // Mock auction payoutCapacity and bidQuantity (GnosisAuction) + setUpGnosisAuction(AUCTION_ID, PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_PRE_EXPIRY); // Will be vesting + setUpGnosisAuction("2", PAYOUT_CAPACITY, BOND_TERM, auctionTwoBidQuantity, AUCTION_CLOSE_TIMESTAMP_POST_EXPIRY); // Will be burnable + + // Mock contract values for the BondManager + mockContracts(); + mockContractBalances(BigDecimal.zero(), BID_QUANTITY, PAYOUT_CAPACITY); // Burnable OHM is burned + + const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); + + const tellerRecordOne: TokenSupply = records[1]; + assert.stringEquals(getNonNullableString(tellerRecordOne.sourceAddress), CONTRACT_TELLER.toLowerCase()); + assert.stringEquals(getNonNullableString(tellerRecordOne.pool) || "", AUCTION_ID); + assert.stringEquals(tellerRecordOne.supplyBalance.toString(), PAYOUT_CAPACITY.times(BigDecimal.fromString("-1")).toString()); + assert.stringEquals(tellerRecordOne.type, TYPE_BONDS_VESTING_TOKENS); + + // supply decreased by bid quantity in bond manager due to vesting user deposits + const bondManagerRecordOne: TokenSupply = records[0]; + assert.stringEquals(getNonNullableString(bondManagerRecordOne.sourceAddress), BOND_MANAGER.toLowerCase()); + assert.stringEquals(getNonNullableString(bondManagerRecordOne.pool), AUCTION_ID); + assert.stringEquals(bondManagerRecordOne.supplyBalance.toString(), BID_QUANTITY.times(BigDecimal.fromString("-1")).toString()); + assert.stringEquals(bondManagerRecordOne.type, TYPE_BONDS_VESTING_DEPOSITS); + + // Remaining payout capacity is burned, no entry + + assert.i32Equals(records.length, 2); + }); }); describe("Treasury OHM", () => { From f33ba55de4776f4ad2c39f4533a28a8f22b79fde Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Fri, 26 Jan 2024 07:56:15 +0000 Subject: [PATCH 05/17] Fix burnable/burned OHM bonds --- .../ethereum/src/utils/OhmCalculations.ts | 112 ++++++++++++++---- .../ethereum/tests/OhmCalculations.test.ts | 54 ++++++--- 2 files changed, 124 insertions(+), 42 deletions(-) diff --git a/subgraphs/ethereum/src/utils/OhmCalculations.ts b/subgraphs/ethereum/src/utils/OhmCalculations.ts index 120cd508..e9c19ff4 100644 --- a/subgraphs/ethereum/src/utils/OhmCalculations.ts +++ b/subgraphs/ethereum/src/utils/OhmCalculations.ts @@ -43,6 +43,7 @@ import { SILO_DEPLOYMENTS, } from "./Constants"; import { + getERC20, getERC20DecimalBalance, getSOlympusERC20, getSOlympusERC20V2, @@ -164,7 +165,7 @@ export function getTotalSupplyRecord(timestamp: BigInt, blockNumber: BigInt): To * - Binds with the sOHM V3 contract * - Multiplies index() from sOHM V3 by {MIGRATION_OFFSET} * - Returns a token record with the offset - * + * * NOTE: the balance of gOHM in the migration contract is likely to be higher than this manual offset, * as it is gOHM pre-minted for migration of OHM (v1). As a result, the difference in the gOHM balance is not considered protocol-owned. * @@ -222,8 +223,57 @@ export function getVestingBondSupplyRecords(timestamp: BigInt, blockNumber: BigI const bondFixedExpiryTellerAddress = bondManager.fixedExpiryTeller(); + // Get the balance of OHM + const bondManagerOhmBalanceTmp = getERC20DecimalBalance(ERC20_OHM_V2, BOND_MANAGER, blockNumber); + let bondManagerOhmBalanceUnallocated = bondManagerOhmBalanceTmp; + // Loop through Gnosis Auctions const gnosisAuctionIds: BigInt[] = gnosisAuctionRoot.markets; + + // Determine the amount of OHM to deduct from the burnable amount + let totalBurnableOhm = BigDecimal.zero(); + for (let i = 0; i < gnosisAuctionIds.length; i++) { + const auctionId = gnosisAuctionIds[i].toString(); + log.debug("{}: Processing Gnosis auction with id {}", [FUNC, auctionId]); + + const auctionRecord = GnosisAuction.load(auctionId); + if (!auctionRecord) { + throw new Error(`Expected to find GnosisAuction record with id ${auctionId}, but it was not found`); + } + + const bidQuantity: BigDecimal | null = auctionRecord.bidQuantity; + + // Open auction + if (!bidQuantity) { + continue; + } + + const bondTermSeconds = auctionRecord.termSeconds; + const auctionCloseTimestamp = auctionRecord.auctionCloseTimestamp; + if (!auctionCloseTimestamp) { + throw new Error(`Expected the auctionCloseTimestamp on closed auction '${auctionId}' to be set`); + } + + const expiryTimestamp = auctionCloseTimestamp.plus(bondTermSeconds); + + // Close auction but not fully-vested + if (timestamp.lt(expiryTimestamp)) { + // Deduct the bid quantity from the unallocated balance + bondManagerOhmBalanceUnallocated = bondManagerOhmBalanceUnallocated.minus(bidQuantity); + continue; + } + + // Closed auction and the bond expiry time has been reached + // Add the OHM to the total burnable amount + totalBurnableOhm = totalBurnableOhm.plus(bidQuantity); + } + + // If the Bond Manager OHM balance is greater than the burnable amount, cap it + log.debug("{}: Bond Manager OHM balance is {}", [FUNC, bondManagerOhmBalanceTmp.toString()]); + log.debug("{}: Total burnable OHM is {}", [FUNC, totalBurnableOhm.toString()]); + const bondManagerOhmBalance = bondManagerOhmBalanceUnallocated.gt(totalBurnableOhm) ? totalBurnableOhm : bondManagerOhmBalanceUnallocated; + + // Record bond details for (let i = 0; i < gnosisAuctionIds.length; i++) { const auctionId = gnosisAuctionIds[i].toString(); log.debug("{}: Processing Gnosis auction with id {}", [FUNC, auctionId]); @@ -269,6 +319,8 @@ export function getVestingBondSupplyRecords(timestamp: BigInt, blockNumber: BigI // Closed auction and the bond expiry time has not been reached if (timestamp.lt(expiryTimestamp)) { + log.debug("{}: bonds are still vesting", [FUNC]); + // Vesting user deposits equal to the sold quantity are stored in the bond manager, so we adjust that records.push( createTokenSupply( @@ -305,6 +357,18 @@ export function getVestingBondSupplyRecords(timestamp: BigInt, blockNumber: BigI } // Bond expiry time has been reached else { + log.debug("{}: bonds are vested", [FUNC]); + + // If OHM in the Bond Manager has been fully or partially burned, this will adjust for it + const adjustedBidQuantity = bidQuantity.times(bondManagerOhmBalance).div(totalBurnableOhm); + log.debug("{}: bidQuantity is {}", [FUNC, bidQuantity.toString()]); + log.debug("{}: adjustedBidQuantity is {}", [FUNC, adjustedBidQuantity.toString()]); + + if (adjustedBidQuantity.equals(BigDecimal.zero())) { + log.debug("{}: adjustedBidQuantity is zero, skipping", [FUNC]); + continue; + } + // User deposits equal to the sold quantity are stored in the bond manager, so we adjust that // These deposits will eventually be burned records.push( @@ -317,14 +381,12 @@ export function getVestingBondSupplyRecords(timestamp: BigInt, blockNumber: BigI getContractName(BOND_MANAGER), BOND_MANAGER, TYPE_BONDS_DEPOSITS, - bidQuantity, + adjustedBidQuantity, blockNumber, -1, // Subtract ), ); } - - // TODO add support for recognising OHM burned from bond deposits } } @@ -379,13 +441,13 @@ function getLendingMarketDeploymentOHMRecords(timestamp: BigInt, deploymentAddre /** * Generates TokenSupply records for OHM that has been minted * and deposited into the Euler and Silo lending markets. - * + * * The values and block(s) are hard-coded, as this was performed manually using * the multi-sig. Future deployments will be automated through a smart contract. - * - * @param timestamp - * @param blockNumber - * @returns + * + * @param timestamp + * @param blockNumber + * @returns */ export function getMintedBorrowableOHMRecords(timestamp: BigInt, blockNumber: BigInt): TokenSupply[] { const records: TokenSupply[] = []; @@ -417,7 +479,7 @@ export function getMintedBorrowableOHMRecords(timestamp: BigInt, blockNumber: Bi * * sOHM and gOHM are converted to the equivalent quantity of OHM (using the index) * and included in the calculation. - * + * * Notes: * - All versions of OHM/sOHM/wsOHM in the migration contract are not considered, as the tokens * are transferred into the contract upon migration into OHMv3/gOHM and hence reflected in @@ -436,8 +498,8 @@ export function getTreasuryOHMRecords(timestamp: BigInt, blockNumber: BigInt): T /** * Make a copy of the circulating wallets array - * - * NOTE: this deliberately does not use the `getWalletAddressesForContract` function, + * + * NOTE: this deliberately does not use the `getWalletAddressesForContract` function, * as that blacklists all OHM variants in treasury wallets, so that they are not added * to the market value */ @@ -663,14 +725,14 @@ export function getProtocolOwnedLiquiditySupplyRecords( /** * Returns TokenSupply records representing the OHM minted into the IncurDebt contract. - * + * * The value reported for each vault is based on the value of `totalOutstandingGlobalDebt()`. - * + * * Only applicable after `OLYMPUS_INCUR_DEBT_BLOCK` - * - * @param timestamp - * @param blockNumber - * @returns + * + * @param timestamp + * @param blockNumber + * @returns */ export function getIncurDebtSupplyRecords(timestamp: BigInt, blockNumber: BigInt): TokenSupply[] { const records: TokenSupply[] = []; @@ -718,12 +780,12 @@ export function getIncurDebtSupplyRecords(timestamp: BigInt, blockNumber: BigInt /** * Returns TokenSupply records representing the OHM minted into boosted liquidity vaults. - * + * * The value reported for each vault is the result of calling `getPoolOhmShare()`. - * - * @param timestamp - * @param blockNumber - * @returns + * + * @param timestamp + * @param blockNumber + * @returns */ export function getBoostedLiquiditySupplyRecords(timestamp: BigInt, blockNumber: BigInt): TokenSupply[] { const records: TokenSupply[] = []; @@ -819,7 +881,7 @@ export function getTotalValueLocked(blockNumber: BigInt): BigDecimal { * this function returns the OHM backed supply. * * Backed supply is the quantity of OHM backed by treasury assets. - * + * * Backed supply is calculated as: * - OHM total supply * - minus: OHM in circulating supply wallets @@ -902,7 +964,7 @@ export function getFloatingSupply(tokenSupplies: TokenSupply[], block: BigInt): * - minus: pre-minted OHM for bonds * - minus: OHM user deposits for bonds * - minus: OHM in boosted liquidity vaults (before `BLV_INCLUSION_BLOCK`) - * + * * OHM represented by vesting bond tokens (type `TYPE_BONDS_VESTING_TOKENS`) is not included in the circulating supply, as it is * owned by users and not the protocol. */ diff --git a/subgraphs/ethereum/tests/OhmCalculations.test.ts b/subgraphs/ethereum/tests/OhmCalculations.test.ts index f2ac6f93..691041ea 100644 --- a/subgraphs/ethereum/tests/OhmCalculations.test.ts +++ b/subgraphs/ethereum/tests/OhmCalculations.test.ts @@ -86,6 +86,8 @@ const TIMESTAMP = BigInt.fromString("1000"); const AUCTION_CLOSE_TIMESTAMP_PRE_EXPIRY = BigInt.fromString("999"); const AUCTION_CLOSE_TIMESTAMP_POST_EXPIRY = BigInt.fromString("980"); +const BLOCK_NUMBER = BigInt.fromString("18000000"); + function setUpGnosisAuction(auctionId: string = AUCTION_ID, payoutCapacity: BigDecimal = PAYOUT_CAPACITY, termSeconds: BigInt = BOND_TERM, bidQuantity: BigDecimal | null = null, auctionCloseTimestamp: BigInt | null = null, auctionOpenTimestamp: BigInt = AUCTION_OPEN_TIMESTAMP): void { const record = new GnosisAuction(auctionId); record.payoutCapacity = payoutCapacity; @@ -101,10 +103,17 @@ function setUpGnosisAuction(auctionId: string = AUCTION_ID, payoutCapacity: BigD } record.save(); +} + +function setGnosisAuctionMarkets(markets: string[]): void { + const marketIds: BigInt[] = []; + for (let i = 0; i < markets.length; i++) { + marketIds.push(BigInt.fromString(markets[i])); + } - const rootRecord = new GnosisAuctionRoot(GNOSIS_RECORD_ID); - rootRecord.markets = [BigInt.fromString(AUCTION_ID)]; - rootRecord.save(); + const record = new GnosisAuctionRoot(GNOSIS_RECORD_ID); + record.markets = marketIds; + record.save(); } function mockContracts(): void { @@ -134,7 +143,7 @@ describe("Vesting Bonds", () => { mockContracts(); mockContractBalances(); - const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); + const records = getVestingBondSupplyRecords(TIMESTAMP, BLOCK_NUMBER); // No supply impact assert.i32Equals(records.length, 0); @@ -143,12 +152,13 @@ describe("Vesting Bonds", () => { test("open auction", () => { // Mock auction payoutCapacity (GnosisAuction) setUpGnosisAuction(); + setGnosisAuctionMarkets([AUCTION_ID]); // Mock contract values for the BondManager mockContracts(); mockContractBalances(BigDecimal.zero(), BigDecimal.zero(), PAYOUT_CAPACITY); - const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); + const records = getVestingBondSupplyRecords(TIMESTAMP, BLOCK_NUMBER); // supply decreased by payoutCapacity in teller const tellerRecord: TokenSupply = records[0]; @@ -165,13 +175,14 @@ describe("Vesting Bonds", () => { test("open auction with deposits", () => { // Mock auction payoutCapacity (GnosisAuction) setUpGnosisAuction(); + setGnosisAuctionMarkets([AUCTION_ID]); // Mock contract values for the BondManager and Gnosis deposit mockContracts(); const gnosisBalance = BigDecimal.fromString("1000"); mockContractBalances(gnosisBalance, BigDecimal.zero(), PAYOUT_CAPACITY); - const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); + const records = getVestingBondSupplyRecords(TIMESTAMP, BLOCK_NUMBER); // supply decreased by payoutCapacity in teller const tellerRecord: TokenSupply = records[0]; @@ -188,12 +199,13 @@ describe("Vesting Bonds", () => { test("closed auction/before bond expiry/with balance in GnosisEasyAuction", () => { // Mock auction payoutCapacity and bidQuantity (GnosisAuction) setUpGnosisAuction(AUCTION_ID, PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_PRE_EXPIRY); + setGnosisAuctionMarkets([AUCTION_ID]); // Mock contract values for the BondManager mockContracts(); mockContractBalances(BID_QUANTITY, BigDecimal.zero(), PAYOUT_CAPACITY); - const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); + const records = getVestingBondSupplyRecords(TIMESTAMP, BLOCK_NUMBER); // supply decreased by payout capacity in bond teller due to vesting tokens const tellerRecord: TokenSupply = records[1]; @@ -215,12 +227,13 @@ describe("Vesting Bonds", () => { test("closed auction/before bond expiry/with balance in BondManager", () => { // Mock auction payoutCapacity and bidQuantity (GnosisAuction) setUpGnosisAuction(AUCTION_ID, PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_PRE_EXPIRY); + setGnosisAuctionMarkets([AUCTION_ID]); // Mock contract values for the BondManager mockContracts(); mockContractBalances(BigDecimal.zero(), BID_QUANTITY, PAYOUT_CAPACITY); - const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); + const records = getVestingBondSupplyRecords(TIMESTAMP, BLOCK_NUMBER); // supply decreased by payout capacity in bond teller due to vesting tokens const tellerRecord: TokenSupply = records[1]; @@ -242,12 +255,13 @@ describe("Vesting Bonds", () => { test("closed auction/after bond expiry", () => { // Mock auction payoutCapacity and bidQuantity (GnosisAuction) setUpGnosisAuction(AUCTION_ID, PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_POST_EXPIRY); + setGnosisAuctionMarkets([AUCTION_ID]); // Mock contract values for the BondManager mockContracts(); mockContractBalances(BigDecimal.zero(), BID_QUANTITY, PAYOUT_CAPACITY); - const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); + const records = getVestingBondSupplyRecords(TIMESTAMP, BLOCK_NUMBER); // No effect on supply from the teller, as bond tokens are no longer vesting @@ -264,12 +278,13 @@ describe("Vesting Bonds", () => { test("closed auction/after bond expiry/all burned", () => { // Mock auction payoutCapacity and bidQuantity (GnosisAuction) setUpGnosisAuction(AUCTION_ID, PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_POST_EXPIRY); + setGnosisAuctionMarkets([AUCTION_ID]); // Mock contract values for the BondManager mockContracts(); mockContractBalances(BigDecimal.zero(), BigDecimal.zero(), PAYOUT_CAPACITY); // Bid capacity is burned - const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); + const records = getVestingBondSupplyRecords(TIMESTAMP, BLOCK_NUMBER); // No effect on supply from the teller, as bond tokens are no longer vesting @@ -283,12 +298,13 @@ describe("Vesting Bonds", () => { // Mock auction payoutCapacity and bidQuantity (GnosisAuction) setUpGnosisAuction(AUCTION_ID, PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_POST_EXPIRY); setUpGnosisAuction("2", PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_POST_EXPIRY); + setGnosisAuctionMarkets([AUCTION_ID, "2"]); // Mock contract values for the BondManager mockContracts(); mockContractBalances(BigDecimal.zero(), BigDecimal.zero(), PAYOUT_CAPACITY); // All of the bid capacity is burned - const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); + const records = getVestingBondSupplyRecords(TIMESTAMP, BLOCK_NUMBER); // No effect on supply from the teller, as bond tokens are no longer vesting @@ -302,12 +318,13 @@ describe("Vesting Bonds", () => { // Mock auction payoutCapacity and bidQuantity (GnosisAuction) setUpGnosisAuction(AUCTION_ID, PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_POST_EXPIRY); // Will be burnable setUpGnosisAuction("2", PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_POST_EXPIRY); // Will be burnable + setGnosisAuctionMarkets([AUCTION_ID, "2"]); // Mock contract values for the BondManager mockContracts(); mockContractBalances(BigDecimal.zero(), BID_QUANTITY, PAYOUT_CAPACITY); // Half of the bid capacity is burned - const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); + const records = getVestingBondSupplyRecords(TIMESTAMP, BLOCK_NUMBER); // Remaining payout capacity is split between the two const bondManagerRecord = records[0]; @@ -331,12 +348,13 @@ describe("Vesting Bonds", () => { // Mock auction payoutCapacity and bidQuantity (GnosisAuction) setUpGnosisAuction(AUCTION_ID, PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_PRE_EXPIRY); // Will be vesting setUpGnosisAuction("2", PAYOUT_CAPACITY, BOND_TERM, auctionTwoBidQuantity, AUCTION_CLOSE_TIMESTAMP_POST_EXPIRY); // Will be burnable + setGnosisAuctionMarkets([AUCTION_ID, "2"]); // Mock contract values for the BondManager mockContracts(); mockContractBalances(BigDecimal.zero(), BID_QUANTITY.plus(auctionTwoBidQuantity), PAYOUT_CAPACITY); - const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); + const records = getVestingBondSupplyRecords(TIMESTAMP, BLOCK_NUMBER); const tellerRecordOne: TokenSupply = records[1]; assert.stringEquals(getNonNullableString(tellerRecordOne.sourceAddress), CONTRACT_TELLER.toLowerCase()); @@ -354,7 +372,7 @@ describe("Vesting Bonds", () => { // Remaining payout capacity is burnable const bondManagerRecordTwo = records[2]; assert.stringEquals(getNonNullableString(bondManagerRecordTwo.sourceAddress), BOND_MANAGER.toLowerCase()); - assert.stringEquals(getNonNullableString(bondManagerRecordTwo.pool), AUCTION_ID); + assert.stringEquals(getNonNullableString(bondManagerRecordTwo.pool), "2"); assert.stringEquals(bondManagerRecordTwo.supplyBalance.toString(), auctionTwoBidQuantity.times(BigDecimal.fromString("-1")).toString()); assert.stringEquals(bondManagerRecordTwo.type, TYPE_BONDS_DEPOSITS); @@ -368,12 +386,13 @@ describe("Vesting Bonds", () => { // Mock auction payoutCapacity and bidQuantity (GnosisAuction) setUpGnosisAuction(AUCTION_ID, PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_PRE_EXPIRY); // Will be vesting setUpGnosisAuction("2", PAYOUT_CAPACITY, BOND_TERM, auctionTwoBidQuantity, AUCTION_CLOSE_TIMESTAMP_POST_EXPIRY); // Will be burnable + setGnosisAuctionMarkets([AUCTION_ID, "2"]); // Mock contract values for the BondManager mockContracts(); mockContractBalances(BigDecimal.zero(), BID_QUANTITY.plus(remainingBidCapacity), PAYOUT_CAPACITY); - const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); + const records = getVestingBondSupplyRecords(TIMESTAMP, BLOCK_NUMBER); const tellerRecordOne: TokenSupply = records[1]; assert.stringEquals(getNonNullableString(tellerRecordOne.sourceAddress), CONTRACT_TELLER.toLowerCase()); @@ -391,7 +410,7 @@ describe("Vesting Bonds", () => { // Remaining payout capacity is partially burned const bondManagerRecordTwo = records[2]; assert.stringEquals(getNonNullableString(bondManagerRecordTwo.sourceAddress), BOND_MANAGER.toLowerCase()); - assert.stringEquals(getNonNullableString(bondManagerRecordTwo.pool), AUCTION_ID); + assert.stringEquals(getNonNullableString(bondManagerRecordTwo.pool), "2"); assert.stringEquals(bondManagerRecordTwo.supplyBalance.toString(), remainingBidCapacity.times(BigDecimal.fromString("-1")).toString()); assert.stringEquals(bondManagerRecordTwo.type, TYPE_BONDS_DEPOSITS); @@ -404,12 +423,13 @@ describe("Vesting Bonds", () => { // Mock auction payoutCapacity and bidQuantity (GnosisAuction) setUpGnosisAuction(AUCTION_ID, PAYOUT_CAPACITY, BOND_TERM, BID_QUANTITY, AUCTION_CLOSE_TIMESTAMP_PRE_EXPIRY); // Will be vesting setUpGnosisAuction("2", PAYOUT_CAPACITY, BOND_TERM, auctionTwoBidQuantity, AUCTION_CLOSE_TIMESTAMP_POST_EXPIRY); // Will be burnable + setGnosisAuctionMarkets([AUCTION_ID, "2"]); // Mock contract values for the BondManager mockContracts(); mockContractBalances(BigDecimal.zero(), BID_QUANTITY, PAYOUT_CAPACITY); // Burnable OHM is burned - const records = getVestingBondSupplyRecords(TIMESTAMP, BigInt.fromString("2")); + const records = getVestingBondSupplyRecords(TIMESTAMP, BLOCK_NUMBER); const tellerRecordOne: TokenSupply = records[1]; assert.stringEquals(getNonNullableString(tellerRecordOne.sourceAddress), CONTRACT_TELLER.toLowerCase()); From 505691c1fa3f2d235286ffe3a79d4443e53ccf69 Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Fri, 26 Jan 2024 08:12:20 +0000 Subject: [PATCH 06/17] Add TRSRY v1.1, adjust definition of bond depository --- subgraphs/ethereum/CHANGELOG.md | 6 ++++ subgraphs/ethereum/src/utils/Constants.ts | 35 ++++++++++--------- .../ethereum/src/utils/OhmCalculations.ts | 14 +++++++- .../ethereum/src/utils/ProtocolAddresses.ts | 3 +- subgraphs/shared/src/Wallets.ts | 3 +- 5 files changed, 41 insertions(+), 20 deletions(-) diff --git a/subgraphs/ethereum/CHANGELOG.md b/subgraphs/ethereum/CHANGELOG.md index 6fb933b1..a8b7926a 100644 --- a/subgraphs/ethereum/CHANGELOG.md +++ b/subgraphs/ethereum/CHANGELOG.md @@ -1,5 +1,11 @@ # Subgraph Changelog +## 5.1.0 (2024-01-26) + +- Adds TRSRY v1.1 +- Adds support for recognising OHM burnt in the Bond Manager +- Removes the Bond Depository from protocol- and DAO-owned wallets going forward, as gOHM in the contract is considered user funds + ## 5.0.0 (2023-10-11) - Improve indexing performance by using Bytes instead of String for entity ids diff --git a/subgraphs/ethereum/src/utils/Constants.ts b/subgraphs/ethereum/src/utils/Constants.ts index 717f0b60..6effc23f 100644 --- a/subgraphs/ethereum/src/utils/Constants.ts +++ b/subgraphs/ethereum/src/utils/Constants.ts @@ -2,7 +2,7 @@ import { Address, BigDecimal, BigInt, log } from "@graphprotocol/graph-ts"; import { TokenCategoryPOL, TokenCategoryStable, TokenCategoryVolatile, TokenDefinition } from "../../../shared/src/contracts/TokenDefinition"; import { LendingMarketDeployment } from "../../../shared/src/utils/LendingMarketDeployment"; -import { AAVE_ALLOCATOR, AAVE_ALLOCATOR_V2, AURA_ALLOCATOR, AURA_ALLOCATOR_V2, BALANCER_ALLOCATOR, BONDS_DEPOSIT, BONDS_INVERSE_DEPOSIT, CONVEX_ALLOCATOR1, CONVEX_ALLOCATOR2, CONVEX_ALLOCATOR3, CONVEX_CVX_ALLOCATOR, CONVEX_CVX_VL_ALLOCATOR, CONVEX_STAKING_PROXY_FRAXBP, CONVEX_STAKING_PROXY_OHM_FRAXBP, COOLER_LOANS_CLEARINGHOUSE_V1, COOLER_LOANS_CLEARINGHOUSE_V1_1, CROSS_CHAIN_ARBITRUM, CROSS_CHAIN_FANTOM, CROSS_CHAIN_POLYGON, DAO_WALLET, DAO_WORKING_CAPITAL, LUSD_ALLOCATOR, MAKER_DSR_ALLOCATOR, MAKER_DSR_ALLOCATOR_PROXY, MYSO_LENDING, OLYMPUS_ASSOCIATION_WALLET, OTC_ESCROW, RARI_ALLOCATOR, TREASURY_ADDRESS_V1, TREASURY_ADDRESS_V2, TREASURY_ADDRESS_V3, TRSRY, VEFXS_ALLOCATOR, VENDOR_LENDING } from "../../../shared/src/Wallets"; +import { AAVE_ALLOCATOR, AAVE_ALLOCATOR_V2, AURA_ALLOCATOR, AURA_ALLOCATOR_V2, BALANCER_ALLOCATOR, BONDS_DEPOSIT, BONDS_INVERSE_DEPOSIT, CONVEX_ALLOCATOR1, CONVEX_ALLOCATOR2, CONVEX_ALLOCATOR3, CONVEX_CVX_ALLOCATOR, CONVEX_CVX_VL_ALLOCATOR, CONVEX_STAKING_PROXY_FRAXBP, CONVEX_STAKING_PROXY_OHM_FRAXBP, COOLER_LOANS_CLEARINGHOUSE_V1, COOLER_LOANS_CLEARINGHOUSE_V1_1, CROSS_CHAIN_ARBITRUM, CROSS_CHAIN_FANTOM, CROSS_CHAIN_POLYGON, DAO_WALLET, DAO_WORKING_CAPITAL, LUSD_ALLOCATOR, MAKER_DSR_ALLOCATOR, MAKER_DSR_ALLOCATOR_PROXY, MYSO_LENDING, OLYMPUS_ASSOCIATION_WALLET, OTC_ESCROW, RARI_ALLOCATOR, TREASURY_ADDRESS_V1, TREASURY_ADDRESS_V2, TREASURY_ADDRESS_V3, TRSRY, TRSRY_V1_1, VEFXS_ALLOCATOR, VENDOR_LENDING } from "../../../shared/src/Wallets"; import { PairHandler, PairHandlerTypes } from "./PairHandler"; export const BLOCKCHAIN = "Ethereum"; @@ -19,10 +19,10 @@ export const OHMETHLPBOND_TOKEN = "OHM-WETH"; /** * Holds OHM V1, wsOHM (V1) and gOHM - * + * * Any V1 assets in this contract were previously external to the protocol, * and should NOT be counted as protocol assets. - * + * * Any gOHM in this contract has been pre-minted * for migration from V1 assets, and should NOT be counted as protocol assets. */ @@ -126,12 +126,12 @@ export const SILO_ADDRESS = "0xb2374f84b3cEeFF6492943Df613C9BcF45322a0c".toLower /** * Defines the contract addresses that belong to the protocol & DAO treasuries. - * + * * This is normally deducted from total supply to determine circulating supply. - * + * * The following are not included: * - Myso and Vendor Finance: the deployed amounts are hard-coded. - * - Migration Contract: the migration offset is used to indicate the protocol-owned OHM. + * - Migration Contract: the migration offset is used to indicate the protocol-owned OHM. * Additionally, the OHM and gOHM in the migration contract is pre-minted for v1 -> v2 migrations, * and is not owned by the protocol or DAO. * - Olympus Association: not considered part of the protocol or DAO treasuries. @@ -311,7 +311,7 @@ const ERC4626_SDAI = "0x83F20F44975D03b1b09e64809B757c47f942BEeA".toLowerCase(); /** * Mapping between the contract address of an ERC4626 token and the TokenDefinition. - * + * * A price lookup path must be defined for the underlying token within `LIQUIDITY_POOL_TOKEN_LOOKUP`. */ export const ERC4626_TOKENS = new Map(); @@ -319,7 +319,7 @@ ERC4626_TOKENS.set(ERC4626_SDAI, new TokenDefinition(ERC4626_SDAI, TokenCategory /** * Mapping between the non-staked token and the token staked in Convex. - * + * * The staked token should NOT be listed in {ERC20_TOKENS}. */ const CONVEX_STAKED_TOKENS = new Map(); @@ -364,7 +364,7 @@ export const FRAX_LOCKING_CONTRACTS = [ /** * Mapping between the non-staked token and the token staked in Frax. - * + * * The staked token should NOT be listed in {ERC20_TOKENS}. */ const FRAX_STAKED_TOKENS = new Map(); @@ -436,8 +436,8 @@ UNSTAKED_TOKEN_MAPPING.set(ERC20_FXS_VE, ERC20_FXS); /** * Often, staked/locked tokens have the same price as the original token. This * provides the address of the unstaked token. - * - * @param contractAddress + * + * @param contractAddress * @returns address of the unstaked token, or the original token address if not found */ export const getUnstakedToken = (contractAddress: string): string => { @@ -774,10 +774,10 @@ VENDOR_DEPLOYMENTS.set(ERC20_DAI, [ /** * Returns Vendor Finance deployments for the given contract address. - * + * * The details of the deployment are manually recorded, as the deposited principal (e.g. DAI) - * is what is recognised until a default takes place - irrespective of the actual balance of - * DAI and gOHM in the contract. + * is what is recognised until a default takes place - irrespective of the actual balance of + * DAI and gOHM in the contract. */ export function getVendorDeployments(contractAddress: string): LendingMarketDeployment[] { const contractAddressLower = contractAddress.toLowerCase(); @@ -795,10 +795,10 @@ MYSO_DEPLOYMENTS.set(ERC20_DAI.toLowerCase(), [ /** * Returns Myso Finance deployments for the given contract address. - * + * * The details of the deployment are manually recorded, as the deposited principal (e.g. DAI) - * is what is recognised until a default takes place - irrespective of the actual balance of - * DAI and gOHM in the contract. + * is what is recognised until a default takes place - irrespective of the actual balance of + * DAI and gOHM in the contract. */ export function getMysoDeployments(contractAddress: string): LendingMarketDeployment[] { const contractAddressLower = contractAddress.toLowerCase(); @@ -1108,6 +1108,7 @@ CONTRACT_NAME_MAP.set(TREASURY_ADDRESS_V1, "Treasury Wallet V1"); CONTRACT_NAME_MAP.set(TREASURY_ADDRESS_V2, "Treasury Wallet V2"); CONTRACT_NAME_MAP.set(TREASURY_ADDRESS_V3, "Treasury Wallet V3"); CONTRACT_NAME_MAP.set(TRSRY, "Bophades Treasury"); +CONTRACT_NAME_MAP.set(TRSRY_V1_1, "Bophades Treasury v1.1"); CONTRACT_NAME_MAP.set(VEFXS_ALLOCATOR, "VeFXS Allocator"); CONTRACT_NAME_MAP.set(VENDOR_LENDING, "Vendor Finance"); diff --git a/subgraphs/ethereum/src/utils/OhmCalculations.ts b/subgraphs/ethereum/src/utils/OhmCalculations.ts index e9c19ff4..6243a767 100644 --- a/subgraphs/ethereum/src/utils/OhmCalculations.ts +++ b/subgraphs/ethereum/src/utils/OhmCalculations.ts @@ -43,7 +43,6 @@ import { SILO_DEPLOYMENTS, } from "./Constants"; import { - getERC20, getERC20DecimalBalance, getSOlympusERC20, getSOlympusERC20V2, @@ -59,6 +58,14 @@ import { ERC20 } from "../../generated/ProtocolMetrics/ERC20"; const MIGRATION_OFFSET_STARTING_BLOCK = "14381564"; const MIGRATION_OFFSET = "2013"; +/** + * The block from which the bond depository was removed + * from the definition of protocol- and DAO-owned wallets. + * This results in any balances being considered part of circulating supply. + * This is accurate, as gOHM in the depository is considered user funds. + */ +const BOND_DEPOSITORY_BLOCK = "19070000"; + /** * The block from which the wallet of the Olympus Association * was removed from the definition of protocol- and DAO-owned wallets. @@ -505,6 +512,11 @@ export function getTreasuryOHMRecords(timestamp: BigInt, blockNumber: BigInt): T */ const wallets = new Array(); for (let i = 0; i < CIRCULATING_SUPPLY_WALLETS.length; i++) { + // Skip the Bond Depository wallet if after the milestone + if (blockNumber.gt(BigInt.fromString(BOND_DEPOSITORY_BLOCK))) { + continue; + } + wallets.push(CIRCULATING_SUPPLY_WALLETS[i]); } diff --git a/subgraphs/ethereum/src/utils/ProtocolAddresses.ts b/subgraphs/ethereum/src/utils/ProtocolAddresses.ts index 32dd8b49..97ed9f16 100644 --- a/subgraphs/ethereum/src/utils/ProtocolAddresses.ts +++ b/subgraphs/ethereum/src/utils/ProtocolAddresses.ts @@ -28,6 +28,7 @@ export const OLYMPUS_ASSOCIATION_WALLET = "0x4c71db02aeeb336cbd8f3d2cc866911f6e2 export const COOLER_LOANS_CLEARINGHOUSE = "0xD6A6E8d9e82534bD65821142fcCd91ec9cF31880".toLowerCase(); export const TRSRY = "0xa8687A15D4BE32CC8F0a8a7B9704a4C3993D9613".toLowerCase(); +export const TRSRY_V1_1 = "0xea1560F36F71a2F54deFA75ed9EaA15E8655bE22".toLowerCase(); export const OTC_ESCROW = "0xe3312c3f1ab30878d9686452f7205ebe11e965eb".toLowerCase(); export const MYSO_LENDING = "0xb339953fc028b9998775c00594a74dd1488ee2c6".toLowerCase(); @@ -67,7 +68,7 @@ export const CONVEX_ALLOCATORS = [ /** * This set of wallet addresses is common across many tokens, * and can be used for balance lookups. - * + * * Myso and Vendor Finance contracts are NOT included in here, as the deployed amounts are hard-coded. */ export const PROTOCOL_ADDRESSES = [ diff --git a/subgraphs/shared/src/Wallets.ts b/subgraphs/shared/src/Wallets.ts index 324c175b..44e09437 100644 --- a/subgraphs/shared/src/Wallets.ts +++ b/subgraphs/shared/src/Wallets.ts @@ -50,6 +50,7 @@ export const COOLER_LOANS_CLEARINGHOUSES = [ ]; export const TRSRY = "0xa8687A15D4BE32CC8F0a8a7B9704a4C3993D9613".toLowerCase(); +export const TRSRY_V1_1 = "0xea1560F36F71a2F54deFA75ed9EaA15E8655bE22".toLowerCase(); export const OTC_ESCROW = "0xe3312c3f1ab30878d9686452f7205ebe11e965eb".toLowerCase(); export const MYSO_LENDING = "0xb339953fc028b9998775c00594a74dd1488ee2c6".toLowerCase(); @@ -58,7 +59,7 @@ export const VENDOR_LENDING = "0x83234a159dbd60a32457df158fafcbdf3d1ccc08".toLow /** * This set of wallet addresses is common across many tokens, * and can be used for balance lookups. - * + * * Myso and Vendor Finance contracts are NOT included in here, as the deployed amounts are hard-coded. */ export const WALLET_ADDRESSES = [ From 70525b78af53e256297e6aaf212aa480fe2b6493 Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Fri, 26 Jan 2024 08:19:41 +0000 Subject: [PATCH 07/17] Add deployment links --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 912139d6..f08ac525 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,11 @@ Gathers data from bonds, liquidity and Olympus treasury. Used in the [Olympus Treasury Dashboard](https://app.olympusdao.finance/). -Deployed at +Deployed at: + +- [https://thegraph.com/explorer/subgraphs/7jeChfyUTWRyp2JxPGuuzxvGt3fDKMkC9rLjm7sfLcNp?view=Overview&chain=arbitrum-one](Ethereum mainnet) +- [https://thegraph.com/explorer/subgraphs/aF7zBXagiSjwwM1yAUiyrWFJDhh5RLpVn2nuvVbKwDw?view=Overview&chain=arbitrum-one](Polygon) +- [https://thegraph.com/explorer/subgraphs/8Zxb1kVv9ZBChHXEPSgtC5u5gjCijMn5k8ErpzRYWNgH?view=Overview&chain=arbitrum-one](Arbitrum) ## Initial Setup From f59281324d9a5415652851814564fc8186fe3c05 Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Fri, 26 Jan 2024 08:21:19 +0000 Subject: [PATCH 08/17] Version bump --- subgraphs/ethereum/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subgraphs/ethereum/config.json b/subgraphs/ethereum/config.json index 40449c0a..d30a7b0b 100644 --- a/subgraphs/ethereum/config.json +++ b/subgraphs/ethereum/config.json @@ -2,5 +2,5 @@ "id": "QmWe5DKxZ2g8V5tr6rLskxSkwBD6x6deZFT7XHoMoB4g5v", "org": "olympusdao", "name": "olympus-protocol-metrics", - "version": "5.0.0" + "version": "5.1.0" } \ No newline at end of file From 09c8d5b40cf7127c7023fe4aad79436200e69c21 Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Fri, 26 Jan 2024 08:21:23 +0000 Subject: [PATCH 09/17] Grafting --- subgraphs/ethereum/CHANGELOG.md | 1 + subgraphs/ethereum/subgraph.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/subgraphs/ethereum/CHANGELOG.md b/subgraphs/ethereum/CHANGELOG.md index a8b7926a..253e1cdb 100644 --- a/subgraphs/ethereum/CHANGELOG.md +++ b/subgraphs/ethereum/CHANGELOG.md @@ -5,6 +5,7 @@ - Adds TRSRY v1.1 - Adds support for recognising OHM burnt in the Bond Manager - Removes the Bond Depository from protocol- and DAO-owned wallets going forward, as gOHM in the contract is considered user funds +- Grafted from 2024-01-20 ## 5.0.0 (2023-10-11) diff --git a/subgraphs/ethereum/subgraph.yaml b/subgraphs/ethereum/subgraph.yaml index 76e2a565..7be5fcac 100644 --- a/subgraphs/ethereum/subgraph.yaml +++ b/subgraphs/ethereum/subgraph.yaml @@ -1,11 +1,11 @@ specVersion: 0.0.8 description: Olympus Protocol Metrics Subgraph repository: https://github.com/OlympusDAO/olympus-protocol-metrics-subgraph -# features: -# - grafting -# graft: -# base: QmSwwBfAoWJLHQeSTagFnkibnkrjeprxcQpXAHk6AVrysA -# block: 18185779 # Clearinghouse deployment +features: + - grafting +graft: + base: QmUX8d1VHoBTPKf6z4anNt2y8ZSgFbeTqXN52LJ1q8FF5N + block: 19050000 # 2024-01-20 schema: file: ../../schema.graphql dataSources: From b217bbfe8a1dc2fdcb3891ddb3ebd52e3882cdad Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Fri, 26 Jan 2024 08:41:51 +0000 Subject: [PATCH 10/17] Adjust grafting. Bump deployment. --- subgraphs/ethereum/config.json | 2 +- subgraphs/ethereum/subgraph.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/subgraphs/ethereum/config.json b/subgraphs/ethereum/config.json index d30a7b0b..e5e50435 100644 --- a/subgraphs/ethereum/config.json +++ b/subgraphs/ethereum/config.json @@ -1,5 +1,5 @@ { - "id": "QmWe5DKxZ2g8V5tr6rLskxSkwBD6x6deZFT7XHoMoB4g5v", + "id": "QmXTbGWF6McFFWYezbCWYn9frV8Ex9AFactQvMFdLWF8mA", "org": "olympusdao", "name": "olympus-protocol-metrics", "version": "5.1.0" diff --git a/subgraphs/ethereum/subgraph.yaml b/subgraphs/ethereum/subgraph.yaml index 7be5fcac..5f061d00 100644 --- a/subgraphs/ethereum/subgraph.yaml +++ b/subgraphs/ethereum/subgraph.yaml @@ -4,7 +4,7 @@ repository: https://github.com/OlympusDAO/olympus-protocol-metrics-subgraph features: - grafting graft: - base: QmUX8d1VHoBTPKf6z4anNt2y8ZSgFbeTqXN52LJ1q8FF5N + base: QmbucBqomBG2qDfizVV1cMGDudCLvW2h9KWHeD6YS6Bk7L block: 19050000 # 2024-01-20 schema: file: ../../schema.graphql From a892374131ac0d396eccec8f99e0a33e4c346049 Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Fri, 26 Jan 2024 08:45:16 +0000 Subject: [PATCH 11/17] New deployment with changes from master. --- subgraphs/ethereum/CHANGELOG.md | 2 +- subgraphs/ethereum/config.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/subgraphs/ethereum/CHANGELOG.md b/subgraphs/ethereum/CHANGELOG.md index 9f096b0a..d2706f23 100644 --- a/subgraphs/ethereum/CHANGELOG.md +++ b/subgraphs/ethereum/CHANGELOG.md @@ -1,6 +1,6 @@ # Subgraph Changelog -## 5.1.0 (2024-01-26) +## 5.1.1 (2024-01-26) - Adds TRSRY v1.1 - Adds support for recognising OHM burnt in the Bond Manager diff --git a/subgraphs/ethereum/config.json b/subgraphs/ethereum/config.json index e5e50435..2267018d 100644 --- a/subgraphs/ethereum/config.json +++ b/subgraphs/ethereum/config.json @@ -1,6 +1,6 @@ { - "id": "QmXTbGWF6McFFWYezbCWYn9frV8Ex9AFactQvMFdLWF8mA", + "id": "QmZe2TQrKnQKBuYqzs5hgobz8k1GKN39wcHG57BdeSDC4F", "org": "olympusdao", "name": "olympus-protocol-metrics", - "version": "5.1.0" + "version": "5.1.1" } \ No newline at end of file From 10659e9f78436084d9ef7de19e112b83e83a85af Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Fri, 26 Jan 2024 08:47:07 +0000 Subject: [PATCH 12/17] Bump node version in GitHub CI --- .github/workflows/query.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/query.yml b/.github/workflows/query.yml index b3bddd47..a101212a 100644 --- a/.github/workflows/query.yml +++ b/.github/workflows/query.yml @@ -17,7 +17,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 with: - node-version: "16" + node-version: "18" cache: "yarn" - name: Install run: | From 3aa3b693e343dbb13698ac094bc0770de24fee3d Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Fri, 26 Jan 2024 10:06:19 +0000 Subject: [PATCH 13/17] Fix bug with bond depository exclusion --- subgraphs/ethereum/config.json | 2 +- subgraphs/ethereum/src/utils/OhmCalculations.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/subgraphs/ethereum/config.json b/subgraphs/ethereum/config.json index 2267018d..f7c11585 100644 --- a/subgraphs/ethereum/config.json +++ b/subgraphs/ethereum/config.json @@ -2,5 +2,5 @@ "id": "QmZe2TQrKnQKBuYqzs5hgobz8k1GKN39wcHG57BdeSDC4F", "org": "olympusdao", "name": "olympus-protocol-metrics", - "version": "5.1.1" + "version": "5.1.2" } \ No newline at end of file diff --git a/subgraphs/ethereum/src/utils/OhmCalculations.ts b/subgraphs/ethereum/src/utils/OhmCalculations.ts index 6243a767..e2381965 100644 --- a/subgraphs/ethereum/src/utils/OhmCalculations.ts +++ b/subgraphs/ethereum/src/utils/OhmCalculations.ts @@ -54,6 +54,7 @@ import { getUniswapV3OhmSupply } from "../liquidity/LiquidityUniswapV3"; import { getSiloSupply } from "./Silo"; import { wsOHM } from "../../generated/ProtocolMetrics/wsOHM"; import { ERC20 } from "../../generated/ProtocolMetrics/ERC20"; +import { BONDS_DEPOSIT } from "./ProtocolAddresses"; const MIGRATION_OFFSET_STARTING_BLOCK = "14381564"; const MIGRATION_OFFSET = "2013"; @@ -513,7 +514,10 @@ export function getTreasuryOHMRecords(timestamp: BigInt, blockNumber: BigInt): T const wallets = new Array(); for (let i = 0; i < CIRCULATING_SUPPLY_WALLETS.length; i++) { // Skip the Bond Depository wallet if after the milestone - if (blockNumber.gt(BigInt.fromString(BOND_DEPOSITORY_BLOCK))) { + if (blockNumber.gt(BigInt.fromString(BOND_DEPOSITORY_BLOCK)) + && + CIRCULATING_SUPPLY_WALLETS[i] == BONDS_DEPOSIT + ) { continue; } From d3ecfe7948e437ed2027bd6a7317b2c0c4f75067 Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Fri, 26 Jan 2024 10:07:08 +0000 Subject: [PATCH 14/17] Fix node version again --- .github/workflows/query.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/query.yml b/.github/workflows/query.yml index a101212a..f40d3629 100644 --- a/.github/workflows/query.yml +++ b/.github/workflows/query.yml @@ -52,7 +52,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 with: - node-version: "16" + node-version: "18" cache: "yarn" - name: Install run: | @@ -89,7 +89,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v3 with: - node-version: "16" + node-version: "18" cache: "yarn" # Looks for an existing comment, so it can be updated - name: Find Existing Comment From add64fed34160482c9f26a8aa76df0f623cbb27e Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Fri, 26 Jan 2024 10:07:31 +0000 Subject: [PATCH 15/17] Deployment id --- subgraphs/ethereum/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subgraphs/ethereum/config.json b/subgraphs/ethereum/config.json index f7c11585..40c2afad 100644 --- a/subgraphs/ethereum/config.json +++ b/subgraphs/ethereum/config.json @@ -1,5 +1,5 @@ { - "id": "QmZe2TQrKnQKBuYqzs5hgobz8k1GKN39wcHG57BdeSDC4F", + "id": "QmPfxmh6EvwtFRJDo7isnFdZuwXmrS7HMrebNTt6pfkJz1", "org": "olympusdao", "name": "olympus-protocol-metrics", "version": "5.1.2" From 21928cf93a9e7d5270af109e752059263a4168dc Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Fri, 26 Jan 2024 10:32:03 +0000 Subject: [PATCH 16/17] Deployment bump with new grafting base. --- subgraphs/ethereum/CHANGELOG.md | 4 ++-- subgraphs/ethereum/config.json | 4 ++-- subgraphs/ethereum/subgraph.yaml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/subgraphs/ethereum/CHANGELOG.md b/subgraphs/ethereum/CHANGELOG.md index d2706f23..6fb246c4 100644 --- a/subgraphs/ethereum/CHANGELOG.md +++ b/subgraphs/ethereum/CHANGELOG.md @@ -1,11 +1,11 @@ # Subgraph Changelog -## 5.1.1 (2024-01-26) +## 5.1.3 (2024-01-26) - Adds TRSRY v1.1 - Adds support for recognising OHM burnt in the Bond Manager - Removes the Bond Depository from protocol- and DAO-owned wallets going forward, as gOHM in the contract is considered user funds -- Grafted from 2024-01-20 +- Grafted on top of 5.0.4 ## 5.0.5 (2023-10-17) diff --git a/subgraphs/ethereum/config.json b/subgraphs/ethereum/config.json index 40c2afad..17860fa3 100644 --- a/subgraphs/ethereum/config.json +++ b/subgraphs/ethereum/config.json @@ -1,6 +1,6 @@ { - "id": "QmPfxmh6EvwtFRJDo7isnFdZuwXmrS7HMrebNTt6pfkJz1", + "id": "Qmd7wgnNTijSpV1JDM3yUE8Exy4EGG1jw3yyQKdTKvYiig", "org": "olympusdao", "name": "olympus-protocol-metrics", - "version": "5.1.2" + "version": "5.1.3" } \ No newline at end of file diff --git a/subgraphs/ethereum/subgraph.yaml b/subgraphs/ethereum/subgraph.yaml index 2bc7dbe0..39079c03 100644 --- a/subgraphs/ethereum/subgraph.yaml +++ b/subgraphs/ethereum/subgraph.yaml @@ -4,8 +4,8 @@ repository: https://github.com/OlympusDAO/olympus-protocol-metrics-subgraph features: - grafting graft: - base: QmbucBqomBG2qDfizVV1cMGDudCLvW2h9KWHeD6YS6Bk7L - block: 19050000 # 2024-01-20 + base: QmUX8d1VHoBTPKf6z4anNt2y8ZSgFbeTqXN52LJ1q8FF5N # 5.0.4 + block: 15275000 # Previous failure schema: file: ../../schema.graphql dataSources: From 43e7e21e06a4caeac5a57704f6c1616190090282 Mon Sep 17 00:00:00 2001 From: Jem <0x0xjem@gmail.com> Date: Mon, 29 Jan 2024 10:28:08 +0400 Subject: [PATCH 17/17] Correct deployment URLs --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f08ac525..5cde29c7 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,10 @@ Used in the [Olympus Treasury Dashboard](https://app.olympusdao.finance/). Deployed at: -- [https://thegraph.com/explorer/subgraphs/7jeChfyUTWRyp2JxPGuuzxvGt3fDKMkC9rLjm7sfLcNp?view=Overview&chain=arbitrum-one](Ethereum mainnet) -- [https://thegraph.com/explorer/subgraphs/aF7zBXagiSjwwM1yAUiyrWFJDhh5RLpVn2nuvVbKwDw?view=Overview&chain=arbitrum-one](Polygon) -- [https://thegraph.com/explorer/subgraphs/8Zxb1kVv9ZBChHXEPSgtC5u5gjCijMn5k8ErpzRYWNgH?view=Overview&chain=arbitrum-one](Arbitrum) +- [Ethereum mainnet](https://thegraph.com/explorer/subgraphs/7jeChfyUTWRyp2JxPGuuzxvGt3fDKMkC9rLjm7sfLcNp?view=Overview&chain=arbitrum-one) +- [Polygon](https://thegraph.com/explorer/subgraphs/aF7zBXagiSjwwM1yAUiyrWFJDhh5RLpVn2nuvVbKwDw?view=Overview&chain=arbitrum-one) +- [Arbitrum](https://thegraph.com/explorer/subgraphs/8Zxb1kVv9ZBChHXEPSgtC5u5gjCijMn5k8ErpzRYWNgH?view=Overview&chain=arbitrum-one) +- [Fantom](https://thegraph.com/hosted-service/subgraph/olympusdao/protocol-metrics-polygon) ## Initial Setup