Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add in GhoTokenService for totalSupply & facilitator info #444

Merged
merged 3 commits into from
Nov 2, 2022

Conversation

drewcook
Copy link
Contributor

@drewcook drewcook commented Nov 2, 2022

General Changes

  • Adds in new GhoTokenService class to work with the functions on the native GHO token
  • Adds in a method to getFacilitatorBucket which returns an instance of a given GHO facilitator's bucket, which includes maxCapacity and level (the current level)
  • Adds in totalSupply, getFacilitiatorsList, and getFacilitator utilities as well as their unit tests
  • Adds in typechain files
  • Adds in proper unit tests

@drewcook drewcook changed the title feat: add in GhoTokenService feat: add in GhoTokenService for getting a facilitator's bucket Nov 2, 2022
@drewcook drewcook changed the base branch from master to feat/gho-base November 2, 2022 04:56
@github-actions
Copy link

github-actions bot commented Nov 2, 2022

🎉 Canary Release
To install use
npm install @aave/math-utils@1.9.1-1cc086c8b76fa6264599d10d8a5fbb9702dc6436.0+d64a665
npm install @aave/contract-helpers@1.9.1-1cc086c8b76fa6264599d10d8a5fbb9702dc6436.0+d64a665

@drewcook
Copy link
Contributor Author

drewcook commented Nov 2, 2022

Do we want to add in some more methods while we have this set up? They would be fairly straightforward to add in, and they are other methods on the GhoToken.sol contract that I think we may want to have access to for the client UI at some point. These would be:

  • getFacilitator - the full facilitator object, which includes a label field and the bucket object
  • getFacilitatorsList - the list of all facilitators of the native GHO token
  • totalSupply - the total supply of minted GHO, which is a combination of all the facilitators' current levels

@grothem
Copy link
Contributor

grothem commented Nov 2, 2022

If it's straightforward to add them in I'd say go ahead. Then it's there to use in this package when/if we need that data.

@drewcook drewcook changed the title feat: add in GhoTokenService for getting a facilitator's bucket feat: add in GhoTokenService for facilitators info and totalSupply Nov 2, 2022
@drewcook drewcook changed the title feat: add in GhoTokenService for facilitators info and totalSupply feat: add in GhoTokenService for totalSupply & facilitator info Nov 2, 2022
@grothem grothem merged commit b727e9c into feat/gho-base Nov 2, 2022
@grothem grothem deleted the feat/gho-facilitator-bucket-levels branch November 2, 2022 18:27
grothem pushed a commit that referenced this pull request Dec 21, 2022
* feat: add in GhoTokenService and getFacilitatorBucket

* fix: typo

