Skip to content

Commit

Permalink
Merge branch 'master' into feat/add_community_templates
Browse files Browse the repository at this point in the history
  • Loading branch information
flmel authored Feb 19, 2025
2 parents fc1d3e1 + 09e285b commit 44f9a5d
Show file tree
Hide file tree
Showing 12 changed files with 84 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ We provide code to derive the address, as it's a complex process that involves m
<Tabs groupId="code-tabs">
<TabItem value="Ξ Ethereum">
<Github language="js"
url="https://github.com/near-examples/near-multichain/blob/main/src/services/ethereum.js" start="18" end="21" />
url="https://github.com/near-examples/near-multichain/blob/aafcfe27f89d000e5abf94580dd4a7aaecb09fa7/src/services/ethereum.js" start="18" end="21" />

</TabItem>

<TabItem value="₿ Bitcoin">
<Github language="js"
url="https://github.com/near-examples/near-multichain/blob/main/src/services/bitcoin.js" start="17" end="25" />
url="https://github.com/near-examples/near-multichain/blob/aafcfe27f89d000e5abf94580dd4a7aaecb09fa7/src/services/bitcoin.js" start="17" end="25" />

</TabItem>

Expand Down Expand Up @@ -108,7 +108,7 @@ Constructing the transaction to be signed (transaction, message, data, etc.) var
<Tabs groupId="code-tabs">
<TabItem value="Ξ Ethereum">
<Github language="js"
url="https://github.com/near-examples/near-multichain/blob/main/src/services/ethereum.js"
url="https://github.com/near-examples/near-multichain/blob/aafcfe27f89d000e5abf94580dd4a7aaecb09fa7/src/services/ethereum.js"
start="47" end="73" />

In Ethereum, constructing the transaction is simple since you only need to specify the address of the receiver and how much you want to send.
Expand All @@ -117,7 +117,7 @@ In Ethereum, constructing the transaction is simple since you only need to speci

<TabItem value="₿ Bitcoin">
<Github language="js"
url="https://github.com/near-examples/near-multichain/blob/main/src/services/bitcoin.js"
url="https://github.com/near-examples/near-multichain/blob/aafcfe27f89d000e5abf94580dd4a7aaecb09fa7/src/services/bitcoin.js"
start="41" end="53" />

In bitcoin, you construct a new transaction by using all the Unspent Transaction Outputs (UTXOs) of the account as input, and then specify the output address and amount you want to send.
Expand All @@ -144,14 +144,14 @@ The method requires two parameters:
<Tabs groupId="code-tabs">
<TabItem value="Ξ Ethereum">
<Github language="js"
url="https://github.com/near-examples/near-multichain/blob/main/src/services/ethereum.js"
url="https://github.com/near-examples/near-multichain/blob/aafcfe27f89d000e5abf94580dd4a7aaecb09fa7/src/services/ethereum.js"
start="75" end="87" />

</TabItem>

<TabItem value="₿ Bitcoin">
<Github language="js"
url="https://github.com/near-examples/near-multichain/blob/main/src/services/bitcoin.js"
url="https://github.com/near-examples/near-multichain/blob/aafcfe27f89d000e5abf94580dd4a7aaecb09fa7/src/services/bitcoin.js"
start="55" end="118" />

For bitcoin, all UTXOs are signed independently and then combined into a single transaction.
Expand Down Expand Up @@ -188,16 +188,16 @@ This allows the contract to generalize the signing process for multiple blockcha
<Tabs groupId="code-tabs">
<TabItem value="Ξ Ethereum">
<Github language="js"
url="https://github.com/near-examples/near-multichain/blob/main/src/services/ethereum.js"
url="https://github.com/near-examples/near-multichain/blob/aafcfe27f89d000e5abf94580dd4a7aaecb09fa7/src/services/ethereum.js"
start="89" end="100" />

In Ethereum, the signature is formatted by concatenating the `r`, `s`, and `v` values returned by the contract.

</TabItem>
<!-- https://github.com/near-examples/near-multichain/blob/1c07d9a3de7f1f2ee93206b77832838f2892144b/src/services/bitcoin.js -->

