Contract Address (Base Mainnet): 0x925857e29e775e4091a7997eb0d57aebd0cf3220
Key Changes from Previous Versions:
- Fixed Entry Fee: 0.00002 ETH (no user selection)
- Owner-Managed Scores: Owner submits scores instead of commit-reveal
- Slippage Protection: Frontend must provide
amountOutMinimumparameter - Simplified Flow: No dice rolling, no commit-reveal complexity
- Pure Score System: Points = score (no modal influence)
- TRIA Payouts: All prizes paid in TRIA token
- Commit-reveal mechanism
- Dice rolling system
- User-selectable entry amounts
- Modal-based points calculation
Pay tournament entry fee (0.00002 ETH).
Parameters:
amountOutMinimum: Minimum TRIA output expected from swap (slippage protection)- Frontend should calculate this using Uniswap V3 Quoter
- Passing
0disables slippage protection (not recommended for production)
Returns: None (reverts on failure)
Example:
// Calculate slippage (e.g., 1% tolerance)
const expectedOutput = await quoter.quoteExactInputSingle(...);
const amountOutMinimum = expectedOutput * 99n / 100n; // 1% slippage
await payEntryFee(amountOutMinimum);Claim TRIA rewards for a specific period.
Parameters:
period: Period number to claim
Requirements:
- Period must be distributed
- User must have pending prize
- User hasn't claimed yet
Submit single player's score.
Parameters:
player: Player wallet addressscore: Final score (max 2,000,000)
Requirements:
- Caller must be owner
- Player must have entered tournament
- Period not yet distributed
Submit multiple scores in one transaction (gas-efficient).
Parameters:
players: Array of player addressesscores: Array of corresponding scores
Requirements:
- Arrays must be same length
- Caller must be owner
- Period not yet distributed
Calculate and allocate prizes for current period.
Requirements:
- 24 hours passed since last distribution
- Period not yet distributed
- Prize pool > 0
- Total points > 0
What it does:
- Calculate each player's share:
prize = (playerScore * prizePool) / totalPoints - Mark prizes as pending for each player
- Mark period as distributed
- Start new period automatically
Withdraw accumulated platform fees (TRIA).
Requirements:
- Caller must be owner
- Platform fees > 0
Returns current period information.
Returns:
(
uint256 period, // Current period number
uint256 prizePoolTRIA, // Prize pool in TRIA
uint256 totalPoints, // Sum of all scores
uint256 participants, // Number of entrants
uint256 startTime, // Period start timestamp
uint256 endTime, // Period end timestamp
bool distributed // Whether prizes allocated
)Returns player's info for specific period.
Returns:
(
bool hasEntered, // Whether player entered
uint256 score, // Player's submitted score
uint256 pendingPrizeTRIA, // Claimable TRIA amount
bool claimed, // Whether player claimed
uint256 points // Player's points (= score in V3)
)ENTRY_FEE = 0.00002 ether (20000000000000 wei)
MAX_SCORE = 2,000,000
DISTRIBUTION_INTERVAL = 24 hours
PRIZE_PERCENT = 80 (80% to prize pool)
PLATFORM_PERCENT = 20 (20% platform fees)1. Pay Entry Fee (0.00002 ETH)
โ
2. Play Game & Achieve Score
โ
3. [OWNER] Submit Score to Contract
โ
4. [OWNER] Allocate Prizes (after 24h)
โ
5. Claim TRIA Rewards
CRITICAL: Always calculate and provide amountOutMinimum when calling payEntryFee().
Recommended Implementation:
import { QUOTER_V2_ADDRESS } from '@uniswap/v3-sdk';
// 1. Get quote from Uniswap V3 Quoter
const quoter = new ethers.Contract(QUOTER_V2_ADDRESS, quoterABI, provider);
const quote = await quoter.callStatic.quoteExactInputSingle({
tokenIn: WETH_ADDRESS,
tokenOut: TRIA_ADDRESS,
fee: 3000, // 0.3%
amountIn: ethers.utils.parseEther('0.00002'),
sqrtPriceLimitX96: 0
});
// 2. Apply slippage tolerance (1-5%)
const slippageTolerance = 100; // 1%
const amountOutMinimum = quote.amountOut.mul(10000 - slippageTolerance).div(10000);
// 3. Call payEntryFee with protection
await contract.payEntryFee(amountOutMinimum, {
value: ethers.utils.parseEther('0.00002')
});- Submit scores accurately from SpacetimeDB
- Allocate prizes within 24-48h of period end
- Verify score submissions before allocation
Scenario:
- Prize Pool: 1000 TRIA
- Player A Score: 500,000
- Player B Score: 300,000
- Player C Score: 200,000
- Total Points: 1,000,000
Prizes:
- Player A:
(500,000 / 1,000,000) * 1000 = 500 TRIA - Player B:
(300,000 / 1,000,000) * 1000 = 300 TRIA - Player C:
(200,000 / 1,000,000) * 1000 = 200 TRIA
-
TournamentEntryModalV3.tsx- Entry payment modal -
usePointBasedContract.ts- Contract interaction hook -
etherTrialsPointBasedV3ABI.ts- Contract ABI -
ScoreSubmissionPanel.tsx- Admin score submission UI
- Update Imports:
import { ETHER_TRIALS_V3_ABI, ETHER_TRIALS_V3_ADDRESS } from '@/lib/contracts/etherTrialsPointBasedV3ABI';
import { TournamentEntryModalV3 } from '@/components/game/TournamentEntryModalV3';
import { usePointBasedContract } from '@/hooks/usePointBasedContract';- Entry Fee Payment:
const { payEntryFee, entryFee } = usePointBasedContract();
// Calculate slippage (placeholder - implement Quoter in production)
const amountOutMinimum = BigInt(0); // TODO: Use Quoter
await payEntryFee(amountOutMinimum);- Admin Panel - Score Submission:
const { submitScoresBatch } = usePointBasedContract();
// Submit all scores from SpacetimeDB
await submitScoresBatch(playerAddresses, playerScores);- Admin Panel - Prize Allocation:
const { allocatePrizes, prizePoolInfo } = usePointBasedContract();
// Check if can allocate
if (prizePoolInfo?.canDistribute) {
await allocatePrizes();
}- Prize Claiming:
const { claimPrize } = usePointBasedContract();
await claimPrize(BigInt(periodNumber));- No Automatic Slippage: Frontend must implement Quoter integration
- Manual Score Submission: Owner must manually submit scores from SpacetimeDB
- 24h Lock: Cannot allocate prizes until 24h after previous distribution
- No Partial Claims: Must claim entire prize for a period at once
| Feature | V9/V10 | V3 |
|---|---|---|
| Entry Amount | Variable | Fixed 0.00002 ETH |
| Score System | Commit-Reveal | Owner Submit |
| Points | Score ร Modal | Pure Score |
| Dice Rolling | Yes | No |
| Slippage Param | No | Yes (required) |
- Update contract address to V3
- Remove commit/reveal modal code
- Remove dice rolling components
- Update entry modal to use fixed fee
- Add owner score submission panel
- Implement slippage calculation (Quoter)
Contract Deployed: โ
Address: 0x925857e29e775e4091a7997eb0d57aebd0cf3220
Network: Base Mainnet
Verified: Yes (check BaseScan)
For questions or issues, refer to contract source code or contact development team.