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

Feat/add unbonding time #36

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Feat/add unbonding time #36

wants to merge 13 commits into from

Conversation

meomeocoj
Copy link
Member

@meomeocoj meomeocoj commented Feb 1, 2024

What this pr do?

  • Add period unbonding-time when register staking asset
  • Add LOCK_INFO which is multiple array of lock asset
  • Unbond will move the token to lock and return all the reward and all when lock.unlock_time < env.block.time

@meomeocoj meomeocoj requested review from ducphamle2, tubackkhoa and lehieuhust and removed request for ducphamle2 February 1, 2024 11:28
}

for res in unbond_responses.into_iter() {
response = response.add_attributes(res.clone().attributes);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add_messages here as well for the _unbond messages?

@@ -100,6 +103,10 @@ pub fn execute(deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg) -> S
staker_addr,
prev_staking_token_amount,
),
ExecuteMsg::UnbondLock {
staking_token,
lock_id,
Copy link
Collaborator

@ducphamle2 ducphamle2 Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For simplicity I think we can re-use the ExecuteMsg::Unbond by locking new amounts then unbonding old locks all in the same tx

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is similar to MsgDelegate, where we delegate new tokens while withdrawing all rewards

amount,
unlock_time,
},
)?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can refactor the unbond_lock logic so we can call it in here

tubackkhoa
tubackkhoa previously approved these changes Feb 5, 2024
Copy link

sonarcloud bot commented Feb 6, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants