Code Monkey home page Code Monkey logo

ncd.l1.sample--lottery's Introduction

Lottery

This repository includes a complete project structure for AssemblyScript contracts targeting the NEAR platform.

The example here is playful. It's a toy involving a lottery.

The goal of this repository is to make it as easy as possible to get started writing unit and simulation tests for AssemblyScript contracts built to work with NEAR Protocol.

⚠️ Warning

Any content produced by NEAR, or developer resources that NEAR provides, are for educational and inspiration purposes only. NEAR does not encourage, induce or sanction the deployment of any such applications in violation of applicable laws or regulations.

Usage

Prerequisites:

  • Current version of Node.js <=v14.18.3

Getting started

  1. clone this repo to a local folder
  2. run yarn
  3. run yarn test

Top-level yarn commands

  • run yarn test to run all tests
    • (!) be sure to run yarn build:release at least once before:
      • run yarn test:unit to run only unit tests
      • run yarn test:simulate to run only simulation tests
  • run yarn build to quickly verify build status
  • run yarn clean to clean up build folder

Other documentation

  • Lottery contract and test documentation

    • see /src/lottery/README for Lottery interface
    • see /src/lottery/__tests__/README for Lottery unit testing details
  • Lottery contract simulation tests

    • see /simulation/README for simulation testing

The file system

Please note that boilerplate project configuration files have been ommitted from the following lists for simplicity.

Contracts and Unit Tests

src
├── lottery                       <-- Lottery contract
│   ├── README.md
│   ├── __tests__
│   │   ├── README.md
│   │   ├── fee-strategies.unit.spec.ts
│   │   ├── index.unit.spec.ts
│   │   └── lottery.unit.spec.ts
│   └── assembly
│       ├── fee-strategies.ts
│       ├── index.ts
│       └── lottery.ts
└── utils.ts                      <-- shared contract code

Simulation Tests

simulation                        <-- simulation tests
├── Cargo.toml
├── README.md
└── src
    ├── lib.rs
    └── lottery.rs

Helper Scripts

scripts
├── 1.init.sh
├── 2.play.sh
├── 3.reset.sh
├── README.md                     <-- instructions
├── report.sh
├── x-configure-fee.sh
└── x-configure-lottery.sh

ncd.l1.sample--lottery's People

Contributors

oguzhancttnky avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.