Skip to content

nearuaguild/mystery-box

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Near Protocol | Mystery Box

Randomly distribute NEAR & NFT rewards among users

Explore other projects · Report a bug

About The Project

Mystery Boxes, a fascinating and dynamic concept, are a popular mechanism used to distribute rewards randomly among users in various domains, including online gaming, eCommerce, and marketing campaigns. These intriguing boxes offer participants an element of chance, suspense, and surprise, creating an engaging and thrilling experience.

Built With


Getting Started

💡 Before starting, please ensure that you have all the necessary installations completed

Smart Contract

Build

  1. Clone the repo
 git clone https://github.com/nearuaguild/mystery-box.git
  1. Open project folder
cd mystery-box/contract
  1. Compile the project
./build.sh

Deploy to testnet

near dev-deploy --wasmFile res/mystery_box.wasm

Initialize

near call mystery_box.testnet new '{}' --accountId some_account.testnet

Add NEAR reward

near call mystery_box.testnet add_near_reward '{"rarity": "epic", "amount": "100000000000000000000000", "capacity": "5"}' --accountId some_account.testnet --depositYocto 186000000000000000000000

Add NFT reward

near call mystery_box.testnet trust_nft_contract '{"contract_id": "some_nft_contract.testnet"}' --accountId some_account.testnet
near call some_nft_contract.testnet nft_transfer_call '{"token_id": "5", "receiver_id": "mystery_box.testnet", "msg": "epic"}' --accountId some_account.testnet --depositYocto 1

Mint box

near call mystery_box.testnet mint '{"account_id": "another_account.testnet", "rarity": "legendary"}' --accountId denbite.testnet --depositYocto 1980000000000000000000

Claim box

near call mystery_box.testnet claim '{"box_id": 1}' --accountId another_account.testnet --depositYocto 1

BOS Widget

Open project folder

cd mystery-box/widget

Preparation

Update widget_owner_id property in each component with the address you want it deploy to

Deploy

bos components deploy

Post Deploy

Make sure to include the contract_id (the address you deployed the Smart Contract to in the steps above) query parameter in the URL for the widget to function correctly after deploying it


Developed by

Guild cover

Near Ukraine Guild is a fast-growing guild based in Ukraine, aimed at providing high-quality educational content and assistance to grow a strong community of developers/entrepreneurs/enthusiasts within the Near Protocol ecosystem

Community Validator Node

Community Validator cover

Our validator has been active for a few months now, and the funds it generates are being put towards sponsoring community activities

Join us now to stake and earn 10% APY

Click below to get started 👇

Socials

Twitter Youtube Telegram Chat Telegram Channel Medium Github

License

Based on LittleLink

See LICENSE.txt for more information