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

feat: pallet/asset: implement status_change() call #277

Merged
merged 5 commits into from
Feb 13, 2024

Conversation

amarts
Copy link
Member

@amarts amarts commented Feb 4, 2024

Fixes #267

Signed-off-by: Amar Tumballi <amar@dhiway.com>
@amarts amarts force-pushed the pallet_asset_revoke_v1 branch from c62557d to c9390f3 Compare February 4, 2024 07:44
Signed-off-by: Amar Tumballi <amar@dhiway.com>
@amarts
Copy link
Member Author

amarts commented Feb 5, 2024

As per one of the comment, instead of focusing on individual status of the asset/instance, one can keep status_change() itself as the key call, which can handle both revoke, restore.

fixes: #267, #268

@amarts
Copy link
Member Author

amarts commented Feb 5, 2024

@smohan-dw does this makes sense now?

@adi-a11y the companion PR in cord.js would change too.

@amarts amarts changed the title feat: pallet/asset: implement revoke() call feat: pallet/asset: implement status_change() call Feb 5, 2024
Signed-off-by: Amar Tumballi <amar@dhiway.com>
pallets/asset/src/lib.rs Outdated Show resolved Hide resolved
Signed-off-by: Amar Tumballi <amar@dhiway.com>
@amarts
Copy link
Member Author

amarts commented Feb 8, 2024

@smohan-dw as per the discussion, for now, only 3 states are good, and this status_change() call handles asset status change or instance status change depending on the argument.

Good to go IMO.

I know this needs a version change in runtime, when deployed. But I am not sure if that should be with this PR, or a separate PR before a release (mentioning all changes in one shot).

smohan-dw
smohan-dw previously approved these changes Feb 8, 2024

#[pallet::call_index(3)]
#[pallet::weight({0})]
pub fn revoke(
Copy link
Member

Choose a reason for hiding this comment

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

Revoke in asset context is a status change according to the AssetStatusOf enum. If the asset status is inactive or expired, no more issuance should happen. We need to check the expected behaviour of transfers if the underlying asset is not active.

Copy link
Member Author

Choose a reason for hiding this comment

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

The logic of transfer and issuance only checks for 'ACTIVE' already in code, so any other status change would result in stopping of transfer and issuance from happening.

pub fn revoke(
origin: OriginFor<T>,
asset_id: AssetIdOf,
instance_id: Option<AssetInstanceIdOf>,
Copy link
Member

Choose a reason for hiding this comment

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

We need to implement the status change behaviour for assets and instances separately.

Copy link
Member Author

Choose a reason for hiding this comment

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

@smohan-dw looks like the comment is bit older than the review. Currently, the status change takes instance status change if instance is sent. Asset state is not changed. If instance is None, then asset status change happens.

Signed-off-by: Amar Tumballi <amar@dhiway.com>
@amarts
Copy link
Member Author

amarts commented Feb 13, 2024

Merging this as @smohan-dw's approval was present for commit without the version change. With this, we will be comfortable to update the existing chain without any major issues.

@amarts amarts merged commit 5f3e37c into dhiway:develop Feb 13, 2024
4 checks passed
@amarts amarts deleted the pallet_asset_revoke_v1 branch February 13, 2024 04:56
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.

pallet_asset: implement revoke() call
2 participants