Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming #692

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
sidebar_label: GRC-20
sidebar_label: VFT
sidebar_position: 1
---

# Gear Fungible Token Standard (GRC-20)
# Vara Fungible Token Standard (VFT)

The Gear Fungible Token Standard provides a unified API for smart contracts to implement token functionalities. It encompasses critical operations like token transfer and approvals for third-party spending on the blockchain. Below, we detail the contract state, its interface, and key methods to facilitate these operations.
The Vara Fungible Token Standard provides a unified API for smart contracts to implement token functionalities. It encompasses critical operations like token transfer and approvals for third-party spending on the blockchain. Below, we detail the contract state, its interface, and key methods to facilitate these operations.

An example implementation of the GRC-20 standard is available on [GitHub](https://github.com/gear-foundation/standards/tree/master/gear-erc20).
An example implementation of the VFT standard is available on [GitHub](https://github.com/gear-foundation/standards/tree/master/vft).

## Functions

Expand Down Expand Up @@ -36,7 +36,7 @@ An example implementation of the GRC-20 standard is available on [GitHub](https:
### `Approve`

```rust
pub fn approve(&mut self, spender: sails_rtl::ActorId, value: U256) -> bool
pub fn approve(&mut self, spender: ActorId, value: U256) -> bool
```

This function allows a designated spender (`spender`) to withdraw up to an `value` of tokens from your account, multiple times up to the amount limit. Resets allowance to `value` with a subsequent call. Returns a boolean value indicating whether the operation succeeded.
Expand All @@ -45,16 +45,16 @@ Upon successful execution, triggers the event:

```rust
Approval {
owner: sails_rtl::ActorId,
spender: sails_rtl::ActorId,
owner: ActorId,
spender: ActorId,
value: U256,
}
```

### `Transfer`

```rust
pub fn transfer(&mut self, to: sails_rtl::ActorId, value: U256) -> bool
pub fn transfer(&mut self, to: ActorId, value: U256) -> bool
```


Expand All @@ -64,25 +64,25 @@ Upon successful execution generates the event:

```rust
Transfer {
from: sails_rtl::ActorId,
to: sails_rtl::ActorId,
from: ActorId,
to: ActorId,
value: U256,
}
```

### `TransferFrom`

```rust
pub fn transfer_from(&mut self, from: sails_rtl::ActorId, to: sails_rtl::ActorId, value: U256) -> bool
pub fn transfer_from(&mut self, from: ActorId, to: ActorId, value: U256) -> bool
```
Transfers a specified `value` of tokens `from` one account `to` another, using the allowance mechanism. Value is then deducted from the caller’s allowance. Returns a boolean value indicating whether the operation succeeded.

Upon successful execution generates the event:

```rust
Transfer {
from: sails_rtl::ActorId,
to: sails_rtl::ActorId,
from: ActorId,
to: ActorId,
value: U256,
}
```
Expand Down Expand Up @@ -126,15 +126,15 @@ pub fn total_supply(&self) -> U256
Returns the token balance of the `owner` address.

```rust
pub fn balance_of(&self, owner: sails_rtl::ActorId) -> U256
pub fn balance_of(&self, account: ActorId) -> U256
```

### `allowance`

Returns the number of tokens the `spender` account is authorized to spend on behalf of the `owner`.

```rust
pub fn allowance(&self, owner: sails_rtl::ActorId, spender: sails_rtl::ActorId) -> U256
pub fn allowance(&self, owner: ActorId, spender: ActorId) -> U256
```

## Contract Interface
Expand All @@ -146,12 +146,12 @@ constructor {
New : (name: str, symbol: str, decimals: u8);
};

service Erc20 {
service Vft {
Approve : (spender: actor_id, value: u256) -> bool;
Transfer : (to: actor_id, value: u256) -> bool;
TransferFrom : (from: actor_id, to: actor_id, value: u256) -> bool;
query Allowance : (owner: actor_id, spender: actor_id) -> u256;
query BalanceOf : (owner: actor_id) -> u256;
query BalanceOf : (account: actor_id) -> u256;
query Decimals : () -> u8;
query Name : () -> str;
query Symbol : () -> str;
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/DeFi/crowdsale.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ A public offering to help build brand-new cryptocurrency or other digital assets

The example of a crowdsale program implementation described in this article is just one of many decentralized applications that can be implemented and launched on Gear. This article explains the programming interface, data structure, basic functions and their purposes. You can use it as-is or modify it to suit your scenarios. Anyone can easily create their crowdsale application and run it on a Gear-powered network.

The initial resources used to acquire tokens are determined by the Gear fungible tokens contract - [gFT](../Standards/gft-20). The program's source code is available on [GitHub](https://github.com/gear-foundation/dapps/tree/master/contracts/crowdsale).
The initial resources used to acquire tokens are determined by the Vara fungible tokens contract - [VFT](../Standards/vft). The program's source code is available on [GitHub](https://github.com/gear-foundation/dapps/tree/master/contracts/crowdsale).

## Interface
### Source files
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/DeFi/dex.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ While transactions on a centralized exchange are recorded in that exchange's int

DEXs are usually built on open-source code, meaning that anyone interested can see exactly how they work. This also means that developers can adapt existing code to create new competing projects, which is how Uniswap's code has been adapted by a whole host of DEXs with "swap" in their names, such as Sushiswap and Pancakeswap.

The exchange uses [Gear fungible tokens (GFT-20)](../Standards/gft-20) underneath for the tokens and [Gear-lib FT wrapper](https://github.com/gear-foundation/dapps/tree/master/contracts/gear-lib-old/src/fungible_token) for the pair to keep track of the liquidity.
The exchange uses [Vara fungible tokens (VFT)](../Standards/vft) underneath for the tokens and [Gear-lib FT wrapper](https://github.com/gear-foundation/dapps/tree/master/contracts/gear-lib-old/src/fungible_token) for the pair to keep track of the liquidity.

### Math
As it was said all the prices are algorithmically calculated. Investors provide funds to the liquidity pools and price is calculated according to the amount of tokens in the reserves using the following formula: <br/><br/>
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/DeFi/escrow.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_position: 2

![escrow](../img/escrow.png)

An escrow is a special wallet to which certain assets (e.g., money or stocks) are deposited and stored until specific conditions are met. In terms of programs, an escrow is a wallet stored on a blockchain that, like a traditional escrow, can receive assets (e.g., cryptocurrency or fungible tokens, such as [Gear fungible tokens - gFT](../Standards/gft-20.md) in this example) from one user and, when certain conditions are met, send them to another.
An escrow is a special wallet to which certain assets (e.g., money or stocks) are deposited and stored until specific conditions are met. In terms of programs, an escrow is a wallet stored on a blockchain that, like a traditional escrow, can receive assets (e.g., cryptocurrency or fungible tokens, such as [Vara fungible tokens - VFT](../Standards/vft.md) in this example) from one user and, when certain conditions are met, send them to another.

- Program source code is avalible on [Github](https://github.com/gear-foundation/dapps/tree/master/contracts/escrow)
- dApp UI [Github](https://github.com/gear-foundation/dapps/tree/master/frontend/apps/escrow)
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/Governance/DAO.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct Dao {
```
where:

`approved_token_program_id` - the reference to the token contract ([gFT20](../Standards/gft-20.md)) that users use as pledge to get the share in the DAO.
`approved_token_program_id` - the reference to the token contract ([VFT](../Standards/vft.md)) that users use as pledge to get the share in the DAO.

`period_duration` - the smallest unit time interval for the DAO, in ms.

Expand Down Expand Up @@ -225,7 +225,7 @@ ProcessProposal {
[//]: # (A [Ready-to-Use application]&#40;https://dao.gear-tech.io/&#41; example provides a user interface that interacts with [DAO]&#40;https://github.com/gear-foundation/dapps-dao-light&#41; and [gFT]&#40;https://github.com/gear-foundation/dapps-fungible-token&#41; programs.)

[//]: # ()
[//]: # (Gear Fundible Token enables creation of utility token DAO, check [this article]&#40;../Standards/gft-20&#41; for details.)
[//]: # (Gear Fundible Token enables creation of utility token DAO, check [this article]&#40;../Standards/vft&#41; for details.)

[//]: # ()
[//]: # (This video demonstrates the entire configuration and user interaction workflow: **https://youtu.be/6lxr7eojADw**)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/Infra/supply-chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ yarn start

* Each newly produced item gets the NFT (in Gear's context - [Gear non-fungible token (gNFT)](../Standards/gnft-721.md) and its ID equals an ID of the item. Then, as an item moves along a supply chain, an item's NFT transfers between a supply chain program, item's producer, and future distributor, retailer and end consumer.
* Anyone who knows an item's ID can get item info.
* Sale, purchase, delivery is made in [Gear fungible tokens (gFT)](../Standards/gft-20).
* Sale, purchase, delivery is made in [Vara fungible tokens (VFT)](../Standards/vft).

Item info has the following struct:
```rust title="supply-chain/io/src/lib.rs"
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/Infra/varatube.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The interface provides an option whether to enable or disable subscription auto-
There is also an option to cancel the active subscription.

The VaraTube consists of two programs:
- [Gear Fungible Token (gFT-20)](../Standards/gft-20) contract determines user and service balances required to purchase a subscription and approves Subscription program to get funds from user's balance.
- [Gear Fungible Token (VFT)](../Standards/vft) contract determines user and service balances required to purchase a subscription and approves Subscription program to get funds from user's balance.
- [VaraTube Subscription](https://github.com/gear-foundation/dapps/tree/master/contracts/varatube) program manages service's subscription - its availability, expiration, auto renewal.

## How to run
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/NFTs/nft-marketplace/marketplace.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ The marketplace program is initialized with the following fields;
- `items` - listed NFTs;
- `approved_nft_contracts` - NFT contracts accounts that can be listed on the marketplace;
- `approved_ft_contracts` - fungible token accounts for which it is possible to buy marketplace items;
- `tx_id` - the id for tracking transactions in the fungible and non-fungible contracts (See the description of [fungible token](/examples/Standards/gft-20.md) and [non-fungible token](/examples/Standards/gnft-721.md)).
- `tx_id` - the id for tracking transactions in the fungible and non-fungible contracts (See the description of [fungible token](/examples/Standards/vft.md) and [non-fungible token](/examples/Standards/gnft-721.md)).


The marketplace item has the following struct:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
sidebar_label: gFT (ERC-20)
sidebar_label: VFT
sidebar_position: 1
---

# Gear Fungible Token Standard (GRC-20)
# Vara Fungible Token Standard (VFT)

The Gear Fungible Token Standard provides a unified API for smart contracts to implement token functionalities. It encompasses critical operations like token transfer and approvals for third-party spending on the blockchain. Below, we detail the contract state, its interface, and key methods to facilitate these operations.
The Vara Fungible Token Standard provides a unified API for smart contracts to implement token functionalities. It encompasses critical operations like token transfer and approvals for third-party spending on the blockchain. Below, we detail the contract state, its interface, and key methods to facilitate these operations.

An example implementation of the GRC-20 standard is available on [GitHub](https://github.com/gear-foundation/standards/tree/master/gear-erc20).
An example implementation of the VFT standard is available on [GitHub](https://github.com/gear-foundation/standards/tree/master/vft).

## Functions

Expand Down Expand Up @@ -36,7 +36,7 @@ An example implementation of the GRC-20 standard is available on [GitHub](https:
### `Approve`

```rust
pub fn approve(&mut self, spender: sails_rtl::ActorId, value: U256) -> bool
pub fn approve(&mut self, spender: ActorId, value: U256) -> bool
```

This function allows a designated spender (`spender`) to withdraw up to an `value` of tokens from your account, multiple times up to the amount limit. Resets allowance to `value` with a subsequent call. Returns a boolean value indicating whether the operation succeeded.
Expand All @@ -45,16 +45,16 @@ Upon successful execution, triggers the event:

```rust
Approval {
owner: sails_rtl::ActorId,
spender: sails_rtl::ActorId,
owner: ActorId,
spender: ActorId,
value: U256,
}
```

### `Transfer`

```rust
pub fn transfer(&mut self, to: sails_rtl::ActorId, value: U256) -> bool
pub fn transfer(&mut self, to: ActorId, value: U256) -> bool
```


Expand All @@ -64,25 +64,25 @@ Upon successful execution generates the event:

```rust
Transfer {
from: sails_rtl::ActorId,
to: sails_rtl::ActorId,
from: ActorId,
to: ActorId,
value: U256,
}
```

### `TransferFrom`

```rust
pub fn transfer_from(&mut self, from: sails_rtl::ActorId, to: sails_rtl::ActorId, value: U256) -> bool
pub fn transfer_from(&mut self, from: ActorId, to: ActorId, value: U256) -> bool
```
Transfers a specified `value` of tokens `from` one account `to` another, using the allowance mechanism. Value is then deducted from the caller’s allowance. Returns a boolean value indicating whether the operation succeeded.

Upon successful execution generates the event:

```rust
Transfer {
from: sails_rtl::ActorId,
to: sails_rtl::ActorId,
from: ActorId,
to: ActorId,
value: U256,
}
```
Expand Down Expand Up @@ -126,15 +126,15 @@ pub fn total_supply(&self) -> U256
Returns the token balance of the `owner` address.

```rust
pub fn balance_of(&self, owner: sails_rtl::ActorId) -> U256
pub fn balance_of(&self, account: ActorId) -> U256
```

### `allowance`

Returns the number of tokens the `spender` account is authorized to spend on behalf of the `owner`.

```rust
pub fn allowance(&self, owner: sails_rtl::ActorId, spender: sails_rtl::ActorId) -> U256
pub fn allowance(&self, owner: ActorId, spender: ActorId) -> U256
```

## Contract Interface
Expand All @@ -146,12 +146,12 @@ constructor {
New : (name: str, symbol: str, decimals: u8);
};

service Erc20 {
service Vft {
Approve : (spender: actor_id, value: u256) -> bool;
Transfer : (to: actor_id, value: u256) -> bool;
TransferFrom : (from: actor_id, to: actor_id, value: u256) -> bool;
query Allowance : (owner: actor_id, spender: actor_id) -> u256;
query BalanceOf : (owner: actor_id) -> u256;
query BalanceOf : (account: actor_id) -> u256;
query Decimals : () -> u8;
query Name : () -> str;
query Symbol : () -> str;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,9 @@ extern "C" fn meta_state() -> *mut [i32; 2] {

## 用户界面

一个 [即用型应用](https://dao.gear-tech.io/)实例提供了一个与[DAO](https://github.com/gear-foundation/dapps-dao-light)和[GFT](https://github.com/gear-foundation/dapps-fungible-token)智能合约互动的用户界面。
一个 [即用型应用](https://dao.gear-tech.io/)实例提供了一个与[DAO](https://github.com/gear-foundation/dapps-dao-light)和[VFT](https://github.com/gear-foundation/dapps-fungible-token)智能合约互动的用户界面。

Gear 同质化代币可以创建基于实用代币的 DAO,详情请看[本文](../Standards/gft-20)。
Gear 同质化代币可以创建基于实用代币的 DAO,详情请看[本文](../Standards/vft)。

这个视频演示了整体配置和用户互动工作流程。

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ sidebar_position: 18

本文所描述的众筹智能合约实现的例子是在 Gear 上实现和发布的去中心化应用之一。这篇文章介绍了接口、数据结构、基本功能,并解释了它们的用途。代码可以直接使用,也可以根据自己的场景进行修改。任何人都可以轻松创建自己的众筹应用,并在 Gear 网络上运行。

购买代币的初始资金由 Gear 同质化代币合约决定 - [gFT](https://wiki.gear-tech.io/examples/Standards/gft-20)。
购买代币的初始资金由 Gear 同质化代币合约决定 - [gFT](https://wiki.gear-tech.io/examples/Standards/vft)。
合约源代码可在[GitHub](https://github.com/gear-foundation/dapps-crowdsale)上找到。

## 界面
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sidebar_position: 8

## 介绍

第三方担保是一个特殊钱包,某些资产 (如钱或股票) 存放在其中,直到某些条件得到满足。就智能合约而言,第三方担保是存储在区块链上的钱包,与常规担保一样,可以从一个用户那里接收一些资产 (例如加密资产或代币,在这个例子中,是像 [gFT](../Standards/gft-20)资产),并在满足特定条件时将它们发送给另一个用户。
第三方担保是一个特殊钱包,某些资产 (如钱或股票) 存放在其中,直到某些条件得到满足。就智能合约而言,第三方担保是存储在区块链上的钱包,与常规担保一样,可以从一个用户那里接收一些资产 (例如加密资产或代币,在这个例子中,是像 [VFT](../Standards/vft)资产),并在满足特定条件时将它们发送给另一个用户。

本篇文章主要介绍智能合约的作用和代码逻辑。想获得更详细的技术描述,请参考[技术文档](https://dapps.gear.rs/escrow_io)和[源码](#source-code)。

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ sidebar_position: 10

* 每个新产生的项目会得到 NFT(在 Gear 的上下文中--[gNFT token](../Standards/gnft-721.md) 和 NFT 相关的 ID。然后,随着物品在供应链上的移动,物品的 NFT 在供应链程序、物品的生产商和未来的分销商、零售商和最终消费者之间转移。
* 任何知道物品 ID 的人都可以获取物品信息
* 销售、购买、交付使用 [gFT 代币](../Standards/gft-20)。
* 销售、购买、交付使用 [VFT 代币](../Standards/vft)。

ItemInfo 结构如下:

Expand Down
12 changes: 6 additions & 6 deletions redirects.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@
"from": "/examples/ping"
},
{
"to": "/docs/examples/Standards/gft-20",
"from": "/examples/gft-20"
"to": "/docs/examples/Standards/vft",
"from": "/examples/vft"
},
{
"to": "/docs/examples/Standards/gnft-721",
Expand Down Expand Up @@ -252,20 +252,20 @@
"from": "/general/dao"
},
{
"to": "/docs/examples/Standards/gft-20",
"to": "/docs/examples/Standards/vft",
"from": "/examples/erc20"
},
{
"to": "/docs/examples/Standards/gft-20",
"to": "/docs/examples/Standards/vft",
"from": "/docs/examples/erc20"
},
{
"to": "/docs/examples/ping",
"from": "/ping"
},
{
"to": "/docs/examples/Standards/gft-20",
"from": "/gft-20"
"to": "/docs/examples/Standards/vft",
"from": "/vft"
},
{
"to": "/docs/examples/Standards/gnft-721",
Expand Down
2 changes: 1 addition & 1 deletion script_checking_code.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ const filePaths = [
'NFTs/nft-pixelboard.md',
'NFTs/onchain-nft.md',

// 'Standards/gft-20.md',
// 'Standards/vft.md',
// 'Standards/gmt-1155.md',
// 'Standards/gnft-721.md',
// 'Standards/rmrk.md',
Expand Down