This is a README file for the Prediction Markets project, a decentralized application (DApp) that utilizes Near Protocol, Near Rust smart contracts, Aurora EVM, and Mintbase SDK to create prediction markets, settle them, and mint NFTs for users who win the prediction market pools.
Near Protocol is a blockchain platform that offers a secure, scalable, and developer-friendly environment for building decentralized applications. It provides smart contract functionality, which we use to create prediction markets.
We have implemented smart contracts in Rust that enable the creation and management of prediction markets on the Near Protocol blockchain. These smart contracts facilitate the betting process, pool management, and settlement of prediction markets.
Aurora is a bridge between the Ethereum Virtual Machine (EVM) and the Near Protocol blockchain. It allows us to run Solidity smart contracts originally designed for Ethereum on the Near Protocol blockchain. We use Aurora to execute smart contracts related to prediction market settlements and payouts.
Mintbase is a platform for creating and managing NFTs (Non-Fungible Tokens). We utilize the Mintbase SDK to mint NFTs when prediction markets are settled, and users win the pool. These NFTs can represent unique assets or rewards associated with the prediction markets.
Before you can run the Prediction Markets DApp, you need to ensure you have the following dependencies installed:
- Near CLI - Near Protocol's command-line interface for interacting with the blockchain.
- Rust - Required for building and deploying Near smart contracts.
- Aurora EVM - To run Solidity smart contracts on Near.
- Mintbase SDK - Required for minting NFTs.
-
Build Near Contracts Project:
cd near_markets/near_rust_contracts ./build.sh
-
Build Solidity Contracts using Aurora SDK
cd near_markets/aurora_solidity_contracts
Below are the Near CLI Commands used to Run the various methods of the Smart contract
Deploy Smart Contract
near dev-deploy --wasmFile ./target/wasm32-unknown-unknown/release/near_rust_contracts.wasm --accountId userid.testnet
Create Prediction markets
near call userid.testnet create_market '{"description": "will india win world cup 2023?", "outcomes": ["YES", "NO"]}' --accountId userid.testnet
Get Current Live markets on the Contract
near view userid.testnet get_markets '{"from_index":0, "limit": 1}'
Vote for One of the Option of Prediction Market
near call userid.testnet place_bet '{"market_id": 0, "prediction": "YES"}' --accountId userid.testnet --amount 0.1
Settle the Market and share rewards to winners (To be moved to an oracle)
near call userid.testnet settle_market '{"market_id": 0, "winning_outcome": "YES"}' --accountId userid.testnet