GammaSwap-logo

GammaSwap

GammaSwap is a decentralized exchange enabling anyone to borrow liquidity from any AMM pool, oracle free. This contract is for UniV2 style AMMs but GammaSwap will support Balancer weighted pools in the future.There are two participants in the GammaSwap ecosystem: Liquidity Providers and Borrowers.

Arbitrum
Defi
AMM
DEX
Derivatives
Lending
Options
Perpetuals
Solidity
Maximum Bounty
$40,000
Live Since
29 September 2023
Last Updated
24 October 2024
  • PoC required

Rewards

GammaSwap provides rewards in USDC on Arbitrum, denominated in USD.

Rewards by Threat Level

Smart Contract
Critical
Max: $40,000Min: $15,000
Primacy of Rules
High
Max: $10,000Min: $5,000
Primacy of Rules
Medium
Flat: $2,000
Primacy of Rules

Rewards are distributed according to the impact the vulnerability could otherwise cause based on the Impacts in Scope table further below.

Reward Calculation for Critical Level Reports

For critical Smart Contract bugs, the reward amount is 10% of the funds directly affected up to a maximum of USD 40,000. The calculation of the amount of funds at risk is based on the time and date the bug report is submitted. However, a minimum reward of USD 15,000 is to be rewarded in order to incentivize security researchers against withholding a bug report.

Repeatable Attack Limitations

In cases of repeatable attacks for smart contract bugs, only the first attack will be counted, regardless of whether the smart contract is upgradable, pausable, or killable.

Reward Calculation for High Level Reports

High smart contract vulnerabilities will be capped at up to 100% of the funds affected. There is a minimum reward of $5,000 USD. In the event of temporary freezing, the reward doubles for every additional 5 blocks that the funds or NFTs could be temporarily frozen, rounded down to the nearest multiple of 5, up to the hard cap of USD 10,000.

Public Disclosure of Known Issues

