Skip to content

cultist-tech/near-tournament

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tournament

This repository includes an implementation of a tournament contract.

Introduction

Necessary for various tournaments on blockchain. A tournament is created (access via NFT as an option) with certain conditions (number of participants, entry price, distribution of funds between winners). Each participant contributes a predetermined amount of money, after the end of the tournament, all collected funds are distributed according to the terms of the tournament. Also anyone can contribute FT or NFT to the tournament prize fund.

Prerequisites

  • Make sure Rust is installed per the prerequisites in near-sdk-rs.
  • Make sure near-cli is installed.

Explore this contract

The source for this contract is in /src/lib.rs.

Building this contract

Run the following, and we'll build our rust project up via cargo. This will generate our WASM binaries into our res/ directory. This is the smart contract we'll be deploying onto the NEAR blockchain later.

sh ./scripts/build.sh

Using this contract

Quickest deploy

You can build and deploy this smart contract to a development account. Dev Accounts are auto-generated accounts to assist in developing and testing smart contracts. Please see the Standard deploy section for creating a more personalized account to deploy to.

sh ./scripts/dev-deploy.sh

Behind the scenes, this is creating an account and deploying a contract to it. On the console, notice a message like:

Done deploying to dev-1234567890123

In this instance, the account is dev-1234567890123. A file has been created containing a key pair to the account, located at neardev/dev-account. To make the next few steps easier, we're going to set an environment variable containing this development account id and use that when copy/pasting commands. Run this command to set the environment variable:

source ./scripts/neardev/dev-account.env

You can tell if the environment variable is set correctly if your command line prints the account name after this command:

echo $CONTRACT_NAME

The next command will initialize the contract using the new method:

near call $CONTRACT_NAME new_default_meta '{"owner_id": "'$CONTRACT_NAME'"}' --accountId $CONTRACT_NAME

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published