This repository contains the source code for the Wagerr smart contract written in Ink!, a Rust-based smart contract language for the Polkadot ecosystem.
Pre-requisites:
- Install Rust via the Substrate Docs (skip the "Compile a Substrate node" section)
- Install
cargo contract
- Install
substrate-contracts-node
# Install dependencies
pnpm install
# Build contracts and move artifacts to `contracts/deployments/{contract}/` folders
pnpm run build
# Start local node with persistence (contracts stay deployed after restart)
# NOTE: When using Brave, shields have to be taken down for the UIs
pnpm run node
## IMPORTANT: Open a separate terminal window and keep the node running
# Deploy the contracts on the local node
pnpm run deploy
Alternatively, you can also deploy contracts manually using Contracts UI (pnpm contracts-ui
) in the browser.
Once deployed, users can interact with the Wagerr Smart Contract in various ways:
createWager(name: String, terms: String)
: Create a new wagergetWager(id: String)
: Retrieve a wager with id.getPendingWagers()
: Get all pending wagers for an active account.getActiveWagers()
: Get all active wagers for an active account.joinWager(id: String)
: Join a pending wager.claimWin(id: String)
: Claim win for an active wager.AcceptRejectClaim(id: String, action: ClaimAction)
: Accept or Reject other party's claim.
Contributions to the Wagerr are welcome! Feel free to fork this repository, make your changes, and submit a pull request. Make sure to follow the contribution guidelines outlined in the repository.