Bug reports covering previously-discovered bugs acknowledged below are not eligible for any reward through the bug bounty program.

  • (Fail promised returns) Arbitrum block number mismatch with mainnet means that the next mainnet block update in arbitrum is usually 4 numbers higher than the previous one because Arbitrum syncs with mainnet every 1 minute. So a loan can be opened and closed in that timeframe to avoid paying an interest rate. However, they will still pay an origination fee.
  • (Fail promised returns) We say GammaSwap performs as good or better than the undeerlying CFMM. However, it is possible for the CFMM to outperform GammaSwap. GammaSwap’s yield is capped at 250% and the return calculated as an annualized value from the yield since the last update. Therefore, if there are many transactions or one really large transaction in the CFMM and subsequently one in GammaSwap soon after so that the annualized yield of the CFMM during that period (calculated by GammaSwap) is greater than 250% then the CFMM will outperform GammaSwap because GammaSwap’s rates are capped at 250%. This means how much a GS LP token represents in CFMM LP tokens would decrease after that update. However, over a longer period since CFMM’s fees don’t sustain that level of activity constantly, such event is short lived and GammaSwap will outperform the CFMM.
  • (Fail promised returns) Protocol fees in the CFMM can make the cfmm fee index be less than 1. This can make the value of the liquidity of GS LP token holders seem greater than it really is before the protocol fee in the CFMM is charged. The CFMM protocol fees in UniswapV2 and its forks are charged during the call of the mint() and burn() functions. Therefore, they always update to accurate values after transactions in GammaSwap that call the mint and burn functions of the CFMM (borrow, repay, liquidate, depositReserves, withdrawReserves). This does not create a benefit to anyone, other than the illusion that the returns (to liquidity suppliers) and expenses (to liquidity borrowers) are greater than they really are prior to the payment of accrued protocol fees. A calculation of the returns or costs after the protocol fee is paid is always accurate.
  • (Fail promised returns) Borrowing more liquidity has to be done in increments of the minBorrow amount. If minBorrow amount is of significant size then there’s not much granularity in borrowing liquidity. It doesn’t affect returns in the platform but it does affect the ease of use of the platform.
  • (Fail promised returns) Long volatility buyers (liquidity borrowers) may show a large profit but when deciding to close their positions to cash in, their profits may be smaller than they expected. The reason is because rebalancing the collateral to repay liquidity debt can have substantial market impact that diminishes their profits. However, this does not create protocol insolvency. The positions are always capable of repaying the liquidity debts as long as they are overcollateralized enough to recover the liquidity borrowed and pay the trading fees in the CFMM to rebalance the collateral.
  • (Fail promised returns, Temporary Freezing of Funds) A user may choose to LP into GammaSwap to become most of the liquidity deposited in the pool. Then borrow most of the liquidity in the pool at a relatively low origination fee. At last he may withdraw enough liquidity that he has LPed to leave the pool locked so nobody else can withdraw and spike up interest rates to 250%. This attack only affects liquidity borrowers, benefits LPs with high yields (although prevents them from withdrawing), and it’s a net cost to the attacker because 10% of the yield LPs receive goes to the protocol, and the attacker is paying most of this yield through interest in his large loan, while not receiving back 100% of the yield he earned. Liquidation rewards on undercollateralized loans are set at 25basis points of the collateral. So the attack may be worth it in some rare instances where there are enough loans close to liquidation that the attacker feels confident in being able to liquidate to cover his losses for spiking interest rates. However, the high rates may attract other LPs to provide liquidity, decreasing the time to liquidation of at risk loans. Also if these at risk loans are closed by their owners before the become undercollateralized then it is a loss to the attacker. Undercollateralization doesn’t mean bad debt in this case either. The current parameters leave a buffer of 50 basis points before reaching a bad debt scenario. That’s about 17.5 hours before a loan becomes bad debt at a constant interest rate of 250%
  • (Fail promised returns) A block stuffing attack may be performed to prevent liquidation transactions, until a GamaPool starts accruing bad debt. The cost of such an attack is of no benefit to the attacker, and given costs to liquidate being 10 cents currently on arbitrum, with the fee reward being multiples higher. The attacker would have to spike up the fees many times for a sustained period of time to make the attack successful. Unlikely to be economically viable for long periods of time.
  • (Fail promised returns) Since GammaPools track the liquidity of each loan as well as the sum of that whole liquidity as two separate numbers that compound separately using the same index. Mismatches may arise due to rounding issues that can accrue over time. The effect only affects the last person closing a loan. The result is that the payment of the last loan causes a write down, even if not undercollateralized, so that LPs do not earn the amount it was calculated they earned. The last person closing the loan is also not charged anymore than he was already aware he owed. These rounding differences however are so small and accrue at such a slow rate (e.g. grow by 1x10^-17 per day) that are unlikely to become a problem within any realistic timeframe.
  • (Fail promised returns) Since solidity does not have native support for decimals or square root formulas, some of the rebalancing calculations may be off a bit due to rounding issues again and liquidity borrowers may get slightly different results from what they expect during rebalancing or closing of their positions. The rounding differences however are usually seen at levels much less than a basis point so they’re usually expected to be very small and more prevalent in tokens that have smaller decimals, such as USDC and USDT which only use 6 decimals. But even in these scenarios the rounding errors lead to differences in outcome of around a couple of basis points.
  • (Fail promised returns) The LP token can be inflated away (e.g. through donations to the CFMM as in UniswapV2 and clones). When this happens it may change the actual reserve tokens a GS LP token represents due to rounding issues. This can lead to gains and losses to different LPs and borrowers. The effects are expected to be small except in early periods when a pool is first created.
  • (Fail promised returns) Liquidations can lead to the loss of the entire profit of a loan under certain conditions, especially the more profitable a position is, through CFMM price manipulation. Therefore, borrowers should always try to close their positiosn and not rely on liquidators to close their positions for them. However, this does not lead to losses of LP funds. Since liquidation is an undesirable outcome for a loan, the loss to profitable borrowers is not considered an issue.
  • (Fail promised returns) The code of the assets in scope for GammaPools, PositionManager, and Staking contracts are implementation contracts. Therefore, the implementation contracts may have security weaknesses, such as not initialized or initialized improperly. Those security issues are not part of this bounty. What is relevant is whether the proxy contracts that use those implementation contracts have security weaknesses using the current implementation contracts. In addition, proxy contracts might have been initialized with previous implementation contracts and therefore the initialization logic of the current implementation contracts may not be relevant anymore if a proxy contract can’t be initialized again. However, if a proxy contract is expected to be created again using the same implementation contract, as in the case of GammaPools for new pairs, or new staking pools, then initialization issues with the current implementation contract are relevant to this bounty.
  • (Fail promised returns) The code regarding staking for loans in the staking contracts is not part of this bounty unless it could affect the staking contracts for LP tokens. The reason is because we don’t plan to use the staking contracts for loan staking anymore. So there will not be any staking pools for loans. We will only create staking pools for LP tokens.
  • (Fail promised returns) The liquidityEMA and related parameters in DeltaSwap can be manipulated to help a token swapper avoid paying a transaction fee. This however, is no longer relevant since DeltaSwap’s parameters are now set to always charge a trading fee, and the GammaPool interest rate model depends on DeltaSwap always paying a trading fee. Therefore, we would never change this logic to not charge a trading fee.(Fail promised returns)

