Feature/bump libs (#255)

* fix id (#214)

* Bump eslint-plugin-prettier from 3.4.0 to 3.4.1 (#206)

Bumps [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) from 3.4.0 to 3.4.1.
- [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-plugin-prettier/commits)

---
updated-dependencies:
- dependency-name: eslint-plugin-prettier
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump typescript from 4.3.5 to 4.4.2 (#211)

Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.3.5 to 4.4.2.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.3.5...v4.4.2)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @typescript-eslint/eslint-plugin from 4.29.1 to 4.29.3 (#209)

Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 4.29.1 to 4.29.3.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.29.3/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump mocha from 9.0.3 to 9.1.1 (#210)

Bumps [mocha](https://github.com/mochajs/mocha) from 9.0.3 to 9.1.1.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v9.0.3...v9.1.1)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @typescript-eslint/parser from 4.29.0 to 4.30.0 (#215)

Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 4.29.0 to 4.30.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.30.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump eslint-plugin-prettier from 3.4.1 to 4.0.0 (#217)

Bumps [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) from 3.4.1 to 4.0.0.
- [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-plugin-prettier/commits/v4.0.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump prettier from 2.3.2 to 2.4.0 (#220)

Bumps [prettier](https://github.com/prettier/prettier) from 2.3.2 to 2.4.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.3.2...2.4.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @typescript-eslint/parser from 4.30.0 to 4.31.0 (#221)

Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 4.30.0 to 4.31.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.31.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @oceanprotocol/lib from 0.17.1 to 0.17.3 (#216)

Bumps [@oceanprotocol/lib](https://github.com/oceanprotocol/ocean.js) from 0.17.1 to 0.17.3.
- [Release notes](https://github.com/oceanprotocol/ocean.js/releases)
- [Changelog](https://github.com/oceanprotocol/ocean.js/blob/main/CHANGELOG.md)
- [Commits](https://github.com/oceanprotocol/ocean.js/compare/v0.17.1...v0.17.3)

---
updated-dependencies:
- dependency-name: "@oceanprotocol/lib"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @typescript-eslint/eslint-plugin from 4.29.3 to 4.31.0 (#222)

Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 4.29.3 to 4.31.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.31.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump typescript from 4.4.2 to 4.4.3 (#223)

Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.4.2 to 4.4.3.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v4.4.2...v4.4.3)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix gaia-x abi

Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro>

* add catenax & bump ocean.js (#227)

* add catenax & bump ocean.js

* fix typo

* fix lint deps

* add nr of sales for user (#231)

* Bump @typescript-eslint/eslint-plugin from 4.31.1 to 4.32.0 (#242)

Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 4.31.1 to 4.32.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.32.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump release-it from 14.11.5 to 14.11.6 (#244)

Bumps [release-it](https://github.com/release-it/release-it) from 14.11.5 to 14.11.6.
- [Release notes](https://github.com/release-it/release-it/releases)
- [Changelog](https://github.com/release-it/release-it/blob/master/CHANGELOG.md)
- [Commits](https://github.com/release-it/release-it/compare/14.11.5...14.11.6)

---
updated-dependencies:
- dependency-name: release-it
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @typescript-eslint/parser from 4.31.1 to 4.33.0 (#245)

Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 4.31.1 to 4.33.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.33.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* add EnergyWeb, Moonriver & Celo Alfajores (#239)

* add EnergyWeb, Moonriver & Celo Alfajores

* fix ocean address

* add ERC20 abis

* Bump mocha from 9.1.1 to 9.1.2 (#247)

Bumps [mocha](https://github.com/mochajs/mocha) from 9.1.1 to 9.1.2.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v9.1.1...v9.1.2)

---
updated-dependencies:
- dependency-name: mocha
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @typescript-eslint/eslint-plugin from 4.32.0 to 4.33.0 (#248)

Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 4.32.0 to 4.33.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v4.33.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @oceanprotocol/lib from 0.17.4 to 0.19.2 (#246)

Bumps [@oceanprotocol/lib](https://github.com/oceanprotocol/ocean.js) from 0.17.4 to 0.19.2.
- [Release notes](https://github.com/oceanprotocol/ocean.js/releases)
- [Changelog](https://github.com/oceanprotocol/ocean.js/blob/main/CHANGELOG.md)
- [Commits](https://github.com/oceanprotocol/ocean.js/compare/v0.17.4...v0.19.2)

---
updated-dependencies:
- dependency-name: "@oceanprotocol/lib"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Release 1.2.0

* lib bumps, remove logs

* more fixes

* more fixes

* bump other libs + fixes

* more fixes!

* remove unusued function, lint exceptions

* downgrade eslint

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alex Coseru <alex.coseru@gmail.com>
pull/226/head
mihaisc 1 year ago committed by GitHub
parent 82fd689144
commit c4633aa381
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 20
      .eslintrc
  2. 69
      CHANGELOG.md
  3. 85970
      package-lock.json
  4. 35
      package.json
  5. 238
      src/helpers.ts
  6. 52
      src/mappings/datatoken.ts
  7. 12
      src/mappings/dispenser.ts
  8. 7
      src/mappings/factory.ts
  9. 14
      src/mappings/fixedrateexchange.ts
  10. 225
      src/mappings/pool.ts
  11. 14
      subgraph.bsc.yaml
  12. 213
      subgraph.catenaxtestnet.yaml
  13. 213
      subgraph.celoalfajores.yaml
  14. 213
      subgraph.energyweb.yaml
  15. 22
      subgraph.gaiaxtestnet.yaml
  16. 14
      subgraph.moonbeamalpha.yaml
  17. 213
      subgraph.moonriver.yaml
  18. 14
      subgraph.mumbai.yaml
  19. 14
      subgraph.polygon.yaml
  20. 14
      subgraph.rinkeby.yaml
  21. 14
      subgraph.ropsten.yaml
  22. 14
      subgraph.yaml

@ -1,14 +1,24 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": ["./tsconfig.json"]
"project": [
"./tsconfig.json"
]
},
"extends": ["oceanprotocol", "plugin:prettier/recommended"],
"plugins": ["@typescript-eslint"],
"extends": [
"oceanprotocol",
"plugin:prettier/recommended"
],
"plugins": [
"@typescript-eslint"
],
"rules": {
"no-use-before-define": "off",
"eqeqeq": "off",
"@typescript-eslint/no-use-before-define": "error",
"no-undef": ["warn"]
"no-undef": "off",
"prefer-destructuring": "off",
"no-unneeded-ternary": "off",
"no-undefined": "off"
}
}
}

@ -4,8 +4,76 @@ 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).
#### [v1.2.0](https://github.com/oceanprotocol/ocean-subgraph/compare/v1.1.2...v1.2.0)
- Bump @oceanprotocol/lib from 0.17.4 to 0.19.2 [`#246`](https://github.com/oceanprotocol/ocean-subgraph/pull/246)
- Bump @typescript-eslint/eslint-plugin from 4.32.0 to 4.33.0 [`#248`](https://github.com/oceanprotocol/ocean-subgraph/pull/248)
- Bump mocha from 9.1.1 to 9.1.2 [`#247`](https://github.com/oceanprotocol/ocean-subgraph/pull/247)
- add EnergyWeb, Moonriver & Celo Alfajores [`#239`](https://github.com/oceanprotocol/ocean-subgraph/pull/239)
- Bump @typescript-eslint/parser from 4.31.1 to 4.33.0 [`#245`](https://github.com/oceanprotocol/ocean-subgraph/pull/245)
- Bump release-it from 14.11.5 to 14.11.6 [`#244`](https://github.com/oceanprotocol/ocean-subgraph/pull/244)
- Bump @typescript-eslint/eslint-plugin from 4.31.1 to 4.32.0 [`#242`](https://github.com/oceanprotocol/ocean-subgraph/pull/242)
- add nr of sales for user [`#231`](https://github.com/oceanprotocol/ocean-subgraph/pull/231)
- add catenax & bump ocean.js [`#227`](https://github.com/oceanprotocol/ocean-subgraph/pull/227)
- Bump typescript from 4.4.2 to 4.4.3 [`#223`](https://github.com/oceanprotocol/ocean-subgraph/pull/223)
- Bump @typescript-eslint/eslint-plugin from 4.29.3 to 4.31.0 [`#222`](https://github.com/oceanprotocol/ocean-subgraph/pull/222)
- Bump @oceanprotocol/lib from 0.17.1 to 0.17.3 [`#216`](https://github.com/oceanprotocol/ocean-subgraph/pull/216)
- Bump @typescript-eslint/parser from 4.30.0 to 4.31.0 [`#221`](https://github.com/oceanprotocol/ocean-subgraph/pull/221)
- Bump prettier from 2.3.2 to 2.4.0 [`#220`](https://github.com/oceanprotocol/ocean-subgraph/pull/220)
- Bump eslint-plugin-prettier from 3.4.1 to 4.0.0 [`#217`](https://github.com/oceanprotocol/ocean-subgraph/pull/217)
- Bump @typescript-eslint/parser from 4.29.0 to 4.30.0 [`#215`](https://github.com/oceanprotocol/ocean-subgraph/pull/215)
- Bump mocha from 9.0.3 to 9.1.1 [`#210`](https://github.com/oceanprotocol/ocean-subgraph/pull/210)
- Bump @typescript-eslint/eslint-plugin from 4.29.1 to 4.29.3 [`#209`](https://github.com/oceanprotocol/ocean-subgraph/pull/209)
- Bump typescript from 4.3.5 to 4.4.2 [`#211`](https://github.com/oceanprotocol/ocean-subgraph/pull/211)
- Bump eslint-plugin-prettier from 3.4.0 to 3.4.1 [`#206`](https://github.com/oceanprotocol/ocean-subgraph/pull/206)
- fix id [`#214`](https://github.com/oceanprotocol/ocean-subgraph/pull/214)
- Bump release-it from 14.11.0 to 14.11.5 [`#203`](https://github.com/oceanprotocol/ocean-subgraph/pull/203)
- Added baseTokenSymbol to FixedRateExchange [`#201`](https://github.com/oceanprotocol/ocean-subgraph/pull/201)
- Bump @oceanprotocol/lib from 0.17.0 to 0.17.1 [`#189`](https://github.com/oceanprotocol/ocean-subgraph/pull/189)
- add nvmrc [`#199`](https://github.com/oceanprotocol/ocean-subgraph/pull/199)
- Bump @typescript-eslint/eslint-plugin from 4.28.5 to 4.29.1 [`#198`](https://github.com/oceanprotocol/ocean-subgraph/pull/198)
- Bump release-it from 14.10.1 to 14.11.0 [`#187`](https://github.com/oceanprotocol/ocean-subgraph/pull/187)
- Bump @typescript-eslint/parser from 4.28.5 to 4.29.0 [`#188`](https://github.com/oceanprotocol/ocean-subgraph/pull/188)
- Manual bump test [`#181`](https://github.com/oceanprotocol/ocean-subgraph/pull/181)
- Bump @typescript-eslint/parser from 4.28.4 to 4.28.5 [`#183`](https://github.com/oceanprotocol/ocean-subgraph/pull/183)
- Bump eslint from 7.31.0 to 7.32.0 [`#185`](https://github.com/oceanprotocol/ocean-subgraph/pull/185)
- Add swap volume, consume volume to subgraph [`#64`](https://github.com/oceanprotocol/ocean-subgraph/pull/64)
- add token name symbol to pools [`#61`](https://github.com/oceanprotocol/ocean-subgraph/pull/61)
- Bump @types/mocha from 8.2.3 to 9.0.0 [`#176`](https://github.com/oceanprotocol/ocean-subgraph/pull/176)
- Bump @typescript-eslint/parser from 4.28.3 to 4.28.4 [`#177`](https://github.com/oceanprotocol/ocean-subgraph/pull/177)
- Bump mocha from 9.0.2 to 9.0.3 [`#171`](https://github.com/oceanprotocol/ocean-subgraph/pull/171)
- Bump @typescript-eslint/eslint-plugin from 4.28.3 to 4.28.4 [`#173`](https://github.com/oceanprotocol/ocean-subgraph/pull/173)
- Bump release-it from 14.10.0 to 14.10.1 [`#172`](https://github.com/oceanprotocol/ocean-subgraph/pull/172)
- Bump eslint from 7.30.0 to 7.31.0 [`#170`](https://github.com/oceanprotocol/ocean-subgraph/pull/170)
- Feature: add Ploygon and Bsc in supported networks [`#168`](https://github.com/oceanprotocol/ocean-subgraph/pull/168)
- Bump @typescript-eslint/eslint-plugin from 4.28.2 to 4.28.3 [`#166`](https://github.com/oceanprotocol/ocean-subgraph/pull/166)
- Bump @typescript-eslint/parser from 4.28.0 to 4.28.3 [`#165`](https://github.com/oceanprotocol/ocean-subgraph/pull/165)
- Bump @types/chai from 4.2.19 to 4.2.21 [`#164`](https://github.com/oceanprotocol/ocean-subgraph/pull/164)
- Bump mocha from 9.0.1 to 9.0.2 [`#161`](https://github.com/oceanprotocol/ocean-subgraph/pull/161)
- Bump @types/mocha from 8.2.2 to 8.2.3 [`#160`](https://github.com/oceanprotocol/ocean-subgraph/pull/160)
- Bump @typescript-eslint/eslint-plugin from 4.28.0 to 4.28.2 [`#162`](https://github.com/oceanprotocol/ocean-subgraph/pull/162)
- Bump eslint from 7.29.0 to 7.30.0 [`#156`](https://github.com/oceanprotocol/ocean-subgraph/pull/156)
- Bump prettier from 2.3.1 to 2.3.2 [`#152`](https://github.com/oceanprotocol/ocean-subgraph/pull/152)
- Bump @graphprotocol/graph-ts from 0.20.0 to 0.20.1 [`#155`](https://github.com/oceanprotocol/ocean-subgraph/pull/155)
- Bump typescript from 4.3.4 to 4.3.5 [`#154`](https://github.com/oceanprotocol/ocean-subgraph/pull/154)
- new moonbeam alpha deployment [`#158`](https://github.com/oceanprotocol/ocean-subgraph/pull/158)
- Bump @typescript-eslint/parser from 4.26.1 to 4.28.0 [`#151`](https://github.com/oceanprotocol/ocean-subgraph/pull/151)
- Bump @typescript-eslint/eslint-plugin from 4.26.1 to 4.28.0 [`#150`](https://github.com/oceanprotocol/ocean-subgraph/pull/150)
- Bump mocha from 9.0.0 to 9.0.1 [`#149`](https://github.com/oceanprotocol/ocean-subgraph/pull/149)
- Bump @types/chai from 4.2.18 to 4.2.19 [`#148`](https://github.com/oceanprotocol/ocean-subgraph/pull/148)
- Bump typescript from 4.3.2 to 4.3.4 [`#146`](https://github.com/oceanprotocol/ocean-subgraph/pull/146)
- Bump release-it from 14.8.0 to 14.10.0 [`#145`](https://github.com/oceanprotocol/ocean-subgraph/pull/145)
- Bump eslint from 7.28.0 to 7.29.0 [`#144`](https://github.com/oceanprotocol/ocean-subgraph/pull/144)
- Bump @typescript-eslint/parser from 4.26.1 to 4.27.0 [`#143`](https://github.com/oceanprotocol/ocean-subgraph/pull/143)
- Bump @graphprotocol/graph-cli from 0.20.0 to 0.20.1 [`#141`](https://github.com/oceanprotocol/ocean-subgraph/pull/141)
- Use debug instead of info [`#147`](https://github.com/oceanprotocol/ocean-subgraph/pull/147)
- fix gaia-x abi [`931cbe0`](https://github.com/oceanprotocol/ocean-subgraph/commit/931cbe0ac016ac50abc24f2d73a76a44515d3e9f)
- fix bsc yaml [`2a65774`](https://github.com/oceanprotocol/ocean-subgraph/commit/2a65774abb9950109e7a2b2f60c7f2be2bcd5398)
#### [v1.1.2](https://github.com/oceanprotocol/ocean-subgraph/compare/v1.1.1...v1.1.2)
> 10 June 2021
- add Gaia-X testnet, BSC & Mumbai [`#140`](https://github.com/oceanprotocol/ocean-subgraph/pull/140)
- Bump prettier from 2.3.0 to 2.3.1 [`#138`](https://github.com/oceanprotocol/ocean-subgraph/pull/138)
- Bump @typescript-eslint/parser from 4.25.0 to 4.26.1 [`#135`](https://github.com/oceanprotocol/ocean-subgraph/pull/135)
@ -38,6 +106,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
- Bump eslint from 7.24.0 to 7.25.0 [`#96`](https://github.com/oceanprotocol/ocean-subgraph/pull/96)
- Issue 92 readme improvements [`#93`](https://github.com/oceanprotocol/ocean-subgraph/pull/93)
- Bump eslint-plugin-prettier from 3.3.1 to 3.4.0 [`#88`](https://github.com/oceanprotocol/ocean-subgraph/pull/88)
- Release 1.1.2 [`d073f2d`](https://github.com/oceanprotocol/ocean-subgraph/commit/d073f2dc33935abb3e7cc153616317870bac51bf)
- Add ADDRESS_FILE env docs [`81c5ad7`](https://github.com/oceanprotocol/ocean-subgraph/commit/81c5ad782e2dc1eb0cf0d52bc62ab699f179427b)
- Update README.md [`8aebc1f`](https://github.com/oceanprotocol/ocean-subgraph/commit/8aebc1f26f938f43ad1fe1487982cec3f992f998)

85970
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
{
"name": "ocean-subgraph",
"version": "1.1.2",
"version": "1.2.0",
"scripts": {
"start": "",
"quickstart:barge": "export ADDRESS_FILE=\"${HOME}/.ocean/ocean-contracts/artifacts/address.json\" && npm run codegen && npm run bargesetup && npm run create:local-barge && npm run deploy:local-barge",
@ -13,8 +13,12 @@
"create:local-polygon": "graph create oceanprotocol/ocean-subgraph --node http://127.0.0.1:8020",
"create:local-moonbeamalpha": "graph create oceanprotocol/ocean-subgraph --node http://127.0.0.1:8020",
"create:local-gaiaxtestnet": "graph create oceanprotocol/ocean-subgraph --node http://127.0.0.1:8020",
"create:local-catenaxtestnet": "graph create oceanprotocol/ocean-subgraph --node http://127.0.0.1:8020",
"create:local-mumbai": "graph create oceanprotocol/ocean-subgraph --node http://127.0.0.1:8020",
"create:local-bsc": "graph create oceanprotocol/ocean-subgraph --node http://127.0.0.1:8020",
"create:local-celoalfajores": "graph create oceanprotocol/ocean-subgraph --node http://127.0.0.1:8020",
"create:local-energyweb": "graph create oceanprotocol/ocean-subgraph --node http://127.0.0.1:8020",
"create:local-moonriver": "graph create oceanprotocol/ocean-subgraph --node http://127.0.0.1:8020",
"codegen": "graph codegen --output-dir src/@types",
"build": "graph build",
"deploy": "graph deploy oceanprotocol/ocean-subgraph --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
@ -26,8 +30,12 @@
"deploy:local-polygon": "graph deploy oceanprotocol/ocean-subgraph subgraph.polygon.yaml --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-moonbeamalpha": "graph deploy oceanprotocol/ocean-subgraph subgraph.moonbeamalpha.yaml --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-gaiaxtestnet": "graph deploy oceanprotocol/ocean-subgraph subgraph.gaiaxtestnet.yaml --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-catenaxtestnet": "graph deploy oceanprotocol/ocean-subgraph subgraph.catenaxtestnet.yaml --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-mumbai": "graph deploy oceanprotocol/ocean-subgraph subgraph.mumbai.yaml --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-bsc": "graph deploy oceanprotocol/ocean-subgraph subgraph.bsc.yaml --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-celoalfajores": "graph deploy oceanprotocol/ocean-subgraph subgraph.celoalfajores.yaml --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-energyweb": "graph deploy oceanprotocol/ocean-subgraph subgraph.energyweb.yaml --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"deploy:local-moonriver": "graph deploy oceanprotocol/ocean-subgraph subgraph.moonriver.yaml --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020",
"test": "npm run codegen && npm run lint && npm run type-check",
"test-integration": "TS_NODE_PROJECT='test/integration/tsconfig.json' mocha --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/**/*.test.ts'",
"lint": "eslint --ignore-path .gitignore --ext .js --ext .ts --ext .tsx .",
@ -37,29 +45,32 @@
"changelog": "auto-changelog -p"
},
"devDependencies": {
"@graphprotocol/graph-cli": "^0.18.0",
"@graphprotocol/graph-ts": "^0.20.1",
"@types/chai": "^4.2.21",
"@graphprotocol/graph-cli": "^0.22.4",
"@graphprotocol/graph-ts": "^0.22.1",
"@types/chai": "^4.2.22",
"@types/chai-spies": "^1.0.3",
"@types/mocha": "^9.0.0",
"@typescript-eslint/eslint-plugin": "^4.29.1",
"@typescript-eslint/parser": "^4.29.0",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"auto-changelog": "^2.3.0",
"chai": "^4.3.4",
"chai-spies": "^1.0.0",
"eslint": "^7.32.0",
"eslint-config-oceanprotocol": "^1.5.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"mocha": "^9.0.3",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-standard": "^5.0.0",
"mocha": "^9.1.3",
"mock-local-storage": "^1.1.17",
"prettier": "^2.3.2",
"release-it": "^14.11.5",
"prettier": "^2.4.0",
"release-it": "^14.11.6",
"ts-node-register": "^1.0.0",
"typescript": "^4.3.5"
"typescript": "^4.4.3"
},
"dependencies": {
"@oceanprotocol/lib": "^0.17.1",
"@oceanprotocol/lib": "^0.19.2",
"cross-fetch": "^3.1.4"
},
"repository": {

@ -47,14 +47,22 @@ export function getOceanAddress(): string {
return '0xf6410bf5d773c7a41ebff972f38e7463fa242477'
if (network == 'gaiaxtestnet')
return '0x80e63f73cac60c1662f27d2dfd2ea834acddbaa8'
if (network == 'catenaxtestnet')
return '0x80e63f73cac60c1662f27d2dfd2ea834acddbaa8'
if (network == 'mumbai') return '0xd8992ed72c445c35cb4a2be468568ed1079357c8'
if (network == 'bsc') return '0xdce07662ca8ebc241316a15b611c89711414dd1a'
if (network == 'celoalfajores')
return '0xd8992ed72c445c35cb4a2be468568ed1079357c8'
if (network == 'energyweb')
return '0x593122aae80a6fc3183b2ac0c4ab3336debee528'
if (network == 'moonriver')
return '0x99c409e5f62e4bd2ac142f17cafb6810b8f0baae'
return '0x967da4048cd07ab37855c090aaf366e4ce1b9f48'
}
export const OCEAN: string = getOceanAddress()
export function getGlobalStats(): Global | null {
export function getGlobalStats(): Global {
let gStats: Global | null = Global.load('1')
if (gStats == null) {
gStats = new Global('1')
@ -69,30 +77,6 @@ export function getGlobalStats(): Global | null {
return gStats
}
export function _debuglog(
message: string,
event: ethereum.Event,
args: Array<string>
): void {
if (event != null) {
args.push(event.transaction.hash.toHex())
args.push(event.address.toHex())
}
for (let i = 0; i < args.length; i++) {
message = message.concat(' {}')
}
log.debug('@@@@@@ ' + message, args)
}
export function debuglog(
message: string,
event: ethereum.Event,
args: Array<string>
): void {
if (!ENABLE_DEBUG) return
_debuglog(message, event, args)
}
export function hexToDecimal(hexString: string, decimals: i32): BigDecimal {
const bytes = Bytes.fromHexString(hexString.toString()).reverse() as Bytes
const bi = BigInt.fromUnsignedBytes(bytes)
@ -188,53 +172,16 @@ export function updatePoolTokenBalance(
balance: BigDecimal,
source: string
): void {
debuglog(
'########## updating poolToken balance (source, oldBalance, newBalance, poolId) ',
null,
[source, poolToken.balance.toString(), balance.toString(), poolToken.poolId]
)
if (!poolToken) return
if (balance < ZERO_BD || poolToken.balance < ZERO_BD) {
log.warning(
'EEEEEEEEEEEEEEEEE poolToken.balance < Zero: pool={}, poolToken={}, oldBalance={}, newBalance={}',
[
poolToken.poolId,
poolToken.address.toString(),
poolToken.balance.toString(),
balance.toString()
]
)
poolToken.balance = balance
}
poolToken.balance = balance
}
export function updatePoolSwapVolume(
pool: Pool,
swapAmount: BigDecimal
// source: string
): void {
debuglog(
'########## updating poolToken balance (source, oldBalance, newBalance, poolId) ',
null,
[source, pool.totalSwapVolume.toString(), swapAmount.toString(), pool.id]
)
if (swapAmount < ZERO_BD || pool.totalSwapVolume < ZERO_BD) {
log.warning(
'EEEEEEEEEEEEEEEEE poolToken.balance < Zero: pool={}, poolToken={}, oldBalance={}, newBalance={}',
[
pool.id,
poolToken.tokenAddress.toString(),
poolToken.balance.toString(),
swapAmount.toString()
]
)
}
poolToken.swapBalanceOcean = poolToken.swapBalanceOcean.plus(swapAmount)
}
export function createUserEntity(address: string): void {
if (User.load(address) == null) {
const user = new User(address)
user.nrSales = 0
user.save()
}
}
@ -281,40 +228,39 @@ export function updatePoolTransactionToken(
balance: BigDecimal,
feeValue: BigDecimal
): void {
log.warning('WWWWWWWWWW ---- started update ptx with id {}', [poolTx])
log.warning('updatePoolTransactionToken({}, {} , {} , {} , {}}', [
poolTx,
poolTokenId,
amount.toString(),
balance.toString(),
feeValue.toString()
])
const ptx = PoolTransaction.load(poolTx)
const poolToken = PoolToken.load(poolTokenId)
const pool = PoolEntity.load(poolToken.poolId)
if (!ptx) {
log.error('Cannot load PoolTransaction {}', [poolTx])
return
}
if (!poolToken) {
log.error('Cannot load PoolToken {}', [poolTokenId])
return
}
const pool = PoolEntity.load(poolToken.poolId)
if (!pool) {
log.error('Cannot load PoolEntity {}', [poolToken.poolId])
return
}
const ptxTokenValuesId = poolTx.concat('-').concat(poolToken.tokenAddress)
const ptxTokenValuesId = poolTx.concat('-').concat(poolTokenId)
let ptxTokenValues = PoolTransactionTokenValues.load(ptxTokenValuesId)
if (ptxTokenValues == null) {
ptxTokenValues = new PoolTransactionTokenValues(ptxTokenValuesId)
log.warning('created PoolTransactionTokenValues for {}', [ptxTokenValuesId])
}
if (!ptxTokenValues) return
ptxTokenValues.txId = poolTx
ptxTokenValues.poolToken = poolTokenId
ptxTokenValues.poolAddress = poolToken.poolId
ptxTokenValues.userAddress = ptx.userAddress
ptxTokenValues.tokenAddress = PoolToken.load(poolTokenId).address
const ptxUserAddress = ptx.userAddress
ptxTokenValues.userAddress = ptxUserAddress ? ptxUserAddress : ''
const poolTokenAddress = poolToken.address
ptxTokenValues.tokenAddress = poolTokenAddress ? poolTokenAddress : ''
ptxTokenValues.value = amount
ptxTokenValues.tokenReserve = balance
@ -326,46 +272,30 @@ export function updatePoolTransactionToken(
}
ptxTokenValues.save()
log.warning('ptxTokenValues {} saved', [ptxTokenValues.id])
if (ptxTokenValues.tokenAddress == OCEAN) {
const factory = PoolFactory.load('1')
if (factory !== null) {
factory.totalOceanLiquidity = factory.totalOceanLiquidity
.plus(ptxTokenValues.tokenReserve)
.minus(pool.oceanReserve)
factory.totalOceanLiquidity = factory.totalOceanLiquidity
.plus(ptxTokenValues.tokenReserve)
.minus(pool.oceanReserve)
const gStats: Global = getGlobalStats()
if (gStats !== null) {
gStats.totalOceanLiquidity = factory.totalOceanLiquidity
const gStats: Global | null = getGlobalStats()
gStats.totalOceanLiquidity = factory.totalOceanLiquidity
gStats.save()
}
gStats.save()
if (factory.totalOceanLiquidity < ZERO_BD || pool.oceanReserve < ZERO_BD) {
log.warning(
'EEEEEEEEEEEEEEEEE totalOceanLiquidity or oceanReserve < Zero: pool={}, totOcnLiq={}, ocnRes={}',
[
pool.id,
factory.totalOceanLiquidity.toString(),
pool.oceanReserve.toString()
]
)
ptx.oceanReserve = ptxTokenValues.tokenReserve
pool.oceanReserve = ptxTokenValues.tokenReserve
factory.save()
}
ptx.oceanReserve = ptxTokenValues.tokenReserve
pool.oceanReserve = ptxTokenValues.tokenReserve
factory.save()
} else {
ptx.datatokenReserve = ptxTokenValues.tokenReserve
pool.datatokenReserve = ptxTokenValues.tokenReserve
}
// debuglog('########## updatePoolTransactionToken: ', null, [
// BigInt.fromI32(ptx.block).toString(),
// BigInt.fromI32(ptx.timestamp).toString(),
// ptxTokenValues.type,
// ptxTokenValues.value.toString(),
// ptxTokenValues.tokenReserve.toString(),
// poolToken.poolId
// ])
log.warning('saving ptx {} ', [ptx.id.toString()])
ptx.save()
log.warning('saving pool {} ', [pool.id.toString()])
pool.save()
}
@ -377,13 +307,6 @@ export function calcSpotPrice(
swapFee: BigDecimal
): BigDecimal {
if (balanceIn <= ZERO_BD || balanceOut <= ZERO_BD) return MINUS_1_BD
debuglog('################ calcSpotPrice', null, [
balanceIn.toString(),
wIn.toString(),
balanceOut.toString(),
wOut.toString(),
swapFee.toString()
])
const numer = balanceIn.div(wIn)
const denom = balanceOut.div(wOut)
@ -393,13 +316,6 @@ export function calcSpotPrice(
const scale = ONE_BD.div(ONE_BD.minus(swapFee))
const price = ratio.times(scale)
price.truncate(18)
debuglog('################ calcSpotPrice values:', null, [
numer.toString(),
denom.toString(),
ratio.toString(),
scale.toString(),
price.toString()
])
return price
}
@ -411,6 +327,7 @@ export function createPoolTransaction(
): void {
const poolId = event.address.toHex()
const pool = PoolEntity.load(poolId)
if (!pool) return
const ptx = event.transaction.hash.toHexString()
const ocnToken = PoolToken.load(poolId.concat('-').concat(OCEAN))
@ -440,24 +357,9 @@ export function createPoolTransaction(
// Initial reserve values, will be updated in `updatePoolTransactionToken`
poolTx.datatokenReserve = dtToken.balance
poolTx.oceanReserve = ocnToken.balance
debuglog('poolTX reserves:(dt, ocean)', null, [
poolTx.datatokenReserve.toString(),
poolTx.oceanReserve.toString()
])
const p = Pool.bind(Address.fromString(poolId))
debuglog(
'createPoolTransaction args sent to calcInGivenOut (ocnBalance, ocnWeight, dtBalance, dtWeight, dtAmount, swapFee)',
null,
[
decimalToBigInt(ocnToken.balance).toString(),
decimalToBigInt(ocnToken.denormWeight).toString(),
decimalToBigInt(dtToken.balance).toString(),
decimalToBigInt(dtToken.denormWeight).toString(),
ONE_BASE_18.toString(),
decimalToBigInt(pool.swapFee).toString()
]
)
const priceResult = p.try_calcInGivenOut(
decimalToBigInt(ocnToken.balance),
decimalToBigInt(ocnToken.denormWeight),
@ -466,13 +368,10 @@ export function createPoolTransaction(
ONE_BASE_18,
decimalToBigInt(pool.swapFee)
)
debuglog('got results', null, [])
poolTx.consumePrice = priceResult.reverted
? MINUS_1_BD
: bigIntToDecimal(priceResult.value, 18)
debuglog('calcInGivenOut:', null, [
priceResult.reverted ? 'failed' : priceResult.value.toString()
])
const priceSpot = p.try_calcSpotPrice(
decimalToBigInt(ocnToken.balance),
@ -484,9 +383,6 @@ export function createPoolTransaction(
poolTx.spotPrice = priceSpot.reverted
? ZERO_BD
: bigIntToDecimal(priceSpot.value, 18)
debuglog('SpotPrice:', null, [
priceSpot.reverted ? 'failed' : priceSpot.value.toString()
])
pool.consumePrice = poolTx.consumePrice
pool.spotPrice = poolTx.spotPrice
@ -496,65 +392,41 @@ export function createPoolTransaction(
poolTx.datatokenReserve.times(spotPrice)
)
const factory = PoolFactory.load('1')
if (oldValueLocked < ZERO_BD || pool.valueLocked < ZERO_BD) {
log.warning(
'EEEEEEEEEEEEEEEEE valueLocked < Zero: pool={}, oldVL={}, newVL={}, OCEAN={}, DT={}, spotPrice={}',
[
pool.id,
oldValueLocked.toString(),
pool.valueLocked.toString(),
poolTx.oceanReserve.toString(),
poolTx.datatokenReserve.toString(),
pool.spotPrice.toString()
]
)
}
factory.totalValueLocked = factory.totalValueLocked
.minus(oldValueLocked)
.plus(pool.valueLocked)
if (!factory) return
if (factory.totalValueLocked !== null) {
const tvl = factory.totalValueLocked
const gStats: Global | null = getGlobalStats()
factory.totalValueLocked = tvl
? tvl.minus(oldValueLocked).plus(pool.valueLocked)
: BigDecimal.fromString('0')
}
gStats.totalValueLocked = factory.totalValueLocked
gStats.save()
const gStats: Global = getGlobalStats()
if (gStats !== null) {
gStats.totalValueLocked = factory.totalValueLocked
gStats.save()
}
pool.transactionCount = pool.transactionCount.plus(BigInt.fromI32(1))
pool.save()
factory.save()
debuglog(
'updated pool reserves (source, dtBalance, ocnBalance, dtReserve, ocnReserve): ',
event,
[
'createPoolTransaction',
dtToken.balance.toString(),
ocnToken.balance.toString(),
pool.datatokenReserve.toString(),
pool.oceanReserve.toString()
]
)
poolTx.tx = event.transaction.hash
// eslint-disable-next-line camelcase
poolTx.event = event_type
poolTx.block = event.block.number.toI32()
poolTx.timestamp = event.block.timestamp.toI32()
poolTx.gasUsed = event.transaction.gasUsed.toBigDecimal()
// Property 'gasUsed' does not exist on type '~lib/@graphprotocol/graph-ts/chain/ethereum/ethereum.Transaction'
// poolTx.gasUsed = event.transaction.gasUsed.toBigDecimal()
poolTx.gasPrice = event.transaction.gasPrice.toBigDecimal()
debuglog('####################### poolTransaction: ', event, [
ptx,
BigInt.fromI32(poolTx.block).toString(),
BigInt.fromI32(poolTx.timestamp).toString(),
pool.oceanReserve.toString()
])
poolTx.save()
}
export function decrPoolCount(finalized: boolean): void {
const factory = PoolFactory.load('1')
if (!factory) return
factory.poolCount -= 1
if (finalized) factory.finalizedPoolCount -= 1
factory.save()
@ -576,7 +448,7 @@ export function saveTokenTransaction(
transaction.event = eventName
transaction.datatokenAddress = event.address.toHex()
transaction.userAddress = userAddress
transaction.gasUsed = event.transaction.gasUsed.toBigDecimal()
// transaction.gasUsed = event.transaction.gasUsed.toBigDecimal()
transaction.gasPrice = event.transaction.gasPrice.toBigDecimal()
transaction.tx = event.transaction.hash
transaction.timestamp = event.block.timestamp.toI32()

@ -6,7 +6,8 @@ import {
Global,
PoolFactory,
TokenBalance,
TokenOrder
TokenOrder,
User
} from '../@types/schema'
import {
tokenToDecimal,
@ -40,6 +41,7 @@ export function handleTransfer(event: Transfer): void {
const isBurn = tokenShareTo == ZERO_ADDRESS
const datatoken = Datatoken.load(tokenId)
if (!datatoken) return
if (isMint) {
tokenBalanceTo = TokenBalance.load(tokenBalanceToId)
@ -99,7 +101,7 @@ export function handleOrderStarted(event: OrderStarted): void {
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
const tokenId = event.address.toHex()
const datatoken = Datatoken.load(tokenId)
if (datatoken == null) return
if (!datatoken) return
const payer = event.params.payer.toHex()
// let feeCollector = event.params.mrktFeeCollector
@ -114,6 +116,7 @@ export function handleOrderStarted(event: OrderStarted): void {
if (order == null) {
order = new TokenOrder(orderId)
}
if (!order) return
order.datatokenId = tokenId
order.amount = tokenToDecimal(event.params.amount.toBigDecimal(), 18)
order.consumer = event.params.consumer.toHex()
@ -121,8 +124,8 @@ export function handleOrderStarted(event: OrderStarted): void {
order.serviceId = event.params.serviceId.toI32()
order.timestamp = event.params.timestamp.toI32()
if (
event.params.mrktFeeCollector != null &&
event.params.mrktFeeCollector.toHex() != ZERO_ADDRESS
event.params.mrktFeeCollector !== null &&
event.params.mrktFeeCollector.toHex() !== ZERO_ADDRESS
) {
order.marketFeeCollector = event.params.mrktFeeCollector.toHexString()
}
@ -132,8 +135,15 @@ export function handleOrderStarted(event: OrderStarted): void {
order.save()
datatoken.orderVolume = datatoken.orderVolume.plus(order.amount)
datatoken.orderCount = datatoken.orderCount.plus(BigInt.fromI32(1))
const orderVolume = datatoken.orderVolume
datatoken.orderVolume = orderVolume
? orderVolume.plus(order.amount)
: BigDecimal.fromString('0')
const orderCount = datatoken.orderCount
datatoken.orderCount = orderCount
? orderCount.plus(BigInt.fromI32(1))
: BigInt.fromI32(0)
datatoken.save()
@ -151,12 +161,28 @@ export function handleOrderStarted(event: OrderStarted): void {
factory.poolCount = 0
factory.finalizedPoolCount = 0
}
if (factory !== null) {
const orderCount = factory.orderCount
factory.orderCount = orderCount
? orderCount.plus(BigInt.fromI32(1))
: BigInt.fromI32(0)
const totalOrderValue = factory.totalOrderVolume
factory.totalOrderVolume = totalOrderValue
? totalOrderValue.plus(order.amount)
: BigDecimal.fromString('0')
factory.save()
}
factory.orderCount = factory.orderCount.plus(BigInt.fromI32(1))
factory.totalOrderVolume = factory.totalOrderVolume.plus(order.amount)
factory.save()
const gStats: Global | null = getGlobalStats()
gStats.orderCount = factory.orderCount
gStats.totalOrderVolume = factory.totalOrderVolume
gStats.save()
const user = User.load(datatoken.minter)
if (user !== null) {
user.nrSales = user.nrSales + 1
user.save()
}
const gStats: Global = getGlobalStats()
if (gStats !== null) {
gStats.orderCount = factory.orderCount
gStats.totalOrderVolume = factory.totalOrderVolume
gStats.save()
}
}

@ -16,32 +16,25 @@ import {
Datatoken
} from '../@types/schema'
import { tokenToDecimal, _debuglog } from '../helpers'
import { tokenToDecimal } from '../helpers'
function _processDispenserUpdate(
event: ethereum.Event,
datatoken: string,
contractAddress: Address
): void {
_debuglog('Start processDispenserUpdate', null, [
datatoken,
contractAddress.toHexString()
])
const dt = Datatoken.load(datatoken)
if (!dt) {
return
}
let dispenser = Dispenser.load(datatoken)
if (!dispenser) {
_debuglog('Creating new dispenser', null, null)
dispenser = new Dispenser(datatoken)
}
const dispenserEntity = DispenserEntity.bind(contractAddress)
_debuglog('Bound dispenser entity', null, null)
const dispenserStatus = dispenserEntity.try_status(
Address.fromString(datatoken)
)
_debuglog('Got status', null, null)
if (dispenserStatus.reverted) return
dispenser.active = dispenserStatus.value.value0
let owner = User.load(dispenserStatus.value.value1.toHexString())
@ -69,9 +62,6 @@ function _processDispenserUpdate(
}
export function handleDispenserActivated(event: Activated): void {
_debuglog('Start handleDispenserActivated', event, [
event.params.datatokenAddress.toHexString()
])
_processDispenserUpdate(
event,
event.params.datatokenAddress.toHexString(),

@ -61,8 +61,11 @@ export function handleNewPool(event: BPoolRegistered): void {
factory.poolCount = factory.poolCount + 1
factory.save()
const gStats: Global | null = getGlobalStats()
gStats.poolCount = factory.poolCount
gStats.save()
if (gStats) {
gStats.poolCount = factory.poolCount
gStats.save()
}
PoolContract.create(event.params.bpoolAddress)
}

@ -50,17 +50,19 @@ function _processActiveUpdated(
const freupdate = new FixedRateExchangeUpdate(id)
freupdate.exchangeId = exchangeId
freupdate.oldRate = fixedrateexchange.rate
freupdate.newRate = fixedrateexchange.rate
freupdate.oldActive = fixedrateexchange.active
if (fixedrateexchange) {
freupdate.oldRate = fixedrateexchange.rate
freupdate.newRate = fixedrateexchange.rate
freupdate.oldActive = fixedrateexchange.active
fixedrateexchange.active = active
fixedrateexchange.save()
}
freupdate.newActive = active
freupdate.block = event.block.number.toI32()
freupdate.timestamp = event.block.timestamp.toI32()
freupdate.tx = tx
freupdate.save()
fixedrateexchange.active = active
fixedrateexchange.save()
}
export function handleExchangeActivated(event: ExchangeActivated): void {

@ -28,7 +28,6 @@ import {
updatePoolTransactionToken,
createPoolTransaction,
OCEAN,
debuglog,
updatePoolTokenBalance,
getOceanAddress,
getGlobalStats,
@ -41,20 +40,22 @@ import {
export function handleSetSwapFee(
event: LOG_CALL,
swapFeeStr: string = null
swapFeeStr: string | null = null
): void {
const poolId = event.address.toHex()
const pool = Pool.load(poolId)
if (!pool) return
if (!swapFeeStr) {
swapFeeStr = event.params.data.toHexString().slice(-40)
}
pool.swapFee = hexToDecimal(swapFeeStr, 18)
if (swapFeeStr !== null) pool.swapFee = hexToDecimal(swapFeeStr, 18)
pool.save()
}
export function handleSetController(event: LOG_CALL): void {
const poolId = event.address.toHex()
const pool = Pool.load(poolId)
if (!pool) return
pool.controller = Address.fromString(
event.params.data.toHexString().slice(-40)
)
@ -64,6 +65,7 @@ export function handleSetController(event: LOG_CALL): void {
export function handleSetPublicSwap(event: LOG_CALL): void {
const poolId = event.address.toHex()
const pool = Pool.load(poolId)
if (!pool) return
pool.publicSwap = event.params.data.toHexString().slice(-1) == '1'
pool.save()
}
@ -71,7 +73,7 @@ export function handleSetPublicSwap(event: LOG_CALL): void {
export function handleFinalize(event: LOG_CALL): void {
const poolId = event.address.toHex()
const pool = Pool.load(poolId)
if (pool === null) {
if (!pool) {
log.error('Cannot handle finalize for unknown pool {} ', [poolId])
return
}
@ -87,6 +89,7 @@ export function handleFinalize(event: LOG_CALL): void {
pool.save()
const factory = PoolFactory.load('1')
if (!factory) return
factory.finalizedPoolCount = factory.finalizedPoolCount + 1
factory.save()
}
@ -99,6 +102,7 @@ export function _handleRebind(
denormWeightStr: string
): void {
const pool = Pool.load(poolId)
if (!pool) return
const decimals = BigInt.fromI32(18).toI32()
if (tokenAddress != OCEAN) {
@ -121,8 +125,9 @@ export function _handleRebind(
pool.totalWeight = pool.totalWeight.minus(oldWeight).minus(denormWeight)
}
}
poolToken.denormWeight = denormWeight
if (!poolToken) return
poolToken.denormWeight =
denormWeight !== null ? denormWeight : BigDecimal.fromString('0')
const balance = hexToDecimal(balanceStr, decimals)
updatePoolTokenBalance(poolToken as PoolToken, balance, '_handleRebind')
@ -151,7 +156,6 @@ export function handleSetup(event: LOG_CALL): void {
}
const poolId = event.address.toHex()
debuglog('handleSetup: ', event, [])
const data = event.params.data.toHexString()
// First 2 chars are 0x
// Next there is 8 chars
@ -178,7 +182,7 @@ export function handleSetup(event: LOG_CALL): void {
}
const poolTokenId = poolId.concat('-').concat(baseTokenAddress)
const poolToken = PoolToken.load(poolTokenId)
if (poolToken != null) return
if (!poolToken) return
_handleRebind(
event,
@ -201,22 +205,31 @@ export function handleSetup(event: LOG_CALL): void {
// update base token
let amount = hexToDecimal(baseTokenAmount, 18)
const poolTokenBalance = poolToken.balance
const balance = poolTokenBalance
? poolTokenBalance
: BigDecimal.fromString('0')
updatePoolTransactionToken(
event.transaction.hash.toHexString(),
poolTokenId,
amount,
PoolToken.load(poolTokenId).balance,
balance,
ZERO_BD
)
// update the datatoken
amount = hexToDecimal(dataTokenAmount, 18)
updatePoolTransactionToken(
event.transaction.hash.toHexString(),
poolId.concat('-').concat(dataTokenAddress),
amount,
PoolToken.load(poolId.concat('-').concat(dataTokenAddress)).balance,
ZERO_BD
const poolDataToken = PoolToken.load(
poolId.concat('-').concat(dataTokenAddress)
)
if (poolDataToken !== null) {
amount = hexToDecimal(dataTokenAmount, 18)
updatePoolTransactionToken(
event.transaction.hash.toHexString(),
poolId.concat('-').concat(dataTokenAddress),
amount,
poolDataToken.balance,
ZERO_BD
)
}
}
/************************************
@ -225,39 +238,24 @@ export function handleSetup(event: LOG_CALL): void {
export function handleJoinPool(event: LOG_JOIN): void {
const poolId = event.address.toHex()
const address = event.params.tokenIn.toHex()
const ptx = event.transaction.hash.toHexString()
const poolTokenId = poolId.concat('-').concat(address)
const poolToken = PoolToken.load(poolTokenId)
const pool = Pool.load(poolId)
const datatoken = Datatoken.load(poolTokenId)
const poolTx = PoolTransaction.load(ptx)
if (poolTx !== null) return
if (!pool || !poolToken || !datatoken) return
if (pool.finalized == false) {
return
}
pool.joinCount = pool.joinCount.plus(BigInt.fromI32(1))
pool.save()
const ptx = event.transaction.hash.toHexString()
const poolTx = PoolTransaction.load(ptx)
if (poolTx != null) {
debuglog(
'!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! JOIN JOIN JOIN !!!!!!!!!!!! PoolTransaction EXISTS: ',
event,
[]
)
return
}
const address = event.params.tokenIn.toHex()
const poolTokenId = poolId.concat('-').concat(address)
const poolToken = PoolToken.load(poolTokenId)
if (poolToken == null) {
debuglog(
'!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! JOIN JOIN JOIN !!!!!!!!!!!! NO PoolToken: ',
event,
[address, poolTokenId]
)
return
}
const datatoken: Datatoken | null =
poolToken.tokenId != null ? Datatoken.load(poolToken.tokenId) : null
const decimals =
datatoken == null ? BigInt.fromI32(18).toI32() : datatoken.decimals
const tokenAmountIn = tokenToDecimal(
@ -269,11 +267,6 @@ export function handleJoinPool(event: LOG_JOIN): void {
poolToken.balance.plus(tokenAmountIn),
'handleJoinPool'
)
debuglog(
'!!!!!!!!!!!!!!!!!! JOIN JOIN JOIN : (token, amountIn, amountIn) ',
event,
[address, tokenAmountIn.toString(), event.params.tokenAmountIn.toString()]
)
poolToken.save()
createPoolTransaction(event, 'join', event.params.caller.toHexString())
@ -291,18 +284,13 @@ export function handleExitPool(event: LOG_EXIT): void {
const address = event.params.tokenOut.toHex()
const poolTokenId = poolId.concat('-').concat(address.toString())
const pool = Pool.load(poolId)
const poolToken = PoolToken.load(poolTokenId)
if (!poolToken) {
debuglog(
'!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! EXIT EXIT EXIT !!!!!!!!!!!! NO PoolToken: ',
event,
[address, poolTokenId]
)
const datatoken = Datatoken.load(poolTokenId)
if (!poolToken || !pool || !datatoken) {
return
}
const datatoken: Datatoken | null =
poolToken.tokenId != null ? Datatoken.load(poolToken.tokenId) : null
const decimals =
datatoken == null ? BigInt.fromI32(18).toI32() : datatoken.decimals
const tokenAmountOut = tokenToDecimal(
@ -312,12 +300,7 @@ export function handleExitPool(event: LOG_EXIT): void {
const newAmount = poolToken.balance.minus(tokenAmountOut)
updatePoolTokenBalance(poolToken as PoolToken, newAmount, 'handleExitPool')
poolToken.save()
debuglog(
'!!!!!!!!!!!!!!!!!! EXIT EXIT EXIT : (token, amountOut, amountOut)',
event,
[address, tokenAmountOut.toString(), event.params.tokenAmountOut.toString()]
)
const pool = Pool.load(poolId)
pool.exitCount = pool.exitCount.plus(BigInt.fromI32(1))
if (newAmount.equals(ZERO_BD)) {
decrPoolCount(pool.finalized)
@ -347,11 +330,6 @@ export function handleSwap(event: LOG_SWAP): void {
const poolTokenInId = poolId.concat('-').concat(tokenIn.toString())
const poolTokenIn = PoolToken.load(poolTokenInId)
if (!poolTokenIn) {
debuglog(
'!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!! SWAP SWAP SWAP !!!!!!!!!!!! NO PoolToken: ',
event,
[tokenIn, poolTokenInId]
)
return
}
const dtIn = Datatoken.load(tokenIn)
@ -370,7 +348,11 @@ export function handleSwap(event: LOG_SWAP): void {
const tokenOut = event.params.tokenOut.toHex()
const poolTokenOutId = poolId.concat('-').concat(tokenOut.toString())
const poolTokenOut = PoolToken.load(poolTokenOutId)
const pool = Pool.load(poolId)
const factory = PoolFactory.load('1')
const dtOut = Datatoken.load(tokenOut)
if (!poolTokenOut || !dtOut || !factory || !pool) return
const tokenAmountOut = tokenToDecimal(
event.params.tokenAmountOut.toBigDecimal(),
dtOut == null ? 18 : dtOut.decimals
@ -382,20 +364,6 @@ export function handleSwap(event: LOG_SWAP): void {
'handleSwap.tokenOut'
)
poolTokenOut.save()
debuglog(
'!!!!!!!!!!!!!!!!!! SWAP SWAP SWAP : (tokenIn, tokenOut, amountIn, amountIn, amountOut, amountOut)',
event,
[
tokenIn,
tokenOut,
tokenAmountIn.toString(),
event.params.tokenAmountIn.toString(),
tokenAmountOut.toString(),
event.params.tokenAmountOut.toString()
]
)
const pool = Pool.load(poolId)
const factory = PoolFactory.load('1')
pool.swapCount = pool.swapCount.plus(BigInt.fromI32(1))
if (newAmountIn.equals(ZERO_BD) || newAmountOut.equals(ZERO_BD)) {
@ -412,10 +380,11 @@ export function handleSwap(event: LOG_SWAP): void {
factory.save()
pool.save()
const gStats: Global | null = getGlobalStats()
gStats.totalSwapVolume = factory.totalSwapVolume
gStats.save()
const gStats: Global = getGlobalStats()
if (gStats !== null) {
gStats.totalSwapVolume = factory.totalSwapVolume
gStats.save()
}
createPoolTransaction(event, 'swap', event.params.caller.toHexString())
updatePoolTransactionToken(
@ -448,96 +417,69 @@ export function handleTransfer(event: Transfer): void {
const poolShareFromId = poolId.concat('-').concat(event.params.from.toHex())
let poolShareFrom = PoolShare.load(poolShareFromId)
const poolShareFromBalance =
poolShareFrom == null ? ZERO_BD : poolShareFrom.balance
const poolShareToId = poolId.concat('-').concat(event.params.to.toHex())
let poolShareTo = PoolShare.load(poolShareToId)
const poolShareToBalance = poolShareTo == null ? ZERO_BD : poolShareTo.balance
const pool = Pool.load(poolId)
if (!pool) return
const poolTx = PoolTransaction.load(event.transaction.hash.toHexString())
const value = tokenToDecimal(event.params.value.toBigDecimal(), 18)
debuglog('poolShare Transfer event: (from, to, value)', event, [
event.params.from.toHex(),
event.params.to.toHex(),
value.toString()
])
if (isMint) {
if (poolShareTo == null) {
createPoolShareEntity(poolShareToId, poolId, event.params.to.toHex())
poolShareTo = PoolShare.load(poolShareToId)
}
poolShareTo.balance = poolShareTo.balance.plus(value)
poolShareTo.save()
if (poolShareTo !== null) {
poolShareTo.balance = poolShareTo.balance.plus(value)
poolShareTo.save()
}
pool.totalShares = pool.totalShares.plus(value)
if (poolTx != null) {
poolTx.sharesTransferAmount = value
poolTx.sharesBalance = poolShareTo.balance
if (poolShareTo !== null) poolTx.sharesBalance = poolShareTo.balance
}
debuglog(
'pool shares mint: (id, value, totalShares, shareToBalance, toAddress)',
event,
[
poolId,
value.toString(),
pool.totalShares.toString(),
poolShareTo.balance.toString(),
poolShareTo.userAddress
]
)
} else if (isBurn) {
if (poolShareFrom == null) {
createPoolShareEntity(poolShareFromId, poolId, event.params.from.toHex())
poolShareFrom = PoolShare.load(poolShareFromId)
}
poolShareFrom.balance = poolShareFrom.balance.minus(value)
poolShareFrom.save()
pool.totalShares = pool.totalShares.minus(value)
if (poolTx != null) {
if (poolTx !== null) {
poolTx.sharesTransferAmount = poolTx.sharesTransferAmount.minus(value)
}
if (poolTx !== null && poolShareFrom !== null) {
poolTx.sharesBalance = poolShareFrom.balance
}
debuglog(
'pool shares burn: (id, value, totalShares, shareFromBalance, fromAddress)',
event,
[
poolId,
value.toString(),
pool.totalShares.toString(),
poolShareFrom.balance.toString(),
poolShareFrom.userAddress
]
)
if (poolShareFrom !== null) {
poolShareFrom.balance = poolShareFrom.balance.minus(value)
poolShareFrom.save()
}
} else {
if (poolShareTo == null) {
createPoolShareEntity(poolShareToId, poolId, event.params.to.toHex())
poolShareTo = PoolShare.load(poolShareToId)
}
poolShareTo.balance = poolShareTo.balance.plus(value)
poolShareTo.save()
if (poolShareTo !== null) {
poolShareTo.balance = poolShareTo.balance.plus(value)
poolShareTo.save()
}
if (poolShareFrom == null) {
createPoolShareEntity(poolShareFromId, poolId, event.params.from.toHex())
poolShareFrom = PoolShare.load(poolShareFromId)
}
poolShareFrom.balance = poolShareFrom.balance.minus(value)
poolShareFrom.save()
debuglog(
'pool shares transfer: ' +
'(id, value, totalShares, shareToBalance, shareFromBalance, toAddress, fromAddress)',
event,
[
poolId,
value.toString(),
pool.totalShares.toString(),
poolShareTo.balance.toString(),
poolShareFrom.balance.toString(),
poolShareTo.userAddress,
poolShareFrom.userAddress
]
)
if (poolShareFrom !== null) {
poolShareFrom.balance = poolShareFrom.balance.minus(value)
poolShareFrom.save()
}
}
if (
@ -549,14 +491,14 @@ export function handleTransfer(event: Transfer): void {
}
if (
poolShareFrom != null &&
poolShareFrom !== null &&
poolShareFrom.balance.equals(ZERO_BD) &&
poolShareFromBalance.notEqual(ZERO_BD)
poolShareFrom.balance.notEqual(ZERO_BD)
) {
pool.holderCount = pool.holderCount.plus(BigInt.fromI32(1))
}
if (poolTx != null) {
if (poolTx !== null) {
poolTx.save()
}
@ -580,11 +522,11 @@ export function handleGulp(event: LOG_CALL): void {
const dtToken = PoolToken.load(
poolId.concat('-').concat(pool.datatokenAddress)
)
const ocnTokenBalance = ocnToken.balance
const dtTokenBalance = dtToken.balance
// get the balances from the contract
// for ocean
if (ocnToken) {
const ocnTokenBalance = ocnToken.balance
const balanceAttempt = poolEbtity.try_getBalance(Address.fromString(OCEAN))
if (!balanceAttempt.reverted) {
const contractBalance = bigIntToDecimal(balanceAttempt.value, 18)