code-423n4 / 2021-12-yetifinance-findings

0 stars 0 forks source link

Use bytes32 instead of string to save gas whenever possible #3

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

robee

Vulnerability details

Use bytes32 instead of string to save gas whenever possible. String is a dynamic data structure and therefore is more gas consuming then bytes32. You could use bytes32 instead of string in the following places: List format:

    ActivePool.sol, 27, string constant public NAME = "ActivePool"; 
    BorrowerOperations.sol, 23, string public constant NAME = "BorrowerOperations"; 
    CollSurplusPool.sol, 19, string public constant NAME = "CollSurplusPool"; 
    DefaultPool.sol, 25, string public constant NAME = "DefaultPool"; 
    HintHelpers.sol, 17, string constant public NAME = "HintHelpers"; 
    Pool2Unipool.sol, 74, string constant public NAME = "Pool2Unipool"; 
    Unipool.sol, 74, string constant public NAME = "Unipool"; 
    PriceFeed.sol, 25, string constant public NAME = "PriceFeed"; 
    SortedTroves.sol, 52, string constant public NAME = "SortedTroves"; 
    StabilityPool.sol, 153, string public constant NAME = "StabilityPool"; 
    TroveManager.sol, 24, string constant public NAME = "TroveManager"; 
    Domain.sol, 11, string private constant EIP191_PREFIX_FOR_EIP712_STRUCTURED_DATA = "\x19\x01"; 
    CommunityIssuance.sol, 18, string constant public NAME = "CommunityIssuance"; 
    LockupContract.sol, 22, string constant public NAME = "LockupContract"; 
    LockupContractFactory.sol, 28, string constant public NAME = "LockupContractFactory"; 
    ShortLockupContract.sol, 22, string constant public NAME = "LockupContract"; 
    sYETIToken.sol, 34, string public constant symbol = "sYETI"; 
    sYETIToken.sol, 35, string public constant name = "Staked YETI Tokens"; 
    YETIToken.sol, 38, string constant internal _NAME = "Yeti Finance"; 
    YETIToken.sol, 39, string constant internal _SYMBOL = "YETI"; 
    YETIToken.sol, 40, string constant internal _VERSION = "1"; 
    YUSDToken.sol, 30, string constant internal _NAME = "YUSD Stablecoin"; 
    YUSDToken.sol, 31, string constant internal _SYMBOL = "YUSD"; 
    YUSDToken.sol, 32, string constant internal _VERSION = "1"; 
0xtruco commented 2 years ago

Resolved in https://github.com/code-423n4/2021-12-yetifinance/pull/28

alcueca commented 2 years ago

Duplicate #169