Submitted by nnez
https://github.com/code-423n4/2024-10-coded-estate/blob/main/contracts/codedestate/src/execute.rs#L1786-L1796
https://github.com/code-423n4/2024-10-coded-estate/blob/main/contracts/codedestate/src/msg.rs#L156-L162
The use of u64 for token amount in the withdrawtolandlord function can lead to failed withdrawals when handling tokens with 18 decimals, limiting the landlords ability to withdraw their entitled funds if the amount exceeds the maximum value of u64.
In the withdrawtolandlord function, the token amount is defined as a u64 value. However, this can cause issues when handling tokens with 18 decimals, as the u64 data type can only store values up to approximately 1.8446744e+19 ~18 token of token with 18 decimals. This limit is significantly lower than what is supported by u128, which is used in other parts of the contract to handle token amount, such as info.funds[0].amount is a U128 type.
This discrepancy between the data types can create an issue. If the token amount owed to the landlord exceeds the maximum value supported by u64, the landlord will not be able to withdraw their entitled funds through the withdrawtolandlord function.
This is problematic as the Nibiru chain, the chain on which Coded Estate is deployed, supports custom denominated tokens, and users can specify tokens with 18 decimals as their payment currency. For example, if a large payment is made in such a token, the landlord would be unable to withdraw the full amount due to the limitations of the u64 type.
See here.
Change type of amount to u128 for consistency with other parts in the system.
Context
Lambda (judge) commented:
blockchainstar12 (Coded Estate) acknowledged
Lambda (judge) decreased severity to Low and commented:
nnez (warden) commented:
Lambda (judge) increased severity to Medium and commented:
