Created
June 8, 2016 18:44
-
-
Save anonymous/77ce269469af559d0cd352f91384cbc8 to your computer and use it in GitHub Desktop.
Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=soljson-latest.js&optimize=undefined&gist=
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 21,030 | |
contract Fallback { | |
uint deposits = 0; | |
} | |
// Transaction: 41,143 | |
// Execution: 20,143 | |
contract FallbackDeposit { | |
uint deposits = 0; | |
function() { | |
deposits++; | |
} | |
} | |
// Transaction: 21,071 | |
// Execution: 71 | |
contract FallbackConditionalFalse { | |
uint deposits = 0; | |
function() { | |
if(false) { | |
deposits++; | |
} | |
} | |
} | |
// Transaction: 41,163 | |
// Execution: 20,163 | |
contract FallbackConditionalTrue { | |
uint deposits = 0; | |
function() { | |
if(true) { | |
deposits++; | |
} | |
} | |
} | |
// Transaction cost: 41226 gas. | |
// Execution cost: 20226 gas | |
contract FallbackMultiAccount { | |
mapping (address => uint) balances; | |
function() { | |
balances[msg.sender] += msg.value; | |
} | |
} | |
// Transaction cost: 186937 gas. | |
// Execution cost: 165937 gas | |
contract FallbackStoreStruct { | |
struct Request { | |
uint a; | |
uint b; | |
uint c; | |
uint d; | |
uint e; | |
uint f; | |
uint g; | |
uint h; | |
} | |
uint min; | |
mapping (address => uint) balances; | |
mapping (address => Request) requests; | |
function() { | |
balances[msg.sender] += msg.value; | |
if(balances[msg.sender] >= min) { | |
requests[msg.sender] = Request(0, 1, 2, 3, 4, 5, 6, 7); | |
} | |
} | |
} | |
// Transaction cost: 61671 gas. | |
// Execution cost: 40671 gas. | |
contract FallbackStoreHash { | |
uint min; | |
mapping (address => uint) balances; | |
mapping (address => bytes16) requests; | |
function() { | |
balances[msg.sender] += msg.value; | |
if(balances[msg.sender] >= min) { | |
requests[msg.sender] = bytes16(12345); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment