
Backstop Liquidity Contract Challenge | Injective Bounty
Injective

Prize Pool
INJ10.0K
Location
Online
Status
Ended
Days Left
Ended
Date Range
Nov 4, 2024 - Nov 18, 2024
Submission Period
Not specified
About the Hackathon
TL;DR:
Putting out a challenge for teams to code a backstop liquidity smart contract for hINJ→INJ liquidation. Reward: 1500 INJ (~USD 30K notional, INJ price: 20.14)
Before you actually start working on the bounty, please register by sending your proposal to Injective via email ( rfp@injective.foundation ).
Overview
Create a smart contract that facilitates a fixed-rate swap mechanism between two tokens (Token A and Token B), with designated roles for liquidity providers and swap executors. The contract should maintain a pool of Token A that can be swapped for Token B at a predetermined rate, serving as a backstop liquidity solution during high-demand periods or market stress.
Background
Backstop liquidity mechanisms are crucial for maintaining market stability, especially during periods of high volatility or large liquidation events. This contract will serve as a guaranteed liquidity source with a fixed swap rate, ensuring that there's always available liquidity at a known price point for certain tokens.
Core Requirements
Role-Based Access Control
- Party A (Liquidity Provider):
-
Must be able to supply Token A to the contract
-
Can withdraw both Token A and Token B from the contract
-
Can set and update the swap rate
-
Can manage whitelist of Party B addresses
-
Should be set during contract instantiation
- Party B (Swap Executor):
-
Must be whitelisted by Party A
-
Can execute swaps up to available liquidity
-
Can query contract state and swap parameters
-
Cannot modify contract parameters
Functionality
- Liquidity Management:
-
Implementation of deposit function for Token A
-
Implementation of withdrawal functions for both tokens
-
Tracking of total liquidity supplied
-
Prevention of unauthorized withdrawals
- Swap Mechanism:
-
Fixed-rate swap execution
-
Validation of available liquidity before swap
-
Proper accounting of swapped amounts
-
Prevention of swaps when insufficient liquidity
- Rate Management:
-
Ability to set and update swap rates
-
Rate validation to prevent invalid values
-
Rate querying functionality
- Whitelist Management:
-
Functions to add/remove Party B addresses
-
Validation of whitelist status before swaps
-
Proper access control for whitelist management
Implementation Requirements
- Contract Structure:
-
Use CosmWasm standard contract structure
-
Implement proper error handling and custom errors
-
Include comprehensive testing suite
-
Follow CosmWasm best practices for state management
- Security Considerations:
-
Implement proper access control checks
-
Include reentrancy protection
-
Add proper validation for all inputs
-
Handle decimal precision carefully
-
Include emergency pause functionality
- Testing Requirements:
-
Unit tests for all main functions
-
Integration tests for common workflows
-
Error case testing
-
Proper mock implementations for CW20 tokens
Bonus Features
- Rate Limits:
-
Implement maximum swap amount per transaction
-
Add daily/weekly swap limits per address
- Enhanced Analytics:
-
Track historical swap volumes
-
Implement swap history queries
-
Add liquidity utilization metrics
- Advanced Features:
-
Multiple token pair support
-
Tiered whitelist system
-
Fee mechanism for swaps
-
Time-weighted average price calculation
Evaluation Criteria
- Code Quality:
-
Clean, well-documented code
-
Proper error handling
-
Efficient state management
-
Gas optimization
- Security:
-
Proper access controls
-
Input validation
-
Safe mathematical operations
-
Protection against common attack vectors
- Testing:
-
Comprehensive test coverage
-
Edge case handling
-
Proper mock implementations
-
Integration test scenarios
- Documentation
Prize Breakdown
- 🏆 Reward
- •1500 INJ

