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

auction: define action balances #4218

Merged
merged 20 commits into from
Apr 16, 2024
Merged

auction: define action balances #4218

merged 20 commits into from
Apr 16, 2024

Conversation

erwanor
Copy link
Member

@erwanor erwanor commented Apr 16, 2024

Describe your changes

This PR:

  • add auctionnfts to the asset registry
  • augment AuctionNft with denom metadata
  • implements DutchAuctionDescription::id
  • implements value balance for each action
  • implements computing the balance commitment for the withdraw action

Issue ticket number and link

This is a prelude to #4212

Checklist before requesting a review

  • If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason:

    This isn't connected to the rest of the app yet.

@erwanor erwanor added the A-auction Area: Relates to the auction component label Apr 16, 2024
// The sequence number should always be >= 1, because we can
// only withdraw an auction that has ended (i.e. with sequence number `>=1`).
// We use a saturating operation defensively so that we don't underflow.
asset_id: AuctionNft::new(self.auction_id, self.seq.saturating_sub(1)).asset_id(),
Copy link
Member Author

@erwanor erwanor Apr 16, 2024

Choose a reason for hiding this comment

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

@redshiftzero My rationale to do this is that we check the binding signature before we run any action validation checks, so even if this MUST be seq >= 1, we can't actually rely on that yet.

@erwanor erwanor marked this pull request as ready for review April 16, 2024 13:21
pub fn new(id: AuctionId, seq: u64) -> AuctionNft {
let metadata = asset::REGISTRY
.parse_denom(&format!("auctionnft_{seq}_{id}"))
.expect("auction nft denom is valid");
Copy link
Member Author

Choose a reason for hiding this comment

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

I think I want to do a second pass on both auction and lp nfts to make their constructor fallible.

@cratelyn cratelyn added this to the Sprint 4 milestone Apr 16, 2024
Copy link
Member

@redshiftzero redshiftzero left a comment

Choose a reason for hiding this comment

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

Value balance changes LGTM! one small comment inline

@erwanor erwanor merged commit ce5ba7e into main Apr 16, 2024
8 checks passed
@erwanor erwanor deleted the erwan/auction_nft_balances branch April 16, 2024 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-auction Area: Relates to the auction component
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants