Skip to content

auralshin/climb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Climb: On-chain Elo

Climb is an on-chain Elo engine with fast convergence, anti-smurf heuristics, and an optional Pro Mode staking layer—designed for environments where you can record every match, not just summaries.


Quick start

Prereqs

# install foundry
curl -L https://foundry.paradigm.xyz | bash
foundryup

Build & test

forge build
forge test -vv
forge test --gas-report

You’ll see unit + edge-case + signature path tests in test/EloLeague.t.sol and additional fuzz/invariant suites if you add the optional files suggested below.

Lint & format

forge fmt

Integrations

Yep—you don’t need a client lib if you’re happy with the oracle path.

Minimal oracle setup

  1. Allowlist your game + oracle:

    league.setGame(gameAddress, true);
    league.setOracle(myOracle, true);
  2. From the oracle (or an allowlisted game contract), call:

    ClimbEloLeague.Match memory m = ClimbEloLeague.Match({
    game: gameAddress,
    playerA: A, playerB: B,
    scoreA: 2, scoreB: 0,
    playedAt: uint64(block.timestamp),
    nonceA: league.nonces(A), nonceB: league.nonces(B)
    });
    league.submitMatch(m, "", "");  // no sigs needed

When a helper lib is useful

Only if you want P2P signatures (EOA/1271) or a tiny utility to build the digest client-side. For pure oracle flows, skip it.

Trade-off: Oracle = simplest integration but trusted submitter; P2P = trust-minimized but you’ll collect two EIP-712 sigs.


Deploy (Forge)

Create a env

echo "DEPLOYER_PK=0xabc123..." > .env
echo "RPC_URL=https://your-rpc" >> .env
echo "OWNER=0xYourOwnerSafe" >> .env
echo "ORACLE=0xYourOracle" >> .env 
echo "MIN_PRO_STAKE=100000000000000000" >> .env
echo "WITHDRAW_DELAY=86400" >> .env
forge script script/Deploy.s.sol:Deploy \
  --rpc-url $RPC_URL \
  --broadcast \
  --slow \
  --via-ir

Run scenario tests

forge test -vv
forge test --ffi --gas-report

Gas snapshot

forge snapshot   # produces .gas-snapshot

License

MIT. See LICENSE.

About

Climb is an on-chain Elo engine

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors