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

0 stars 0 forks source link

Use local variables when emitting `ChangedPublisher` and `ChangedLicenseFee` #79

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

neslinesli93

Vulnerability details

Impact

Save an SLOAD call when emitting these two types of events: since the value is already available as a local variable, using that when emitting saves gas

Proof of Concept

https://github.com/code-423n4/2021-12-defiprotocol/blob/main/contracts/contracts/Basket.sol#L166 https://github.com/code-423n4/2021-12-defiprotocol/blob/main/contracts/contracts/Basket.sol#L185

0xleastwood commented 2 years ago

Duplicate of #162