Docs Category: Examples

Self Upgrade & State Migration

To Share and +4 nLEARNs Login with NEARimport Tabs from ‘@theme/Tabs’; import TabItem from ‘@theme/TabItem’; import {CodeTabs, Language, Github} from "@site/components/codetabs" Three examples on how to handle updates and state migration: State Migration: How to implement a migrate method to migrate state between contract updates. State Versioning: How to use readily use versioning on a …

Self Upgrade & State Migration Read More »

Factory

To Share and +4 nLEARNs Login with NEARimport Tabs from ‘@theme/Tabs’; import TabItem from ‘@theme/TabItem’; import {CodeTabs, Language, Github} from "@site/components/codetabs" A factory is a smart contract that stores a compiled contract on itself, and automatizes deploying it into sub-accounts. We have two factory examples: Token Factory: A factory that creates fungible tokens contracts. A …

Factory Read More »

Frontend Multiple Contracts

To Share and +4 nLEARNs Login with NEARimport Tabs from ‘@theme/Tabs’; import TabItem from ‘@theme/TabItem’; import {CodeTabs, Language, Github} from "@site/components/codetabs" This example showcases how to interact with multiple contracts from a single frontend. Particularly, this example shows how to: Query data from multiple contracts. Call methods in multiple contracts simultaneously. Query Data from Multiple …

Frontend Multiple Contracts Read More »

Complex Cross Contract Call

To Share and +4 nLEARNs Login with NEARimport Tabs from ‘@theme/Tabs’; import TabItem from ‘@theme/TabItem’; import {CodeTabs, Language, Github} from "@site/components/codetabs" This example presents 3 instances of complex cross-contract calls. Particularly, it shows: How to batch multiple method calls to a same contract. How to call multiple contracts in parallel, each returning a different type. …

Complex Cross Contract Call Read More »

Escrow Contract

To Share and +4 nLEARNs Login with NEARimport Tabs from ‘@theme/Tabs’; import TabItem from ‘@theme/TabItem’; import {CodeTabs, Language, Github} from "@site/components/codetabs" This example provides a simple implementation of an escrow contract, with a timeout callable function that concludes the transaction if the buyer has not provided approval within a given timeframe. The code also includes …

Escrow Contract Read More »

Coin Flip

To Share and +4 nLEARNs Login with NEARimport Tabs from ‘@theme/Tabs’; import TabItem from ‘@theme/TabItem’; import {CodeTabs, Language, Github} from "@site/components/codetabs" Coin Flip is a game where the player tries to guess the outcome of a coin flip. It is one of the simplest contracts implementing random numbers. Starting the Game You have two options …

Coin Flip Read More »

Scroll to Top