Skip to content

Instantly share code, notes, and snippets.

Avatar

Ev evertonfraga

View GitHub Profile
@evertonfraga
evertonfraga / delegatecall.sol
Last active Dec 19, 2017
Prevent library direct code execution
View delegatecall.sol
/**
This code snippet aims to show how to prevent library methods from being executed directly.
That's achieved by baking in the address of the library before it's deployed, then comparing `address(this)` against the saved address within a modifier.
A contract/library address is deterministic, so one could inject that in: keccak256(creator_address, nonceValue).
Thanks to @pirapira, @chriseth and @arachnid for the idea.
*/
@evertonfraga
evertonfraga / ABI
Last active Oct 13, 2017
Exemplo de entrega de projeto
View ABI
[{"constant":false,"inputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"name":"transfer","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]
@evertonfraga
evertonfraga / Distribuição de ether
Last active Oct 5, 2017
PROSPERA - Outubro: Distribuição de ether e Emissão de PRSP
View Distribuição de ether
// https://etherscan.io/address/0xa4e23286c06208645f52c57a6ef5a510e87a6d76
const Web3 = require('web3');
// const web3 = new Web3(Web3.providers.HttpProvider('https://mainnet.infura.io/bnr6Lt3Xle02EzHa3Bf5 '));
const web3 = new Web3(Web3.providers.HttpProvider('http://localhost:8545 '));
var txs = [];
var cb = function(err, hash) { txs.push(hash); console.log(err, 'https://etherscan.io/tx/'+hash) };
var myAccount = '0xa4E23286C06208645f52c57A6eF5a510e87A6d76';
@evertonfraga
evertonfraga / ethereum-dev-mode.md
Last active Jul 16, 2020
Set up an Ethereum development network in two minutes
View ethereum-dev-mode.md
View MyToken.sol
pragma solidity ^0.4.8;
contract tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData); }
contract MyToken {
/* Public variables of the token */
string public standard = 'Token 0.1';
string public name;
string public symbol;
uint8 public decimals;
View privatekey-example
{
"address": "84491dabc6366120bca1801b3223cc60b693e999",
"crypto": {
"cipher": "aes-128-ctr",
"ciphertext": "b2499f41a70f9792cf6444e150d256c8ad41ee009b5a54bf6e50c073630f06e4",
"cipherparams": {
"iv": "690c2b57b2f7389aae8f452ce0b2fc2c"
},
"kdf": "scrypt",
"kdfparams": {
View VipClub.sol
pragma solidity ^0.4.5;
/*
Cadastrando itens em um struct
*/
contract VipClub {
// Estrutura de dados Member, que possui os atributos `name` e `email`
struct Member {
string name;
View EtherSplitter.sol
pragma solidity ^0.4.5;
/*
Ether Splitter é um simples contrato que divide o
ether enviado entre dois endereços.
*/
contract EtherSplitter {
// Definição de evento.
View MyToken.sol
pragma solidity ^0.4.5;
contract MyToken {
/*
Variáveis públicas do token.
Elas conformam com o padrão de moedas na rede ethereum, este padrão permite integração
com as Wallets e interoperabilidade com outros contratos.
Standard ERC 20: https://github.com/ethereum/EIPs/issues/20
*/
string public standard = 'Token 0.1';
You can’t perform that action at this time.