Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
13a2280
feat: disallow removing last remaining draft operator id
alexaunter Aug 23, 2022
317e955
Merge pull request #21 from galactic3/add_draft_operator_role
Aug 23, 2022
c0953db
feat: preserve start checkpoint on terminate
alexaunter Jul 3, 2022
927d61c
feat: preserve finish termination timestamp
alexaunter Jul 3, 2022
6c64df5
feat: create unlocked now lockup wnen terminate transfer fails
alexaunter Jul 3, 2022
d9aae1d
refactor: remove unused function from the wasm binary
alexaunter Jul 16, 2022
0e6f6b5
fix: typo
alexaunter Jul 16, 2022
2f1662c
style: cargo fmt
alexaunter Aug 24, 2022
09e4dc6
Merge pull request #22 from galactic3/preserve_schedule_on_terminate_…
Aug 24, 2022
a465bcd
feat: add option to try converting drafts when funding group
alexaunter Jul 3, 2022
f3bc23c
feat: add min remaining gas threshold
alexaunter Jul 16, 2022
ce26971
style: cargo fmt
alexaunter Aug 23, 2022
75c24ea
feat: update remaining gas calculation logic
alexaunter Aug 23, 2022
5353ed9
fix: fix failing tests due to too low offset
alexaunter Aug 24, 2022
267c84a
Merge pull request #23 from galactic3/try_convert_drafts_on_draft_gro…
Aug 25, 2022
2318196
refactor: remove bak backup files
alexaunter Aug 28, 2022
4c03d84
feat: expose package version
alexaunter Jul 31, 2022
93bfb56
feat: add new lockup contract event
alexaunter Jul 31, 2022
1732915
feat: add add_to_deposit_whitelist event
alexaunter Jul 31, 2022
f797dc4
style: cargo fmt
alexaunter Jul 31, 2022
9468c9e
feat: add add_to_draft_operators_whitelist event
alexaunter Jul 31, 2022
d2631a2
feat: add remove_from_deposit_whitelist event
alexaunter Jul 31, 2022
404bd5d
feat: add remove_from_draft_operators_whitelist event
alexaunter Jul 31, 2022
8c99426
feat: add create_lockup event
alexaunter Jul 31, 2022
f5f0794
feat: add claim_lockup event
alexaunter Jul 31, 2022
a989ea5
feat: add terminate_lockup event
alexaunter Jul 31, 2022
574a4b4
feat: add create_draft_group event
alexaunter Aug 1, 2022
6c30eff
feat: add create_draft event
alexaunter Aug 1, 2022
7571769
feat: add fund_draft_group event
alexaunter Aug 1, 2022
bf5f908
feat: add discard_draft_group event
alexaunter Aug 1, 2022
e919b16
feat: add delete_draft event
alexaunter Aug 1, 2022
793acdc
style: cargo fmt
alexaunter Aug 1, 2022
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
Binary file modified res/ft_lockup.wasm
Binary file not shown.
17 changes: 10 additions & 7 deletions src/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ impl SelfCallbacks for Contract {
let mut total_balance = 0;
if promise_success {
let mut remove_indices = vec![];
let mut events: Vec<FtLockupClaimLockup> = vec![];
for LockupClaim {
index,
is_final,
Expand All @@ -36,6 +37,11 @@ impl SelfCallbacks for Contract {
remove_indices.push(index);
}
total_balance += claim_amount.0;
let event = FtLockupClaimLockup {
id: index,
amount: claim_amount,
};
events.push(event);
}
if !remove_indices.is_empty() {
let mut indices = self.account_lockups.get(&account_id).unwrap_or_default();
Expand All @@ -44,6 +50,7 @@ impl SelfCallbacks for Contract {
}
self.internal_save_account_lockups(&account_id, indices);
}
emit(EventKind::FtLockupClaimLockup(events));
} else {
log!("Token transfer has failed. Refunding.");
let mut modified = false;
Expand Down Expand Up @@ -79,14 +86,10 @@ impl SelfCallbacks for Contract {
if !promise_success {
log!("Lockup termination transfer has failed.");
// There is no internal balance, so instead we create a new lockup.
let lockup = Lockup::new_unlocked(account_id, amount.0);
let lockup = Lockup::new_unlocked_since(account_id, amount.0, current_timestamp_sec());
let lockup_index = self.internal_add_lockup(&lockup);
log!(
"Generated a new lockup #{} as a refund of {} for account {}",
lockup_index,
amount.0,
lockup.account_id.as_ref(),
);
let event: FtLockupCreateLockup = (lockup_index, lockup, None).into();
emit(EventKind::FtLockupCreateLockup(vec![event]));
0.into()
} else {
amount
Expand Down
Loading