ContractMe is a Starknet smart contract that implements a buy-in system with an increasing action cost and a prize pool. It allows users to participate by buying in, funding the contract, and includes owner-only functions for payouts and management.
- Buy-in mechanism with increasing cost
- Prize pool accumulation
- Owner-controlled payouts
- Contract funding
- Upgradeable design
action_cost()
: Returns the current cost to buy inprize_pool()
: Returns the current prize pool amountbuyin()
: Allows a user to buy in, transferring the action cost to the contractfundme(amount)
: Allows anyone to fund the prize pool
payout(recipient, amount)
: Transfers a specified amount from the prize pool to a recipientreset_cost()
: Resets the action cost to the initial valuedrain()
: Transfers all funds to the owner and resets the contract stateupgrade(new_class_hash)
: Upgrades the contract to a new implementation
- Deploy the contract, specifying the initial owner address
- Users can call buyin() to participate, ensuring they have approved the contract to spend STRK tokens
- Anyone can call fundme(amount) to add funds to the prize pool
- The owner can manage payouts and contract state using the owner-only functions
- Ownable: Only the owner can perform sensitive operations
- Upgradeable: The contract can be upgraded to fix bugs or add features
- Checks for overflows and insufficient balances/allowances
BuyIn
: Emitted when a user successfully buys in, including the caller's address, amount paid, and new prize pool total
The contract uses the STRK token on Starknet Sepolia testnet
Initial action cost is set to 4 STRK, increasing by 0.25 STRK with each buy-in
Ensure proper allowance is set before calling buyin()
or fundme()
To work with this contract:
- Set up a Starknet development environment
- Compile the contract using a compatible Cairo compiler
- Deploy to a Starknet testnet for testing
- Interact with the contract using Starknet-compatible wallets or SDKs
For detailed setup and testing instructions, refer to the Starknet documentation.