Can some recommend a way to save gas fees?
a = a + 1;a++;
I heard about this; Pack struct tightly
Mine looks like this. I am not sure about size of address, ENUM variables and array without length. Please advice me or give me some reference links.
enum TokenType {A, B, C}
enum SwapType {AA, BB}
struct A {
address[] a;
uint256[] b;
TokenType[] c;
address d;
uint256 e;
}
struct B {
uint256 a;
uint256 b;
bool c;
uint256 d;
uint256 e;
bool f;
mapping(address => bool) g;
SwapType h;
Collection i;
Collection j;
}
And what is the best way for accessing struct mapping variables? I am using a lot of gas fees because I have struct B mapping, inside that, I have 2 struct objects, inside that object, I have 2 arrays.
Another question is, I heard functions orders in contract are affecting gas fees. Do function parameter orders affect gas fees as well?