The function that calculates how much collateral to sell subtracts the base token's decimals from the collateral token's decimals using unsigned integers. When the collateral token has fewer decimals than the base token, the subtraction underflows and the function always reverts.
The update_collateral_asset function stores the caller-supplied configuration without forcing its asset_id to match the key it is stored under, unlike update_market_configuration which reuses the old base_token. An owner could therefore save a configuration whose asset_id disagrees with its storage key, leaving inconsistent collateral data.
The absorb function processes a list of accounts and reverts entirely if any one account is not liquidatable. An attacker could make a transaction fail by ensuring one account in the list is no longer liquidatable, for example by repaying debt first, thereby blocking the liquidation of other accounts.
The contract's price update function accepts a payment larger than the required update fee but does not refund the excess, so the extra tokens remain stuck in the contract. An attacker could cause a user to lose funds by inducing them to overpay, though the report frames it as a user mistake.
The mint function in an SRC-20 token contract does not check whether the recipient identity is the zero address. An attacker with owner privileges could mint tokens to the zero address, causing those tokens to be permanently lost.
The update_market_configuration function preserves the original base_token but does not preserve base_token_decimals, so an owner could accidentally change the decimals of the base token. This could lead to incorrect calculations or accounting if the decimals are altered.
The present_value_borrow() function truncates the result of principal * borrow_index / BASE_INDEX_SCALE_15, rounding down instead of up, so small loans may accrue no interest. An attacker could repeatedly borrow small amounts and supply them to earn interest from the rounding loss.
In markets where a collateral token has fewer decimals than the base token, the scale calculation in collateral_value_to_sell() underflows and reverts, while available_to_borrow() computes an incorrect borrow limit. This can prevent liquidators from calculating collateral to sell, wasting time and potentially causing bad debt.
The market contract forwards the user's fee to Pyth's oracle before checking whether the price feeds actually need updating. When the feeds are already current, Pyth keeps the fee without updating anything, so users lose funds that become stuck in the oracle.
The token contract's constructor can be called by anyone, so an attacker can front-run the real deployer and set themselves as owner. This makes the deployer's own initialisation call fail, forcing a redeploy and wasting gas.
The withdraw_base function enforces a minimum borrow amount, but the supply_base function does not, allowing a user to borrow a large amount and then repay most of it to leave a debt below the minimum. This could create small loans that are not worth liquidating, potentially leaving collateral stuck in the contract.
The function that converts a borrower's principal into the current debt amount uses integer division that rounds down, so the debt is slightly understated. An attacker could repay slightly less than owed, and repeated rounding in the protocol's favour of the borrower could contribute to insolvency.
The contract's pause configuration lets the admin pause collateral supply and base supply while leaving the absorb (liquidation) function active. If a borrower's collateral price falls during that state, the borrower cannot add collateral or repay, but other users can still call absorb and take the collateral.
The burn function in the src-20 contract checks that the sent amount is greater than or equal to the burn amount, but only burns the specified amount and subtracts it from total supply. An attacker can send more tokens than they burn, leaving the excess stuck in the contract with no way to recover them, and if the total supply cap is reached, no further tokens can be minted.
The market contract's function that updates the Pyth oracle contract identifier writes the new value to storage without emitting an event. As a result, off-chain observers would not be notified when this important configuration changes.
The contract's price validation uses a single hard-coded confidence threshold for every Pyth price feed, but different feeds have very different confidence widths. A feed with a wide confidence interval can fail the check and cause transactions to revert, while a feed with a narrow interval may pass even when the price is unreliable.
The market contract calculates decimal scaling factors using subtraction and division that can underflow or divide by zero when the base token has more decimals than the collateral, or fewer than six decimals. This causes view functions to revert or the market to become unusable, requiring redeployment.
The available-to-borrow calculation compares a collateral limit expressed in USD against the already-borrowed amount in base units, without converting the borrow to USD. When the base asset price differs from one dollar, the function reports more or less borrowable than the true remaining limit.
The liquidation check in the absorb function used the supply rate instead of the borrow rate when calculating a borrower's present debt value, making the debt appear smaller. This delayed liquidation until collateral prices fell further, reducing the yield the protocol could earn from liquidating the position.
The Swaylend market contract forwards the user-supplied Pyth oracle update fee without checking whether the oracle actually requires that amount. If the oracle price was already updated or the fee was reduced, the user overpays and the excess is not refunded.
The contract's pause mechanism blocks supplying collateral but not withdrawing it, so a user can still remove collateral while the market is paused. An attacker could keep exploiting the protocol during a pause that the admin intended to stop activity.
The Market contract loops over all collateral configurations in several functions, and since configurations cannot be removed, adding enough of them would exceed the transaction gas limit, making functions like withdraw_base unexecutable and permanently locking funds.