code-423n4 / 2021-10-union-findings

0 stars 0 forks source link

Struct with only 1 element #88

Open code423n4 opened 3 years ago

code423n4 commented 3 years ago

Handle

pauliax

Vulnerability details

Impact

It is not efficient to have a struct with only 1 field as structs are meant for grouping related information together. A market struct can be replaced by directly pointing to a bool value: //before mapping(address => Market) public supportedMarkets; struct Market { bool isSupported; }

//after mapping(address => bool) public supportedMarkets;

GalloDaSballo commented 3 years ago

Agree with the finding, using a mapping of bool is probably more straightforward