Does packing bools alongside address reduce storage costs?

by Paul Berg   Last Updated September 23, 2019 13:28 PM - source

Say I have a struct like this:

struct MyStruct {
    bool foo;
    uint256 bar;
    uint256 baz;
    address qux;
}

If I rewrite it like this:

struct MyStruct {
    bool foo;
    address qux;
    uint256 bar;
    uint256 baz;
}

Would storage become less expensive, since address is an alias for uint160 and bool can only be 0 or 1? What if foo was of type address?



Related Questions


Getting storage variable state by name

Updated July 23, 2018 08:28 AM