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

Minting doesn't need special treatment after all #267

Merged
merged 2 commits into from
Jan 25, 2022
Merged

Conversation

sjoerdvisscher
Copy link
Contributor

@sjoerdvisscher sjoerdvisscher commented Jan 21, 2022

Fixes #263

Pre-submit checklist:

  • Branch
    • Tests are provided (if possible)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
    • Relevant tickets are mentioned in commit messages
    • Formatting, materialized Nix files, PNG optimization, etc. are updated
  • PR
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested

@@ -405,52 +404,23 @@ handleBalanceTx utxo UnbalancedTx{unBalancedTxTx} = do
-- | Adjust the left and right balance of an unbalanced 'Tx' with the missing
-- lovelace considering the minimum lovelace per transaction output constraint
-- from the Cardano blockchain.
adjustBalanceWithMissingLovelace ::
Copy link
Contributor

Choose a reason for hiding this comment

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

🥳

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice refactoring!

let val = vL 200
lookups = Constraints.mintingPolicy coinMintingPolicy
constraints = Constraints.mustMintValue val
<> Constraints.mustPayToPubKey pkh (val <> Ada.toValue Ledger.minAdaTxOut)
Copy link
Contributor

Choose a reason for hiding this comment

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

If I'm understanding correctly, if the constraints is:

Constraints.mustMintValue val <> Constraints.mustPayToPubKey pkh val

instead, then the new balancing logic in the emulator will not try to add the min Ada to the output containing the minted token? So the transaction will just fail unless we call adjustUnbalanceTx?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is consistent with the other Constraints right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes it seems consistent! Thanks :)

@sjoerdvisscher sjoerdvisscher merged commit 51da951 into main Jan 25, 2022
@sjoerdvisscher sjoerdvisscher deleted the sv/fix-263 branch January 25, 2022 13:14
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.

Extra signer UTxO when minting
3 participants