Skip to main content

This hackathon has ended

This event is no longer accepting registrations or submissions. Explore upcoming hackathons

Injective

Backstop Liquidity Contract Challenge | Injective Bounty

Injective

0 of 0
Backstop Liquidity Contract Challenge | Injective Bounty banner

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

  1. 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

  1. 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

  1. 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

  1. Swap Mechanism:
  • Fixed-rate swap execution

  • Validation of available liquidity before swap

  • Proper accounting of swapped amounts

  • Prevention of swaps when insufficient liquidity

  1. Rate Management:
  • Ability to set and update swap rates

  • Rate validation to prevent invalid values

  • Rate querying functionality

  1. Whitelist Management:
  • Functions to add/remove Party B addresses

  • Validation of whitelist status before swaps

  • Proper access control for whitelist management

Implementation Requirements

  1. 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

  1. Security Considerations:
  • Implement proper access control checks

  • Include reentrancy protection

  • Add proper validation for all inputs

  • Handle decimal precision carefully

  • Include emergency pause functionality

  1. Testing Requirements:
  • Unit tests for all main functions

  • Integration tests for common workflows

  • Error case testing

  • Proper mock implementations for CW20 tokens

Bonus Features

  1. Rate Limits:
  • Implement maximum swap amount per transaction

  • Add daily/weekly swap limits per address

  1. Enhanced Analytics:
  • Track historical swap volumes

  • Implement swap history queries

  • Add liquidity utilization metrics

  1. Advanced Features:
  • Multiple token pair support

  • Tiered whitelist system

  • Fee mechanism for swaps

  • Time-weighted average price calculation

Evaluation Criteria

  1. Code Quality:
  • Clean, well-documented code

  • Proper error handling

  • Efficient state management

  • Gas optimization

  1. Security:
  • Proper access controls

  • Input validation

  • Safe mathematical operations

  • Protection against common attack vectors

  1. Testing:
  • Comprehensive test coverage

  • Edge case handling

  • Proper mock implementations

  • Integration test scenarios

  1. Documentation

Prize Breakdown

  • 🏆 Reward
    • 1500 INJ