Skip to content

Instantly share code, notes, and snippets.

View 0xpolarzero's full-sized avatar

polarzero 0xpolarzero

View GitHub Profile
import { Cli } from 'incur'
import {
Client,
HttpClient,
MemoryClient,
HttpTransport,
MemoryTransport,
} from 'incur/client'
import type { Commands } from './generated/incur-client.js'
// TokenV1.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract TokenV1 {
error InsufficientBalance();
uint256 public totalSupply;
mapping(address => uint256) public balances;
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract SuboptimalStructLayout {
struct Data {
uint256 a; // takes a full storage slot (32 bytes)
uint8 b; // takes only 1 byte but occupies a full storage slot (32 bytes reserved)
uint256 c; // needs a new slot, takes a full storage slot (32 bytes) - explains the previous full slot
uint8 d; // takes only 1 byte but occupies a full storage slot (32 bytes reserved)
}