Possible gas optimization
The getBurnRequest
function returns a burn-request amount associated with a given account. If the request does not exist, it returns zero. However, the internal behavior of tryGet
is identical, making the last conditional assignment unnecessary. Here is a possible optimization:
function getBurnRequest(
address account
) external view returns (uint256 amount) {
- (bool exists, uint256 value) = Storage.layout().burnRequests.tryGet(
+ (, amount) = Storage.layout().burnRequests.tryGet(
account
);
- amount = exists ? value : 0;
}
Since this is a view function, it does not directly save gas. However, it may if the function is called in another transaction.