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

refactor: merged jars #114

Draft
wants to merge 96 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 93 commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
bcb2e73
move interest calculation to terms
vasyafromrussia Oct 4, 2024
26043c7
refactor claim
vasyafromrussia Oct 9, 2024
09e950b
refactor penalty
vasyafromrussia Oct 9, 2024
a271fac
refactor withdraw
vasyafromrussia Oct 10, 2024
f68e6b2
some clean
vasyafromrussia Oct 10, 2024
a6b7ed6
refactor restake
vasyafromrussia Oct 10, 2024
a900fbc
refactor view methods
vasyafromrussia Oct 11, 2024
03de827
some fixes
vasyafromrussia Oct 11, 2024
b10c425
some fixes
vasyafromrussia Oct 11, 2024
ec5b34d
some fixes
vasyafromrussia Oct 11, 2024
e733984
fix mappers
vasyafromrussia Oct 14, 2024
7aef67c
fix withdraw api errors
vasyafromrussia Oct 14, 2024
e186ac7
fix account borrow checker errors
vasyafromrussia Oct 14, 2024
2e09106
fix build
vasyafromrussia Oct 15, 2024
52e16d2
restore product tests
vasyafromrussia Oct 16, 2024
d9fdaa6
restore jar basic tests
vasyafromrussia Oct 16, 2024
b7b3952
restore some restake tests
vasyafromrussia Oct 16, 2024
6f99039
restore restake tests
vasyafromrussia Oct 17, 2024
2d5146e
restore test for restake_all
vasyafromrussia Oct 17, 2024
6a65594
restore restake_all tests
vasyafromrussia Oct 18, 2024
e3775f4
restore tests for claim
vasyafromrussia Oct 21, 2024
3821011
restore some tests
vasyafromrussia Oct 23, 2024
58d5537
fix interest calculation
vasyafromrussia Oct 25, 2024
4080458
fix score based product term calculation
vasyafromrussia Oct 25, 2024
a32dda1
restore score recording tests
vasyafromrussia Oct 25, 2024
dba6cc5
restore withdrawal tests
vasyafromrussia Oct 28, 2024
05321dc
fix flaky test
vasyafromrussia Oct 28, 2024
5d7ea30
fix tests
vasyafromrussia Oct 28, 2024
951d905
some clean
vasyafromrussia Oct 28, 2024
ce29af4
fix signing and green flow integration tests
vasyafromrussia Oct 28, 2024
64d440a
restore integration tests
vasyafromrussia Oct 29, 2024
8348bce
add some measures for staking storage
vasyafromrussia Oct 30, 2024
67e61bf
restore more tests
vasyafromrussia Oct 31, 2024
73feb84
fix basic tests
vasyafromrussia Nov 4, 2024
6af83e6
add restake to a single product
vasyafromrussia Nov 7, 2024
b3025f7
add account migration
vasyafromrussia Nov 7, 2024
84283d9
add test for account migration
vasyafromrussia Nov 8, 2024
c6da35e
add tests for restake all
vasyafromrussia Nov 9, 2024
cabef76
add tests for partial restake
vasyafromrussia Nov 9, 2024
0dbdbfe
replace account migration with assertion
vasyafromrussia Nov 18, 2024
3879516
add state migration
vasyafromrussia Nov 18, 2024
867c704
clean accounts code
vasyafromrussia Nov 19, 2024
404b040
make account versioned
vasyafromrussia Nov 19, 2024
adee1c0
rename products
vasyafromrussia Nov 19, 2024
7067f76
remove outdated counter
vasyafromrussia Nov 19, 2024
70de323
remove counter
vasyafromrussia Nov 19, 2024
0c1399e
clean linter
vasyafromrussia Nov 19, 2024
5348733
fix tests
vasyafromrussia Nov 19, 2024
2d35bd4
fix integration tests
vasyafromrussia Nov 20, 2024
1bee4d4
restore recovery tests
vasyafromrussia Nov 21, 2024
710fd5c
restore charts
vasyafromrussia Nov 21, 2024
41a352f
restore measurements
vasyafromrussia Nov 22, 2024
7d38b44
Merge remote-tracking branch 'refs/remotes/origin/dev' into feat/rejars
vasyafromrussia Nov 25, 2024
7a6e5c8
fix lint
vasyafromrussia Nov 26, 2024
3b53c14
add events
vasyafromrussia Nov 27, 2024
f3b8601
get rid of boxed dyn
VladasZ Nov 28, 2024
154844f
rename legacy versioned jars
vasyafromrussia Nov 28, 2024
701adb7
rename jars
vasyafromrussia Nov 28, 2024
e15b737
clean account code
vasyafromrussia Nov 28, 2024
c5793c4
rearrange accounts code
vasyafromrussia Nov 28, 2024
a1ebb28
rename account
vasyafromrussia Nov 28, 2024
d5794f8
remove base apy for score based product
vasyafromrussia Nov 28, 2024
b0a9dd6
remove redundant logs
vasyafromrussia Nov 28, 2024
30445c2
remove outdated comment
vasyafromrussia Nov 28, 2024
91c86ac
some clean
vasyafromrussia Nov 28, 2024
3308c6f
add claim event
vasyafromrussia Nov 28, 2024
49374b4
add restakable check
vasyafromrussia Dec 2, 2024
d8e3e10
fix typo
vasyafromrussia Dec 2, 2024
133ba30
remove 'claimed_balance' property from jar
vasyafromrussia Dec 2, 2024
4a8166c
add event on merging migration
vasyafromrussia Dec 2, 2024
2c92286
fix integration tests
vasyafromrussia Dec 2, 2024
842d83f
Merge remote-tracking branch 'origin/dev' into feat/rejars
vasyafromrussia Dec 3, 2024
b8f7ac8
Merge remote-tracking branch 'origin/dev' into feat/rejars
vasyafromrussia Dec 3, 2024
9ec3003
add product migration
vasyafromrussia Dec 3, 2024
9df15f1
add mapping for legacy accounts
vasyafromrussia Dec 3, 2024
3e51e95
comment obsolete migration test
vasyafromrussia Dec 4, 2024
0731ae9
add migration test with basic operations
vasyafromrussia Dec 5, 2024
cb01b9e
add interest check to migration test
vasyafromrussia Dec 6, 2024
173daf0
add docs for events
vasyafromrussia Dec 9, 2024
b84ec03
add test for withdrawal for multiple products with fee
vasyafromrussia Dec 10, 2024
38fc3d7
feat: add fee accumulator
vasyafromrussia Dec 11, 2024
ba110ce
fix: require pk for score based products on registration
vasyafromrussia Dec 18, 2024
b54e698
refactor: add serializer for UDecimal
vasyafromrussia Dec 19, 2024
18017db
refactor: remove product view and dto
vasyafromrussia Dec 20, 2024
9bd95fc
fix: div_ceil in restaking fee calculation
vasyafromrussia Dec 23, 2024
1b0c872
fix: lock and check a lock on restaking operations
vasyafromrussia Dec 23, 2024
e26c465
chore: update measurements
vasyafromrussia Dec 23, 2024
d409a30
fix: remove redundant code
vasyafromrussia Dec 23, 2024
e443a92
chore: remove outdated comments
vasyafromrussia Dec 23, 2024
dfc1109
build: add wasm
vasyafromrussia Dec 23, 2024
34284d8
chore: remove U32 type
vasyafromrussia Dec 24, 2024
2fff5a2
refactor: extract signer to model
vasyafromrussia Dec 27, 2024
e74a042
test: protected score based products in int
vasyafromrussia Dec 27, 2024
f8a5e50
fix: add 'account_id' to Claim and Deposit events
vasyafromrussia Jan 17, 2025
88df69b
build: version 4.0.0
vasyafromrussia Jan 17, 2025
71d1b2e
refactor: add account_id to all user-initiated action events
vasyafromrussia Jan 20, 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
26 changes: 5 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions contract/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ integration-test = [
integration-api = ["sweat-jar-model/integration-api"]

[dependencies]
ed25519-dalek = { workspace = true }
mutants = { workspace = true }

near-sdk = { workspace = true, features = ["unit-testing"] }
Expand All @@ -29,9 +28,6 @@ sweat-jar-model = { workspace = true }
[dev-dependencies]
visu = { workspace = true }
fake = { workspace = true }
rand = { workspace = true }
sha256 = { workspace = true }
base64 = { workspace = true }
anyhow = { workspace = true }
crypto-hash = { workspace = true }
itertools = { workspace = true }
sweat-jar-model = { workspace = true, features = ["testing"] }
13 changes: 4 additions & 9 deletions contract/src/assert.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
use near_sdk::require;
use sweat_jar_model::TokenAmount;

use crate::{common::Timestamp, jar::model::Jar, product::model::Product};
use crate::jar::model::{Jar, JarVersionedLegacy};

pub(crate) fn assert_not_locked(jar: &Jar) {
pub(crate) fn assert_not_locked_legacy(jar: &JarVersionedLegacy) {
require!(!jar.is_pending_withdraw, "Another operation on this Jar is in progress");
}

pub(crate) fn assert_sufficient_balance(jar: &Jar, amount: TokenAmount) {
require!(jar.principal >= amount, "Insufficient balance");
}

pub(crate) fn assert_is_liquidable(jar: &Jar, product: &Product, now: Timestamp) {
require!(jar.is_liquidable(product, now), "The jar is not mature yet");
pub(crate) fn assert_not_locked(jar: &Jar) {
require!(!jar.is_pending_withdraw, "Another operation on this Jar is in progress");
}
Loading