diff --git a/.docs/contributing-book/src/documentation/library-quality/documentation/specification.md b/.docs/contributing-book/src/documentation/library-quality/documentation/specification.md index 1c7d489b..dcb2c5fa 100644 --- a/.docs/contributing-book/src/documentation/library-quality/documentation/specification.md +++ b/.docs/contributing-book/src/documentation/library-quality/documentation/specification.md @@ -8,7 +8,7 @@ For simplicity, a specification can be broken into two levels of detail and the A non-technical specification is aimed at an audience that may not have the expertise in an area to appreciate the technical challenges involved in achieving the goals and thus it can be seen as an overview or summary. -As an example, this may be a developer explaining how a user would interact with the user interface in order to send a coin / token to someone, without revealing the functionality behind signing a transaction and why a transaction may take some amount of time to be confirmed. +As an example, this may be a developer explaining how a user would interact with the user interface in order to send a coin / asset to someone, without revealing the functionality behind signing a transaction and why a transaction may take some amount of time to be confirmed. This type of specification is simple so that any layperson can follow the basic concepts of the workflow. diff --git a/README.md b/README.md index 400a3b9e..7faf89cb 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ These libraries contain helper functions and other tools valuable to blockchain #### Assets -- [Token](./libs/token/) provides helper functions for the [SRC-20](https://github.com/FuelLabs/sway-standards/tree/master/standards/src_20), [SRC-3](https://github.com/FuelLabs/sway-standards/tree/master/standards/src_3), and [SRC-7](https://github.com/FuelLabs/sway-standards/tree/master/standards/src_7) standards. +- [Native Assets](./libs/native_assets/) provides helper functions for the [SRC-20](https://github.com/FuelLabs/sway-standards/tree/master/standards/src20-native-asset), [SRC-3](https://github.com/FuelLabs/sway-standards/tree/master/standards/src_3), and [SRC-7](https://github.com/FuelLabs/sway-standards/tree/master/standards/src_7) standards. #### Access Control and Security diff --git a/libs/Forc.toml b/libs/Forc.toml index f5df0194..211a48e0 100644 --- a/libs/Forc.toml +++ b/libs/Forc.toml @@ -3,10 +3,10 @@ members = [ "admin", "fixed_point", "merkle_proof", + "native_asset", "ownership", "pausable", "queue", "reentrancy", "signed_integers", - "token", ] diff --git a/libs/merkle_proof/SPECIFICATION.md b/libs/merkle_proof/SPECIFICATION.md index 6025ebce..8aa5c7e9 100644 --- a/libs/merkle_proof/SPECIFICATION.md +++ b/libs/merkle_proof/SPECIFICATION.md @@ -6,7 +6,7 @@ It outlines the use cases, i.e. specification, and describes how to implement th # Use Cases -A common use case for Merkle Tree verification is airdrops. An airdrop is a method of distribution a set amount of tokens to a specified number of users. These often include a list of addresses and amounts. By posting the root hash, users can provide a proof and claim their airdrop. +A common use case for Merkle Tree verification is airdrops. An airdrop is a method of distribution a set amount of assets to a specified number of users. These often include a list of addresses and amounts. By posting the root hash, users can provide a proof and claim their airdrop. ## Public Functions diff --git a/libs/native_asset/.docs/asset-logo-dark-theme.png b/libs/native_asset/.docs/asset-logo-dark-theme.png new file mode 100644 index 00000000..08fcce98 Binary files /dev/null and b/libs/native_asset/.docs/asset-logo-dark-theme.png differ diff --git a/libs/native_asset/.docs/asset-logo-light-theme.png b/libs/native_asset/.docs/asset-logo-light-theme.png new file mode 100644 index 00000000..aa7cf51a Binary files /dev/null and b/libs/native_asset/.docs/asset-logo-light-theme.png differ diff --git a/libs/token/Forc.toml b/libs/native_asset/Forc.toml similarity index 53% rename from libs/token/Forc.toml rename to libs/native_asset/Forc.toml index 0bab2b9e..e8b42877 100644 --- a/libs/token/Forc.toml +++ b/libs/native_asset/Forc.toml @@ -2,7 +2,7 @@ authors = ["Fuel Labs "] entry = "lib.sw" license = "Apache-2.0" -name = "token" +name = "asset" [dependencies] -src_7 = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.2.2" } +src7 = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.3.3" } diff --git a/libs/token/README.md b/libs/native_asset/README.md similarity index 58% rename from libs/token/README.md rename to libs/native_asset/README.md index 2b0f6587..a5a0c859 100644 --- a/libs/token/README.md +++ b/libs/native_asset/README.md @@ -1,13 +1,13 @@

