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

Compute stake/pool preview guarantees state #774

Merged
merged 5 commits into from
Jan 30, 2024
Merged

Conversation

jakub-rdx
Copy link
Contributor

@jakub-rdx jakub-rdx commented Jan 29, 2024

Description

  • compute guarantees for stake/pool tx types
  • in pool contribution, resolve asset using general rules if there is no pool associated (example to test this case, set up pool that has 10:1 ratio of Asset A to Asset B, and contribute 110 asset A and and 10 Asset B - in preview you will see pool unit deposited and 10 units of Asset A)
  • optimize stake claim processor - we don't need TrackedClaim object to produce model representing tx preview in that case

PR submission checklist

  • I have tested stake/unstake/claims and pool contribution/redemption previews
  • I have compared those previews in Andorid/iOS apps.

val resourceAddress = deposit.resourceAddress
val contributions = classification.poolContributions.filter {
it.poolUnitsResourceAddress.addressString() == resourceAddress
}
if (contributions.isEmpty()) {
null
resolveGeneralAsset(deposit, summary, assets, defaultDepositGuarantee)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this needed here? Can you explain when we have empty contributions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see second bullet

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if you contribute to pool amounts of resources that do not convert to pool units entirely (for example you have ratio of resources A:B as 1:2, and you contribute 1 unit of A and 2.5 of B (via sandbox), that reminder of 0.5 B is returned by RET as regular resource deposited to the specific account. Without that change, this is not reflected in the "Depositing" section, although you see in "Withdrawn" 2.5 of B being withdrawn.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I see now thanks

Copy link
Contributor

@micbakos-rdx micbakos-rdx left a comment

Choose a reason for hiding this comment

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

Check the 2 above comments I am not sure about the change of the pool contribution processor.

@micbakos-rdx micbakos-rdx self-requested a review January 29, 2024 15:26
@micbakos-rdx micbakos-rdx force-pushed the bugfix/ABW-2846-ui-discrepancies branch from 5016cc6 to f31bd6b Compare January 30, 2024 09:58
Base automatically changed from bugfix/ABW-2846-ui-discrepancies to main January 30, 2024 13:51
Copy link

sonarcloud bot commented Jan 30, 2024

Quality Gate Failed Quality Gate failed

Failed conditions

1.3% Coverage on New Code (required ≥ 40%)

See analysis details on SonarCloud

@jakub-rdx jakub-rdx merged commit c44540b into main Jan 30, 2024
8 of 9 checks passed
@jakub-rdx jakub-rdx deleted the fix/ABW-2846-guarantees branch January 30, 2024 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants