Skip to content

Instantly share code, notes, and snippets.

Avatar

Alejandro Santander ajsantander

View GitHub Profile
@ajsantander
ajsantander / birthday-bet-testoutput
Created Jun 22, 2017
Unit test output for the birthday-bet smart contract on 2017/06/21
View birthday-bet-testoutput
Compiling ./contracts/BetOnDate.sol...
Contract: BetOnDate(BetTests)
✓ should accept funds from the user when a valid bet is made (521ms)
✓ should reject and return funds from the user when an invalid bet is attempted (wrong unitBet) (569ms)
✓ should accept a number of valid bets (559ms)
✓ shoud not allow invalid bet refunds to be exploited to deplete the contracts balance (493ms)
✓ should reject bets with an invalid amount (56ms)
✓ should allow players to only bet once (53ms)
View rinkeby
0x62324bD5362658Fa058995d5c314014a6Ef3816F
@ajsantander
ajsantander / proof_of_ownership.js
Created Aug 28, 2017
Simple demonstration of how to do a "proof of ownership" in web3
View proof_of_ownership.js
var EthUtil = require('ethereumjs-util');
var Web3 = require('web3');
var provider = new Web3.providers.HttpProvider('http://localhost:8545');
var web3 = new Web3(provider);
// Client side (user signs a message) ------------------------------
// User's keys
var privKey = '0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501200';
var pubKey = '0xdf08f82de32b8d460adbe8d72043e3a7e25a3b39';
View keybase.md

Keybase proof

I hereby claim:

  • I am ajsantander on github.
  • I am ajsantander (https://keybase.io/ajsantander) on keybase.
  • I have a public key whose fingerprint is 1484 F900 8ACA EEF1 A9D6 8E7F 4416 88F3 6A75 7687

To claim this, I am signing this object:

View init.coffee
# initialization file (not found)
View BasicToken.sol
pragma solidity ^0.4.24;
contract BasicToken {
uint256 totalSupply_;
mapping(address => uint256) balances;
constructor(uint256 _initialSupply) public {
totalSupply_ = _initialSupply;
balances[msg.sender] = _initialSupply;
View BasicToken.asm
000 PUSH1 80
002 PUSH1 40
004 MSTORE
005 CALLVALUE
006 DUP1
007 ISZERO
008 PUSH2 0010
011 JUMPI
012 PUSH1 00
014 DUP1
View BasicToken.evm
608060405234801561001057600080fd5b5060405160208061021783398101604090815290516000818155338152600160205291909120556101d1806100466000396000f3006080604052600436106100565763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166318160ddd811461005b57806370a0823114610082578063a9059cbb146100b0575b600080fd5b34801561006757600080fd5b506100706100f5565b60408051918252519081900360200190f35b34801561008e57600080fd5b5061007073ffffffffffffffffffffffffffffffffffffffff600435166100fb565b3480156100bc57600080fd5b506100e173ffffffffffffffffffffffffffffffffffffffff60043516602435610123565b604080519115158252519081900360200190f35b60005490565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604090205490565b600073ffffffffffffffffffffffffffffffffffffffff8316151561014757600080fd5b3360009081526001602052604090205482111561016357600080fd5b503360009081526001602081905260408083208054859003905573ffffffffffffffffffffffffffffffffffffffff85168352909120805483019055929150505600a165627a7a72305820a5d999f4459642872a29be
View BasicToken.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View ModifierOverride.sol
pragma solidity ^0.4.24;
contract Ownable {
address public owner;
modifier onlyOwner() {
require(msg.sender == owner);
_;
}