<TabItem value="₿ Bitcoin">
<Github language="js"
url="https://github.com/near-examples/near-multichain/blob/main/src/services/bitcoin.js"
url="https://github.com/near-examples/near-multichain/blob/aafcfe27f89d000e5abf94580dd4a7aaecb09fa7/src/services/bitcoin.js"
start="120" end="172" />

In Bitcoin, the signature is formatted by concatenating the `r` and `s` values returned by the contract.
Expand All @@ -215,14 +215,14 @@ Once we have reconstructed the signature, we can relay it to the corresponding n
<Tabs groupId="code-tabs">
<TabItem value="Ξ Ethereum">
<Github language="js"
url="https://github.com/near-examples/near-multichain/blob/main/src/services/ethereum.js"
url="https://github.com/near-examples/near-multichain/blob/aafcfe27f89d000e5abf94580dd4a7aaecb09fa7/src/services/ethereum.js"
start="109" end="115" />

</TabItem>
<!-- https://github.com/near-examples/near-multichain/blob/1c07d9a3de7f1f2ee93206b77832838f2892144b/src/services/bitcoin.js -->

<TabItem value="₿ Bitcoin">
<Github language="js"
url="https://github.com/near-examples/near-multichain/blob/main/src/services/bitcoin.js"
url="https://github.com/near-examples/near-multichain/blob/aafcfe27f89d000e5abf94580dd4a7aaecb09fa7/src/services/bitcoin.js"
start="189" end="202" />

</TabItem>
Expand Down
8 changes: 4 additions & 4 deletions docs/2.build/5.primitives/dao.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ import SmartContractCreateDAO from "@site/src/components/docs/primitives/dao/sma
import SmartContractCreateProposal from "@site/src/components/docs/primitives/dao/smart-contract/create-proposal.md"
import SmartContractVoteForProposal from "@site/src/components/docs/primitives/dao/smart-contract/vote-for-proposal.md"

Decentralized Autonomous Organizations (DAOs) are self-organized groups that form around common purposes. Membership, decision making, and funding are coordinated by publicly voting on proposals through a smart contract.
Decentralized Autonomous Organizations (DAOs) are self-organized groups that form around common purposes. Membership, decision-making, and funding are coordinated by publicly voting on proposals through a smart contract.

![dao](/docs/primitives/dao.png)

