Submitted by adeolu
In the function mint(), owner is a parameter which is accepted by the function and is meant to be set into the TokenInfo structs owner field during the mint. But the issue is that the TokenInfo struct sets the owner to be the info.sender. This is wrong because info.sender, which is the function caller is not always the owner arg. This means the mint logic is defective, the user supplied value for owner will never be the owner of the newly minted token.
https://github.com/code-423n4/2024-10-coded-estate/blob/97efb35fd3734676f33598e6dff70119e41c7032/contracts/codedestate/src/execute.rs#L249-L257
From above, we can see the mint functions name and parameters, the owner parameter is a required parameter meant to be provided by the caller of the function. But this owner parameter is not used in the token:TokenInfo struct. Instead, owner is set to be the function caller instead of the user supplied owner value.
https://github.com/code-423n4/2024-10-coded-estate/blob/97efb35fd3734676f33598e6dff70119e41c7032/contracts/codedestate/src/execute.rs#L293
This will mean that a case where user A wants to mint token1 for user B will not work because even though user A is the function caller and has specified that user B should be the owner of token1, user A will still be set as the token owner.
Set user supplied owner value as owner in the token struct.
Context
blockchainstar12 (Coded Estate) acknowledged and commented:
adeolu (warden) commented:
For this audit, 3 reports were submitted by wardens detailing low risk and non-critical issues. The report highlighted below by Ch_301 received the top score from the judge.
The following wardens also submitted reports: nnez and K42.
