Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
6e4bb5e
feat: initial vault contract
carrion256 Oct 1, 2025
bf16fff
feat: add vault configuration to test harness
carrion256 Oct 3, 2025
2caf5fc
chore: move opstate
carrion256 Oct 6, 2025
b6a5d3c
test: init storage for the accounts properly in the test harness
carrion256 Oct 8, 2025
12d5792
chore: expose some getters
carrion256 Oct 8, 2025
7f13178
feat!: introduce lazy/eager allocations
carrion256 Oct 8, 2025
f920287
feat: implement plan-based weighted allocation for per-op reallocate
carrion256 Oct 8, 2025
f718507
feat: add vault events, allocate flow, and withdraw/skim support
carrion256 Oct 8, 2025
b344eb6
chore: slightly better gas accounting
carrion256 Oct 8, 2025
2a8618a
test: happy path test
carrion256 Oct 8, 2025
7c620dd
fix: use calc_refund in AllocationStepSettled event
carrion256 Oct 8, 2025
4c08fe2
test: further assumptions
carrion256 Oct 8, 2025
17e3c6c
test: user can withdraw position if unborrowed
carrion256 Oct 8, 2025
40c1dbe
test: happy path with withdraw
carrion256 Oct 8, 2025
85d99a9
feat: add vault-level deferred withdrawals queue and executor
carrion256 Oct 8, 2025
6f397d0
test: locked state machine
carrion256 Oct 9, 2025
8f04378
test: duplicate markets
carrion256 Oct 9, 2025
48005dd
chore: default alloc mode
carrion256 Oct 9, 2025
18bc866
test: cb tests
carrion256 Oct 9, 2025
3f22537
test: more cb tests
carrion256 Oct 9, 2025
3a23b6f
test: props for callbacks
carrion256 Oct 9, 2025
92eaa97
test: moving tests around and adding callback test suite
carrion256 Oct 10, 2025
8721db9
fix: zero the plan on empty weights
carrion256 Oct 13, 2025
61abec7
fix: verify mt is underlying
carrion256 Oct 13, 2025
bf4a3f2
fix: require allocations to maintain idle
carrion256 Oct 13, 2025
4c07b09
feat: invariant violations and proper tests
carrion256 Oct 13, 2025
37d4552
feat: storage management :<
carrion256 Oct 14, 2025
b3a5157
refactor: constant size for storage
carrion256 Oct 14, 2025
e2b0a2c
fix: cap should be unlimited in controller
carrion256 Oct 15, 2025
d8191f4
feat: gas reports
carrion256 Oct 15, 2025
83ab837
feat: assert gas minimums on each fn
carrion256 Oct 15, 2025
f6eb73e
fix: allocations and withdraw executions can't be parallel
carrion256 Oct 15, 2025
2ab8afb
fix: update schemars
carrion256 Oct 15, 2025
bb2f1ff
fix: compilation after worker macro was merged
carrion256 Oct 15, 2025
9702f0e
fix: lints
carrion256 Oct 15, 2025
b4235f1
ci: gas report for vault
carrion256 Oct 15, 2025
95b4fe8
fix: fmt
carrion256 Oct 15, 2025
cee6514
chore: misnamed package
carrion256 Oct 17, 2025
bc21635
chore: pr comments - docstrings, requires & panics
carrion256 Oct 17, 2025
35bb60f
fix: account id has u32 prefix
carrion256 Oct 17, 2025
153a9ac
chore: rename preconditions to policies
carrion256 Oct 17, 2025
5d0f40a
chore: requires
carrion256 Oct 17, 2025
e0517a9
fix: gas
carrion256 Oct 17, 2025
bf29918
chore: golf
carrion256 Oct 17, 2025
3211abe
chore: docstring
carrion256 Oct 17, 2025
f74a4d5
chore: json types for cap
carrion256 Oct 17, 2025
9aad95a
chore: type for escrowsettlement
carrion256 Oct 17, 2025
ce3ba67
refactor: move returnstyle to lib
carrion256 Oct 20, 2025
1e07b7b
chore: remove clean errors due to json types
carrion256 Oct 20, 2025
6137856
refactor: ensure wad is wide enough for future changes to u256
carrion256 Oct 20, 2025
9281756
chore: json types
carrion256 Oct 20, 2025
6b39381
chore: use fixture to clean up macro
carrion256 Oct 20, 2025
23e92ef
test: internal fee accrual
carrion256 Oct 20, 2025
a5b6df9
chore: comments from call
peer2f00l Oct 20, 2025
4f32922
wip: refactor numbers and generic style changes for quality
carrion256 Oct 20, 2025
32cf90a
chore: borshschema
carrion256 Oct 21, 2025
c9bebae
refactor: clean up
carrion256 Oct 22, 2025
8efea16
test: reconcile supply
carrion256 Oct 22, 2025
62a1142
test: clean up callback tests
carrion256 Oct 22, 2025
3a74a17
test: idle tests
carrion256 Oct 22, 2025
3c449d7
test: use more fixtures
carrion256 Oct 22, 2025
ced410c
refactor: document codebase and slight style changes
carrion256 Oct 22, 2025
c6ee233
refactor: don't acount markets without supply
carrion256 Oct 23, 2025
1651860
refactor: timelock jumping between ns <> secs
carrion256 Oct 23, 2025
544abb5
fix: critical idle balance issue with overdrawn markets
carrion256 Oct 24, 2025
879c0af
fix: saturating math & test fix
carrion256 Oct 24, 2025
8a8f502
fix: add force unregister hook
carrion256 Oct 24, 2025
c956d76
fix: owner can exfiltrate underlying and/or escrowed share tokens via…
carrion256 Oct 24, 2025
7e9f556
chore: emit events on timelock updates
carrion256 Oct 24, 2025
ae321fc
test: prevent owner reaping
carrion256 Oct 24, 2025
93044a7
refactor!: convert introduce AUM modes to better underline tradeoffs …
carrion256 Oct 24, 2025
d5101a0
chore: log on fee accrual
carrion256 Oct 24, 2025
bb98bd9
refactor: make market supply iterable
carrion256 Oct 24, 2025
b190878
feat: AUM module
carrion256 Oct 24, 2025
061a1e8
chore: move aum to own module
carrion256 Oct 24, 2025
95fdede
chore: move tests to slim down sloc
carrion256 Oct 24, 2025
664aa48
refactor: cfg to markets
carrion256 Oct 24, 2025
ae9dbde
refactor: set AUM in config
carrion256 Oct 24, 2025
b0ffef2
fix: do not delete configs on removal
carrion256 Oct 24, 2025
47c25b5
feat: pay for storage when setting skim recipient
carrion256 Oct 24, 2025
a7dfe61
chore: emit event on guardian
carrion256 Oct 24, 2025
bdb9f96
chore: supply is iterable
carrion256 Oct 24, 2025
528f690
fix: don't double refund on insufficient liquidity
carrion256 Oct 27, 2025
ff8a294
chore: ergonomics in errors
carrion256 Oct 27, 2025
730e0ac
fix: allocator does not need gas for queue mutation
carrion256 Oct 27, 2025
73d2e67
fix: aum should use full authoritative supply
carrion256 Oct 27, 2025
6966c66
test: update tests to account for latest bug fixes
carrion256 Oct 27, 2025
910c5cf
feat: add get_idle_balance method and improve gas handling
carrion256 Oct 27, 2025
f1517fb
fix: ensure idle balance is properly updated during allocation
carrion256 Oct 27, 2025
fca0026
refactor: update gas constant names and callback methods
carrion256 Oct 27, 2025
b8a9e6a
fix: ensure idle_balance updated and add allocation success comments
carrion256 Oct 27, 2025
ab61e1f
fix: debugging gas and idle balance
carrion256 Oct 27, 2025
8de4974
fix: fmt and clippy
carrion256 Oct 28, 2025
2eb6345
wip: withdraws(again)
carrion256 Oct 28, 2025
35d604d
chore: pr comments
carrion256 Oct 30, 2025
edc4d45
chore: panic on top level receipts
carrion256 Oct 30, 2025
714926e
chore: name fee wad
carrion256 Nov 1, 2025
6caf49f
feat: impl deser for wad
carrion256 Nov 1, 2025
f2b26a9
refactor!: simplify adjacent structures
carrion256 Nov 1, 2025
e0cc4ce
refactor!: style and move simple governance items to module
carrion256 Nov 1, 2025
381ef0a
refactor!: queueless withdrawals
carrion256 Nov 1, 2025
165c31e
refactor!: callback names are more descriptive
carrion256 Nov 3, 2025
e32891d
chore: schemars for numbers
carrion256 Nov 3, 2025
9f61eb7
chore: do a minimum storage bounds
carrion256 Nov 3, 2025
175be2b
refactor: use storageless for market configurations
carrion256 Nov 3, 2025
13da7ea
refactor: avoid requerying
carrion256 Nov 3, 2025
f07dad2
fix: lints and fmts
carrion256 Nov 3, 2025
f16b778
chore: shut up clippy
carrion256 Nov 3, 2025
9f1c909
chore: update gas
carrion256 Nov 4, 2025
c1bc42e
fix: gas for skim
carrion256 Nov 4, 2025
adc21ed
fix: invariants were hard to force race condition
carrion256 Nov 4, 2025
3865729
fix: TOCTOU during payouts would cause accounting drift
carrion256 Nov 4, 2025
bf57830
fix: check actual balance bounds for the vault around supply boundaries
carrion256 Nov 4, 2025
928e076
fix: share accounting bug was settling AFTER payouts
carrion256 Nov 4, 2025
13dbaa4
fix: avoid wedging during dust redemptions
carrion256 Nov 4, 2025
62768bb
fix: additive inflow stranding surplus principal
carrion256 Nov 4, 2025
52ae2dc
fix: after defensive idle decrement - tests
carrion256 Nov 5, 2025
84ac693
fix: clippy
carrion256 Nov 5, 2025
c980807
chore: synchronous gas report
carrion256 Nov 5, 2025
a4d7b6f
Merge branch 'dev' into feat/metavault
carrion256 Nov 11, 2025
d86ef94
fix: race condition when CI script fails to create the contract
carrion256 Nov 12, 2025
fafd3b6
fix: undo hack
carrion256 Nov 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:

