Skip to content

A contract with a simple implementation of transient storage

Notifications You must be signed in to change notification settings

nzmpi/TransientLock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Transient Lock

An example of a lock that uses transient storage for its reentrancy guard.

The contract is implemented in src/TransientLock.sol. The tests are in test/TransientLock.t.sol.

How to use

  • Use git clone git@github.com:nzmpi/TransientLock.git && cd TransientLock.

  • Run forge test -vv (you need to install Foundry first).

You can notice that using transient storage for a reentrancy guard uses almost 50% less gas than using cold persistent storage, but uses more gas than using warm storage.

However, using transient storage for an approve pattern tx uses more than 90% less gas than using cold persistent storage.

About

A contract with a simple implementation of transient storage

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published