Skip to content

Instantly share code, notes, and snippets.

View ernestognw's full-sized avatar
👨‍💻

Ernesto García ernestognw

👨‍💻
View GitHub Profile
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (governance/utils/Votes.sol)
pragma solidity ^0.8.19;
import {IERC5805} from "../../interfaces/IERC5805.sol";
import {Context} from "../../utils/Context.sol";
import {Nonces} from "../../utils/Nonces.sol";
import {EIP712} from "../../utils/cryptography/EIP712.sol";
import {SignatureChecker} from "../../utils/cryptography/SignatureChecker.sol";
import {Checkpoints} from "../../utils/structs/Checkpoints.sol";
## Optimizer ON with 200 runs
| src/ProposalDeadline.sol:ProposalDeadline contract | | | | | |
|----------------------------------------------------|-----------------|-------|--------|-------|---------|
| Deployment Cost | Deployment Size | | | | |
| 185226 | 957 | | | | |
| Function Name | min | avg | median | max | # calls |
| add | 23322 | 23322 | 23322 | 23322 | 3 |
| getMemory | 2768 | 2768 | 2768 | 2768 | 1 |
| getRaw | 2639 | 2639 | 2639 | 2639 | 1 |
## Optimizer ON with 200 runs
| src/ProposalSnapshot.sol:ProposalSnapshot contract | | | | | |
|----------------------------------------------------|-----------------|-------|--------|-------|---------|
| Deployment Cost | Deployment Size | | | | |
| 160808 | 835 | | | | |
| Function Name | min | avg | median | max | # calls |
| add | 23300 | 23300 | 23300 | 23300 | 2 |
| getMemory | 2667 | 2667 | 2667 | 2667 | 1 |
| getRaw | 2474 | 2474 | 2474 | 2474 | 1 |
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import "forge-std/Test.sol";
contract ErrorTest32 is Test {
error Test32(bytes32 foo, bytes32 bar);
bytes32 foo32 = bytes32(uint256(10));
bytes32 bar32 = bytes32(uint256(20));
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract Uninitialized {
address public owner;
constructor() {
owner = msg.sender;
}
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import "forge-std/Test.sol";
import "./mocks/WhatAreBuckets.mock.sol";
contract WhatAreBucketsTest is Test {
WhatAreBucketsMock public puzzle;
enum Ops {
const master = {
"contracts/crosschain/polygon/CrossChainEnabledPolygonChild.sol":
"d403ea7f253740e03bded065e3bfa0426d23fe1f61a0328fc952dba0a66098d5",
"contracts/finance/VestingWallet.sol":
"060764d14cf9f8ab5c73d3e132d3808043cddb3721781fa1ec54627a0b7d0506",
"contracts/governance/Governor.sol":
"120cfa23f6630482f363c229f5ef9103170e238f62817c8aea78baf22666e37e",
"contracts/governance/TimelockController.sol":
"f5a9953266de708798ffdfd4747e333c9ae5bc0b0e8ee902143f9213226798a2",
"contracts/governance/compatibility/GovernorCompatibilityBravo.sol":
if value == current_value 
  if key is warm 
    base_dynamic_gas = 100 
  else
    base_dynamic_gas = 100
else if current_value == original_value 
  if original_value == 0 
    base_dynamic_gas = 20000 
 else 
const { AdminClient } = require("defender-admin-client");
const adminClient = new AdminClient({
apiKey: <<API_KEY>>,
apiSecret: <<API_SECRET>>,
});
const proposeGrantRole = async () => {
const yourAccont = '<<YOUR EOA>>'
const result = await adminClient.proposeRevokeRole(
const { AdminClient } = require("defender-admin-client");
const adminClient = new AdminClient({
apiKey: <<API_KEY>>,
apiSecret: <<API_SECRET>>,
});
const proposeGrantRole = async () => {
const yourAccont = '<<YOUR EOA>>'
const result = await adminClient.proposeGrantRole(