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.
- clone this repo to a local folder
- run
yarn - run
yarn test
- run
yarn testto run all tests- (!) be sure to run
yarn build:releaseat least once before:- run
yarn test:unitto run only unit tests - run
yarn test:simulateto run only simulation tests
- run
- (!) be sure to run
- run
yarn buildto quickly verify build status - run
yarn cleanto clean up build folder
-
Lottery contract and test documentation
- see
/src/lottery/READMEfor Lottery interface - see
/src/lottery/__tests__/READMEfor Lottery unit testing details
- see
-
Lottery contract simulation tests
- see
/simulation/READMEfor simulation testing
- see
Please note that boilerplate project configuration files have been omitted from the following lists for simplicity.
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 codesimulation <-- simulation tests
├── Cargo.toml
├── README.md
└── src
├── lib.rs
└── lottery.rsscripts
├── 1.init.sh
├── 2.play.sh
├── 3.reset.sh
├── README.md <-- instructions
├── report.sh
├── x-configure-fee.sh
└── x-configure-lottery.sh