Skip to content

Commit

Permalink
update ink advance docs
Browse files Browse the repository at this point in the history
  • Loading branch information
CocDap committed Sep 16, 2024
1 parent 8c39048 commit 1d407aa
Show file tree
Hide file tree
Showing 10 changed files with 487 additions and 21 deletions.
Binary file modified pages/assets/add_custom_token.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pages/assets/deploy_psp34.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pages/assets/filter_token.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pages/assets/import_collection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pages/assets/import_token.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pages/assets/manage_token.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pages/assets/mint_nft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 0 additions & 21 deletions pages/ink_advance/migrate_erc20_solidity.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
/// Returned if not enough allowance to fulfill a request is available.
InsufficientAllowance,
}

```
</details>

Expand All @@ -96,7 +95,6 @@ constructor(string memory _name, string memory _symbol, uint256 _totalSupply) {
totalSupply = _totalSupply;
_balances[msg.sender] = _totalSupply;
}
```
</details>

Expand Down Expand Up @@ -125,8 +123,6 @@ constructor(string memory _name, string memory _symbol, uint256 _totalSupply) {
allowances: Default::default(),
}
}


```
</details>

Expand All @@ -140,7 +136,6 @@ constructor(string memory _name, string memory _symbol, uint256 _totalSupply) {
require(_owner != address(0), "!ZA");
return _balances[_owner];
}

```

</details>
Expand All @@ -153,7 +148,6 @@ constructor(string memory _name, string memory _symbol, uint256 _totalSupply) {
self.balance_of_impl(&owner)
}
```

</details>


Expand All @@ -172,27 +166,21 @@ function transfer(address _to, uint256 _value) public returns(bool) {
return true;
}
```

</details>


<details>
<summary>Ink!</summary>

```rust
#[ink(message)]
pub fn transfer(&mut self, to: AccountId, value: Balance) -> Result<()> {
let from = self.env().caller();
self.transfer_from_to(&from, &to, value)
}

```
</details>





## Tạo hàm transferFrom

<details>
Expand All @@ -207,7 +195,6 @@ function transfer(address _to, uint256 _value) public returns(bool) {
emit Transfer(_from, _to, _value);
return true;
}

```

</details>
Expand Down Expand Up @@ -235,21 +222,15 @@ function transfer(address _to, uint256 _value) public returns(bool) {
.insert((&from, &caller), &(allowance - value));
Ok(())
}

```

</details>





## Tạo hàm approve


<details>
<summary>Solidity</summary>

```javascript
function approve(address _spender, uint256 _value) public returns(bool) {
require(_balances[msg.sender] >= _value, "!Bal");
Expand Down Expand Up @@ -293,7 +274,6 @@ function transfer(address _to, uint256 _value) public returns(bool) {
return _allowances[_spender][_owner];
}
```

</details>


Expand Down Expand Up @@ -367,7 +347,6 @@ function transfer(address _to, uint256 _value) public returns(bool) {
self.allowances.get((owner, spender)).unwrap_or_default()
}
```

</details>


Expand Down
51 changes: 51 additions & 0 deletions pages/ink_advance/nft_extension_psp34.mdx
Original file line number Diff line number Diff line change
@@ -1 +1,52 @@
# Phân tích code chuẩn psp34 ink!


## Tạo psp34 contract bằng POP CLI

```bash
pop new contract my_psp34 -c psp -t PSP34
```


## Build psp34

```bash
cargo contract build --release --features "contract"
```


## Phân tích code



## Cách import nft psp34 trên mạng Aleph Zero Testnet - Subwallet

Noted: Yêu cầu cài Subwallet Extension
[Cài đặt SubWallet Extension](../ink_advance/token_extension_psp22#cài-đặt-subwallet-extension-trên-google-chromfirefoxbrave)



### Deploy contract trên mạng Aleph Zero Testnet bằng Contract UI

Bước deploy sẽ tương tự như các bước mình có hướng dẫn ở section [Ink Basic - Contract Template](../../ink_basic/contract_template#sử-dụng-contract-ui-deploy-trên-pop-network-testnet)
Nên mình bỏ qua bước này

![](../assets/deploy_psp34.png)


### Mint PSP34 NFT trên mạng Aleph Zero Testnet bằng Contract UI


![](../assets/mint_nft.png)


### Import collections trên mạng Aleph Zero Testnet - Subwallet

https://docs.subwallet.app/main/extension-user-guide/import-and-manage-customized-assets/import-nfts




## Tài liệu tham khảo
+ https://docs.subwallet.app/main/extension-user-guide/import-and-manage-customized-assets/import-nfts

Loading

0 comments on commit 1d407aa

Please sign in to comment.