Skip to content

Instantly share code, notes, and snippets.

View frozeman's full-sized avatar

Fabian Vogelsteller frozeman

View GitHub Profile
/**
* Base contract that all upgradeable contracts should use.
*
* Contracts implementing this interface are all called using delegatecall from
* a dispatcher. As a result, the _sizes and _dest variables are shared with the
* dispatcher contract, which allows the called contract to update these at will.
*
* _sizes is a map of function signatures to return value sizes. Due to EVM
* limitations, these need to be populated by the target contract, so the
* dispatcher knows how many bytes of data to return from called functions.
@frozeman
frozeman / token.md
Last active October 23, 2022 00:47
Token proposal

This is outdated: The ERC-20 is here: ethereum/EIPs#20

Token

Methods

totalSupply

@frozeman
frozeman / addressfixes.js
Last active September 4, 2022 01:04
Fixes the wallet links in the ethereum wallet
// Open the wallet console: Menu -> Develop -> Toggle console ...
// Run the following script
_.each(Wallets.find().fetch(), function(item){
if(item.address)
Wallets.update(item._id, {$set: {address: item.address.toLowerCase()}});
});
_.each(CustomContracts.find().fetch(), function(item){
if(item.address)
CustomContracts.update(item._id, {$set: {address: item.address.toLowerCase()}});
Mapping
bytes10 + bytes2(0) + <whatever> (bytes20) or bytes20 //
0x112233445566778899001122 0000 000000000000112233445566778899001122
MappingWithGrouping
bytes6 + <whatever> (max bytes4) or bytes4 + bytes2(0) + <whatever> or bytes20 (max bytes20)
0x112233445566 11223344 0000 00000000000000000001122334455667788
@frozeman
frozeman / SymbioticBlockCreation.md
Last active April 25, 2022 22:44 — forked from blazejkrzak/SymbioticBlockCreation.md
Symbiotic block creation with Pandora and Vanguard orchestrated

Block creation

Pandora and Vanguard orchestration when producing a new block.

Terminology

Orchestrator - client written in go. Its responsibility is to orchestrate the Pandora and Vanguard to verify blocks.

Pandora - modified fork of go-ethereum (geth). Responsible to create valid execution blocks. P2P is enabled to share txpool and propagate blocks. It requires symbiotic connection with the orchestrator/validator client.

Vanguard - modified fork of prysm client. Responsible to run consensus algorithm (CASPER) with add execution layer data for shard0.

@frozeman
frozeman / isValidSignature.sol
Created June 25, 2020 11:39
Signature verification in solidity, taken from 0x
/// @dev Verifies that a hash has been signed by the given signer.
/// @param hash Any 32 byte hash.
/// @param signerAddress Address that should have signed the given hash.
/// @param signature Proof that the hash has been signed by signer.
/// @return True if the address recovered from the provided signature matches the input signer address.
function isValidSignature(
bytes32 hash,
address signerAddress,
bytes memory signature
)
@frozeman
frozeman / mistweb3.js
Last active July 22, 2021 01:00
Mist web3 loading proposal
/*
Basically "web3" comes from Mist,
but "Web3" CAN come from the dapp.
A Dapp has 3 ways to use web3.
2. and 3. would work when in Mist and outside.
*/
// 1. simply use, web3 comes already defined
@frozeman
frozeman / ENSresolving.md
Created March 6, 2017 15:06
ENS resolving in Mist
  • eth://inigomontoya.eth -> calls resolver.addr() -> shows account page with balance or something
  • http://inigomontoya.eth -> calls resolver.a() -> will resolve a normal DNS ip
  • bzz://inigomontoya.eth -> calls resolver.multiHash() -> will resoslve using swarm
  • ipfs://inigomontoya.eth -> calls resolver.multiHash() -> will resoslve using ipfs
  • inigomontoya.eth -> will default to swarm and calls resolver.multiHash() -> will resoslve using swarm
@frozeman
frozeman / ricoABI.json
Created April 29, 2020 10:35
rICO ABI - april 2020
[
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
@frozeman
frozeman / web3changes.md
Last active April 15, 2020 18:28
web3.js API changes

TODO: update web3.js examples ?

  • uses BN instead of BigNumber
  • added websockets and new events for these providers (web3.currentProvider.on 'connect', 'end', 'error', 'timeout')
  • changed web3.eth.sendRawTransaction -> web3.eth.sendSignedTransaction
  • added web3.eth.subscription
    • web3.eth.subscription('logs', {address: '0x12', topics: [], fromBlock: ''}) allows only fromBlock, use web3.eth.getPastLogs for a specifc range of past blocks.
    • subscriptions return events like:
      • for "logs": "error", "log", "deleted/reverted"
      • for syncing: "error", "started", "processing", "ended"