Skip to content

0x73696d616f/In-memory-stack

Repository files navigation

In memory dynamic stack Github Actions Foundry License: MIT

A dynamic memory stack implementation in solidity.

Blueprint

lib
├─ forge-std — https://github.com/foundry-rs/forge-std
├─ openzeppelin-contracts — https://github.com/OpenZeppelin/openzeppelin-contracts
scripts
├─ 01_Deploy.s.sol — Simple Deployment Script
src
├─ InMemoryStack.sol — The library
test
└─ InMemoryStack.t.sol — Tests

Usage

Here's a list of the most frequently needed commands.

Build

Build the contracts:

$ make build

Clean

Delete the build artifacts and cache directories:

$ make clean

Compile

Compile the contracts:

$ make build

Test

To run all tests execute the following commad:

make tests

Alternatively, you can run specific tests as detailed in this guide.

Benchmarking

In the test testBenchmarkDynamicVsStatic() the gas costs of the dynamic stack vs a fixed sized array are compared.

The gas cost is approximately the same when 1000 elements are declared in the static array, but only 100 elements are effectively added.

Thus, try to use static arrays whenever possible to reduce gas overload.

About Us

Three Sigma is a venture builder firm focused on blockchain engineering, research, and investment. Our mission is to advance the adoption of blockchain technology and contribute towards the healthy development of the Web3 space.

If you are interested in joining our team, please contact us here.


About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published