* feat: add in more utils for GhoTokenService
defispartan added a commit that referenced this pull request Dec 23, 2022
* feat: add in GhoDiscountRateStrategyService (#443)

* feat: add in typechain and setup base GhoDiscountRateService

* chore: add in type definition files

* chore: add in basic calculateDiscountRate function and unit test

* fix: skip unit test for now

* fix: allow to commit to repo and bypass jest coverage limit

* chore: write utility for calculating discount rate

* fix: write unit tests for all use cases for discount rates

* fix: write unit test for barrel file

* chore: jest config and export gho service

* fix: use zero values and mock return calls

* fix: test coverage and mocks

* chore: remove unnecessary coverage skips

* feat: add in GhoTokenService for totalSupply & facilitator info (#444)

* feat: add in GhoTokenService and getFacilitatorBucket

* fix: typo

* feat: add in more utils for GhoTokenService

* feat: add in GhoVariableDebtTokenService & getters for debt strategy constants (#446)

* chore: move existing test files to __tests__ dir

* chore: add in typechain types

* feat: add in GhoVariableDebtTokenService with methods and tests

* feat: add in getters and tests for GhoDiscountRateStrategy constants

* chore: update discount rate strategy source (#447)

* feat: add getDiscountRateStrategy to ghoVariableDebtTokenService

* feat: use ghoVariableDebtToken as source of discount strategy address

* feat: add test for discountRateStrategy update

* feat: add function for getting reserve data from lending pool (#451)

* feat: add function for getting reserve data from lending pool

* test: getReserveData

* chore: export compounded rate helper

* chore: use compounded rate helper in formatReserves

* fix: add in plumbing for exporting calc compound rate

* chore: remove duplicated function and update refs

* feat: add fetchGhoData wrapper service

* feat: add formatGhoData utility function

* chore: re-add exports

* fix: discountLockPeriod decimal formatting

* feat: export gho formatter

* feat: facilitator percentage minted

* chore: swap string to number in gho formatter

* chore: use object destructuring for facilitatorInfo

* chore: rename fields and add userGhoBorrowBalance

* fix: facilitatorAddress parameter

* fix: facilitator info typo

* chore: remove userGhoBorrowBalance from service and formatter

* chore: split user and reserve services and add fields for user borrow balance

* chore: split user and reserve formatters

* fix: use correct service for scaledBalance and previousIndex

* chore: export discounted gho interest to factor into total borrows

* feat: add Ui helper contract typechain

* feat: use helper contract in GhoService

* chore: purge unused gho services

* feat: helper function to account for gho discount in user summary

* feat: update discount summary helper and add tests

* chore: remove old comment

Co-authored-by: Drew Cook <drew@dco.dev>
Co-authored-by: Mark Grothe <grothem@gmail.com>
grothem added a commit that referenced this pull request Jul 14, 2023
* feat: add in GhoDiscountRateStrategyService (#443)

* feat: add in typechain and setup base GhoDiscountRateService

* chore: add in type definition files

* chore: add in basic calculateDiscountRate function and unit test

* fix: skip unit test for now

* fix: allow to commit to repo and bypass jest coverage limit

* chore: write utility for calculating discount rate

* fix: write unit tests for all use cases for discount rates

* fix: write unit test for barrel file

* chore: jest config and export gho service

* fix: use zero values and mock return calls

* fix: test coverage and mocks

* chore: remove unnecessary coverage skips

* feat: add in GhoTokenService for totalSupply & facilitator info (#444)

* feat: add in GhoTokenService and getFacilitatorBucket

* fix: typo

* feat: add in more utils for GhoTokenService

* feat: add in GhoVariableDebtTokenService & getters for debt strategy constants (#446)

* chore: move existing test files to __tests__ dir

* chore: add in typechain types

* feat: add in GhoVariableDebtTokenService with methods and tests

* feat: add in getters and tests for GhoDiscountRateStrategy constants

* chore: update discount rate strategy source (#447)

* feat: add getDiscountRateStrategy to ghoVariableDebtTokenService

* feat: use ghoVariableDebtToken as source of discount strategy address

* feat: add test for discountRateStrategy update

* feat: add function for getting reserve data from lending pool (#451)

* feat: add function for getting reserve data from lending pool

* test: getReserveData

* feat: add in GhoDiscountRateStrategyService (#443)

* feat: add in typechain and setup base GhoDiscountRateService

* chore: add in type definition files

* chore: add in basic calculateDiscountRate function and unit test

* fix: skip unit test for now

* fix: allow to commit to repo and bypass jest coverage limit

* chore: write utility for calculating discount rate

* fix: write unit tests for all use cases for discount rates

* fix: write unit test for barrel file

* chore: jest config and export gho service

* fix: use zero values and mock return calls

* fix: test coverage and mocks

* chore: remove unnecessary coverage skips

* feat: add in GhoTokenService for totalSupply & facilitator info (#444)

* feat: add in GhoTokenService and getFacilitatorBucket

* fix: typo

* feat: add in more utils for GhoTokenService

* feat: add in GhoVariableDebtTokenService & getters for debt strategy constants (#446)

* chore: move existing test files to __tests__ dir

* chore: add in typechain types

* feat: add in GhoVariableDebtTokenService with methods and tests

* feat: add in getters and tests for GhoDiscountRateStrategy constants

* chore: update discount rate strategy source (#447)

* feat: add getDiscountRateStrategy to ghoVariableDebtTokenService

* feat: use ghoVariableDebtToken as source of discount strategy address

* feat: add test for discountRateStrategy update

* feat: add function for getting reserve data from lending pool (#451)

* feat: add function for getting reserve data from lending pool

* test: getReserveData

* chore: sync gho base with upstream (#472)

* feat: add default gas estimation for permit actions (#461)

* chore(release): publish [ci skip]

 - @aave/contract-helpers@1.10.0
 - @aave/math-utils@1.10.0

Co-authored-by: DeFi Spartan <andrew@aave.com>
Co-authored-by: GitHub Actions Build <developers@aave.com>

* chore/export compounding rate helper (#462)

* chore: export compounded rate helper

* chore: use compounded rate helper in formatReserves

* fix: add in plumbing for exporting calc compound rate

* chore: remove duplicated function and update refs

Co-authored-by: Drew Cook <drew@dco.dev>

* fix: build error

* feat: gho sdk (#466)

* feat: add in GhoDiscountRateStrategyService (#443)

* feat: add in typechain and setup base GhoDiscountRateService

* chore: add in type definition files

* chore: add in basic calculateDiscountRate function and unit test

* fix: skip unit test for now

* fix: allow to commit to repo and bypass jest coverage limit

* chore: write utility for calculating discount rate

* fix: write unit tests for all use cases for discount rates

* fix: write unit test for barrel file

* chore: jest config and export gho service

* fix: use zero values and mock return calls

* fix: test coverage and mocks

* chore: remove unnecessary coverage skips

* feat: add in GhoTokenService for totalSupply & facilitator info (#444)

* feat: add in GhoTokenService and getFacilitatorBucket

* fix: typo

* feat: add in more utils for GhoTokenService

* feat: add in GhoVariableDebtTokenService & getters for debt strategy constants (#446)

* chore: move existing test files to __tests__ dir

* chore: add in typechain types

* feat: add in GhoVariableDebtTokenService with methods and tests

* feat: add in getters and tests for GhoDiscountRateStrategy constants

* chore: update discount rate strategy source (#447)

* feat: add getDiscountRateStrategy to ghoVariableDebtTokenService

* feat: use ghoVariableDebtToken as source of discount strategy address

* feat: add test for discountRateStrategy update

* feat: add function for getting reserve data from lending pool (#451)

* feat: add function for getting reserve data from lending pool

* test: getReserveData

* chore: export compounded rate helper

* chore: use compounded rate helper in formatReserves

* fix: add in plumbing for exporting calc compound rate

* chore: remove duplicated function and update refs

* feat: add fetchGhoData wrapper service

* feat: add formatGhoData utility function

* chore: re-add exports

* fix: discountLockPeriod decimal formatting

* feat: export gho formatter

* feat: facilitator percentage minted

* chore: swap string to number in gho formatter

* chore: use object destructuring for facilitatorInfo

* chore: rename fields and add userGhoBorrowBalance

* fix: facilitatorAddress parameter

* fix: facilitator info typo

* chore: remove userGhoBorrowBalance from service and formatter

* chore: split user and reserve services and add fields for user borrow balance

* chore: split user and reserve formatters

* fix: use correct service for scaledBalance and previousIndex

* chore: export discounted gho interest to factor into total borrows

* feat: add Ui helper contract typechain

* feat: use helper contract in GhoService

* chore: purge unused gho services

* feat: helper function to account for gho discount in user summary

* feat: update discount summary helper and add tests

* chore: remove old comment

Co-authored-by: Drew Cook <drew@dco.dev>
Co-authored-by: Mark Grothe <grothem@gmail.com>

* chore: cleanup

* chore: update staking permit (#485)

* feat: fetch nonce inside staking signature generation

* fix: nonce test

* feat: add deadline parameter

* fix: blank nonce test coverage

* feat: add staking default gas estimation

* chore: revert dynamic deadline which contract does not support

* feat: gho testnet (#506)

* feat: add default gas estimation for borrow and vote (#492)

* feat: add default gas estimation for borrow

* chore: add default estimation for vote

* chore(release): publish [ci skip]

 - @aave/contract-helpers@1.13.0
 - @aave/math-utils@1.13.0

* fix: apply default gas limit estimations (#499)

* fix: apply default gas limit estimations

* chore: update vote estimate

* fix: update remaining actions

* chore: update gas limit tests for v3 pool

* chore: update gas limits tests for v2 pool

* chore: update gas limits tests for voting

* chore: revert v3 pool rollup changes

* chore(release): publish [ci skip]

 - @aave/contract-helpers@1.13.1
 - @aave/math-utils@1.13.1

* chore: change migration on v3 from flash loan to use credit delegation (#493)

* feat: v3 migration services added

* feat: erc20-2612 export and test for v3 migration added

* feat: migration service types

* feat: migrate no borrow without permits

* feat: migrate v3 with borrow continue

* fix: pass permits to flashloan v3

* fix: added test for migrateV3 and fixed some types

* fix: remove approval tx if permits passed

* fix: approve txs in migrate with permits

* fix: added 100% coverage

* fix: fixed ingores

* feat: add migrate method

* fix: add tests

* fix: added credit delegation approval

* fix: separate v3 variable debt approval for migraiton v3

* fix: updated tests

* feat: add get migration supply method added

* fix: get migration supply test added

* fix: get migration supply test

Co-authored-by: sendra <polsendra@gmail.com>

* chore(release): publish [ci skip]

 - @aave/contract-helpers@1.13.2
 - @aave/math-utils@1.13.2

* fix: typechain structure (#501)

* fix: typechain structure

* chore: disable typescript linting for migration service

* chore: add type to permit mapping

* fix: migration typechain import and unused config

* fix: factory typechain import

* chore(release): publish [ci skip]

 - @aave/contract-helpers@1.13.3
 - @aave/math-utils@1.13.3

* fix: check for liq threshold in place of ltv for user collateral check (#505)

* chore(release): publish [ci skip]

 - @aave/contract-helpers@1.13.4
 - @aave/math-utils@1.13.4

* fix: Fix typos (#486)

* chore(release): publish [ci skip]

 - @aave/contract-helpers@1.13.5
 - @aave/math-utils@1.13.5

* feat: decentralize the readme header image

* chore: remove legacy files

* feat: update uighodataprovider typechain and references (#507)

* feat: custom version for gho beta [skip ci]

* chore(release): [skip ci]

 - @aave/contract-helpers@1.0.0-gho-beta.0
 - @aave/math-utils@1.0.0-gho-beta.0

* chore: remove readme line

* chore: revert attempt for custom custom version

---------

Co-authored-by: GitHub Actions Build <developers@aave.com>
Co-authored-by: Dmitry Petrov <satanworker@gmail.com>
Co-authored-by: sendra <polsendra@gmail.com>
Co-authored-by: Dimitris Apostolou <dimitris.apostolou@icloud.com>

* feat: gho uighodataprovider update (#526)

* feat: update uighodataprovider typechain

* feat: update usage of discountLockPeriod in gho service

* feat: gho base update (#536)

* feat: add Scroll Alpha chainId (#528)

* chore(release): publish [ci skip]

 - @aave/contract-helpers@1.15.0
 - @aave/math-utils@1.15.0

* feat: update borrow methods SDK (#527)

* feat: updated borrow methods + test for L2Pool

* feat: updated borrow methods + test for WETHGateway

* feat: update  borrow methods on V3 pool bundle + tests

* feat: update borrow methods on V2 bundle + tests

* chore: add wethgateway test coverage

* feat: add generateApproveDelegationTxData helper function + tests

* feat: numeric credit delegation approved amount instead of boolean

* chore(release): publish [ci skip]

 - @aave/contract-helpers@1.16.0
 - @aave/math-utils@1.16.0

* fix: apply default gas limits (#533)

* chore: add approval and approveDelegation gasLimitRecommendations

* fix: apply default gas limit estimations to all tx data generation methods

* feat: fixed available debt in isolated reserve in case that debt > ma… (#532)

* feat: fixed available debt in isolated reserve in case that debt > max debt

* feat: add isolation mode ceiling exceeded test

* chore: remove comment

---------

Co-authored-by: aschmidt20 <andrew@aave.com>

* chore(release): publish [ci skip]

 - @aave/contract-helpers@1.17.0
 - @aave/math-utils@1.17.0

---------

Co-authored-by: Daniel Helm <dan.helm@gmail.com>
Co-authored-by: GitHub Actions Build <developers@aave.com>
Co-authored-by: JoaquinBattilana <battilanajn@gmail.com>

* fix: check that user has required amount of token for discount (#539)

* fix: check that user has required amount of token for discount

* test: unit itest for not having enough discount token for discount

* fix: bad merge

* fix: typings

* chore: cleanup unnecessary changes

* chore: more file cleanup

* chore: update stakeWithPermit to directly call function on  StkAave token

* chore: update signStaking and stakeWithPermit tests

* chore: add ProtocolAction to stakeWithPermit

* fix: signStakingApproval spender

---------

Co-authored-by: Drew Cook <drew@dco.dev>
Co-authored-by: Andrew Schmidt <andrew@aave.com>
Co-authored-by: GitHub Actions Build <developers@aave.com>
Co-authored-by: Dmitry Petrov <satanworker@gmail.com>
Co-authored-by: sendra <polsendra@gmail.com>
Co-authored-by: Dimitris Apostolou <dimitris.apostolou@icloud.com>
Co-authored-by: Daniel Helm <dan.helm@gmail.com>
Co-authored-by: JoaquinBattilana <battilanajn@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants