Skip to content

Instantly share code, notes, and snippets.

View pabloruiz55's full-sized avatar

Pablo Ruiz pabloruiz55

View GitHub Profile
function verifyTransfer(address _from, address _to, uint256 _amount) public view returns (bool success) {
return true;
}
/**
* @dev Overloaded version of the transfer function
*/
function transfer(address _to, uint256 _value) public returns (bool success) {
require(verifyTransfer(msg.sender, _to, _value));
return super.transfer(_to, _value);
@pabloruiz55
pabloruiz55 / allocation_data.csv
Last active January 11, 2018 16:16
allocation_data.csv
143 0x2b6dc8362f76df34f493497a64df7d627720b8df
708 0x917eccf1bef46a829d2067fae540736120e15a56
152 0x3967b417ad03585c031f987341bf9a4565fce021
846 0xd508c806157976aedbf94493c1f266f2142dadc4
0 0xee8e50710d670e92a4373e77c163bfba1675464e
873 0x25c26fa100d21ffa4b6df1b4f15ed01cb1884a5d
860 0x4ec56b9c34d09dc6805b19cd24da495269f2cc9c
989 0x8ed097af0cb9d5551fb68ff3e01e01473ca18443
709 0xc4011b89a7ec6d913e93811e651fa1408fa294f6
187 0x6f41770d4d065de774d1a0bfb77b98eeb02f7f3e
@pabloruiz55
pabloruiz55 / Reentrancy.sol
Last active January 4, 2018 13:16
Re-entrancy attack from Ethernaut
// https://ethernaut.zeppelin.solutions/level/0xf70706db003e94cfe4b5e27ffd891d5c81b39488
// How to test this:
// 1. Deploy Reentrance contract. Take note of the address.
// 2. With the same account, call donate() and send 1 ether.
// 3. With a second account, deploy Exploit contract and pass Reentrance address.
// 4. Call attack(), sending 0.1 ether.
// 5. Call ethBalance() to check Reentrance ether balance, should be 0.
// 6. Call ethBalance() to check Exploit balance, should be 1 ether
// 7. Call kill() to selfdestruct Exploit and get the 1 ether forwarded to attacker account.
// Once the auction end has been reached, we distribute the ether.
function finalizeAuction() public {
require (now > auctionEndTime);
require (!auctionFinalized);
auctionFinalized = true;
if(highestBidder == address(0)){
//If no one bid at the auction, auctioneer can withdraw the funds.
balances[auctioneer] = auctionedEth;
}else{
//Anyone can bid by calling this function and supplying the corresponding eth
function bid() public payable {
require(auctionStarted);
require(now < auctionEndTime);
require(msg.sender != auctioneer);
require(highestBidder != msg.sender); //If sender is already the highest bidder, reject it.
address _newBidder = msg.sender;
uint previousBid = balances[_newBidder];
// The auctioneer has to call this function while supplying the 1th to start the auction
function startAuction() public payable{
require(!auctionStarted);
require(msg.sender == auctioneer);
require(msg.value == (1 * 10 ** 18));
auctionedEth = msg.value;
auctionStarted = true;
auctionEndTime = now + (3600 * 24 * 7); // Ends 7 days after the deployment of the contract
E_AuctionStarted(msg.sender,now, auctionEndTime);
pragma solidity ^0.4.18;
contract EtherAuction {
// The address that deploys this auction and volunteers 1 eth as price.
address public auctioneer;
uint public auctionedEth = 0;
uint public highestBid = 0;
uint public secondHighestBid = 0;
pragma solidity ^0.4.4;
import "./usingOraclize.sol";
contract Raffle is usingOraclize{
function Raffle(){
scheduleRandomNumOnCreation(1000);
0x0fC20E774EA6674087494a36F8F8f09a4Ee3a131