---
# System prepended metadata

title: '[Injective] Rate limit for IBC and Peggy Bridge'

---

# Implement rate-limit for Injective

## Goal
Design and implement rate-limit logic for IBC and Peggy bridges. Its primary function is to limit the amount of assets transfer in/out the chain in the period of time. This is a safety control, intended to protect assets in the case Injective or couterparty chain has bug/exploit.

### Scope of work 

We implement a module that handles both rate-limit for IBC and Peggy.

1. Design the module: 
- The implementation for rate-limit has already existed. However, the existing design is lacking as it doesn't take into account of Peggy. We should come up with a new design to work with both Peggy and IBC, ideally, re-use some of the design from existing rate-limit module.
- In the existing rate-limit module, the module keeps track of throughput of IBC channels via IBC middleware so that it can stop transfering in/out on any channel whose throughput exceeds its configured limit. We can use the same model in our module but with some modification to adapt for Peggy. Thus, the module has a universal state which is the throughput data of tokens coming from IBC channels and Peggy, BUT the logic to fetch the throughput data and to restrict transfering is different for IBC token and Peggy token.

    Timeline:
    - Module design defined in spec
    - Review from injective team
    
    Total estimated time: 1 ~ 1.5 week

2. Implementing the module:

- We plan to implement to module in the following steps:
    1. Define module state, keeper method to interact with store and unit tests. The state should contains the following items:
        - Mapping from token to its throughput
        - Mapping from token to its in/out limit
    2. Implementing logic for IBC rate-limit, and unit tests. This step can be done quickly because we can refer stride's rate-limit module.
    3. Implementing logic for Peggy rate-limit, and unit tests. Unlike IBC rate-limit, we need to write our own logic, possibly with the need to modify `peggy` module.
    4. Review module's code, refactor and clean up if needed. 
   
  Total estimated time : 6 ~ 7 weeks 

### Pricing

Total cost of project: 40.000$ for 2 month works.

