diff --git a/CHANGELOG.md b/CHANGELOG.md index b82b4c7..5dee499 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,17 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [v3.0.3](https://github.com/oceanprotocol/ocean-subgraph/compare/v3.0.2...v3.0.3) + +- Removing amountFraction and adding timestamp [`#647`](https://github.com/oceanprotocol/ocean-subgraph/pull/647) +- Fixing decimals issue [`#644`](https://github.com/oceanprotocol/ocean-subgraph/pull/644) +- Bump typescript from 5.0.2 to 5.0.3 [`#641`](https://github.com/oceanprotocol/ocean-subgraph/pull/641) +- Bump release-it from 15.9.3 to 15.10.0 [`#640`](https://github.com/oceanprotocol/ocean-subgraph/pull/640) + #### [v3.0.2](https://github.com/oceanprotocol/ocean-subgraph/compare/v3.0.1...v3.0.2) +> 31 March 2023 + - Storing the fraction of veOcean [`#623`](https://github.com/oceanprotocol/ocean-subgraph/pull/623) - Bump eslint-config-prettier from 8.7.0 to 8.8.0 [`#637`](https://github.com/oceanprotocol/ocean-subgraph/pull/637) - Bump prettier from 2.8.4 to 2.8.7 [`#636`](https://github.com/oceanprotocol/ocean-subgraph/pull/636) @@ -25,6 +34,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - Bump @graphprotocol/graph-ts from 0.29.1 to 0.29.3 [`#611`](https://github.com/oceanprotocol/ocean-subgraph/pull/611) - Bump typescript from 4.9.4 to 4.9.5 [`#610`](https://github.com/oceanprotocol/ocean-subgraph/pull/610) - Bump @graphprotocol/graph-cli from 0.37.7 to 0.38.0 [`#609`](https://github.com/oceanprotocol/ocean-subgraph/pull/609) +- Release 3.0.2 [`de5f1aa`](https://github.com/oceanprotocol/ocean-subgraph/commit/de5f1aab4bc70d6ec831fa0f24099666ef3c46a1) #### [v3.0.1](https://github.com/oceanprotocol/ocean-subgraph/compare/v3.0.0...v3.0.1) diff --git a/package-lock.json b/package-lock.json index c4a758d..10b5538 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ocean-subgraph", - "version": "3.0.2", + "version": "3.0.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "ocean-subgraph", - "version": "3.0.2", + "version": "3.0.3", "license": "Apache-2.0", "dependencies": { "@oceanprotocol/contracts": "^1.1.12", @@ -35,12 +35,12 @@ "mocha": "^10.2.0", "mock-local-storage": "^1.1.23", "prettier": "^2.8.7", - "release-it": "^15.10.0", + "release-it": "^15.10.1", "source-map-support": "^0.5.21", "ts-node": "^10.9.1", "ts-node-dev": "^2.0.0", "ts-node-register": "^1.0.0", - "typescript": "^5.0.3" + "typescript": "^5.0.4" } }, "node_modules/@babel/code-frame": { @@ -11079,9 +11079,9 @@ } }, "node_modules/release-it": { - "version": "15.10.0", - "resolved": "https://registry.npmjs.org/release-it/-/release-it-15.10.0.tgz", - "integrity": "sha512-cXY7cZyXjZ/e8TPUjzM7AHvnOKzNmj2NwNT3gREmZIdnDRmuX3DSnS3S3SLbVF8S3SmM88WfHVifGxFaFjNthQ==", + "version": "15.10.1", + "resolved": "https://registry.npmjs.org/release-it/-/release-it-15.10.1.tgz", + "integrity": "sha512-Wkk4aFHSo27vQwHIlcEy77lJwnQlh4UDQckc53gh5tKo7F22mAUEAe8SYQZJcFh7icdkf0OV70onhB1dDmeClA==", "dev": true, "dependencies": { "@iarna/toml": "2.2.5", @@ -13479,9 +13479,9 @@ } }, "node_modules/typescript": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.3.tgz", - "integrity": "sha512-xv8mOEDnigb/tN9PSMTwSEqAnUvkoXMQlicOb0IUVDBSQCgBSaAAROUZYy2IcUy5qU6XajK5jjjO7TMWqBTKZA==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -13788,9 +13788,9 @@ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, "node_modules/vm2": { - "version": "3.9.11", - "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.11.tgz", - "integrity": "sha512-PFG8iJRSjvvBdisowQ7iVF580DXb1uCIiGaXgm7tynMR1uTBlv7UJlB1zdv5KJ+Tmq1f0Upnj3fayoEOPpCBKg==", + "version": "3.9.15", + "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.15.tgz", + "integrity": "sha512-XqNqknHGw2avJo13gbIwLNZUumvrSHc9mLqoadFZTpo3KaNEJoe1I0lqTFhRXmXD7WkLyG01aaraXdXT0pa4ag==", "dev": true, "dependencies": { "acorn": "^8.7.0", @@ -23193,9 +23193,9 @@ } }, "release-it": { - "version": "15.10.0", - "resolved": "https://registry.npmjs.org/release-it/-/release-it-15.10.0.tgz", - "integrity": "sha512-cXY7cZyXjZ/e8TPUjzM7AHvnOKzNmj2NwNT3gREmZIdnDRmuX3DSnS3S3SLbVF8S3SmM88WfHVifGxFaFjNthQ==", + "version": "15.10.1", + "resolved": "https://registry.npmjs.org/release-it/-/release-it-15.10.1.tgz", + "integrity": "sha512-Wkk4aFHSo27vQwHIlcEy77lJwnQlh4UDQckc53gh5tKo7F22mAUEAe8SYQZJcFh7icdkf0OV70onhB1dDmeClA==", "dev": true, "requires": { "@iarna/toml": "2.2.5", @@ -24976,9 +24976,9 @@ } }, "typescript": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.3.tgz", - "integrity": "sha512-xv8mOEDnigb/tN9PSMTwSEqAnUvkoXMQlicOb0IUVDBSQCgBSaAAROUZYy2IcUy5qU6XajK5jjjO7TMWqBTKZA==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", + "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", "dev": true }, "uglify-js": { @@ -25213,9 +25213,9 @@ } }, "vm2": { - "version": "3.9.11", - "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.11.tgz", - "integrity": "sha512-PFG8iJRSjvvBdisowQ7iVF580DXb1uCIiGaXgm7tynMR1uTBlv7UJlB1zdv5KJ+Tmq1f0Upnj3fayoEOPpCBKg==", + "version": "3.9.15", + "resolved": "https://registry.npmjs.org/vm2/-/vm2-3.9.15.tgz", + "integrity": "sha512-XqNqknHGw2avJo13gbIwLNZUumvrSHc9mLqoadFZTpo3KaNEJoe1I0lqTFhRXmXD7WkLyG01aaraXdXT0pa4ag==", "dev": true, "requires": { "acorn": "^8.7.0", diff --git a/package.json b/package.json index dcfcd6c..f4678b1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ocean-subgraph", - "version": "3.0.2", + "version": "3.0.3", "scripts": { "start": "", "quickstart:development": "node ./scripts/generatenetworkssubgraphs.js development && npm run codegen && npm run create:local && npm run deploy:local", @@ -64,12 +64,12 @@ "mocha": "^10.2.0", "mock-local-storage": "^1.1.23", "prettier": "^2.8.7", - "release-it": "^15.10.0", + "release-it": "^15.10.1", "source-map-support": "^0.5.21", "ts-node": "^10.9.1", "ts-node-dev": "^2.0.0", "ts-node-register": "^1.0.0", - "typescript": "^5.0.3" + "typescript": "^5.0.4" }, "dependencies": { "@oceanprotocol/contracts": "^1.1.12", diff --git a/schema.graphql b/schema.graphql index fce4ca7..71711fd 100644 --- a/schema.graphql +++ b/schema.graphql @@ -478,10 +478,11 @@ type VeDelegation @entity { receiver: VeOCEAN! tokenId: BigInt! amount: BigInt! - amountFraction: BigDecimal! cancelTime: BigInt! expireTime: BigInt! block: Int! + timestamp: Int! + tx: String! } type VeOCEAN @entity { diff --git a/src/mappings/utils/globalUtils.ts b/src/mappings/utils/globalUtils.ts index dbab391..d631c29 100644 --- a/src/mappings/utils/globalUtils.ts +++ b/src/mappings/utils/globalUtils.ts @@ -13,7 +13,7 @@ export function getGlobalStats(): GlobalStatistic { let globalStats = GlobalStatistic.load(GLOBAL_ID) if (!globalStats) { globalStats = new GlobalStatistic(GLOBAL_ID) - globalStats.version = '3.0.2' + globalStats.version = '3.0.3' globalStats.orderCount = 0 globalStats.fixedCount = 0 globalStats.datatokenCount = 0 diff --git a/src/mappings/utils/veUtils.ts b/src/mappings/utils/veUtils.ts index ae5b7f8..0f06e86 100644 --- a/src/mappings/utils/veUtils.ts +++ b/src/mappings/utils/veUtils.ts @@ -133,11 +133,12 @@ export function getveDelegation(id: string): VeDelegation { veDelegation.cancelTime = BigInt.zero() veDelegation.expireTime = BigInt.zero() veDelegation.tokenId = BigInt.zero() - veDelegation.amountFraction = BigDecimal.zero() veDelegation.amount = BigInt.zero() veDelegation.receiver = '' veDelegation.delegator = '' veDelegation.block = 0 + veDelegation.timestamp = 0 + veDelegation.tx = '' veDelegation.save() } return veDelegation diff --git a/src/mappings/veDelegation.ts b/src/mappings/veDelegation.ts index e1a57e5..cb1fa59 100644 --- a/src/mappings/veDelegation.ts +++ b/src/mappings/veDelegation.ts @@ -1,4 +1,4 @@ -import { BigDecimal, BigInt } from '@graphprotocol/graph-ts' +import { BigInt } from '@graphprotocol/graph-ts' import { BurnBoost, DelegateBoost, @@ -6,7 +6,6 @@ import { TransferBoost } from '../@types/veDelegation/veDelegation' import { getveDelegation, getveOCEAN } from './utils/veUtils' -import { weiToDecimal } from './utils/generic' export function handleDelegation(event: DelegateBoost): void { const _delegator = event.params._delegator.toHex() @@ -19,18 +18,14 @@ export function handleDelegation(event: DelegateBoost): void { const veDelegation = getveDelegation(_tokenId.toHex()) veDelegation.delegator = _delegator getveOCEAN(_receiver) - const delegatorVeOcean = getveOCEAN(_delegator) - if (_amount && delegatorVeOcean.lockedAmount) { - veDelegation.amountFraction = _amount.divDecimal( - delegatorVeOcean.lockedAmount - ) - } veDelegation.receiver = _receiver veDelegation.tokenId = _tokenId veDelegation.amount = _amount veDelegation.cancelTime = _cancelTime veDelegation.expireTime = _expireTime veDelegation.block = event.block.number.toI32() + veDelegation.timestamp = event.block.timestamp.toI32() + veDelegation.tx = event.transaction.hash.toHex() veDelegation.save() } @@ -43,18 +38,14 @@ export function handleExtendBoost(event: ExtendBoost): void { const _expireTime = event.params._expire_time const veDelegation = getveDelegation(_tokenId.toHex()) - const delegatorVeOcean = getveOCEAN(_delegator) - if (_amount && delegatorVeOcean.lockedAmount) { - veDelegation.amountFraction = weiToDecimal(_amount.toBigDecimal(), 18).div( - delegatorVeOcean.lockedAmount - ) - } veDelegation.delegator = _delegator veDelegation.receiver = _receiver veDelegation.tokenId = _tokenId veDelegation.amount = _amount veDelegation.cancelTime = _cancelTime veDelegation.expireTime = _expireTime + veDelegation.timestamp = event.block.timestamp.toI32() + veDelegation.tx = event.transaction.hash.toHex() veDelegation.save() } @@ -72,6 +63,5 @@ export function handleBurnBoost(event: BurnBoost): void { // delete const veDelegation = getveDelegation(_tokenId.toHex()) - veDelegation.amountFraction = BigDecimal.zero() veDelegation.amount = BigInt.zero() } diff --git a/test/integration/VeOcean.test.ts b/test/integration/VeOcean.test.ts index fda7471..96f62ce 100644 --- a/test/integration/VeOcean.test.ts +++ b/test/integration/VeOcean.test.ts @@ -664,7 +664,6 @@ describe('veOcean tests', async () => { }, tokenId, amount, - amountFraction, cancelTime, expireTime }