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

Unlock grace period contracts #2582

Merged
merged 49 commits into from
May 22, 2024
Merged

Conversation

0oM4R
Copy link
Contributor

@0oM4R 0oM4R commented Apr 18, 2024

Update
  • now user can select contracts that are on rented node, and the coast of related rent contract is added to require funds.
  • fixed free balance issue, now we are using usable balance (free -lock)
  • add loading and error handling, dialog was opened before loading the details.
  • update lock details by opening dialog, to avoid mismatched lock details

Description

add button to manually unlock grace period contract, instead of waiting for the next billing cycle
image

Changes

  • add required methods to call billContractForBlock
  • support unlock grace period contracts with 3 flows
  1. single contract
    Add an unlock button to the Contract lock details dailog
    image
    if the contract is on rented node, there is no unlock button, user should unlock the rent contract and the alert is shown
  2. multiple contracts
    selected contracts from the table could be unlocked by unlock button in each table
    image
  3. unlock all contracts
    image

note

we can't guarantee that the contracts will be moved to the created state, as the chain method billContractForBlock do not return an error if the balance is not enough, but it only updates the locked amount,
Also, we are updating the contracts table after 30 seconds from calling the method

Screenshot from 2024-05-07 16-38-29
Screenshot from 2024-05-07 16-51-44

Related Issues

Documentation PR

For UI changes, Please provide the Documetation PR on info_grid

Checklist

  • Tests included
  • Build pass
  • Documentation
  • Code format and docstrings
  • Screenshots/Video attached (needed for UI changes)

@0oM4R 0oM4R changed the title Feat: add unclock grace period function to tfchain client and grid cl… Unlock grace period contracts Apr 22, 2024
@0oM4R 0oM4R marked this pull request as ready for review April 22, 2024 15:31
@0oM4R 0oM4R changed the base branch from development to development_2.5 April 22, 2024 15:33
Copy link
Contributor

@zaelgohary zaelgohary left a comment

Choose a reason for hiding this comment

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

I noticed that we let the user unlock the contract manually. What if we unlock contract/contracts automatically if the user has enough balance? This would save us any new changes in the UI.

@0oM4R 0oM4R marked this pull request as draft April 23, 2024 15:18
Base automatically changed from development_2.5 to development May 7, 2024 12:16
0oM4R added 4 commits May 15, 2024 14:52
@sameh-farouk
Copy link
Member

What are your thoughts on using the term 'unlock'? Would using something like 'resume' or 'restore' be more friendly since the related workload is paused?

@amiraabouhadid
Copy link
Contributor

amiraabouhadid commented May 16, 2024

What are your thoughts on using the term 'unlock'? Would using something like 'resume' or 'restore' be more friendly since the related workload is paused?

resume sounds more intuitive

sameh-farouk
sameh-farouk previously approved these changes May 19, 2024
@xmonader xmonader requested a review from sameh-farouk May 19, 2024 14:35
@sameh-farouk sameh-farouk dismissed their stale review May 19, 2024 14:37

unintentionally approve

@AlaaElattar AlaaElattar marked this pull request as draft May 21, 2024 10:22
@AlaaElattar AlaaElattar marked this pull request as ready for review May 21, 2024 10:45
@sameh-farouk
Copy link
Member

Can we add a note that in some cases the actual deducted amount when contracts are resumed could be less than estimated here?

@AlaaElattar AlaaElattar marked this pull request as draft May 21, 2024 12:22
@AlaaElattar AlaaElattar marked this pull request as ready for review May 22, 2024 07:21
@AhmedHanafy725
Copy link
Contributor

Can we add a note that in some cases the actual deducted amount when contracts are resumed could be less than estimated here?

I prefer to not add it as it's not harmful. Cause sometimes when we add many notes, the user becomes too lazy to read them.

Copy link
Contributor

@zaelgohary zaelgohary left a comment

Choose a reason for hiding this comment

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

@0oM4R Good job! The feature works perfectly as seen below.

unlock_contract.webm

Just one comment. It might not be clear to the user that this feature exists. I suggest to add an alert before the tables which contains the grace period chip and how to unlock the contract. Created an issue for it.

@zaelgohary zaelgohary dismissed amiraabouhadid’s stale review May 22, 2024 09:00

Has 3 approvals.

@zaelgohary zaelgohary merged commit 5bcd6fd into development May 22, 2024
3 checks passed
@zaelgohary zaelgohary deleted the development_unlockContracts branch May 22, 2024 09:00
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.

9 participants