Bug Bounty Simulations
Below are detailed simulations for the key functions, demonstrating their interactions and outcomes.
A. Creating a Bounty
Scenario 1: Using Otacon Tokens
User wants to create a bounty using Otacon tokens.
User approves
otaconFee
Otacon tokens for transfer to the registry contract.User calls
startBounty
withuseOtaconToken = true
.
TypeScript Example:
Outcome:
Otacon tokens are transferred from the user to the contract.
Bounty is created and assigned a new
bountyId
.
Scenario 2: Using ETH
User sends
ethFee
amount of ETH with the transaction.User calls
startBounty
withuseETH = true
.
TypeScript Example:
Outcome:
Half of the ETH is used to buy back Otacon tokens via Uniswap V3.
Bounty is created and assigned a new
bountyId
.
Scenario 3: Using Bounty Pass Collectible
User owns a Bounty Pass collectible (
bountyPassTokenId
).User calls
startBounty
withbountyPassTokenId
.
TypeScript Example:
Outcome:
Bounty Pass collectible is transferred to the contract and burned.
Bounty is created and assigned a new
bountyId
.
B. Staking a Collectible
Staking a ProofCollectible
User owns a ProofCollectible (
collectibleId
).User approves the transfer.
User calls
stakeProofCollectible
.
TypeScript Example:
Outcome:
The ProofCollectible is transferred to the contract.
Recorded in
stakedProofs
.
C. Validating a Proof of Bug
Validator calls
validateProof
with thebountyId
,proofCollectibleId
, andseverity
.The contract checks authorization and existence of the staked proof.
Calculates rewards and protocol fees.
Transfers rewards and updates state.
TypeScript Example:
Outcome:
Bounty hunter receives their reward.
Protocol fees are accumulated.
ProofCollectible is burned.
D. Distributing Rewards to a Bounty Hunter
Handled within
validateProof
.The hunter's reward is transferred during validation.
Protocol fee is calculated and stored.
E. Claiming a Bounty Share
User must have staked a proof and a multiplier.
User calls
claimBountyShare
.Contract calculates the user's share.
Burns the staked multiplier collectibles.
Transfers the share to the user.
TypeScript Example:
Outcome:
User receives their calculated share of the protocol bounty rewards.
Multiplier collectibles are burned.
User cannot claim again for the same bounty.
Last updated