Skip to content

Commit

Permalink
Minor fixing in standards (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
MedovTimur authored Oct 24, 2024
1 parent b723ba5 commit ee495d7
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 7 deletions.
4 changes: 4 additions & 0 deletions docs/build/standards/vft.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

```
Expand Down
100 changes: 100 additions & 0 deletions docs/build/standards/vmt.md
Original file line number Diff line number Diff line change
@@ -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<TokenId>,
amounts: Vec<U256>,
)
```

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<ActorId>, id: Vec<TokenId>) -> Vec<U256>
```

#### `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).
4 changes: 4 additions & 0 deletions docs/build/standards/vnft.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

```
Expand Down
10 changes: 7 additions & 3 deletions docs/examples/Standards/vft.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
8 changes: 6 additions & 2 deletions docs/examples/Standards/vmt.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 6 additions & 2 deletions docs/examples/Standards/vnft.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

```
Expand Down Expand Up @@ -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.

0 comments on commit ee495d7

Please sign in to comment.