- Abstract contract used to implement rate limits.
- Vault and Controller connect to socket via ConnectorPlugs
- This is to enable support of multiple switchboards on same path.
- Contract on non App chains.
- Lock and unlock amounts.
- Implements Gauge.
- Revert on lock throttle.
- Store pending and unlock later on unlock throttle.
- Contract on App chain.
- Has mint and burn rights on token.
- Calls ExchangeRate contract for lock >> mint and burn >> unlock conversion.
- Implements sibling chain specific Gauge.
- Revert on burn throttle.
- Store pending and mint later on mint throttle.
- Contract for lock >> mint and burn >> unlock conversion.
- Enables path to AMM based bridging.
- Each connector has a configurable
maxLimit
andratePerSecond
. maxLimit
defines the maximum amount that can be bridged in the decided time frame.ratePerSecond
defines the rate at which limit is replenished once it is used. The limit keeps increasing with time till it reachesmaxLimit
.- Eg. Suppose we want to allow maximum 3600 tokens to be deposited per hour.
maxLimit = 3600
ratePerSecond = maxLimit / duration = 1
- If a user were to deposit 3600 tokens, no one would be able to deposit more tokens immediately.
After 10 minutes, users would be able to deposit
10 * 60 * 1 = 600
tokens. After an hour, they would be able to deposit60 * 60 * 1 = 3600
tokens. - If a user were to deposit 1200 tokens, users could deposit
3600 - 1200 = 2400
more tokens immediately. And after 10 minutes they would be able to deposit2400 + 10 * 60 * 1 = 3000
tokens.