permissions:
contents: read
id-token: write # Required for workflows that call test.yml (Codecov OIDC)
pull-requests: write # Required for deployment comments
id-token: write # Required for workflows that call test.yml (Codecov OIDC)
pull-requests: write # Required for deployment comments

jobs:
# Check if we need to run contract-related jobs
Expand Down Expand Up @@ -72,11 +72,11 @@ jobs:

- name: Initialize staging account
run: |
EXISTS=$(./script/ci/account-exists.sh \
ACCOUNT_EXISTS=$(./script/ci/account-exists.sh \
--account "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" \
--network "${{ vars.NEAR_CONTRACT_STAGING_NETWORK }}")

if [[ -z "$EXISTS" ]]; then
if [[ -z "$ACCOUNT_EXISTS" ]]; then
echo "Account does not already exist, creating"

near account create-account fund-myself "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" '20 NEAR' \
Expand All @@ -88,19 +88,26 @@ jobs:

echo "NEWLY_CREATED=1" >> $GITHUB_ENV
else
echo "Account already exists, adding tokens and removing old market versions"

near tokens "${{ vars.NEAR_CONTRACT_STAGING_ACCOUNT_ID }}" \
send-near "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" '6 NEAR' \
network-config "${{ vars.NEAR_CONTRACT_STAGING_NETWORK }}" \
sign-with-plaintext-private-key "${{ secrets.NEAR_CONTRACT_STAGING_ACCOUNT_PRIVATE_KEY }}" \
send

./script/ci/remove-all-versions-from-registry.sh \
--account "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" \
--registry "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" \
--network "${{ vars.NEAR_CONTRACT_STAGING_NETWORK }}" \
--private-key "${{ secrets.NEAR_CONTRACT_STAGING_ACCOUNT_PRIVATE_KEY }}"
CONTRACT_EXISTS=$(./script/ci/contract-exists.sh \
--contract "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" \
--network "${{ vars.NEAR_CONTRACT_STAGING_NETWORK }}")

if [[ -z "$CONTRACT_EXISTS" ]]; then
echo "Contract already exists on staging account, removing old market versions"
./script/ci/remove-all-versions-from-registry.sh \
--account "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" \
--registry "${{ env.NEAR_CONTRACT_PR_STAGING_ACCOUNT_ID }}" \
--network "${{ vars.NEAR_CONTRACT_STAGING_NETWORK }}" \
--private-key "${{ secrets.NEAR_CONTRACT_STAGING_ACCOUNT_PRIVATE_KEY }}"
else
echo "NEWLY_CREATED=1" >> $GITHUB_ENV
fi
fi

- name: Deploy registry to staging account
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@

# documentation site
_site/
.aider*
Loading
Loading