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

Support of the multi-assets per contract #506

Merged
merged 3 commits into from
Jul 13, 2023

Conversation

xgreenx
Copy link
Collaborator

@xgreenx xgreenx commented Jul 12, 2023

Closes #496

  • Added new Mint and Burn receipts with serialization and deserialization.
  • mint and burn opcodes accept a new $rB register - sub_id
  • mint and burn opcodes produce receipts now.

- Added a new `Mint` and `Burn` receipts with serialization nand deserialization.
- `mint` and `burn` opcodes accept a new `$rB` register - `sub_id`
- `mint` and `burn` opcodes produces receipts now.
@xgreenx xgreenx requested a review from a team July 12, 2023 15:47
@xgreenx xgreenx self-assigned this Jul 12, 2023
ReceiptRepr::Mint as u8,
);

bytes::store_at(buf, S::layout(S::LAYOUT.sub_id), sub_id);
Copy link
Member

Choose a reason for hiding this comment

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

Why do we put sub id before contract id?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is layout from the specification=)
image

pub(crate) fn mint(&mut self, a: Word, b: Word) -> Result<(), RuntimeError> {
let (SystemRegisters { fp, pc, is, .. }, _) =
split_registers(&mut self.registers);
MindCtx {
Copy link
Member

Choose a reason for hiding this comment

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

Mint

/// Trait extends the functionality of the `ContractId` type.
pub trait ContractIdExt {
/// Creates an `AssetId` from the `ContractId` and `sub_id`.
fn asset_id(&self, sub_id: &Bytes32) -> AssetId;
Copy link
Contributor

@bvrooman bvrooman Jul 13, 2023

Choose a reason for hiding this comment

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

Is it worth reusing AssetID here for sub_id, or maybe creating a type/type alias for SubId?

@xgreenx xgreenx added this pull request to the merge queue Jul 13, 2023
Merged via the queue into master with commit f90298b Jul 13, 2023
27 checks passed
@xgreenx xgreenx deleted the feature/multi-asset-per-contract branch July 13, 2023 19:00
@xgreenx xgreenx mentioned this pull request Jul 13, 2023
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.

Support multi asset per contract
3 participants