Theory ArrayBuilder
theory ArrayBuilder
imports Solidity_Main Mcalc
begin
section ‹Memory Array Building Contract›
text ‹
In the following we verify the Memory Array Building contract,
a contract implementing a common pattern in Solidity to leverage memory arrays to save gas costs.
The contract is described further in
🌐‹https://web.archive.org/web/20251024110129/https://fravoll.github.io/solidity-patterns/memory_array_building.html›.
›
subsection ‹Formalisation of Contract›
abbreviation "items ≡ STR ''items''"
abbreviation "owner ≡ STR ''owner''"
abbreviation "result ≡ STR ''result''"
abbreviation "counter ≡ STR ''counter''"
abbreviation "i ≡ STR ''i''"
abbreviation "itemCount ≡ STR ''itemCount''"
abbreviation "Item ≡ SType.TEnum [SType.TValue TAddress, SType.TValue (TBytes 32)]"