jcarbonnell/preTrainingNEAR huggingface dataset:
NEAR and WEMADE Team Up to Accelerate Mainstream Web3 Adoption
NEAR FOUNDATION
March 23, 2023
The Near Foundation is excited to announce that it’s partnering with WEMADE, one of the largest publicly-listed gaming companies in South Korea. A leading game developer in South Korea for over 20 years, WEMADE will be vital in Near’s push toward mainstream adoption of Web3.

Near and WEMADE will support the development of blockchain apps in Korea as well as other markets. Near and WEMADE will also jointly work on mutual brand awareness, and collaborate on a number of Web3 community events and business opportunities.  

“WEMADE and Near share a similar vision of enabling and accelerating the mainstream adoption of blockchain to create a future of nearly limitless potential use cases and benefits for all of us across many different areas of our daily lives,” said Shane Kim, CEO, WEMIX and Vice President, WEMADE. 

“In order to achieve that vision, we must make it easier, faster, and more cost-effective for developers to onboard off-chain apps, organizations, and startups, and are confident that Near is ideally positioned to do so.”

Onboarding end users and developers into Web3
The partnership will do much to encourage developers, including game designers, to build on the Near. Beyond co-hosting community events like offline hackathons and boot camps, Near and WEMADE will work together on mutual brand awareness, invest in research and collaboration on cross-chain initiatives, and be on the lookout for potential Web3 business opportunities and founders. 


A renowned leader in game development, WEMADE is at the forefront of a generational shift as the gaming industry pivots to blockchain technology. Its WEMIX subsidiary is building an experience-based, platform-driven, and service-oriented mega-ecosystem — one that will give users everywhere access to a wide array of easy-to-use Web3 apps and experiences.

“We’re thrilled to be partnering with WEMADE as part of our shared vision towards a decentralized future for the gaming industry,” said Commenting on the partnership, Marieke Flament, CEO of the Near Foundation. “By joining forces, we are confident in our ability to accelerate the development of cutting-edge solutions that meet the growing needs of gamers and developers in the Web3 space.”

The Near-WEMADE partnership marks the second major Web3 gaming partnership from the Near Korea Hub. The first, a partnership with BORA — the Web3 GameFi platform of Kakao Games — will also be vital in accelerating the mainstream adoption of Web3.
---
sidebar_position: 3
---

# Private Methods

## When using callbacks

Usually, when a contract has to have a callback for a remote cross-contract call, this callback method should only be called by the contract itself. It's to avoid someone else calling it and messing the state. Pretty common pattern is to have an assertion that validates that the direct caller (predecessor account ID) matches to the contract's account (current account ID). Macro `#[private]` simplifies it, by making it a single line macro instead and improves readability.

Use this annotation within the [`near_bindgen` macro](../contract-structure/near-bindgen.md) as follows:

```rust
#[private]
pub fn my_method(&mut self) {
    …
}
```

Which is equivalent to:

```rust
pub fn my_method(&mut self ) {
    if near_sdk::env::current_account_id() != near_sdk::env::predecessor_account_id() {
        near_sdk::env::panic_str("Method method is private");
    }
...
}
```

Now with this annotation, only the account of the contract itself can call this method, either directly or through a promise.

## Writing internal methods

Not all functions need to be exposed publicly. It may be beneficial to write private methods for helper or utility functions, for instance. There are three approaches to write internal methods:

1. Using `fn` instead of `pub fn`

  ```rust
  fn helper_method(a: u8, b: u8) {
    …
  }
  ```

