diff --git a/docs/build/standards/vft.md b/docs/build/standards/vft.md index 4047c47..f0ff2b0 100644 --- a/docs/build/standards/vft.md +++ b/docs/build/standards/vft.md @@ -11,6 +11,10 @@ The Vara Fungible Token Standard is the analogue of ERC-20 on Ethereum. The Vara Fungible Token Standard provides a unified API for programs to implement token functionalities. It encompasses critical operations like token transfer and approvals for third-party spending on the blockchain. Below is a detailed look at the state of the program, its interface, and key methods to facilitate these operations. +:::tip +The project code is developed using the [Sails](../../build/sails/sails.mdx) framework. +::: + ## Functions ``` diff --git a/docs/build/standards/vmt.md b/docs/build/standards/vmt.md new file mode 100644 index 0000000..9354396 --- /dev/null +++ b/docs/build/standards/vmt.md @@ -0,0 +1,100 @@ +--- + +sidebar_label: VMT +sidebar_position: 3 + +--- + +# Vara Multi-Token (VMT) Standard + +:::note +The Vara Multi-Token (VMT) Standard is analogous to ERC-1155 on Ethereum. +::: + +The VMT Standard establishes a unified API for multi-token functionality in applications. It details the core VMT service, which includes operations such as batch token transfers and balance queries, along with the contract's state, interface, and key methods. The source code for the core service can be found on [GitHub](https://github.com/gear-foundation/standards/tree/master/vmt-service). + +:::tip +The project code is developed using the [Sails](../../build/sails/sails.mdx) framework. +::: + +## Core VMT Service + +### Functions + +- `Approve(to)` +- `TransferFrom(from, to, id, amount)` +- `BatchTransferFrom(from, to, ids, amounts)` +- `BalanceOf(account, id)` +- `BalanceOfBatch(accounts, ids)` +- `IsApproved(account, operator)` +- `Name()` +- `Symbol()` +- `Decimals()` +- `TotalSupply()` + +### Events + +- `Approval(from, to)` +- `Transfer(from, to, ids, amounts)` + +### Key Methods + +#### `Approve` + +```rust +pub fn approve(&mut self, to: ActorId) -> bool +``` + +Allows one account to authorize another to manage its tokens. Upon success, it triggers the `Approval` event. + +#### `TransferFrom` + +```rust +pub fn transfer_from(&mut self, from: ActorId, to: ActorId, id: TokenId, amount: U256) +``` + +Transfers a specified amount of a token from one account to another. The caller must be authorized to manage the tokens. It triggers the `Transfer` event upon success. + +#### `BatchTransferFrom` + +```rust +pub fn batch_transfer_from( + &mut self, + from: ActorId, + to: ActorId, + ids: Vec, + amounts: Vec, +) +``` + +Transfers multiple token types from one account to another, triggering a `Transfer` event for each. + +### Query Methods + +#### `BalanceOf` + +Returns the balance of a specific token for a given account. + +```rust +pub fn balance_of(&self, account: ActorId, id: TokenId) -> U256 +``` + +#### `BalanceOfBatch` + +Returns the balances for specified accounts and token IDs. + +```rust +pub fn balance_of_batch(&self, accounts: Vec, id: Vec) -> Vec +``` + +#### `IsApproved` + +Checks if an operator is approved to manage an account's tokens. + +```rust +pub fn is_approved(&self, account: ActorId, operator: ActorId) -> bool +``` + +### Conclusion + +The core VMT service forms the foundation for multi-token contracts and can be extended for more advanced functionalities like minting and burning. The complete code is available on [GitHub](https://github.com/gear-foundation/standards/tree/master/vmt-service). diff --git a/docs/build/standards/vnft.md b/docs/build/standards/vnft.md index 1fae64f..958c0f3 100644 --- a/docs/build/standards/vnft.md +++ b/docs/build/standards/vnft.md @@ -11,6 +11,10 @@ The Vara Non-Fungible Token Standard is the analogue of ERC-721 on Ethereum. The Vara Non-Fungible Token (VNFT) Standard provides a unified API for programs to implement non-fungible token (NFT) functionalities. It encompasses critical operations like token transfer and approvals for third-party spending on the blockchain. Below is a detailed look at the state of the program, its interface, and key methods to facilitate these operations. +:::tip +The project code is developed using the [Sails](../../build/sails/sails.mdx) framework. +::: + ## Functions ``` diff --git a/docs/examples/Standards/vft.md b/docs/examples/Standards/vft.md index 1d30dca..95123f3 100644 --- a/docs/examples/Standards/vft.md +++ b/docs/examples/Standards/vft.md @@ -9,9 +9,13 @@ sidebar_position: 1 The Vara Fungible Token Standard is the analogue of ERC-20 on Ethereum. ::: -The Vara Fungible Token Standard outlines a unified API for implementing fungible token functionalities in programs. The initial section of this document provides a comprehensive examination of the core VFT service, which serves as a foundational framework. It covers essential operations such as token transfers and approvals for third-party spending, detailing the contract state, interface, and key methods involved. +The Vara Fungible Token Standard outlines a unified API for implementing fungible token functionalities in programs. The initial section of this document provides a comprehensive examination of the core VFT service, which serves as a foundational framework. It covers essential operations such as token transfers and approvals for third-party spending, detailing the contract state, interface, and key methods involved. The source code of the standard-service is avaiable on the [GitHub](https://github.com/gear-foundation/standards/tree/master/vft-service). -The subsequent section expands on how to leverage and extend this core service to develop a fully functional token application. It illustrates the process of adding advanced features like minting and burning, demonstrating how to build upon the core VFT service to create a comprehensive and customizable token system. This extension highlights the flexibility and potential of the core standard, providing a pathway to develop more sophisticated and tailored token solutions. +The subsequent section expands on how to leverage and extend this core service to develop a fully functional token application. It illustrates the process of adding advanced features like minting and burning, demonstrating how to build upon the core VFT service to create a comprehensive and customizable token system. This extension highlights the flexibility and potential of the core standard, providing a pathway to develop more sophisticated and tailored token solutions. The source code of the extended version is avaiable on the [GitHub](https://github.com/gear-foundation/standards/tree/master/extended-vft). + +:::tip +The project code is developed using the [Sails](../../build/sails/sails.mdx) framework. +::: ## Core VFT Service @@ -271,4 +275,4 @@ For a more detailed implementation, the code for the Extended VFT can be found o ## Conclusion -The core VFT service establishes a robust foundation for implementing fungible tokens within the Vara ecosystem, encompassing essential functionalities that adhere to recognized token standards. This service functions as a fundamental core, with the Extended VFT illustrating how it can be expanded to incorporate advanced capabilities, including minting, burning, and role management. Together, these implementations provide a comprehensive framework for developers, facilitating the creation of tailored and sophisticated token systems. By utilizing both the core service and its extended functionalities, developers are well-positioned to design flexible and secure token solutions that address specific requirements and enhance overall system capabilities. +The core [VFT service](https://github.com/gear-foundation/standards/tree/master/vft-service) establishes a robust foundation for implementing fungible tokens within the Vara ecosystem, encompassing essential functionalities that adhere to recognized token standards. This service functions as a fundamental core, with the [Extended VFT](https://github.com/gear-foundation/standards/tree/master/extended-vft) illustrating how it can be expanded to incorporate advanced capabilities, including minting, burning, and role management. Together, these implementations provide a comprehensive framework for developers, facilitating the creation of tailored and sophisticated token systems. By utilizing both the core service and its extended functionalities, developers are well-positioned to design flexible and secure token solutions that address specific requirements and enhance overall system capabilities. diff --git a/docs/examples/Standards/vmt.md b/docs/examples/Standards/vmt.md index f71f2cb..b7e5d41 100644 --- a/docs/examples/Standards/vmt.md +++ b/docs/examples/Standards/vmt.md @@ -11,9 +11,13 @@ sidebar_position: 3 The Vara Multi-Token (VMT) Standard is the analogue of ERC-1155 on Ethereum. ::: -The VMT Standard outlines a unified API for implementing multi-token functionality in programs. The initial section provides an in-depth exploration of the core VMT service, covering operations like batch token transfers and token balance queries, detailing the contract state, interface, and key methods. +The VMT Standard outlines a unified API for implementing multi-token functionality in programs. The initial section provides an in-depth exploration of the core VMT service, covering operations like batch token transfers and token balance queries, detailing the contract state, interface, and key methods. The source code of the standard-service is avaiable on the [GitHub](https://github.com/gear-foundation/standards/tree/master/vmt-service). -The following section expands on extending this core service to develop a fully functional multi-token application. This part illustrates how to incorporate minting and burning capabilities and advanced management features, building upon the core VMT service to create a robust and flexible token system. +The following section expands on extending this core service to develop a fully functional multi-token application. This part illustrates how to incorporate minting and burning capabilities and advanced management features, building upon the core VMT service to create a robust and flexible token system. The source code of the extended version is avaiable on the [GitHub](https://github.com/gear-foundation/standards/tree/master/extended-vmt). + +:::tip +The project code is developed using the [Sails](../../build/sails/sails.mdx) framework. +::: ## Core VMT Service diff --git a/docs/examples/Standards/vnft.md b/docs/examples/Standards/vnft.md index b92d547..e334df9 100644 --- a/docs/examples/Standards/vnft.md +++ b/docs/examples/Standards/vnft.md @@ -9,10 +9,14 @@ sidebar_position: 2 The Vara Non-Fungible Token Standard is the analogue of ERC-721 on Ethereum. ::: -The Vara Non-Fungible Token Standard outlines a unified API for implementing non-fungible token functionalities in programs. The initial section of this document provides a comprehensive examination of the core VNFT service, which serves as a foundational framework. It covers essential operations such as token transfers and approvals for third-party spending, detailing the contract state, interface, and key methods involved. The source code of the standard is avaiable on the [GitHub](https://github.com/gear-foundation/standards/tree/master/vnft-service). +The Vara Non-Fungible Token Standard outlines a unified API for implementing non-fungible token functionalities in programs. The initial section of this document provides a comprehensive examination of the core VNFT service, which serves as a foundational framework. It covers essential operations such as token transfers and approvals for third-party spending, detailing the contract state, interface, and key methods involved. The source code of the standard-service is avaiable on the [GitHub](https://github.com/gear-foundation/standards/tree/master/vnft-service). The subsequent section expands on how to leverage and extend this core service to develop a fully functional token application. It illustrates the process of adding advanced features like minting and burning, demonstrating how to build upon the core VNFT service to create a comprehensive and customizable token system. This extension highlights the flexibility and potential of the core standard, providing a pathway to develop more sophisticated and tailored token solutions. The source code of the extended version is avaiable on the [GitHub](https://github.com/gear-foundation/standards/tree/master/extended-vnft). +:::tip +The project code is developed using the [Sails](../../build/sails/sails.mdx) framework. +::: + ## Functions ``` @@ -289,5 +293,5 @@ For a more detailed implementation, the code for the Extended VNFT can be found ## Conclusion -The core VNFT service establishes a robust foundation for implementing non-fungible tokens within the Vara ecosystem, encompassing essential functionalities that adhere to recognized token standards. This service functions as a fundamental core, with the Extended VNFT illustrating how it can be expanded to incorporate advanced capabilities, including minting, burning, and role management. Together, these implementations provide a comprehensive framework for developers, facilitating the creation of tailored and sophisticated token systems. By utilizing both the core service and its extended functionalities, developers are well-positioned to design flexible and secure token solutions that address specific requirements and enhance overall system capabilities. +The core [VNFT service](https://github.com/gear-foundation/standards/tree/master/vnft-service) establishes a robust foundation for implementing non-fungible tokens within the Vara ecosystem, encompassing essential functionalities that adhere to recognized token standards. This service functions as a fundamental core, with the [Extended VNFT](https://github.com/gear-foundation/standards/tree/master/extended-vnft) illustrating how it can be expanded to incorporate advanced capabilities, including minting, burning, and role management. Together, these implementations provide a comprehensive framework for developers, facilitating the creation of tailored and sophisticated token systems. By utilizing both the core service and its extended functionalities, developers are well-positioned to design flexible and secure token solutions that address specific requirements and enhance overall system capabilities.