Given the fact that the zap contracts will be layered, one mint() function may call another mint() function and tokens will be transferred multiple times from contract to contract. If we can add a recipient parameter, the unnecessary contract to contract token transfers can be avoided and save gas.
For example:
SettToRenIbbtcZap.sol#mint() will call IBBTC_MINT_ZAP.mint(), and IBBTC_MINT_ZAP will mint and transfer the minted tokens back to SettToRenIbbtcZap contract, and it will then send to the user (msg.sender)
Handle
WatchPug
Vulnerability details
Given the fact that the zap contracts will be layered, one
mint()
function may call anothermint()
function and tokens will be transferred multiple times from contract to contract. If we can add arecipient
parameter, the unnecessary contract to contract token transfers can be avoided and save gas.For example:
SettToRenIbbtcZap.sol#mint()
will callIBBTC_MINT_ZAP.mint()
, andIBBTC_MINT_ZAP
will mint and transfer the minted tokens back toSettToRenIbbtcZap
contract, and it will then send to the user (msg.sender
)https://github.com/Badger-Finance/badger-ibbtc-utility-zaps/blob/8d265aacb905d30bd95dcd54505fb26dc1f9b0b6/contracts/SettToRenIbbtcZap.sol#L311-L322
If a
recipient
parameter get added toIBBTC_MINT_ZAP.mint()
, the above codes can be changed to: