diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 40f91078..bd9a3e22 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,9 +15,9 @@ concurrency: env: CARGO_TERM_COLOR: always REGISTRY: ghcr.io - RUST_VERSION: 1.69.0 - FORC_VERSION: 0.40.1 - CORE_VERSION: 0.18.1 + RUST_VERSION: 1.71.1 + FORC_VERSION: 0.44.1 + CORE_VERSION: 0.20.3 PATH_TO_SCRIPTS: .github/scripts jobs: diff --git a/README.md b/README.md index bcea2587..412758dd 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,6 @@ These libraries contain helper functions and other tools valuable to blockchain ### Libraries - [Binary Merkle Proof](./libs/merkle_proof/) is used to verify Binary Merkle Trees computed off-chain. -- [Non-Fungible Token (NFT)](./libs/nft/) is a token library which provides unqiue collectibles, identified and differentiated by token IDs. - [Ownership](./libs/ownership/) is used to apply restrictions on functions such that only a single user may call them. - [Reentrancy](./libs/reentrancy) is used to detect and prevent reentrancy attacks. - [Signed Integers](./libs/signed_integers/) is an interface to implement signed integers. diff --git a/libs/Forc.toml b/libs/Forc.toml index cb01c66f..4f65153e 100644 --- a/libs/Forc.toml +++ b/libs/Forc.toml @@ -2,7 +2,6 @@ members = [ "fixed_point", "merkle_proof", - "nft", "ownership", "queue", "reentrancy", diff --git a/libs/nft/.docs/NFT-logo-dark-theme.png b/libs/archive/nft/.docs/NFT-logo-dark-theme.png similarity index 100% rename from libs/nft/.docs/NFT-logo-dark-theme.png rename to libs/archive/nft/.docs/NFT-logo-dark-theme.png diff --git a/libs/nft/.docs/NFT-logo-light-theme.png b/libs/archive/nft/.docs/NFT-logo-light-theme.png similarity index 100% rename from libs/nft/.docs/NFT-logo-light-theme.png rename to libs/archive/nft/.docs/NFT-logo-light-theme.png diff --git a/libs/nft/Forc.toml b/libs/archive/nft/Forc.toml similarity index 100% rename from libs/nft/Forc.toml rename to libs/archive/nft/Forc.toml diff --git a/libs/nft/README.md b/libs/archive/nft/README.md similarity index 89% rename from libs/nft/README.md rename to libs/archive/nft/README.md index dccca061..7a4da438 100644 --- a/libs/nft/README.md +++ b/libs/archive/nft/README.md @@ -5,6 +5,9 @@

