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

[fungible_asset] a layered design #7183

Merged
merged 20 commits into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions aptos-move/framework/aptos-framework/doc/create_signer.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ on account to have access to this.



<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="create_signer.md#0x1_create_signer">create_signer</a>(addr: <b>address</b>): <a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>
<pre><code><b>public</b> <b>fun</b> <a href="create_signer.md#0x1_create_signer">create_signer</a>(addr: <b>address</b>): <a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>
</code></pre>


Expand All @@ -39,7 +39,7 @@ on account to have access to this.
<summary>Implementation</summary>


<pre><code><b>public</b>(<b>friend</b>) <b>native</b> <b>fun</b> <a href="create_signer.md#0x1_create_signer">create_signer</a>(addr: <b>address</b>): <a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>;
<pre><code><b>public</b> <b>native</b> <b>fun</b> <a href="create_signer.md#0x1_create_signer">create_signer</a>(addr: <b>address</b>): <a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>;
</code></pre>


Expand All @@ -63,7 +63,7 @@ on account to have access to this.
### Function `create_signer`


<pre><code><b>public</b>(<b>friend</b>) <b>fun</b> <a href="create_signer.md#0x1_create_signer">create_signer</a>(addr: <b>address</b>): <a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>
<pre><code><b>public</b> <b>fun</b> <a href="create_signer.md#0x1_create_signer">create_signer</a>(addr: <b>address</b>): <a href="../../aptos-stdlib/../move-stdlib/doc/signer.md#0x1_signer">signer</a>
</code></pre>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ module aptos_framework::create_signer {
friend aptos_framework::multisig_account;
friend aptos_framework::object;

public(friend) native fun create_signer(addr: address): signer;
public native fun create_signer(addr: address): signer;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please ignore for now but I need this for the creation of FungibleAssetIndex and FungibleAsset object with deposit from nowhere.

I suppose we'll merge this package into AptosFramework sooner or later so it's okay to use this function.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure why we need to share the signer... if we jump to this, we're missing a permissions model.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we are missing the permission model. I don't mean this is the final change. It is just a hack for me to test. The way we jump to this is:

  1. make FA module in the framework.
  2. friend FA module here and keeep public(friend)

I need this to create a FA object from nowhere when getting money the first time. It's for unilateral transfer.

Copy link
Contributor

Choose a reason for hiding this comment

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

In general, to create a new object we need a signer. When we're sending coins to someone for the first time and they don't have the object to store them, there's not a perfect signer to use (using sender's signer can be strange)

}
10 changes: 10 additions & 0 deletions aptos-move/move-examples/fungible_asset/Move.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "FungibleAsset"
version = "0.0.0"

[addresses]
aptos_framework = "0x1"
fungible_asset = "_"

[dependencies]
AptosFramework = { local = "../../framework/aptos-framework" }
Loading