Canto Application Specific Dollars and Bonding Curves for 1155s - 0xluckhu's results

Tokenizable bonding curves using a Stablecoin-as-a-Service token

General Information

Platform: Code4rena

Start Date: 13/11/2023

Pot Size: $24,500 USDC

Total HM: 3

Participants: 120

Period: 4 days

Judge: 0xTheC0der

Id: 306

League: ETH

Canto

Findings Distribution

Researcher Performance

Rank: 17/120

Findings: 1

Award: $690.37

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

Awards

690.3741 USDC - $690.37

Labels

bug
3 (High Risk)
satisfactory
upgraded by judge
duplicate-181

External Links

Lines of code

https://github.com/code-423n4/2023-11-canto/blob/486d0723d686964a6dacc93ae0e1876705b4aa6b/asD/src/asD.sol#L76

Vulnerability details

Impact

In function asD::withdrawCarry(), it uses wrong scale factor (1e28) in the calculation of the maximum withdrawable NOTE, while the correct scale factor to be removed shall be 1e18. As a result, the owner can withdraw less interest than expected (meaning most interests are locked in cNote).

Proof of Concept

Check below code to calculate the maximum withdrawable NOTE in asD::withdrawCarry(): uint256 maximumWithdrawable = (CTokenInterface(cNote).balanceOf(address(this)) * exchangeRate) /1e28 -totalSupply();

  1. CTokenInterface(cNote).balanceOf(address(this)) holds the decimals of cNote.decimals.
  2. exchangeRate holds the decimals of Note.decimals*1e18/cNote.decimals. Based on 1,2, (CTokenInterface(cNote).balanceOf(address(this)) * exchangeRate) has the decimals of Note.decimals*1e18. As a result, in order to keep the Note.decimals for the calculated maximumWithdrawable, it shall remove the scale factor of 1e18 instead of 1e28.

Tools Used

https://github.com/code-423n4/2023-11-canto/blob/486d0723d686964a6dacc93ae0e1876705b4aa6b/asD/src/asD.sol#L76 Correct 1e28 to 1e18.

Assessed type

Decimal

#0 - c4-pre-sort

2023-11-18T05:09:16Z

minhquanym marked the issue as duplicate of #227

#1 - c4-judge

2023-11-28T22:53:52Z

MarioPoneder changed the severity to 3 (High Risk)

#2 - c4-judge

2023-11-28T22:54:02Z

MarioPoneder marked the issue as satisfactory

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter