Module 0xd5044d9f4b80910ef7b8910a68d2ac257d14319fb9315ddce1ca5190878bc8ea::coin_migrator

@title Coin Migrator Module @author Aave @notice Implements functionality to convert Aptos Coin to FungibleAsset

use 0x1::coin;
use 0x1::event;
use 0x1::fungible_asset;
use 0x1::object;
use 0x1::option;
use 0x1::primary_fungible_store;
use 0x1::signer;
use 0x1::string;
use 0x1::type_info;
use 0xa888dd108ea636a234c973b8b72b9cadf0c7ae94d6f355c64dde9fdc275724ee::error_config;

Struct CoinToFaConvertion

@notice Emitted when a Coin is converted to a FungibleAsset @param user The address of the user who performed the conversion @param amount The amount of coins converted @param name The name of the fungible asset @param symbol The symbol of the fungible asset @param decimals The number of decimals for the fungible asset @param coin_address The address of the coin type @param fa_address The address of the fungible asset

#[event]
struct CoinToFaConvertion has drop, store

Function coin_to_fa

@notice Converts Aptos Coin to FungibleAsset @dev Withdraws coins from the user's account and converts them to fungible assets @param account The signer account of the user @param amount The amount of coins to convert

public fun coin_to_fa<CoinType>(account: &signer, amount: u64): object::Object<fungible_asset::Metadata>

Function get_fa_address

@notice Gets the address of the fungible asset that corresponds to a coin type @dev Returns the address of the fungible asset metadata object @return The address of the fungible asset

#[view]
public fun get_fa_address<CoinType>(): address

Function get_fa_balance

@notice Gets the balance of fungible assets for a given coin type and owner @dev Returns 0 if the coin type is not mapped to a fungible asset @param owner The address of the owner @return The balance of fungible assets

#[view]
public fun get_fa_balance<CoinType>(owner: address): u64