- - SwayApps logo + + SwayApps logo

# Overview -The Token library provides basic helper functions for the [SRC-20; Token Standard](https://github.com/FuelLabs/sway-standards/tree/master/standards/src_20), [SRC-3; Mint and Burn Standard](https://github.com/FuelLabs/sway-standards/tree/master/standards/src_3), and the [SRC-7; Arbitrary Asset Metadata Standard](https://github.com/FuelLabs/sway-standards/tree/master/standards/src_7). It is intended to make develpment of Native Assets using Sway quick and easy while following the standard's specifications. +The Native Asset Library provides basic helper functions for the [SRC-20; Native Asset Standard](https://github.com/FuelLabs/sway-standards/tree/master/standards/src20-native-asset), [SRC-3; Mint and Burn Standard](https://github.com/FuelLabs/sway-standards/tree/master/standards/src3-mint-burn), and the [SRC-7; Arbitrary Asset Metadata Standard](https://github.com/FuelLabs/sway-standards/tree/master/standards/src7-metadata). It is intended to make develpment of Native Assets using Sway quick and easy while following the standard's specifications. For more information please see the [specification](./SPECIFICATION.md). @@ -15,15 +15,15 @@ For more information please see the [specification](./SPECIFICATION.md). ## Getting Started -In order to use the Token library it must be added to the Forc.toml file and then imported into your Sway project. To add Sway-libs as a dependency to the Forc.toml file in your project please see the [README.md](../../README.md). +In order to use the Native Asset Library it must be added to the Forc.toml file and then imported into your Sway project. To add Sway-libs as a dependency to the Forc.toml file in your project please see the [README.md](../../README.md). -You may import the Token library's functionalities like so: +You may import the Native Asset Library's functionalities like so: ```rust -use token::*; +use asset::*; ``` -Once imported, the Token library's functions should be available. To use them, be sure to add the storage block bellow to your contract which enables the [SRC-20](https://github.com/FuelLabs/sway-standards/tree/master/standards/src_20) standard. +Once imported, the Native Asset Library's functions should be available. To use them, be sure to add the storage block bellow to your contract which enables the [SRC-20](https://github.com/FuelLabs/sway-standards/tree/master/standards/src20-native-asset) standard. ```rust storage { @@ -37,10 +37,10 @@ storage { ## Basic Functionality -To use a function, simply pass the `StorageKey` from the prescribed storage block above. The example below shows the implementation of the [SRC-20](https://github.com/FuelLabs/sway-standards/tree/master/standards/src_20) standard in combination with the Token library with no user defined restrictions or custom functionality. +To use a function, simply pass the `StorageKey` from the prescribed storage block above. The example below shows the implementation of the [SRC-20](https://github.com/FuelLabs/sway-standards/tree/master/standards/src20-native-asset) standard in combination with the Native Asset Library with no user defined restrictions or custom functionality. ```rust -use token::base::{ +use asset::base::{ _total_assets, _total_supply, _name, @@ -88,4 +88,4 @@ impl SRC20 for Contract { For more information please see the [specification](./SPECIFICATION.md). -> **NOTE** Until [Issue #5025](https://github.com/FuelLabs/sway/issues/5025) is resolved, in order to use the SRC-7 portion of the library, you must also add the [SRC-7](https://github.com/FuelLabs/sway-standards/tree/master/standards/src_7) standard as a dependency. +> **NOTE** Until [Issue #5025](https://github.com/FuelLabs/sway/issues/5025) is resolved, in order to use the SRC-7 portion of the library, you must also add the [SRC-7](https://github.com/FuelLabs/sway-standards/tree/master/standards/src7-metadata) standard as a dependency. diff --git a/libs/token/SPECIFICATION.md b/libs/native_asset/SPECIFICATION.md similarity index 74% rename from libs/token/SPECIFICATION.md rename to libs/native_asset/SPECIFICATION.md index c5a535eb..fdb07a98 100644 --- a/libs/token/SPECIFICATION.md +++ b/libs/native_asset/SPECIFICATION.md @@ -1,12 +1,12 @@ # Overview -This document provides an overview of the Token library. +This document provides an overview of the Native Asset Library. It outlines the use cases, i.e. specification, and describes how to implement the library. ## Use Cases -The Token library can be used anytime a contract needs a basic implementation of the [SRC-20](https://github.com/FuelLabs/sway-standards/tree/master/standards/src_20) and [SRC-3](https://github.com/FuelLabs/sway-standards/tree/master/standards/src_3) standards. +The Native Asset Library can be used anytime a contract needs a basic implementation of the [SRC-20](https://github.com/FuelLabs/sway-standards/tree/master/standards/src_20) and [SRC-3](https://github.com/FuelLabs/sway-standards/tree/master/standards/src_3) standards. ## Public Functions @@ -18,7 +18,7 @@ This function will return the total number of individual assets for a contract. #### `_total_supply()` -This function will return the total supply of tokens for an asset. +This function will return the total supply of coins for an asset. #### `_name()` @@ -48,11 +48,11 @@ This function will unconditionally set the decimals of an asset. #### `_mint()` -This function will unconditionally mint new tokens using a sub-identifier. +This function will unconditionally mint new assets using a sub-identifier. #### `_burn()` -This function will burns tokens with the given sub-identifier. +This function will burns assets with the given sub-identifier. ### SRC-7 diff --git a/libs/token/src/base.sw b/libs/native_asset/src/base.sw similarity index 95% rename from libs/token/src/base.sw rename to libs/native_asset/src/base.sw index 66bd3fca..10d36d54 100644 --- a/libs/token/src/base.sw +++ b/libs/native_asset/src/base.sw @@ -19,7 +19,7 @@ use std::{hash::{Hash, sha256}, storage::storage_string::*, string::String}; /// # Examples /// /// ```sway -/// use token::_total_assets; +/// use asset::_total_assets; /// /// storage { /// total_assets: u64 = 0, @@ -35,7 +35,7 @@ pub fn _total_assets(total_assets_key: StorageKey) -> u64 { total_assets_key.try_read().unwrap_or(0) } -/// Returns the total supply of tokens for an asset. +/// Returns the total supply of coins for an asset. /// /// # Arguments /// @@ -53,7 +53,7 @@ pub fn _total_assets(total_assets_key: StorageKey) -> u64 { /// # Examples /// /// ```sway -/// use token::_total_supply; +/// use asset::_total_supply; /// /// storage { /// total_supply: StorageMap = StorageMap {}, @@ -90,7 +90,7 @@ pub fn _total_supply( /// # Examples /// /// ```sway -/// use token::_name; +/// use asset::_name; /// use std::string::String; /// /// storage { @@ -127,7 +127,7 @@ pub fn _name( /// # Examples /// /// ```sway -/// use token::_symbol; +/// use asset::_symbol; /// use std::string::String; /// /// storage { @@ -150,7 +150,7 @@ pub fn _symbol( /// /// # Additional Information /// -/// e.g. 8, means to divide the token amount by 100000000 to get its user representation. +/// e.g. 8, means to divide the coins amount by 100000000 to get its user representation. /// /// # Arguments /// @@ -168,7 +168,7 @@ pub fn _symbol( /// # Examples /// /// ```sway -/// use token::_decimals; +/// use asset::_decimals; /// /// storage { /// decimals: StorageMap = StorageMap {}, @@ -205,7 +205,7 @@ pub fn _decimals( /// # Examples /// /// ```sway -/// use token::{_set_name, _name}; +/// use asset::{_set_name, _name}; /// use std::string::String; /// /// storage { @@ -246,7 +246,7 @@ pub fn _set_name( /// # Examples /// /// ```sway -/// use token::{_set_symbol, _symbol}; +/// use asset::{_set_symbol, _symbol}; /// use std::string::String; /// /// storage { @@ -287,7 +287,7 @@ pub fn _set_symbol( /// # Examples /// /// ```sway -/// use token::{_set_decimals, _decimals}; +/// use asset::{_set_decimals, _decimals}; /// use std::string::String; /// /// storage { @@ -308,7 +308,7 @@ pub fn _set_decimals( ) { decimals_key.insert(asset, decimals); } -abi SetTokenAttributes { +abi SetAssetAttributes { #[storage(write)] fn set_name(asset: AssetId, name: String); #[storage(write)] diff --git a/libs/native_asset/src/errors.sw b/libs/native_asset/src/errors.sw new file mode 100644 index 00000000..0f74207e --- /dev/null +++ b/libs/native_asset/src/errors.sw @@ -0,0 +1,7 @@ +library; + +/// Error log for when something goes wrong when burning assets. +pub enum BurnError { + /// Emitted when there are not enough coins owned by the contract to burn. + NotEnoughCoins: (), +} diff --git a/libs/token/src/lib.sw b/libs/native_asset/src/lib.sw similarity index 100% rename from libs/token/src/lib.sw rename to libs/native_asset/src/lib.sw diff --git a/libs/token/src/metadata.sw b/libs/native_asset/src/metadata.sw similarity index 96% rename from libs/token/src/metadata.sw rename to libs/native_asset/src/metadata.sw index 306c44b1..49d5a799 100644 --- a/libs/token/src/metadata.sw +++ b/libs/native_asset/src/metadata.sw @@ -1,6 +1,6 @@ library; -use src_7::Metadata; +use src7::Metadata; use std::{ bytes::Bytes, hash::{ @@ -42,7 +42,7 @@ impl StorageKey { /// /// ```sway /// use src_7::Metadata; - /// use token::metdata::*; + /// use asset::metadata::*; /// /// storage { /// metadata: StorageMetadata = StorageMetadata {} @@ -97,7 +97,7 @@ impl StorageKey { /// /// ```sway /// use src_7::Metadata; - /// use token::metdata::*; + /// use asset::metadata::*; /// /// storage { /// metadata: StorageMetadata = StorageMetadata {} @@ -149,7 +149,7 @@ impl StorageKey { /// /// ```sway /// use src_7::Metadata; -/// use token::metdata::*; +/// use asset::metadata::*; /// /// storage { /// metadata: StorageMetadata = StorageMetadata {} @@ -169,7 +169,7 @@ pub fn _set_metadata( metadata_key.insert(asset, key, metadata); } -abi SetTokenMetadata { +abi SetAssetMetadata { #[storage(read, write)] fn set_metadata(asset: AssetId, key: String, metadata: Metadata); } @@ -185,7 +185,7 @@ impl Metadata { /// /// ```sway /// use std::string::String; - /// use token::src_7::*; + /// use asset::metadata::*; /// use src_7::{SRC7, Metadata}; /// /// fn foo(contract_id: ContractId, asset: AssetId, key: String) { @@ -213,7 +213,7 @@ impl Metadata { /// /// ```sway /// use std::string::String; - /// use token::src_7::*; + /// use asset::metadata::*; /// use src_7::{SRC7, Metadata}; /// /// fn foo(contract_id: ContractId, asset: AssetId, key: String) { @@ -240,7 +240,7 @@ impl Metadata { /// /// ```sway /// use std::string::String; - /// use token::src_7::*; + /// use asset::metadata::*; /// use src_7::{SRC7, Metadata}; /// /// fn foo(contract_id: ContractId, asset: AssetId, key: String) { @@ -268,7 +268,7 @@ impl Metadata { /// /// ```sway /// use std::string::String; - /// use token::src_7::*; + /// use asset::metadata::*; /// use src_7::{SRC7, Metadata}; /// /// fn foo(contract_id: ContractId, asset: AssetId, key: String) { @@ -295,7 +295,7 @@ impl Metadata { /// /// ```sway /// use std::{bytes::Bytes, string::String}; - /// use token::src_7::*; + /// use asset::metadata::*; /// use src_7::{SRC7, Metadata}; /// /// fn foo(contract_id: ContractId, asset: AssetId, key: String) { @@ -323,7 +323,7 @@ impl Metadata { /// /// ```sway /// use std::{bytes::Bytes, string::String}; - /// use token::src_7::*; + /// use asset::metadata::*; /// use src_7::{SRC7, Metadata}; /// /// fn foo(contract_id: ContractId, asset: AssetId, key: String) { @@ -350,7 +350,7 @@ impl Metadata { /// /// ```sway /// use std::{constants::ZERO_B256, string::String}; - /// use token::src_7::*; + /// use asset::metadata::*; /// use src_7::{SRC7, Metadata}; /// /// fn foo(contract_id: ContractId, asset: AssetId, key: String) { @@ -378,7 +378,7 @@ impl Metadata { /// /// ```sway /// use std::string::String; - /// use token::src_7::*; + /// use asset::metadata::*; /// use src_7::{SRC7, Metadata}; /// /// fn foo(contract_id: ContractId, asset: AssetId, key: String) { diff --git a/libs/token/src/mint.sw b/libs/native_asset/src/mint.sw similarity index 85% rename from libs/token/src/mint.sw rename to libs/native_asset/src/mint.sw index afeda4db..78ad659d 100644 --- a/libs/token/src/mint.sw +++ b/libs/native_asset/src/mint.sw @@ -20,15 +20,15 @@ use std::{ string::String, }; -/// Unconditionally mints new tokens using the `sub_id` sub-identifier. +/// Unconditionally mints new assets using the `sub_id` sub-identifier. /// /// # Arguments /// /// * `total_assets_key`: [StorageKey] - The location in storage that the `u64` which represents the total assets is stored. /// * `total_supply_key`: [StorageKey>] - The location in storage which the `StorageMap` that stores the total supply of assets is stored. -/// * `recipient`: [Identity] - The user to which the newly minted tokens are transferred to. -/// * `sub_id`: [SubId] - The sub-identifier of the newly minted token. -/// * `amount`: [u64] - The quantity of tokens to mint. +/// * `recipient`: [Identity] - The user to which the newly minted asset is transferred to. +/// * `sub_id`: [SubId] - The sub-identifier of the newly minted asset. +/// * `amount`: [u64] - The quantity of coins to mint. /// /// # Returns /// @@ -42,7 +42,7 @@ use std::{ /// # Examples /// /// ```sway -/// use token::_mint; +/// use asset::mint::_mint; /// use std::{constants::ZERO_B256, context::balance_of}; /// /// storage { @@ -76,21 +76,21 @@ pub fn _mint( asset_id } -/// Burns tokens with the given `sub_id`. +/// Burns assets with the given `sub_id`. /// /// # Additional Information /// -/// **Warning** This function burns tokens unequivocally. It does not check that tokens are sent to the calling contract. +/// **Warning** This function burns assets unequivocally. It does not check that assets are sent to the calling contract. /// /// # Arguments /// /// * `total_assets_key`: [StorageKey] - The location in storage that the `u64` which represents the total assets is stored. -/// * `sub_id`: [SubId] - The sub-identifier of the token to burn. -/// * `amount`: [u64] - The quantity of tokens to burn. +/// * `sub_id`: [SubId] - The sub-identifier of the asset to burn. +/// * `amount`: [u64] - The quantity of coins to burn. /// /// # Reverts /// -/// * When the calling contract does not have enough tokens. +/// * When the calling contract does not have enough assets. /// /// # Number of Storage Accesses /// @@ -100,7 +100,7 @@ pub fn _mint( /// # Examples /// /// ```sway -/// use token::_burn; +/// use asset::mint::_burn; /// use std::{call_frames::contract_id, constants::ZERO_B256, context::balance_of}; /// /// storage { @@ -120,7 +120,7 @@ pub fn _burn( amount: u64, ) { let asset_id = AssetId::new(contract_id(), sub_id); - require(this_balance(asset_id) >= amount, BurnError::NotEnoughTokens); + require(this_balance(asset_id) >= amount, BurnError::NotEnoughCoins); // If we pass the check above, we can assume it is safe to unwrap. let supply = _total_supply(total_supply_key, asset_id).unwrap(); total_supply_key.insert(asset_id, supply - amount); diff --git a/libs/token/.docs/token-logo-dark-theme.png b/libs/token/.docs/token-logo-dark-theme.png deleted file mode 100644 index 2fa631ba..00000000 Binary files a/libs/token/.docs/token-logo-dark-theme.png and /dev/null differ diff --git a/libs/token/.docs/token-logo-light-theme.png b/libs/token/.docs/token-logo-light-theme.png deleted file mode 100644 index 3093dd88..00000000 Binary files a/libs/token/.docs/token-logo-light-theme.png and /dev/null differ diff --git a/libs/token/src/errors.sw b/libs/token/src/errors.sw deleted file mode 100644 index bf9a5135..00000000 --- a/libs/token/src/errors.sw +++ /dev/null @@ -1,7 +0,0 @@ -library; - -/// Error log for when something goes wrong when burning tokens. -pub enum BurnError { - /// Emitted when there are not enough tokens owned by the contract to burn. - NotEnoughTokens: (), -} diff --git a/tests/Forc.toml b/tests/Forc.toml index e6be5983..ed183090 100644 --- a/tests/Forc.toml +++ b/tests/Forc.toml @@ -25,6 +25,7 @@ members = [ "./src/fixed_point/ifp256_div_test", "./src/fixed_point/ifp256_test", "./src/merkle_proof", + "./src/native_asset", "./src/pausable", "./src/ownership", "./src/reentrancy/reentrancy_attacker_abi", @@ -43,5 +44,4 @@ members = [ "./src/signed_integers/signed_i16_twos_complement", "./src/signed_integers/signed_i32_twos_complement", "./src/signed_integers/signed_i64_twos_complement", - "./src/token", ] diff --git a/tests/src/native_asset/Forc.toml b/tests/src/native_asset/Forc.toml new file mode 100644 index 00000000..5e0d2446 --- /dev/null +++ b/tests/src/native_asset/Forc.toml @@ -0,0 +1,11 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "asset_test" + +[dependencies] +src20 = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.3.3" } +src3 = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.3.3" } +src7 = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.3.3" } +asset = { path = "../../../libs/native_asset" } diff --git a/tests/src/token/src/main.sw b/tests/src/native_asset/src/main.sw similarity index 93% rename from tests/src/token/src/main.sw rename to tests/src/native_asset/src/main.sw index 9fb2b843..923371da 100644 --- a/tests/src/token/src/main.sw +++ b/tests/src/native_asset/src/main.sw @@ -1,9 +1,9 @@ contract; -use src_20::SRC20; -use src_3::SRC3; -use src_7::{Metadata, SRC7}; -use token::{ +use src20::SRC20; +use src3::SRC3; +use src7::{Metadata, SRC7}; +use asset::{ base::{ _decimals, _name, @@ -13,7 +13,7 @@ use token::{ _symbol, _total_assets, _total_supply, - SetTokenAttributes, + SetAssetAttributes, }, metadata::*, mint::{ @@ -86,7 +86,7 @@ impl SRC7 for Contract { } } -impl SetTokenAttributes for Contract { +impl SetAssetAttributes for Contract { #[storage(write)] fn set_name(asset: AssetId, name: String) { _set_name(storage.name, asset, name); @@ -103,7 +103,7 @@ impl SetTokenAttributes for Contract { } } -impl SetTokenMetadata for Contract { +impl SetAssetMetadata for Contract { #[storage(read, write)] fn set_metadata(asset: AssetId, key: String, metadata: Metadata) { _set_metadata(storage.metadata, asset, key, metadata); @@ -155,12 +155,12 @@ fn test_name() { use std::constants::ZERO_B256; let src20_abi = abi(SRC20, CONTRACT_ID); - let attributes_abi = abi(SetTokenAttributes, CONTRACT_ID); + let attributes_abi = abi(SetAssetAttributes, CONTRACT_ID); let recipient = Identity::ContractId(ContractId::from(CONTRACT_ID)); let sub_id = ZERO_B256; let asset_id = AssetId::new(ContractId::from(CONTRACT_ID), sub_id); - let name = String::from_ascii_str("Fuel Token"); + let name = String::from_ascii_str("Fuel Asset"); assert(src20_abi.name(asset_id).is_none()); @@ -173,7 +173,7 @@ fn test_symbol() { use std::constants::ZERO_B256; let src20_abi = abi(SRC20, CONTRACT_ID); - let attributes_abi = abi(SetTokenAttributes, CONTRACT_ID); + let attributes_abi = abi(SetAssetAttributes, CONTRACT_ID); let recipient = Identity::ContractId(ContractId::from(CONTRACT_ID)); let sub_id = ZERO_B256; @@ -191,7 +191,7 @@ fn test_decimals() { use std::constants::ZERO_B256; let src20_abi = abi(SRC20, CONTRACT_ID); - let attributes_abi = abi(SetTokenAttributes, CONTRACT_ID); + let attributes_abi = abi(SetAssetAttributes, CONTRACT_ID); let recipient = Identity::ContractId(ContractId::from(CONTRACT_ID)); let sub_id = ZERO_B256; @@ -313,7 +313,7 @@ fn test_set_metadata_b256() { let metadata = Metadata::B256(data_b256); let asset_id = AssetId::new(ContractId::from(CONTRACT_ID), ZERO_B256); let src7_abi = abi(SRC7, CONTRACT_ID); - let set_metadata_abi = abi(SetTokenMetadata, CONTRACT_ID); + let set_metadata_abi = abi(SetAssetMetadata, CONTRACT_ID); let key = String::from_ascii_str("my_key"); set_metadata_abi.set_metadata(asset_id, key, metadata); @@ -331,7 +331,7 @@ fn test_set_metadata_u64() { let metadata = Metadata::Int(data_int); let asset_id = AssetId::new(ContractId::from(CONTRACT_ID), ZERO_B256); let src7_abi = abi(SRC7, CONTRACT_ID); - let set_metadata_abi = abi(SetTokenMetadata, CONTRACT_ID); + let set_metadata_abi = abi(SetAssetMetadata, CONTRACT_ID); let key = String::from_ascii_str("my_key"); set_metadata_abi.set_metadata(asset_id, key, metadata); @@ -349,7 +349,7 @@ fn test_set_metadata_string() { let metadata = Metadata::String(data_string); let asset_id = AssetId::new(ContractId::from(CONTRACT_ID), ZERO_B256); let src7_abi = abi(SRC7, CONTRACT_ID); - let set_metadata_abi = abi(SetTokenMetadata, CONTRACT_ID); + let set_metadata_abi = abi(SetAssetMetadata, CONTRACT_ID); let key = String::from_ascii_str("my_key"); set_metadata_abi.set_metadata(asset_id, key, metadata); @@ -367,7 +367,7 @@ fn test_set_metadata_bytes() { let metadata = Metadata::Bytes(data_bytes); let asset_id = AssetId::new(ContractId::from(CONTRACT_ID), ZERO_B256); let src7_abi = abi(SRC7, CONTRACT_ID); - let set_metadata_abi = abi(SetTokenMetadata, CONTRACT_ID); + let set_metadata_abi = abi(SetAssetMetadata, CONTRACT_ID); let key = String::from_ascii_str("my_key"); set_metadata_abi.set_metadata(asset_id, key, metadata); diff --git a/tests/src/token/Forc.toml b/tests/src/token/Forc.toml deleted file mode 100644 index fcf1def2..00000000 --- a/tests/src/token/Forc.toml +++ /dev/null @@ -1,11 +0,0 @@ -[project] -authors = ["Fuel Labs "] -entry = "main.sw" -license = "Apache-2.0" -name = "token_test" - -[dependencies] -src_20 = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.2.2" } -src_3 = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.2.2" } -src_7 = { git = "https://github.com/FuelLabs/sway-standards", tag = "v0.2.2" } -token = { path = "../../../libs/token" }