Previous Audits

GammaSwap has provided these completed audit review reports for reference. Any unfixed vulnerability mentioned in these reports are not eligible for a reward.

Proof of Concept (PoC) Requirements

A PoC is required for the following severity levels:

  • Smart Contract, Critical Severity Level
  • Smart Contract, High Severity Level

All PoCs submitted must comply with the Immunefi-wide PoC Guidelines and Rules. Bug report submissions without a PoC when a PoC is required will not be provided with a reward.

Reward Payment Terms

Payouts are handled by the GammaSwap team directly and are denominated in USD. However, payments are done in USDC.

Program Overview

GammaSwap is a decentralized exchange enabling anyone to borrow liquidity from any AMM pool, oracle free. This contract is for UniV2 style AMMs but GammaSwap will support Balancer weighted pools in the future.There are two participants in the GammaSwap ecosystem: Liquidity Providers and Borrowers.

For more information about GammaSwap, please visit https://gammaswap.com/.

GammaSwap provides rewards in USDC. For more details about the payment process, please view the Rewards by Threat Level section further below.

Primacy of Impact vs Primacy of Rules

GammaSwap adheres to the Primacy of Rules, which means that the whole bug bounty program is run strictly under the terms stated in this page.

Invoicing Information

If needed by the security researcher, GammaSwap is able to provide the necessary information for the proper issuance of an invoice. This includes:

  • Legal Entity Name
  • Registered Address

KYC not required

No KYC information is required for payout processing.

Proof of Concept

Proof of concept is always required for all severities.

Responsible Publication

Category 2: Notice Required

Prohibited Activities

Default prohibited activities
  • Any testing on mainnet or public testnet deployed code; all testing should be done on local-forks of either public testnet or mainnet
  • Any testing with pricing oracles or third-party smart contracts
  • Attempting phishing or other social engineering attacks against our employees and/or customers
  • Any testing with third-party systems and applications (e.g. browser extensions) as well as websites (e.g. SSO providers, advertising networks)
  • Any denial of service attacks that are executed against project assets
  • Automated testing of services that generates significant amounts of traffic
  • Public disclosure of an unpatched vulnerability in an embargoed bounty
  • Any other actions prohibited by the Immunefi Rules

Feasibility Limitations

The project may be receiving reports that are valid (the bug and attack vector are real) and cite assets and impacts that are in scope, but there may be obstacles or barriers to executing the attack in the real world. In other words, there is a question about how feasible the attack really is. Conversely, there may also be mitigation measures that projects can take to prevent the impact of the bug, which are not feasible or would require unconventional action and hence, should not be used as reasons for downgrading a bug's severity.

Therefore, Immunefi has developed a set of feasibility limitation standards which by default states what security researchers, as well as projects, can or cannot cite when reviewing a bug report.

Severity
Min. - Max.
Critical
$15k -$40k
High
$5k -$10k
Medium
$2k
Total Assets in Scope
26