In contrast with [FT](ft.md) and [NFT](nft.md), DAO contract's are not standardized. Because of this, in this page we will use as
In contrast with [FT](ft.md) and [NFT](nft.md), DAO contract's are not standardized. Because of this, on this page we will use as
reference the [Astra dao](https://dev.near.org/astraplusplus.ndctools.near/widget/home?page=daos) [contract](https://github.com/near-daos/sputnik-dao-contract). The main concepts covered here should
easily generalizable to other DAO implementations.

Expand Down Expand Up @@ -164,5 +164,5 @@ These snippet will enable your users to cast a vote for proposal of a particular

## Additional Resources

1. [AstroDAO UI](https://astrodao.com/) - the web app built on top of the Sputnik DAO Contract. Allows users to create and manage DAOs.
2. [List of DAOs as a NEAR component](https://dev.near.org/onboarder.near/widget/DAOSocialSearch)
1. [NEAR Treasury](https://neartreasury.com/) - a Treasury management web app built on top of the Sputnik DAO Contract. Allows users to create and manage treasury funds with ease.
2. [List of DAOs as a NEAR component](https://dev.near.org/onboarder.near/widget/DAOSocialSearch)
36 changes: 32 additions & 4 deletions docs/2.build/5.primitives/ft.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,14 @@ import CLISendToken from "@site/src/components/docs/primitives/ft/near-cli/send.
import CLIRegister from "@site/src/components/docs/primitives/ft/near-cli/register.md"
import CLIAttachTokenToCall from "@site/src/components/docs/primitives/ft/near-cli/attach-to-call.md"
import CLICreateToken from "@site/src/components/docs/primitives/ft/near-cli/create.md"
import CLICreateTokenManually from "@site/src/components/docs/primitives/ft/near-cli/create-manually.md"

import SmartContractSendToken from "@site/src/components/docs/primitives/ft/smart-contract/send.md"
import SmartContractAttachTokenToCall from "@site/src/components/docs/primitives/ft/smart-contract/attach-to-call.md"

import { LantstoolLabel } from "@site/src/components/lantstool/LantstoolLabel/LantstoolLabel";
import { TryOutOnLantstool } from "@site/src/components/lantstool/TryOutOnLantstool";

Besides the native NEAR token, NEAR accounts have access to a [multitude of tokens](https://guide.ref.finance/developers-1/cli-trading#query-whitelisted-tokens) to use throughout the ecosystem. Moreover, it is even possible for users to create their own fungible tokens.

In contrast with the NEAR native token, fungible token (FT) are **not stored** in the user's account. In fact, each FT lives in **their own contract** which is in charge of doing **bookkeeping**. This is, the contract keeps track of how many tokens each user has, and handles transfers internally.
Expand All @@ -56,6 +60,9 @@ You can create an FT using the toolbox on [Dev Portal](https://dev.near.org/tool
<TabItem value="🖥️ CLI" label="🖥️ CLI">
<CLICreateToken />
</TabItem>
<TabItem value="Lantstool" label={<LantstoolLabel />}>
<TryOutOnLantstool path="docs/2.build/5.primitives/ft/create-ft-via-factory.json" />
</TabItem>
</Tabs>

The FT you create will live in the account `<your_token_symbol>.tkn.primitives.near` (e.g. `test.tkn.primitives.near`).
Expand All @@ -66,13 +73,19 @@ The FT you create will live in the account `<your_token_symbol>.tkn.primitives.n

You can also create a fungible token by deploying and initializing a [canonical FT contract](https://github.com/near-examples/FT).

On initialization you will define the token's metadata such as its name (e.g. Ethereum), symbol (e.g. ETH) and total supply (e.g. 10M). You will also define an `owner`, which will own the tokens **total supply**.
On initialization, you will define the token's metadata such as its name (e.g. Ethereum), symbol (e.g. ETH) and total supply (e.g. 10M). You will also define an `owner`, which will own the tokens **total supply**.

To initialize a FT contract you will need to deploy it and then call the `new` method defining the token's metadata.

```bash
cargo near deploy build-non-reproducible-wasm <account-id> with-init-call new json-args '{"owner_id": "<owner-account>", "total_supply": "1000000000000000", "metadata": { "spec": "ft-1.0.0", "name": "Example Token Name", "symbol": "EXLT", "decimals": 8 }}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
```
<Tabs groupId="code-tabs">
<TabItem value="🖥️ CLI" label="🖥️ CLI">
<CLICreateTokenManually />
</TabItem>
<TabItem value="Lantstool" label={<LantstoolLabel />}>
<TryOutOnLantstool path="docs/2.build/5.primitives/ft/create-ft-manually.json" />
</TabItem>
</Tabs>


:::tip
Check the [Contract Wizard](https://dev.near.org/contractwizard.near/widget/ContractWizardUI) to create a personalized FT contract!.
Expand All @@ -93,6 +106,9 @@ You can query the FT's metadata by calling the `ft_metadata`.
<TabItem value="🖥️ CLI" label="🖥️ CLI">
<CLIGetMetadata />
</TabItem>
<TabItem value="Lantstool" label={<LantstoolLabel />}>
<TryOutOnLantstool path="docs/2.build/5.primitives/ft/query-ft-metadata.json" />
</TabItem>
</Tabs>

---
Expand All @@ -110,6 +126,9 @@ To know how many coins a user has you will need to query the method `ft_balance_
<TabItem value="🖥️ CLI" label="🖥️ CLI">
<CLICheckBalance />
</TabItem>
<TabItem value="Lantstool" label={<LantstoolLabel />}>
<TryOutOnLantstool path="docs/2.build/5.primitives/ft/check-ft-balance.json" />
</TabItem>
</Tabs>

---
Expand All @@ -129,6 +148,9 @@ By calling this `storage_deposit` the user can register themselves or **register
<TabItem value="🖥️ CLI" label="🖥️ CLI">
<CLIRegister />
</TabItem>
<TabItem value="Lantstool" label={<LantstoolLabel />}>
<TryOutOnLantstool path="docs/2.build/5.primitives/ft/register-user.json" />
</TabItem>
</Tabs>

:::info
Expand All @@ -154,6 +176,9 @@ To send FT to another account you will use the `ft_transfer` method, indicating
<TabItem value="🖥️ CLI" label="🖥️ CLI">
<CLISendToken />
</TabItem>
<TabItem value="Lantstool" label={<LantstoolLabel />}>
<TryOutOnLantstool path="docs/2.build/5.primitives/ft/transfer-tokens.json" />
</TabItem>
<TabItem value="📄 Contract" label="📄 Contract" default>
<SmartContractSendToken />
</TabItem>
Expand All @@ -176,6 +201,9 @@ Let's assume that you need to deposit FTs on Ref Finance.
<TabItem value="🖥️ CLI" label="🖥️ CLI">
<CLIAttachTokenToCall />
</TabItem>
<TabItem value="Lantstool" label={<LantstoolLabel />}>
<TryOutOnLantstool path="docs/2.build/5.primitives/ft/attach-ft-to-call.json" />
</TabItem>
<TabItem value="📄 Contract" label="📄 Contract" default>
<SmartContractAttachTokenToCall />
</TabItem>
Expand Down
35 changes: 15 additions & 20 deletions docs/2.build/5.primitives/linkdrop.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {FeatureList, Column, Feature} from "@site/src/components/featurelist"
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import { Github } from "@site/src/components/codetabs"
import { LantstoolLabel } from '@site/src/components/lantstool/LantstoolLabel/LantstoolLabel';
import { LantstoolLabel } from "@site/src/components/lantstool/LantstoolLabel/LantstoolLabel";
import { TryOutOnLantstool } from "@site/src/components/lantstool/TryOutOnLantstool";

Linkdrops allow users to distribute assets and onboard people to Web3 apps through a simple web link.

Expand Down Expand Up @@ -213,9 +214,8 @@ near call v2.keypom.near create_drop '{"public_keys": <PUBLIC_KEYS>, "deposit_pe

</TabItem>

<TabItem value="Lantstool" label={<LantstoolLabel/>}>
<p>Try it out on [Lantstool](https://app.lantstool.dev/import/gh/lantstool/examples.near-protocol/main/docs/2.build/5.primitives/linkdrop/create-near-drop.json)</p>
<Github language="json" url="https://github.com/lantstool/examples.near-protocol/blob/main/docs/2.build/5.primitives/linkdrop/create-near-drop.json" />
<TabItem value="Lantstool" label={<LantstoolLabel />}>
<TryOutOnLantstool path="docs/2.build/5.primitives/linkdrop/create-near-drop.json" />
</TabItem>
</Tabs>

Expand Down Expand Up @@ -306,9 +306,8 @@ near call v2.keypom.near create_drop '{"public_keys": <PUBLIC_KEYS>, "deposit_pe
</TabItem>
<TabItem value="Lantstool" label={<LantstoolLabel/>}>
<p>Try it out on [Lantstool](https://app.lantstool.dev/import/gh/lantstool/examples.near-protocol/main/docs/2.build/5.primitives/linkdrop/create-nft-drop.json)</p>
<Github language="json" url="https://github.com/lantstool/examples.near-protocol/blob/main/docs/2.build/5.primitives/linkdrop/create-nft-drop.json" />
<TabItem value="Lantstool" label={<LantstoolLabel />}>
<TryOutOnLantstool path="docs/2.build/5.primitives/linkdrop/create-nft-drop.json" />
</TabItem>
</Tabs>
Expand Down Expand Up @@ -372,9 +371,8 @@ near call nft.primitives.near nft_transfer_call '{"receiver_id": "v2.keypom.near
</TabItem>
<TabItem value="Lantstool" label={<LantstoolLabel/>}>
<p>Try it out on [Lantstool](https://app.lantstool.dev/import/gh/lantstool/examples.near-protocol/main/docs/2.build/5.primitives/linkdrop/transfer-nft-to-v2keypomnear.json)</p>
<Github language="json" url="https://github.com/lantstool/examples.near-protocol/blob/main/docs/2.build/5.primitives/linkdrop/transfer-nft-to-v2keypomnear.json" />
<TabItem value="Lantstool" label={<LantstoolLabel />}>
<TryOutOnLantstool path="docs/2.build/5.primitives/linkdrop/transfer-nft-to-v2keypomnear.json" />
</TabItem>
</Tabs>
Expand Down Expand Up @@ -467,10 +465,9 @@ near call v2.keypom.near create_drop '{"public_keys": <PUBLIC_KEYS>, "deposit_pe
</TabItem>
<TabItem value="Lantstool" label={<LantstoolLabel/>}>
<p>Try it out on [Lantstool](https://app.lantstool.dev/import/gh/lantstool/examples.near-protocol/main/docs/2.build/5.primitives/linkdrop/create-ft-drop.json)</p>
<Github language="json" url="https://github.com/lantstool/examples.near-protocol/blob/main/docs/2.build/5.primitives/linkdrop/create-ft-drop.json" />
</TabItem>
<TabItem value="Lantstool" label={<LantstoolLabel />}>
<TryOutOnLantstool path="docs/2.build/5.primitives/linkdrop/create-ft-drop.json" />
</TabItem>
</Tabs>
#### 2. Transferring FT
Expand Down Expand Up @@ -533,9 +530,8 @@ near call ft.primitives.near ft_transfer '{"receiver_id": "v2.keypom.near", "amo
</TabItem>
<TabItem value="Lantstool" label={<LantstoolLabel/>}>
<p>Try it out on [Lantstool](https://app.lantstool.dev/import/gh/lantstool/examples.near-protocol/main/docs/2.build/5.primitives/linkdrop/transfer-ft-to-v2keypomnear.json)</p>
<Github language="json" url="https://github.com/lantstool/examples.near-protocol/blob/main/docs/2.build/5.primitives/linkdrop/transfer-ft-to-v2keypomnear.json" />
<TabItem value="Lantstool" label={<LantstoolLabel />}>
<TryOutOnLantstool path="docs/2.build/5.primitives/linkdrop/transfer-ft-to-v2keypomnear.json" />
</TabItem>
</Tabs>
Expand Down Expand Up @@ -654,9 +650,8 @@ near call v2.keypom.near create_drop '{"public_keys": <PUBLIC_KEYS>, "deposit_pe
</TabItem>
<TabItem value="Lantstool" label={<LantstoolLabel/>}>
<p>Try it out on [Lantstool](https://app.lantstool.dev/import/gh/lantstool/examples.near-protocol/main/docs/2.build/5.primitives/linkdrop/create-function-call-drop.json)</p>
<Github language="json" url="https://github.com/lantstool/examples.near-protocol/blob/main/docs/2.build/5.primitives/linkdrop/create-function-call-drop.json" />
<TabItem value="Lantstool" label={<LantstoolLabel />}>
<TryOutOnLantstool path="docs/2.build/5.primitives/linkdrop/create-function-call-drop.json" />
</TabItem>
</Tabs>
Expand Down
8 changes: 3 additions & 5 deletions docs/chain-abstraction/omnibridge/implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,11 @@ flowchart TD
MPCSign --> Chain{Destination Chain}
Chain -->|Ethereum| EVMBridge[EVM Bridge Contract]
Chain -->|Bitcoin| BTCBridge[Bitcoin Script]
Chain -->|Other| WormBridge[Wormhole Bridge]
Chain -->|Other| OtherBridge[Verify MPC Signature]
EVMBridge --> Mint[Mint/Release Tokens]
BTCBridge --> Mint
WormBridge --> Mint
BTCBridge --> Mint[Mint/Release Tokens]
OtherBridge --> Mint
Mint --> End[Transfer Complete]
```
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```bash
cargo near deploy build-non-reproducible-wasm <account-id> \
with-init-call new \
json-args '{
"owner_id": "<owner-account>",
"total_supply": "1000000000000000",
"metadata": {
"spec": "ft-1.0.0",
"name": "Example Token Name",
"symbol": "EXLT",
"decimals": 8
}
}' \
prepaid-gas '100.0 Tgas' \
attached-deposit '0 NEAR' \
network-config testnet \
sign-with-keychain send
```
Binary file not shown.
Binary file modified website/static/docs/assets/explorers/nearblocks.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 website/static/docs/assets/explorers/nearcatalog.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 website/static/docs/assets/explorers/nearscope.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 website/static/docs/assets/explorers/pikespeak.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 not shown.

0 comments on commit 44f9a5d

Please sign in to comment.