Skip to content
Business logic Audit finding Intermediate

Swivel.setFee() is implemented wrongly.

hansfriese Follow

Originally disclosed on Code4rena

Submitted by hansfriese, also found by jonatascm

Swivel.setFee() is implemented wrongly. Swivel.feenominators won’t be set as expected.

Proof of Concept

This function has a parameter “i” for the index of the new fee denomination but it isn’t used during the update.

Tools Used

Solidity Visual Developer of VSCode

Recommended Mitigation Steps

This line should be modified like below.

feenominators[i[x]] = d[x];

JTraversa (Swivel) disagreed with severity and commented:

Given this allows us to change fees post initialization, and doesn’t lead to the leakage of value or loss of funds, but a potential issue for admins solely (in a rare edge case where fees would even need to be changed), I might consider this low risk?

bghughes (judge) commented:

I agree with the warden here given that this is an incorrect implementation of the intended functionality. The warden’s suggestion shows that the function was not working as intended; if in production, for instance, this was not caught then calls to setFee would not work as intended and not set any fees across the markets. Instead, it would only populate the zero index of the 2nd-demensional array uint16[4] public feenominators; losing these values [zcTokenInitiate, zcTokenExit, vaultInitiate, vaultExit] and breaking functionality.

JTraversa (Swivel) commented:

Yeah I was kind of on the fence on this one thinking the method wouldn’t impact the current feenominators in the way you’ve stated, but because it actually could have an impact, and the event itself also would be misleading, removing the disagreement.

robrobbins (Swivel) resolved:

Addressed: https://github.com/Swivel-Finance/gost/pull/419.


The original report as published on Code4rena, by hansfriese. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is known

A medium-severity business logic bug in Swivel v3 contest. Code4rena made it public on 29 September 2022. Found in the 2022-07-swivel audit contest (finding M-02).

About Business logic

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by hansfriese

View all

65 more disclosed reports, best first.

More from Swivel v3 contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.