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

Feature request: transfer to object #8816

Closed
JackyDisc opened this issue Mar 3, 2023 · 2 comments
Closed

Feature request: transfer to object #8816

JackyDisc opened this issue Mar 3, 2023 · 2 comments
Labels

Comments

@JackyDisc
Copy link

Feature Description

Extend the 0x2::transfer::transfer system method and sui::pay module to support transferring assets to objects. Specifically, allow the to address to be an object ID or address in addition to an account address.

Rationale

Currently, to transfer assets to an object, users need to send assets via dynamic fields through a function call defined by the module of the object type. This method is technically sufficient but creates friction for user experience. For example, it reduces on-chain composability for object-based treasury management applications such as multi-sig, smart contract wallets, and DAO management tools with treasury.

By extending the 0x2::transfer::transfer system method and sui::pay module to support transferring assets to objects directly, users can transfer assets without needing to know and call customized deposit functions. This will improve the user experience and increase on-chain composability for object-based treasury management applications.

Proposed Solution

To implement this feature, the following changes should be made:

  • Extend the 0x2::transfer::transfer system method to allow the to address to be an object ID or address in addition to an account address. When the to address is an object, the move should call dynamic_object_field::add to add the asset to the object.

  • In the sui::pay module, extend the join_vec_and_transfer and split_and_transfer methods to allow the receiver parameter to be an object ID or address in addition to an account address. When the receiver is an object, move should transfer the coins to the object following the standard of coin management for move account.

  • (Optional) Add an acceptTransfer flag to the Object structure. The acceptTransfer flag is a boolean value indicating whether the object accepts assets sent via transfer. Transferring assets to an object whose acceptTransfer flag is false will abort with an error code. The acceptTransfer flag can be set by the move language, similar to transfer::share_object.

By implementing these changes, users will be able to transfer assets to objects directly, improving the user experience and increasing on-chain composability for object-based treasury management applications. The optional acceptTransfer flag will provide an additional layer of security by allowing objects to explicitly indicate whether they accept asset transfers or not.

@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2023

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label May 3, 2023
@stefan-mysten
Copy link
Contributor

Thanks for the suggestion. We indeed have been working on this recently, see #12658

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants