Skip to content

Commit 91c86ac

Browse files
some clean
1 parent 30445c2 commit 91c86ac

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

contract/src/claim/api.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ impl ClaimApi for Contract {
6666
}
6767

6868
let account_rollback = AccountV1Companion {
69-
score: Some(account.score),
70-
jars: Some(rollback_jars),
69+
score: account.score.into(),
70+
jars: rollback_jars.into(),
7171
..AccountV1Companion::default()
7272
};
7373

contract/src/jar/api.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ use sweat_jar_model::{
1010
use crate::{
1111
assert::assert_not_locked_legacy,
1212
event::{emit, EventKind, RestakeData},
13-
jar::{account::Account, model::AccountLegacyV2, view::DetailedJarV2},
13+
jar::{
14+
account::{v1::AccountV1, Account},
15+
model::AccountLegacyV2,
16+
view::DetailedJarV2,
17+
},
1418
product::model::v1::{InterestCalculator, Product},
1519
score::AccountScore,
1620
Contract, ContractExt,
@@ -121,9 +125,7 @@ impl From<&AccountLegacyV2> for Account {
121125
fn from(value: &AccountLegacyV2) -> Self {
122126
let mut account = Account {
123127
nonce: value.last_id,
124-
jars: HashMap::default(),
125-
score: AccountScore::default(),
126-
is_penalty_applied: false,
128+
..Account::default()
127129
};
128130

129131
for jar in &value.jars {

contract/src/score/account_score.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,9 @@ impl AccountScore {
6262
}
6363
}
6464

65-
pub fn try_reset_score(&mut self) -> Option<Vec<Score>> {
65+
pub fn try_reset_score(&mut self) {
6666
if self.is_valid() {
67-
Some(self.reset_score())
68-
} else {
69-
None
67+
self.reset_score();
7068
}
7169
}
7270

0 commit comments

Comments
 (0)