+> **Warning** +> This library has been deprecated with the introduction of [Sway multi-token standard](https://github.com/FuelLabs/sway-standards/issues/1). Use of this library is *highly* discouraged. The last supported version is forc v0.40.1. + ## Overview A non-fungible token (NFT) is a unique token that has an identifier which distinguishes itself from other tokens within the same token contract. Unlike Fuel's Native Assets, these tokens are not fungible with one another and may contain metadata or other traits giving them distinctive characteristics. diff --git a/libs/nft/SPECIFICATION.md b/libs/archive/nft/SPECIFICATION.md similarity index 100% rename from libs/nft/SPECIFICATION.md rename to libs/archive/nft/SPECIFICATION.md diff --git a/libs/nft/src/extensions.sw b/libs/archive/nft/src/extensions.sw similarity index 100% rename from libs/nft/src/extensions.sw rename to libs/archive/nft/src/extensions.sw diff --git a/libs/nft/src/extensions/administrator.sw b/libs/archive/nft/src/extensions/administrator.sw similarity index 100% rename from libs/nft/src/extensions/administrator.sw rename to libs/archive/nft/src/extensions/administrator.sw diff --git a/libs/nft/src/extensions/administrator/administrator_errors.sw b/libs/archive/nft/src/extensions/administrator/administrator_errors.sw similarity index 100% rename from libs/nft/src/extensions/administrator/administrator_errors.sw rename to libs/archive/nft/src/extensions/administrator/administrator_errors.sw diff --git a/libs/nft/src/extensions/administrator/administrator_events.sw b/libs/archive/nft/src/extensions/administrator/administrator_events.sw similarity index 100% rename from libs/nft/src/extensions/administrator/administrator_events.sw rename to libs/archive/nft/src/extensions/administrator/administrator_events.sw diff --git a/libs/nft/src/extensions/burnable.sw b/libs/archive/nft/src/extensions/burnable.sw similarity index 100% rename from libs/nft/src/extensions/burnable.sw rename to libs/archive/nft/src/extensions/burnable.sw diff --git a/libs/nft/src/extensions/burnable/burnable_events.sw b/libs/archive/nft/src/extensions/burnable/burnable_events.sw similarity index 100% rename from libs/nft/src/extensions/burnable/burnable_events.sw rename to libs/archive/nft/src/extensions/burnable/burnable_events.sw diff --git a/libs/nft/src/extensions/supply.sw b/libs/archive/nft/src/extensions/supply.sw similarity index 100% rename from libs/nft/src/extensions/supply.sw rename to libs/archive/nft/src/extensions/supply.sw diff --git a/libs/nft/src/extensions/supply/supply_errors.sw b/libs/archive/nft/src/extensions/supply/supply_errors.sw similarity index 100% rename from libs/nft/src/extensions/supply/supply_errors.sw rename to libs/archive/nft/src/extensions/supply/supply_errors.sw diff --git a/libs/nft/src/extensions/supply/supply_events.sw b/libs/archive/nft/src/extensions/supply/supply_events.sw similarity index 100% rename from libs/nft/src/extensions/supply/supply_events.sw rename to libs/archive/nft/src/extensions/supply/supply_events.sw diff --git a/libs/nft/src/extensions/token_metadata.sw b/libs/archive/nft/src/extensions/token_metadata.sw similarity index 100% rename from libs/nft/src/extensions/token_metadata.sw rename to libs/archive/nft/src/extensions/token_metadata.sw diff --git a/libs/nft/src/extensions/token_metadata/token_metadata_structures.sw b/libs/archive/nft/src/extensions/token_metadata/token_metadata_structures.sw similarity index 100% rename from libs/nft/src/extensions/token_metadata/token_metadata_structures.sw rename to libs/archive/nft/src/extensions/token_metadata/token_metadata_structures.sw diff --git a/libs/nft/src/lib.sw b/libs/archive/nft/src/lib.sw similarity index 100% rename from libs/nft/src/lib.sw rename to libs/archive/nft/src/lib.sw diff --git a/libs/nft/src/nft_core.sw b/libs/archive/nft/src/nft_core.sw similarity index 100% rename from libs/nft/src/nft_core.sw rename to libs/archive/nft/src/nft_core.sw diff --git a/libs/nft/src/nft_core/errors.sw b/libs/archive/nft/src/nft_core/errors.sw similarity index 100% rename from libs/nft/src/nft_core/errors.sw rename to libs/archive/nft/src/nft_core/errors.sw diff --git a/libs/nft/src/nft_core/events.sw b/libs/archive/nft/src/nft_core/events.sw similarity index 100% rename from libs/nft/src/nft_core/events.sw rename to libs/archive/nft/src/nft_core/events.sw diff --git a/libs/nft/src/nft_core/nft_storage.sw b/libs/archive/nft/src/nft_core/nft_storage.sw similarity index 100% rename from libs/nft/src/nft_core/nft_storage.sw rename to libs/archive/nft/src/nft_core/nft_storage.sw diff --git a/libs/fixed_point/src/ufp32.sw b/libs/fixed_point/src/ufp32.sw index 1d4c081f..fdb559f3 100644 --- a/libs/fixed_point/src/ufp32.sw +++ b/libs/fixed_point/src/ufp32.sw @@ -169,12 +169,12 @@ impl core::ops::Subtract for UFP32 { impl core::ops::Multiply for UFP32 { /// Multiply a UFP32 with a UFP32. Panics of overflow. fn multiply(self, other: Self) -> Self { - let self_u64: u64 = self.value; - let other_u64: u64 = other.value; + let self_u64: u64 = self.value.as_u64(); + let other_u64: u64 = other.value.as_u64(); let self_multiply_other = self_u64 * other_u64; let res_u64 = self_multiply_other >> 16; - if res_u64 > u32::max() { + if res_u64 > u32::max().as_u64() { // panic on overflow revert(0); } @@ -191,18 +191,18 @@ impl core::ops::Divide for UFP32 { let zero = UFP32::zero(); assert(divisor != zero); - let denominator: u64 = Self::denominator(); + let denominator: u64 = Self::denominator().as_u64(); // Conversion to U64 done to ensure no overflow happen // and maximal precision is avaliable // as it makes possible to multiply by the denominator in // all cases - let self_u64: u64 = self.value; - let divisor_u64: u64 = divisor.value; + let self_u64: u64 = self.value.as_u64(); + let divisor_u64: u64 = divisor.value.as_u64(); // Multiply by denominator to ensure accuracy let res_u64 = self_u64 * denominator / divisor_u64; - if res_u64 > u32::max() { + if res_u64 > u32::max().as_u64() { // panic on overflow revert(0); } @@ -454,7 +454,7 @@ impl Power for UFP32 { // which means that the denominator is always 2 ^ 16 // we need to divide the nominator by 2 ^ (16 * exponent - 1) // - 1 is the formula is due to denominator need to stay 2 ^ 16 - let nominator = nominator_pow >> 16 * (exponent_int - 1u32); + let nominator = nominator_pow >> 16 * (exponent_int - 1u32).as_u64(); if nominator > u32::max() { // panic on overflow diff --git a/tests/Cargo.toml b/tests/Cargo.toml index f6fc64a5..2822283a 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -7,7 +7,7 @@ license = "Apache-2.0" [dependencies] fuel-merkle = { version = "0.33.0" } -fuels = { version = "0.42.0", features = ["fuel-core-lib"] } +fuels = { version = "0.46.0", features = ["fuel-core-lib"] } sha2 = { version = "0.10" } tokio = { version = "1.12", features = ["rt", "macros"] } diff --git a/tests/Forc.toml b/tests/Forc.toml index 2ecb0847..5b10ca8e 100644 --- a/tests/Forc.toml +++ b/tests/Forc.toml @@ -24,8 +24,6 @@ members = [ "./src/fixed_point/ifp256_div_test", "./src/fixed_point/ifp256_test", "./src/merkle_proof", - "./src/nft/nft_core", - "./src/nft/nft_extensions", "./src/ownership", "./src/reentrancy/reentrancy_attacker_abi", "./src/reentrancy/reentrancy_attacker_contract", diff --git a/tests/src/nft/mod.rs b/tests/src/archive/nft/mod.rs similarity index 100% rename from tests/src/nft/mod.rs rename to tests/src/archive/nft/mod.rs diff --git a/tests/src/nft/nft_core/.gitignore b/tests/src/archive/nft/nft_core/.gitignore similarity index 100% rename from tests/src/nft/nft_core/.gitignore rename to tests/src/archive/nft/nft_core/.gitignore diff --git a/tests/src/nft/nft_core/Forc.toml b/tests/src/archive/nft/nft_core/Forc.toml similarity index 100% rename from tests/src/nft/nft_core/Forc.toml rename to tests/src/archive/nft/nft_core/Forc.toml diff --git a/tests/src/nft/nft_core/mod.rs b/tests/src/archive/nft/nft_core/mod.rs similarity index 100% rename from tests/src/nft/nft_core/mod.rs rename to tests/src/archive/nft/nft_core/mod.rs diff --git a/tests/src/nft/nft_core/src/main.sw b/tests/src/archive/nft/nft_core/src/main.sw similarity index 100% rename from tests/src/nft/nft_core/src/main.sw rename to tests/src/archive/nft/nft_core/src/main.sw diff --git a/tests/src/nft/nft_core/tests/functions/approve.rs b/tests/src/archive/nft/nft_core/tests/functions/approve.rs similarity index 100% rename from tests/src/nft/nft_core/tests/functions/approve.rs rename to tests/src/archive/nft/nft_core/tests/functions/approve.rs diff --git a/tests/src/nft/nft_core/tests/functions/approved.rs b/tests/src/archive/nft/nft_core/tests/functions/approved.rs similarity index 100% rename from tests/src/nft/nft_core/tests/functions/approved.rs rename to tests/src/archive/nft/nft_core/tests/functions/approved.rs diff --git a/tests/src/nft/nft_core/tests/functions/balance_of.rs b/tests/src/archive/nft/nft_core/tests/functions/balance_of.rs similarity index 100% rename from tests/src/nft/nft_core/tests/functions/balance_of.rs rename to tests/src/archive/nft/nft_core/tests/functions/balance_of.rs diff --git a/tests/src/nft/nft_core/tests/functions/is_approved_for_all.rs b/tests/src/archive/nft/nft_core/tests/functions/is_approved_for_all.rs similarity index 100% rename from tests/src/nft/nft_core/tests/functions/is_approved_for_all.rs rename to tests/src/archive/nft/nft_core/tests/functions/is_approved_for_all.rs diff --git a/tests/src/nft/nft_core/tests/functions/mint.rs b/tests/src/archive/nft/nft_core/tests/functions/mint.rs similarity index 100% rename from tests/src/nft/nft_core/tests/functions/mint.rs rename to tests/src/archive/nft/nft_core/tests/functions/mint.rs diff --git a/tests/src/nft/nft_core/tests/functions/mod.rs b/tests/src/archive/nft/nft_core/tests/functions/mod.rs similarity index 100% rename from tests/src/nft/nft_core/tests/functions/mod.rs rename to tests/src/archive/nft/nft_core/tests/functions/mod.rs diff --git a/tests/src/nft/nft_core/tests/functions/owner_of.rs b/tests/src/archive/nft/nft_core/tests/functions/owner_of.rs similarity index 100% rename from tests/src/nft/nft_core/tests/functions/owner_of.rs rename to tests/src/archive/nft/nft_core/tests/functions/owner_of.rs diff --git a/tests/src/nft/nft_core/tests/functions/set_approval_for_all.rs b/tests/src/archive/nft/nft_core/tests/functions/set_approval_for_all.rs similarity index 100% rename from tests/src/nft/nft_core/tests/functions/set_approval_for_all.rs rename to tests/src/archive/nft/nft_core/tests/functions/set_approval_for_all.rs diff --git a/tests/src/nft/nft_core/tests/functions/tokens_minted.rs b/tests/src/archive/nft/nft_core/tests/functions/tokens_minted.rs similarity index 100% rename from tests/src/nft/nft_core/tests/functions/tokens_minted.rs rename to tests/src/archive/nft/nft_core/tests/functions/tokens_minted.rs diff --git a/tests/src/nft/nft_core/tests/functions/transfer.rs b/tests/src/archive/nft/nft_core/tests/functions/transfer.rs similarity index 100% rename from tests/src/nft/nft_core/tests/functions/transfer.rs rename to tests/src/archive/nft/nft_core/tests/functions/transfer.rs diff --git a/tests/src/nft/nft_core/tests/mod.rs b/tests/src/archive/nft/nft_core/tests/mod.rs similarity index 100% rename from tests/src/nft/nft_core/tests/mod.rs rename to tests/src/archive/nft/nft_core/tests/mod.rs diff --git a/tests/src/nft/nft_core/tests/utils/mod.rs b/tests/src/archive/nft/nft_core/tests/utils/mod.rs similarity index 100% rename from tests/src/nft/nft_core/tests/utils/mod.rs rename to tests/src/archive/nft/nft_core/tests/utils/mod.rs diff --git a/tests/src/nft/nft_extensions/.gitignore b/tests/src/archive/nft/nft_extensions/.gitignore similarity index 100% rename from tests/src/nft/nft_extensions/.gitignore rename to tests/src/archive/nft/nft_extensions/.gitignore diff --git a/tests/src/nft/nft_extensions/Forc.toml b/tests/src/archive/nft/nft_extensions/Forc.toml similarity index 100% rename from tests/src/nft/nft_extensions/Forc.toml rename to tests/src/archive/nft/nft_extensions/Forc.toml diff --git a/tests/src/nft/nft_extensions/mod.rs b/tests/src/archive/nft/nft_extensions/mod.rs similarity index 100% rename from tests/src/nft/nft_extensions/mod.rs rename to tests/src/archive/nft/nft_extensions/mod.rs diff --git a/tests/src/nft/nft_extensions/src/main.sw b/tests/src/archive/nft/nft_extensions/src/main.sw similarity index 100% rename from tests/src/nft/nft_extensions/src/main.sw rename to tests/src/archive/nft/nft_extensions/src/main.sw diff --git a/tests/src/nft/nft_extensions/tests/functions/admin.rs b/tests/src/archive/nft/nft_extensions/tests/functions/admin.rs similarity index 100% rename from tests/src/nft/nft_extensions/tests/functions/admin.rs rename to tests/src/archive/nft/nft_extensions/tests/functions/admin.rs diff --git a/tests/src/nft/nft_extensions/tests/functions/burn.rs b/tests/src/archive/nft/nft_extensions/tests/functions/burn.rs similarity index 100% rename from tests/src/nft/nft_extensions/tests/functions/burn.rs rename to tests/src/archive/nft/nft_extensions/tests/functions/burn.rs diff --git a/tests/src/nft/nft_extensions/tests/functions/max_supply.rs b/tests/src/archive/nft/nft_extensions/tests/functions/max_supply.rs similarity index 100% rename from tests/src/nft/nft_extensions/tests/functions/max_supply.rs rename to tests/src/archive/nft/nft_extensions/tests/functions/max_supply.rs diff --git a/tests/src/nft/nft_extensions/tests/functions/meta_data.rs b/tests/src/archive/nft/nft_extensions/tests/functions/meta_data.rs similarity index 100% rename from tests/src/nft/nft_extensions/tests/functions/meta_data.rs rename to tests/src/archive/nft/nft_extensions/tests/functions/meta_data.rs diff --git a/tests/src/nft/nft_extensions/tests/functions/mod.rs b/tests/src/archive/nft/nft_extensions/tests/functions/mod.rs similarity index 100% rename from tests/src/nft/nft_extensions/tests/functions/mod.rs rename to tests/src/archive/nft/nft_extensions/tests/functions/mod.rs diff --git a/tests/src/nft/nft_extensions/tests/functions/set_admin.rs b/tests/src/archive/nft/nft_extensions/tests/functions/set_admin.rs similarity index 100% rename from tests/src/nft/nft_extensions/tests/functions/set_admin.rs rename to tests/src/archive/nft/nft_extensions/tests/functions/set_admin.rs diff --git a/tests/src/nft/nft_extensions/tests/functions/set_max_supply.rs b/tests/src/archive/nft/nft_extensions/tests/functions/set_max_supply.rs similarity index 100% rename from tests/src/nft/nft_extensions/tests/functions/set_max_supply.rs rename to tests/src/archive/nft/nft_extensions/tests/functions/set_max_supply.rs diff --git a/tests/src/nft/nft_extensions/tests/functions/set_meta_data.rs b/tests/src/archive/nft/nft_extensions/tests/functions/set_meta_data.rs similarity index 100% rename from tests/src/nft/nft_extensions/tests/functions/set_meta_data.rs rename to tests/src/archive/nft/nft_extensions/tests/functions/set_meta_data.rs diff --git a/tests/src/nft/nft_extensions/tests/mod.rs b/tests/src/archive/nft/nft_extensions/tests/mod.rs similarity index 100% rename from tests/src/nft/nft_extensions/tests/mod.rs rename to tests/src/archive/nft/nft_extensions/tests/mod.rs diff --git a/tests/src/nft/nft_extensions/tests/utils/mod.rs b/tests/src/archive/nft/nft_extensions/tests/utils/mod.rs similarity index 100% rename from tests/src/nft/nft_extensions/tests/utils/mod.rs rename to tests/src/archive/nft/nft_extensions/tests/utils/mod.rs diff --git a/tests/src/fixed_point/ufp32_test/src/main.sw b/tests/src/fixed_point/ufp32_test/src/main.sw index f54b234a..1f2f7f75 100644 --- a/tests/src/fixed_point/ufp32_test/src/main.sw +++ b/tests/src/fixed_point/ufp32_test/src/main.sw @@ -26,7 +26,7 @@ fn main() -> bool { // recip let mut value = UFP32 { - value: 1 << 32 + 3, + value: 3u32, }; res = UFP32::recip(value); assert(UFP32 { @@ -35,21 +35,21 @@ fn main() -> bool { // trunc value = UFP32 { - value: (1 << 32) + 3, + value: 3u32, }; res = value.trunc(); assert(UFP32::from_uint(1) == res); // floor value = UFP32 { - value: (1 << 32) + 3, + value: 3u32, }; res = value.floor(); assert(UFP32::from_uint(1) == res); // fract value = UFP32 { - value: (1 << 32) + 3, + value: 3u32, }; res = value.fract(); assert(UFP32 { value: 3 } == res); @@ -60,7 +60,7 @@ fn main() -> bool { // ceil value = UFP32 { - value: (1 << 32) + 3, + value: 3u32, }; res = value.ceil(); assert(UFP32::from_uint(2) == res); @@ -71,13 +71,13 @@ fn main() -> bool { // round value = UFP32 { - value: (1 << 32) + 3, + value: 3u32, }; res = value.round(); assert(UFP32::from_uint(1) == res); value = UFP32 { - value: (1 << 32) + (1 << 31) + 1, + value: 2147483649u32, }; res = value.round(); assert(UFP32::from_uint(2) == res); diff --git a/tests/src/harness.rs b/tests/src/harness.rs index df8ead79..c6090e02 100644 --- a/tests/src/harness.rs +++ b/tests/src/harness.rs @@ -2,7 +2,6 @@ mod fixed_point; mod merkle_proof; -mod nft; mod ownership; mod reentrancy; mod signed_integers;