Grep-Fu - show all signatures for custom errors

Posted on Tue 07 March 2023 in tech • Tagged with solidity, programming

Grep-Fu

Custom errors are a feature of Solidity that allow you to display error messages to the user in a convenient and gas-efficient way. They are declared in the head of the contract and called after a revert statement.

error Unauthorized();
if (msg.sender != owner()) {
  revert Unauthorized();
}

However, a challenge …


Continue reading

Dynamic address set in solidity

Posted on Fri 17 February 2023 in tech • Tagged with solidity, ethereum, programming, tutorial

Dynamic Address Set

This is a complete step by step walkthrough implementation of a dynamic address set in Solidity for Ethereum blockchain.

Includes:

  • foundry
  • modifier
  • event
  • dynamic data structures
  • unit testing

  • Full project on GitHub

  • Full tutorial on YouTube:

Compiled switch in modern c++

Posted on Tue 31 January 2023 in tech • Tagged with c++, c++20, programming, tutorial

Compiled Switch

This example demonstrates how to incorporate a compiled switch construct in an event driven application such as a market data handler or parser.

Full tutorial on YouTube:


Fibonacci 200M in 2 Minutes

Posted on Fri 16 December 2022 in tech • Tagged with programming, fibonacci, prime, go

Fibonaccis

F(200M) in 2 minutes! Apple arm64 is no joke. You can do it yourself with Go Fib


Order of evaluation for Solidity modifiers

Posted on Thu 13 October 2022 in tech • Tagged with solidity, programming, ethereum, web3, modifier

Solidity modifiers are evaluated from left to right. It makes sense to order modifiers in order of those that are most likely to fail to those that are least likely to fail. It is also a good idea to order them from most primitive to most expensive. And prerequisite conditions …


Continue reading

remove the ./ from find -print

Posted on Wed 28 September 2022 in tech • Tagged with linux, programming, bash

If you want to apply a script to each file in a folder recursively you may not want the full relative path. Here is how to remove it.

$ find . -type f -print | sed -e "s|^\./||g"

For example to combine it with xargs and invoke a script on each name …


Continue reading