Manage Fungible Assets with Multisig
This tutorial introduces a practical use case that combines Aptos framework multisig account with fungible asset standard to enhance the security margin of the management of fungible assets. Make sure you have understood module publishing and Aptos framework multisig account before moving on to the tutorial. If not, it is highly recommended to try out the following tutorials first:
Step 1: Pick an SDK
Section titled “Step 1: Pick an SDK”This tutorial was created for the TypeScript SDK.
Other developers are invited to add support for the Python SDK, Rust SDK, and Go SDK!
Step 2: Publish the module
Section titled “Step 2: Publish the module”To create a fungible asset controlled by an Aptos framework multisig account
with all the administrative operations (mint, transfer, burn, freeze/unfreeze),
a well-designed smart contract based on fungible asset standard is a
prerequisite. The Aptos team provides an example code in aptos-core repo.
Clone the aptos-core repo:
git clone git@github.com:aptos-labs/aptos-core.git ~/aptos-coreNavigate to the managed_fungible_asset directory and then publish this package
onto your default account using CLI:
cd ~/aptos-core/aptos-move/move-examples/fungible_asset/managed_fungible_assetaptos move publish --named-addresses example_addr=defaultNavigate to the multisig_managed_coin directory and then publish this package
onto your default account using CLI too:
cd ~/aptos-core/aptos-move/move-examples/fungible_asset/multisig_managed_coinaptos move publish --named-addresses example_addr=defaultFor this tutorial, multisig_managed_coin need to call functions defined
in managed_fungible_asset on the same address. So both modules have to be
published.
Step 3: Understand the on-chain flow
Section titled “Step 3: Understand the on-chain flow”The TypeScript example that used to live under
aptos-core/ecosystem/typescript/sdk was removed when the SDK moved to
aptos-ts-sdk. Use the Move
packages you just published, then drive the same flow with the current SDK
multisig APIs.
- Move:
managed_fungible_assetandmultisig_managed_coin - TypeScript SDK multisig (create, propose, approve, execute):
examples/typescript-esm/multisig_v2.ts - Beginner walkthrough: Your First Multisig
The intended flow is:
Generate single-signer accounts
Section titled “Generate single-signer accounts”Generate three accounts — owner1, owner2, and owner3 — that will co-own an Aptos framework multisig account.
Create a framework multisig that administers a fungible asset
Section titled “Create a framework multisig that administers a fungible asset”Have owner1 call initialize() in multisig_managed_coin.move. That function
creates a framework multisig owned by owner1, adds owner2 and owner3, creates a
fungible asset (“meme coin”) with the settings in the argument list, and makes
the multisig the asset admin. Each proposal needs at least two approvals.
Mint 1000 units to owner2 and 2000 to owner3. Owner2 submits the proposal; owner3 approves it; then execute.
Freeze
Section titled “Freeze”Freeze owner1’s primary store. Owner2 submits; owner3 approves. Unfreeze is the
same call with the last argument set to false.
Force transfer
Section titled “Force transfer”While owner1 is frozen, a normal transfer cannot withdraw from or deposit to that account. The multisig, as admin, can still force-transfer 1000 units from owner3 to owner1. Owner2 proposes; owner1 approves.
Burn 1000 units from each owner. Owner2 proposes; owner1 approves.
Conclusion
Section titled “Conclusion”This tutorial shows an end-to-end flow of using an Aptos framework multisig account to administer a fungible asset. You can publish your own module and use the current SDK to build an administration scheme that fits your needs.