README.md
near-smart-lottery
    Cargo.toml
    README.md
    build.sh
    deploy.sh
    src
        lib.rs
    test.sh
solana-smart-lottery
    Anchor.toml
    Cargo.toml
    migrations
        deploy.ts
    package.json
    programs
        solana-smart-lottery
            Cargo.toml
            Xargo.toml
            src
                lib.rs
    tests
        solana-smart-lottery.ts
    tsconfig.json
substrate_smart_lottery
    Cargo.toml
    lib.rs

# Smart Lottery on chain

This is a mono-repo for a smart contract on multiple blockchains. It aims to compare a (kind of) minumum viable code, for an actually useful smart-contract, on different blockchains.

The contracts implement a lottery logic with these features:
- A user can deposit tokens into the contract (`deposit` function)
- A random number can be generated on chain (`get_random_seed` function)
- The `trigger_lottery` function is triggered by external events
    - A real-world-time interval
    - A cross-chain event - when a certain sum of players reached _across all chains_
- The `share_prize` function transfers token to winners
    - For a single-chain lottery winners chosen from one chain
    - An multi-chain lottery - tokens across multiple chains are shared between winners on those chains, with price conversions and cross-chain value transfer

| Chain     | `deposit`      | `get_random_seed` | `trigger_lottery` | `share_prize` |
|-----------|----------------|-------------------|--------------|---------------|
| Ethereum  |                |                   |              |               |
| Cosmos    |                |                   |              |               |
| Solana    | wip            |                   |              |               |
| Cardano   |                |                   |              |               |
| Polkadot  | ✅              |                   |              |               |
| Near      | ✅              |                   |              |               |
| BSC       |                |                   |              |               |
| Harmony   |                |                   |              |               |
|           |                |                   |              |               |
# Rust Smart Contract Template

## Getting started

To get started with this template:

1. Click the "Use this template" button to create a new repo based on this template
2. Update line 2 of `Cargo.toml` with your project name
3. Update line 4 of `Cargo.toml` with your project author names
4. Set up the [prerequisites](https://github.com/near/near-sdk-rs#pre-requisites)
5. Begin writing your smart contract in `src/lib.rs`
6. Test the contract 

    `cargo test -- --nocapture`

8. Build the contract

    `RUSTFLAGS='-C link-arg=-s' cargo build --target wasm32-unknown-unknown --release`

**Get more info at:**

* [Rust Smart Contract Quick Start](https://docs.near.org/docs/develop/contracts/rust/intro)
* [Rust SDK Book](https://www.near-sdk.io/)
