From d216e7e705b099ce2cc5eb326224102d62462688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sieczkowski?= Date: Fri, 4 Nov 2022 17:57:45 +0100 Subject: [PATCH] Optimise gas by using storage pointer --- packages/contracts-por/contracts/TokenControllerV3.sol | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/contracts-por/contracts/TokenControllerV3.sol b/packages/contracts-por/contracts/TokenControllerV3.sol index 278f3df45..b4dc562a1 100644 --- a/packages/contracts-por/contracts/TokenControllerV3.sol +++ b/packages/contracts-por/contracts/TokenControllerV3.sol @@ -369,14 +369,14 @@ contract TokenControllerV3 { address _to, uint256 _value ) external mintNotPaused onlyMintRatifierOrOwner { - MintOperation memory op = mintOperations[_index]; + MintOperation storage op = mintOperations[_index]; require(op.to == _to, "to address does not match"); require(op.value == _value, "amount does not match"); - require(!mintOperations[_index].approved[msg.sender], "already approved"); - mintOperations[_index].approved[msg.sender] = true; - mintOperations[_index].numberOfApproval = mintOperations[_index].numberOfApproval.add(1); + require(!op.approved[msg.sender], "already approved"); + op.approved[msg.sender] = true; + op.numberOfApproval = op.numberOfApproval.add(1); emit MintRatified(_index, msg.sender); - if (hasEnoughApproval(mintOperations[_index].numberOfApproval, _value)) { + if (hasEnoughApproval(op.numberOfApproval, _value)) { finalizeMint(_index); } }