Hey @0xneves,
In the function createSwap() the state variable 'swapId' is used thrice (excluding swapId++) making it 3 sloads. Instead storing 'swapId' to a local variable brings it down to 1 sload and using the local variable thrice reduces the gas cost.
And also incrementing the swapId in assembly saves gas.
Hey @0xneves,
In the function createSwap() the state variable 'swapId' is used thrice (excluding swapId++) making it 3 sloads. Instead storing 'swapId' to a local variable brings it down to 1 sload and using the local variable thrice reduces the gas cost.
And also incrementing the swapId in assembly saves gas.