Skip to content

Conversation

peer2f00l
Copy link
Collaborator

No description provided.

@peer2f00l peer2f00l self-assigned this Mar 3, 2025
@peer2f00l peer2f00l added the bug Something isn't working label Mar 3, 2025
@peer2f00l peer2f00l linked an issue Mar 3, 2025 that may be closed by this pull request
@peer2f00l peer2f00l merged commit 71c6777 into dev/fresh_start Mar 3, 2025
3 of 4 checks passed
@peer2f00l peer2f00l deleted the 26-supply-position-not-updated-after-withdrawal-execution branch March 3, 2025 17:32
peer2f00l added a commit that referenced this pull request Mar 7, 2025
* withdrawal queue maybe working?

* remove internal balance accounting, move some withdrawal queue logic

* happy path test expansion

* better tests

* distribute rewards

* use custom units for all asset operations

* rename: rewards -> yield

* improves yieldweights semantics

* yield withdrawal

* withdrawals + tests

* addressing some comments from review

* Start implementing maximum borrow asset usage ratio:

	- Everything is async, so we have to implement some asset locking (`borrow_asset_in_flight`, not yet implemented)
	- Some updates to requesting current balance: let's just go with making everything a return value.
	- Will also need to implement borrow record locking.

* implements global borrow_asset_in_flight

* locking half done, checkpoint to try in-flight approach

* feat: partial balance locking on balance records completed

* chore: tests for maximum_borrow_asset_usage_ratio

* chore: few docs

* feat: max duration

* feat: borrow limits

* chore: small renames + reorg

* feat: liquidation + some tests

* chore: more liquidation tests

* chore: removes authorized liquidation

* chore: liquidation spread tests

* chore: remove debug logs

* chore: resync with template

* chore: adds clippy

* chore: update gh action to run init method

* chore: nextest + skip tests during actions testing

* chore: fix after merge

* chore: remove master account from testnet config

* fix: maybe moving near-sdk unit-testing feature to dev-dependencies fixes docker build issue

* chore: unused; maybe causing docker build issue?

* fix: better conditions for init call and account creation

* fix: exit code 1 is intentional here

* chore: reenable testing

* feat: reuse builds

* chore: upgrade near cli version in ci

* chore: fixing up native endpoints (#23)

* Use a custom decimal representation (#28)

* trying out bigdecimal

* feat: custom decimal

* chore: rm old files

* chore: better string epsilon; tests

* chore: add ceil and floor u128 fns

* fix: broken withdrawal queue test

* chore: reorganize

* fix: update some paths

* chore: trim trailing zeroes on decimal stringification

* Clear supply position after withdrawal execution (#29)

* fix: contract building + add test for supply position clearing

* fix: write supply position back

* fix: gh actions, cd to contract dir

* Use Vector instead of TreeMap for yield calculations (#30)

* feat: reduced gas usage attempt

	- Use a Vector with binary search instead of TreeMap. While the binary search is probably a little bit more expensive at first, subsequent element accesses should be a bit cheaper. Also, lower insertion complexity.
	- Epoch-based accounting for yield distribution rather than block-based.

* chore: update more items to epoch accounting

* fix: some zero cases

* chore: chain time, using block height

* chore: harvest yield gas check

* Implement minimum initial collateral ratio (#31)

* chore: minimum initial plus tests

* fix: root dir without realpath

* fix: install cargo near before tests

* chore: minimum initial collateral ratio tests

---------

Co-authored-by: peer2 <peer2@templarprotocol.com>
peer2f00l added a commit that referenced this pull request Mar 10, 2025
* withdrawal queue maybe working?

* remove internal balance accounting, move some withdrawal queue logic

* happy path test expansion

* better tests

* distribute rewards

* use custom units for all asset operations

* rename: rewards -> yield

* improves yieldweights semantics

* yield withdrawal

* withdrawals + tests

* addressing some comments from review

* Start implementing maximum borrow asset usage ratio:

	- Everything is async, so we have to implement some asset locking (`borrow_asset_in_flight`, not yet implemented)
	- Some updates to requesting current balance: let's just go with making everything a return value.
	- Will also need to implement borrow record locking.

* implements global borrow_asset_in_flight

* locking half done, checkpoint to try in-flight approach

* feat: partial balance locking on balance records completed

* chore: tests for maximum_borrow_asset_usage_ratio

* chore: few docs

* feat: max duration

* feat: borrow limits

* chore: small renames + reorg

* feat: liquidation + some tests

* chore: more liquidation tests

* chore: removes authorized liquidation

* chore: liquidation spread tests

* chore: remove debug logs

* chore: resync with template

* chore: adds clippy

* chore: update gh action to run init method

* chore: nextest + skip tests during actions testing

* chore: fix after merge

* chore: remove master account from testnet config

* fix: maybe moving near-sdk unit-testing feature to dev-dependencies fixes docker build issue

* chore: unused; maybe causing docker build issue?

* fix: better conditions for init call and account creation

* fix: exit code 1 is intentional here

* chore: reenable testing

* feat: reuse builds

* chore: upgrade near cli version in ci

* chore: fixing up native endpoints (#23)

* Use a custom decimal representation (#28)

* trying out bigdecimal

* feat: custom decimal

* chore: rm old files

* chore: better string epsilon; tests

* chore: add ceil and floor u128 fns

* fix: broken withdrawal queue test

* chore: reorganize

* fix: update some paths

* chore: trim trailing zeroes on decimal stringification

* Clear supply position after withdrawal execution (#29)

* fix: contract building + add test for supply position clearing

* fix: write supply position back

* fix: gh actions, cd to contract dir

* Use Vector instead of TreeMap for yield calculations (#30)

* feat: reduced gas usage attempt

	- Use a Vector with binary search instead of TreeMap. While the binary search is probably a little bit more expensive at first, subsequent element accesses should be a bit cheaper. Also, lower insertion complexity.
	- Epoch-based accounting for yield distribution rather than block-based.

* chore: update more items to epoch accounting

* fix: some zero cases

* chore: chain time, using block height

* chore: harvest yield gas check

* Implement minimum initial collateral ratio (#31)

* chore: minimum initial plus tests

* fix: root dir without realpath

* fix: install cargo near before tests

* chore: minimum initial collateral ratio tests

* feat: interest rate strategy

* chore: Decimal +Copy, adds Linear IRS

* chore: irs helper methods, fixing errors

* feat: adds total asset borrowed tracking

* feat: much simpler logs processing

* fix: only subtract principal from borrowed accounting

* chore: use store::Vector instead of collections::Vector for logs

* chore: interest tests and many related bugfixes

* chore: tests fixed

* chore: remove balance_log.rs

* chore: rename log -> snapshot

* feat: adds get_last_interest_rate fn

* feat: adds get_last_yield_rate fn

* fix: broken test

* chore: normalize and test asset accumulators for both yield and interest

* chore: cleanup

* feat: refund on over-repayment

* fix: divzero issue

* chore: cleanup some tests

* fix: some div0s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Supply position not updated after withdrawal execution

1 participant