GammaSwap

Submit a Bug
29 September 2023
Live since
No
KYC required
$30,000
Maximum bounty
18 April 2024
Last updated

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.

Responsible Publication

GammaSwap adheres to category 2: Notice Required. This Policy determines what information whitehats are allowed to make public from their submitted bug reports. For more information about the category selected, please refer to our Responsible Publication page.

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.

Known Issue Assurance

GammaSwap commits to providing Known Issue Assurance to bug submissions through their program. This means that GammaSwap will either disclose known issues publicly or at the very least privately via a self-reported bug submission in order to allow for a more objective and streamlined mediation process to prove that an issue is known. Otherwise, assuming the bug report itself is valid, it would result in the bug report being considered in-scope and due 100% of the reward with respect to the bug bounty program terms.

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

Rewards by Threat Level

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 30,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.

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.

Smart Contract

Critical
Level
USD $15,000 to USD $30,000
Payout
PoC Required
High
Level
USD $5,000 to USD $10,000
Payout
PoC Required
Medium
Level
USD $2,000
Payout

Assets in scope

Impacts in scope

Only the following impacts are accepted within this bug bounty program. All other impacts are not considered as in-scope, even if they affect something in the assets in scope table.

Smart Contract

  • Direct theft of any user funds, whether at-rest or in-motion, other than unclaimed yield
    Critical
    Impact
  • Permanent freezing of funds
    Critical
    Impact
  • Protocol insolvency
    Critical
    Impact
  • Theft of unclaimed yield
    High
    Impact
  • Permanent freezing of unclaimed yield
    High
    Impact
  • Temporary freezing of funds
    High
    Impact
  • Contract fails to deliver promised returns, but doesn't lose value
    Medium
    Impact

Out of Scope & Rules

These impacts are out of scope for this bug bounty program.

All Categories

  • Impacts requiring attacks that the reporter has already exploited themselves, leading to damage
  • Impacts caused by attacks requiring access to leaked keys/credentials
  • Impacts caused by attacks requiring access to privileged addresses (governance, strategist) except in such cases where the contracts are intended to have no privileged access to functions that make the attack possible
  • Impacts relying on attacks involving the depegging of an external stablecoin where the attacker does not directly cause the depegging due to a bug in code
  • Mentions of secrets, access tokens, API keys, private keys, etc. in Github will be considered out of scope without proof that they are in-use in production
  • Best practice recommendations
  • Feature requests
  • Impacts on test files and configuration files unless stated otherwise in the bug bounty program

Smart Contracts

  • Incorrect data supplied by third party oracles
    • Not to exclude oracle manipulation/flash loan attacks
  • Impacts requiring basic economic and governance attacks (e.g. 51% attack)
  • Lack of liquidity impacts
  • Impacts from Sybil attacks
  • Impacts involving centralization risks
  • Best practice recommendations
  • Impact in UniswapV2 code for DeltaSwap fork (Unless such code was materially changed by GammaSwap or used by the GammaSwap contracts)

The following activities are prohibited by this bug bounty program:

  • 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