Skip to content

Commit

Permalink
update root readme.
Browse files Browse the repository at this point in the history
update bitmap nonces readme
  • Loading branch information
merklejerk committed Nov 19, 2023
1 parent 5e07321 commit bda49ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ This repo is an ongoing collection of useful, and occasionally clever, solidity/
- Contracts with upgradeable logic.
- [Big Data Storage (SSTORE2)](./patterns/big-data-storage)
- Cost efficient on-chain storage of multi-word data accessible to contracts.
- [Bitmap Nonces](./patterns/bitmap-nonces/)
- Efficiently tracking the state of many operations identifiable by a unique nonce.
- [Commit + Reveal](./patterns/commit-reveal)
- A two-step process for performing partially obscured on-chain actions that can't be front or back runned.
- [EIP712 Signed Messages](./patterns/eip712-signed-messages)
Expand Down Expand Up @@ -52,7 +54,7 @@ This repo is an ongoing collection of useful, and occasionally clever, solidity/
- [Read-Only Delegatecall](./patterns/readonly-delegatecall)
- Execute arbitrary delegatecalls in your contract in a read-only manner, without side-effects.
- [Reentrancy](./patterns/reentrancy)
- Explaining reentrancy vulnerabilities and patterns for addressing them.
- Explaining reentrancy vulnerabilities and patterns for addressing them (Checks-Effects-Interactions and reentrancy guards).
- [Separate Allowance Targets](./patterns/separate-allowance-targets/)
- Avoid having to migrate user allowances between upgrades with a dedicated approval contract.
- [Stack-Too-Deep Workarounds](./patterns/stack-too-deep/)
Expand Down
10 changes: 4 additions & 6 deletions patterns/bitmap-nonces/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,8 @@ contract TransferRelay {
}
```

## In the Wild
## Final Thoughts

You can find bitmap nonces being used in major protocols such as Uniswap's [Permit2](https://github.com/Uniswap/permit2/blob/cc56ad0f3439c502c246fc5cfcc3db92bb8b7219/src/SignatureTransfer.sol#L142) and 0x's [Exchange Proxy](https://github.com/0xProject/protocol/blob/e66307ba319e8c3e2a456767403298b576abc85e/contracts/zero-ex/contracts/src/features/nft_orders/ERC721OrdersFeature.sol#L662).

## The Demo

The full, working example can be found [here](./TransferRelay.sol) with complete tests demonstrating its usage and gas savings [here](../../test/TransferRelay.sol).
- You can find bitmap nonces being used in major protocols such as Uniswap's [Permit2](https://github.com/Uniswap/permit2/blob/cc56ad0f3439c502c246fc5cfcc3db92bb8b7219/src/SignatureTransfer.sol#L142) and 0x's [Exchange Proxy](https://github.com/0xProject/protocol/blob/e66307ba319e8c3e2a456767403298b576abc85e/contracts/zero-ex/contracts/src/features/nft_orders/ERC721OrdersFeature.sol#L662).
- There is no reason you couldn't track operations that have more than 2 states using bitmap nonces. You would just simply increase the number of bits in a word assigned to each operation and adjust the mapping formula accordingly.
- The full, working example can be found [here](./TransferRelay.sol) with complete tests demonstrating its usage and gas savings [here](../../test/TransferRelay.sol).

0 comments on commit bda49ab

Please sign in to comment.