Skip to content

Instantly share code, notes, and snippets.

@0age
0age / MetamorphicContractInitCode.txt
Last active May 24, 2023 10:24
Metamorphic Contract Initialization Code
* @title Metamorphic Contract
* @author 0age, derived from cloner contract by @mhswende
* @notice This contract will create a metamorphic contract, or an upgradeable
* contract that does not rely on a transparent proxy, when deployed using
* CREATE2. It expects the deployer to provide a getImplementation() function
* that will return an implementation address, which it will then clone and
* deploy. Unlike with upgradeable transparent proxies, the state of a
* metamorphic contract will be wiped clean with each upgrade. With great power
* comes great responsibility - implement appropriate controls and educate the
* users of your contract if it will be interacted with!
@0age
0age / rewardFunction.js
Created September 26, 2018 01:01
Calculate the reward for creating an upgradeable proxy contract with a given efficient address.
#!/usr/bin/env node
var Decimal = require('decimal.js') // $ yarn add decimal.js
// pulling out the big guns (maybe a tad excessive...)
Decimal.config(
{
precision: 500,
toExpNeg: -500
}
)
@0age
0age / SeaportNavigatorABI.json
Created June 21, 2023 14:23
ABIs for SeaportNavigator & SeaportValidator contracts
[
{
"inputs": [],
"name": "CannotDeriveProofForSingleTokenId",
"type": "error"
},
{
"inputs": [],
"name": "CannotDeriveRootForSingleTokenId",
"type": "error"
@0age
0age / deprecate_wyvern_user_proxy.sh
Created July 24, 2023 15:39
shell script to examine and deprecate a Wyvern user proxy via `cast`
##### SUMMARY #####
#
# to brick a user proxy, you can upgrade to this contract then call the proxy:
# https://etherscan.io/address/0x00000000008fe2c0c1795fe9a8e2c1d3f913b35d#code
#
# Step 1: find the proxy for the account
# proxy registry: 0xa5409ec958C83C3f309868babACA7c86DCB077c1
# call: proxies(address) where address = user's account
#
# Step 2: upgrade the proxy and call it to renounce ownership
@0age
0age / MetamorphicDelegatorFactory.sol
Last active September 20, 2023 08:53
Deploy (and redeploy) contracts to known addresses
pragma solidity 0.5.8;
/**
* @title Metamorphic Delegator Factory
* @author 0age
* @notice This contract creates metamorphic contracts, or contracts that can be
* redeployed with new code to the same address. First, it deploys a contract
* with the initialization code of the contract you want to deploy stored in its
* RUNTIME code. Then, it deploys the contract, which retrieves the address of
@0age
0age / Seaport.json
Last active February 18, 2024 05:18
Seaport 1.4 ABI
[
{
"inputs": [
{
"components": [
{
"internalType": "address",
"name": "offerer",
"type": "address"
},