Skip to content

Latest commit

 

History

History
105 lines (76 loc) · 3.05 KB

README.md

File metadata and controls

105 lines (76 loc) · 3.05 KB

Base64

Base64 is a smart contract framework for Tournament-based prediction markets that was built for Coinbase's Onchain Summer Hackathon. It was built using Foundry by Yuga Cohler and Chris Nascone.

NOTE: These contracts are unaudited and potentially buggy. Use at your own risk!

demo.mov

(The above video uses random competitors and random results.)

Key Concepts

A Tournament is the central smart contract of Base64. It consists of:

  • Competitors: The entities that compete in the tournament. These can be anything, e.g. ERC-721 tokens, or FriendTech accounts. The number of competitors must be a power of 2 between 4 and 256 inclusive.
  • Results: The mechanism for deciding the winner of any given match in the Tournament. This could be anything, e.g. random, or based on price.
  • Participants: These are the onchain addresses that predict the results of the Tournament. There could be conditions on them, for example, that they are ENS holders.

The Participant with the most points at the end of the Tournament wins.

NOTE: Base64 does not accept bets/stakes and does not compute payouts to participants. However, a separate Escrow contract that depends on Base64 could be deployed to enable this functionality. Do so at your own risk!

Frontend

Coming soon!

Live Contract Addresses

On Base Goerli:

Build

$ forge build

Test

$ forge test

Format

$ forge fmt

Gas Snapshots

$ forge snapshot

Start Local Ethereum Network

Start a local Ethereum Network by running

$ anvil

Deploy Base64

See the script folder for a sequence of scripts to deploy Base64 on Base Goerli.

Call Base64

getBracket

cast call <contract-address> "getBracket()(uint256[][])"

getTeam

cast call <contract-address> "getTeam(uint256)((uint256,string))" 1

submitEntry

Use another private key for this transaction.

cast send \
  --private-key <other-private-key> \
  <contract-address> \
  "submitEntry(uint256[][])" "[[1,3,5,7],[3,5],[3]]"

getParticipant

cast call <contract-address> "listParticipants()(address[])"

advance

cast send --private-key <admin-private-key> \
  --rpc-url "https://goerli.base.org/" \
  --gas-limit 5000000 \
  <contract-address> "advance()"