2. Using `pub(crate) fn`. This may be helpful when an internal method is in a different module.

  ```rust
  // Function that can be called in another Rust file
  pub(crate) fn get_first_name(account: Account) {
    …
  }
  ```

  More information from the [official Rust docs](https://doc.rust-lang.org/reference/visibility-and-privacy.html) regarding public/private methods.

3. Separate `impl` block  

  Another way of not exporting methods is by having a separate `impl Contract` section, that is not marked with `#[near_bindgen]`.

  ```rust
  #[near_bindgen]
  impl Contract {
      pub fn increment(&mut self) {
          self.internal_increment();
      }
  }
  impl Contract {
      /// This methods is still not exported.
      pub fn internal_increment(&mut self) {
          self.counter += 1;
      }
  }
  ```
---
id: what-is
title: What are Primitives? 
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import {CodeTabs, Language, Github} from "@site/src/components/codetabs"

Primitives are fundamental building blocks that can be combined to create a fully functional application. Blockchain primitives include [Fungible Tokens (FT)](#fungible-tokens-ft), [Non Fungible Tokens (NFT)](#non-fungible-tokens-nft), [Decentralized Autonomous organizations (DAO)](#decentralized-autonomous-organizations-dao), [Link Drops](#linkdrops) and more.

![img](/docs/assets/welcome-pages/primitives-landing.png)

---

#### Fungible Tokens (FT)
[Fungible tokens](./ft.md) represent an **asset** on a blockchain that is **interchangeable**. Besides the native NEAR token, users can issue their own fungible tokens or use those that are already present in the ecosystem.

:::tip
Fungible Tokens are ideal to create **reward systems**, **fair tickets** and any other type of **token**.
:::

<hr class="subsection" />

#### Non Fungible Tokens (NFT)
In contrast with fungible tokens, each [non-fungible token (NFT)](./nft.md) is **unitary** and therefore **unique**. Users can create their own non-fungible token, transfer to other users, or exchange them in marketplaces.

:::tip
NFTs are ideal to represent **ownership of assets** such as **collectibles**, **event tickets** and other unique assets.
:::

<hr class="subsection" />

#### Decentralized Autonomous organizations (DAO)
[Decentralized Autonomous Organizations (DAOs)](./dao.md) 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.

:::tip
DAOs are ideal to create **decentralized governance**, **funding**, and **decision-making** tools.
:::

<hr class="subsection" />

### LinkDrops
[LinkDrops](./linkdrop.md) are an easy way to **distribute digital assets** (NFTs, FTs) via links. You simply **provide a link** for users and they can **claim** your drop.

:::tip
LinkDrops are ideal to do **drops**, and **onboard new users** into Web3 apps.
:::
---
id: frontrunning
title: Front Running
---

In the NEAR network, validators have access to the transaction pool, and can therefore see them before they execute. This enables validators to analyze transactions for a potential profit and frontrun them with a transaction of their own.

For example, imagine that you make a game where users are paid for solving puzzles. If not handled carefully, a validator could swap a transaction with the valid answer for one of its own and claim the prize. You can read more about this in [this blog post](https://www.paradigm.xyz/2020/08/ethereum-is-a-dark-forest).
---
id: basics
title: "Basic Instructions"
---

# Basic instructions
To compile release version of the smart contract you can run:

```bash
cargo build --target wasm32-unknown-unknown --release
```

:::info

The above `build` command is setting a `target` flag to create a WebAssembly `.wasm` file.

:::

Notice that your project directory now has a few additional items:

```bash
.
├── Cargo.lock  ⟵ created during build to lock dependencies
├── Cargo.toml
├── src
│  └── lib.rs
└── target      ⟵ created during build, holds the compiled wasm
```
# Build and Flags
We recommend you to optimize your build artifact with the use of the next flags in your Cargo.toml file. If you are performing a multi-contract build, you should include these settings in the Cargo.toml that is at the root of your project.

```bash
[profile.release]
codegen-units = 1
# Tell `rustc` to optimize for small code size.
opt-level = "z"
lto = true
debug = false
panic = "abort"
# Opt into extra safety checks on arithmetic operations https://stackoverflow.com/a/64136471/249801
overflow-checks = true
```

The above command is essentially setting special flags and optimizing the resulting `.wasm` file. At the end of the day, this allows you to customize the `cargo build --release` command.

# Custom Flags
If you wish to add custom flags to your build, you can perform this by adding build flags to your `ProjectFolder/.cargo/config.toml` as illustrated in this example.

```toml
[target.wasm32-unknown-unknown]
rustflags = ["-C", "link-arg=-s"]
```

A full set of build options can be accessed at https://doc.rust-lang.org/cargo/reference/config.html.


You can find an example [here](https://github.com/near/near-sdk-rs/blob/05e4539a8f3db86dd43b768ee9660dd4c8e7ea5c/examples/fungible-token/.cargo/config.toml).
---
description: Astro DAO Factory aka Astro DAO of DAOs
title: Astro DAO
---

# ✨ Astro DAO

### **Astro (SputnikDAO V2)**

[**Astro**](https://astrodao.com) builds on the foundations of SputnikDAO V1 and widely expands the functionality of DAOs built atop it.
Features shipped with Astro include:

* Flexible, role-based voting policies
* Stable coin payouts
  * This reduces the uncertainty imposed by crypto volatility between proposal requests and payouts
* Polling system for governance
* Electing representatives
* Cross-DAO accountability&#x20;
  * DAOs can serve as members of other DAOs
  * DAOs can own each other's social tokens for shared investment in collaboration.

Astro truly is the next evolution of SputnikDAO and comes with a host of new features, more flexibility, and a friendly UI.&#x20;

With Astro, DAOs will be able to retain more autonomy and, importantly, cast the net further in regards to governance through increased flexibility and the introduction of governance tokens.&#x20;

Despite the revamped user experience and broadened feature set, the goal of Astro remains the same; to empower communities within the NEAR ecosystem.

With Astro you can discover existing DAOs, [launch your own DAO](./how-to-launch-a-dao.md), and participate in [DAO governance](./dao-governance.md).
All you need is a NEAR account to start using Astro.
Orange DAO Selects NEAR Foundation as Web3 Startup Partner
COMMUNITY
March 31, 2022
NEAR Foundation is excited to announce that Orange DAO, a crypto collective created by Y Combinator alumni for backing Web3 startups, has selected NEAR as its preferred layer 1 blockchain. 

In turn, NEAR Foundation will invest $15 million into Orange DAO to help support the founders who are building Web3 companies on the NEAR blockchain.

“We are thrilled to have been selected by some of the brightest minds in the world as the preferred layer1 chain on which Orange DAO members will want to build,” said Marieke Flament, CEO of the NEAR Foundation. “We know that community-driven innovation benefits everyone, and this partnership is simply another example of our mission in practice.”

Bringing startup accelerator expertise to NEAR
Although Y Combinator is not formally involved in the project, Orange DAO is currently made up entirely of YC alumni, including NEAR co-founder Alexander Skidanov. After starting with just a few dozen YC alums, Orange DAO has expanded in recent months to include over a thousand YC founders. 

One of the world’s leading startup accelerators, YC has been integral in developing some of the fastest-growing and most valuable tech brands. Based in Mountain View, California, YC has backed over 3,300 companies for a combined valuation of $600B, including Airbnb, Stripe, Dropbox, Coinbase, Opensea, Twitch, and Reddit. 

YC alums created Orange DAO as a venture structure to both identify and support young crypto startups currently building the future of the Web3 ecosystem. 

Orange DAO is not the first foray into Web3 by YC founders. Back in 2017, hundreds of alumni created the Pioneer Fund, a more traditional venture vehicle, to back Web3 projects. By contrast, Orange DAO operates as a decentralized autonomous organization, using blockchain tech to help multiple users make collective decisions. 

Why Orange DAO chose NEAR
Unlike other blockchain networks, NEAR offers Web3 software developers an extremely fast, secure, and low-cost protocol—by way of its unique Nightshade sharding approach—for building decentralized applications (dapps). NEAR’s protocol technology, as well as its bridges to other blockchains, and developer ecosystem proved highly attractive to Orange DAO’s founders. 

The Orange DAO team will leverage NEAR’s strengths to back past, present, and aspiring Y Combinator founders. The DAO will do this by helping founders apply and get accepted into YC; providing pre- and post-YC funding; as well as mentoring founders and helping where possible with recruitment and customer acquisition. 

NEAR Foundation’s funding will vest over four years, and the Foundation will also provide time and resources to support YC founders.
NEAR in Hong Kong: Create Without Limits
COMMUNITY
March 29, 2023
NEAR is making a debut in Hong Kong as a Platinum Sponsor for the Hong Kong Web3 Festival, which will be held at the Hong Kong Convention and Exhibition Centre on April 12-15, 2023. This four-day event, hosted on five center stages across an area of about 9,000㎡, will see over 10,000 attendees, 300 distinguished industry speakers, about 100 Web3 projects, community partners and media partners around the world congregate to network, share, and learn through high-level content and panel discussions. 

Web3 Festival will bring together the world’s brightest minds, top Web3 projects and leading venture capital firms presenting content-rich discussions and topics centered around Web3. Hong Kong regulatory representatives will also dive into and interpret the latest digital asset regulation policies. Top industry leaders such as CZ of Binance, Illia of NEAR Protocol, Juan of Filecoin, Dr. Xiao Feng of Wanxiang and Yat Siu of Animoca Brands are all expected to speak at the Festival.

Join us on April 14th 9:30am to 12:30pm (GMT+8) at NEAR in HK Meetup — a half-day mini summit with a full schedule of keynote speeches and panels to explore topics on NEAR as a BOS, Web3 social, NFTs, DeFi and more. The summit is hosted as one of the official side stages as part of the Web3 Festival at the Convention Centre. A number of remarkable NEAR speakers will join us in Hong Kong and share their insights around NEAR’s ecosystem development. While we are finalizing the details of the event, the list of guests below are expected to speak at the summit:

Illia Polosukhin – Co-Founder of NEAR Protocol and CEO of Pagoda
Robbie Lim – Head of BD, NEAR Foundation
Louis Liu – Founder & CEO, Octopus Network
Amos Zhang – Founder of MetaWeb Ventures and Early Contributor of NEAR Protocol
Bowen Shen – Co-Founder, Proximity Labs
Kenny Qi – Founder & CEO, Sender Wallet
Cox Zhang – Founder & CEO, Connect3
Ran Yi – Co-Founder of Orderly Network
Arjun Arora – COO,  Orderly Network

Register for NEAR in HK Meetup

From April 12th – 15th, you can visit the NEAR booth during Hong Kong Web3 Festival and mingle with NEAR projects, community members, and other builders from the ecosystem.

To participate in the NEAR in HK Meetup, please register via Eventbrite and obtain a single day pass to the HK Web 3 Festival on April 14th (valued at $100 USD). The space is limited and open registration is available for the first 200 qualified registrants only. The remaining tickets will be distributed via various community giveaways and online events to our most loyal community members.
---
sidebar_position: 3
title: "Payable Methods"
---

# Payable Methods

We can allow methods to accept a NEAR token transfer together with the function call. This is done so that contracts can define a fee in tokens that needs to be paid when they are used. By default the methods are not payable and they will throw an error if someone will attempt to attach tokens to them during the invocation. This is done for safety reasons, in case someone accidentally transfers tokens during the function call.

To declare a method as payable, use the `({ payableFunction: true })` decorator parameter within the [`NearBindgen` decorated contract class](../contract-structure/near-bindgen.md) as follows:

```js
@call({ payableFunction: true })
my_method({}) {
    // ...
}
```

This will allow the `my_method` function to be called with NEAR Tokens attached to the call, transferring tokens to the contract.

Example:

```js
@NearBindgen({})
export class Contract {
    @call({ payableFunction: true })
    take_my_money({}) {
        near.log("Thanks!");
    }

    @call({})
    do_not_take_my_money({}) {
        near.log("No thanks!");
    }
}
```

is equivalent to:

```js
@NearBindgen({})
export class Contract {
    @call({})
    take_my_money({}) {
        near.log("Thanks!");
    }

    @call({})
    do_not_take_my_money({}) {
        if (near.attachedDeposit() > BigInt(0)) {
            throw new Error("Method do_not_take_my_money doesn't accept deposit");
        }
        near.log("No thanks!");
    }
}
```
Near and RECUR to Make Building on Web3 Easy for Web2 Brands
NEAR FOUNDATION
February 23, 2023
Near Foundation is excited to announce a new integration with RECUR, a  Web3 platform helping major enterprises launch innovative, digital collectible experiences. With RECUR Builder, an enterprise-grade SaaS, the company is making it easier than ever for projects of all sizes to seamlessly build, scale, and integrate Web3 experiences into their existing products, marketing stack, video games, and more. 

By using RECUR Builder, Web2 brands and other projects can develop on-chain branded experiences that enable the purchase, collection, and resale of digital projects and collectibles, like NFTs and beyond. Beloved brands like Paramount, Hello Kitty, and Nickelodeon currently work with RECUR to create chain-agnostic, bespoke experiences that make NFTs accessible through user-friendly experiences. 

Near’s partnership with RECUR is part of its Web2.5 strategy, functioning as a bridge between the Web2 and Web3 worlds. This new integration will enable Near users to purchase, trade, and engage with RECUR’s extensive roster of licensed intellectual property, along with participation in upcoming mints and the option of ecosystem partnerships and NEAR-native mints.

Building and scaling Web3 experiences
RECUR prides itself on helping businesses and creators to build, distribute, and manage Web3 experiences at scale with enterprise-level tools. With a polished and super user-friendly interface, first-time buyers can purchase NFTs from major global and upcoming brands alike. With a Near Wallet, users can buy NFTs using credit cards, Apple Pay, Google Pay, and crypto (BTC, ETH, USDC). 

 “We are delighted to partner with Near to bring more Web2 companies into the world of Web3, supporting enterprises and fans with future-proof solutions via the RECUR platform,” says Zach Bruch, CEO of Recur. “We have always been passionate about building the future of web3 for everyone, and building alongside partners like Near is a crucial part of that journey.” 

Marieke Flament, CEO of Near Foundation, noted that this partnership with RECUR is part of a larger commitment to making Web3 more accessible for everyone. 

“[We] are excited about partnering with RECUR to empower brands and fans as they invent and explore new digital experiences,” says Flament. “Finding ways to make Web3 more user-friendly is a key part of unlocking the magic of this new chapter, and we believe this partnership with RECUR helps us to do that for many around the globe.”
```js
import { Wallet } from './near-wallet';

const KEYPOM_CONTRACT_ADDRESS = "v2.keypom.near";
const FT_CONTRACT_ADDRESS = "ft.primitives.near";

const wallet = new Wallet({ createAccessKeyFor: FT_CONTRACT_ADDRESS }); 

await wallet.callMethod({
  method: "ft_transfer",
  contractId: FT_CONTRACT_ADDRESS,
  args: {
    receiver_id: KEYPOM_CONTRACT_ADDRESS,
    amount: "1"
  },
  deposit: "1",
  gas: "100000000000000"
});
```

_The `Wallet` object comes from our [quickstart template](https://github.com/near-examples/hello-near-examples/blob/main/frontend/near-wallet.js)_
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs groupId="nft-contract-tabs" className="file-tabs">
<TabItem value="NFT Primitive" label="Reference" default>

```js
import { Wallet } from './near-wallet';

const CONTRACT_ADDRESS = "nft.primitives.near";
const wallet = new Wallet({ createAccessKeyFor: CONTRACT_ADDRESS });
 
await wallet.callMethod({
  method: 'nft_transfer',
  args: {
    token_id: "1",
    receiver_id: "bob.near"
  },
  contractId: CONTRACT_ADDRESS,
  deposit: 1
});
```

_The `Wallet` object comes from our [quickstart template](https://github.com/near-examples/hello-near-examples/blob/main/frontend/near-wallet.js)_ 

</TabItem>

<TabItem value="Paras" label="Paras">

```js
import { Wallet } from './near-wallet';

const CONTRACT_ADDRESS = "x.paras.near";
const wallet = new Wallet({ createAccessKeyFor: CONTRACT_ADDRESS });
 
await wallet.callMethod({
  method: 'nft_transfer',
  args: {
    token_id: "490641",
    receiver_id: "bob.near"
  },
  contractId: CONTRACT_ADDRESS,
  deposit: 1
});
```

_The `Wallet` object comes from our [quickstart template](https://github.com/near-examples/hello-near-examples/blob/main/frontend/near-wallet.js)_ 

</TabItem>

<TabItem value="Mintbase" label="Mintbase">

```js
import { Wallet } from './near-wallet';

const CONTRACT_ADDRESS = "thomasettorreiv.mintbase1.near";
const wallet = new Wallet({ createAccessKeyFor: CONTRACT_ADDRESS });
 
await wallet.callMethod({
  method: 'nft_transfer',
  args: {
    token_id: "490641",
    receiver_id: "bob.near"
  },
  contractId: CONTRACT_ADDRESS,
  deposit: 1
});
```

_The `Wallet` object comes from our [quickstart template](https://github.com/near-examples/hello-near-examples/blob/main/frontend/near-wallet.js)_

:::tip

Check how to also do this using [`Mintbase JS`](https://docs.mintbase.xyz/dev/mintbase-sdk-ref/sdk/transfer)

:::

</TabItem>

</Tabs>