Skip to content

Instantly share code, notes, and snippets.

@avatar-lavventura avatar-lavventura/contract.sol Secret
Last active Jan 3, 2017

Embed
What would you like to do?
I trim some of my code so it will be lower gas but still it does not mines inside geth using solc.
library LinkedList {
uint80 constant None = uint80(0); // NULL.
struct data {
uint256 head;
Node[100] n;
uint size;
uint insert_number;
uint buffer_size;
}
struct Node {
string data;
address owner;
uint own;
uint prev;
uint next;
}
function construct_me(data storage self){
self.n[0].own = 0;
self.n[0].next = 0;
self.n[0].prev = 0;
self.head = 0;
self.insert_number = self.size = 1;
self.buffer_size = 100;
}
}
contract owned {
address public owner;
function owned() {
owner = msg.sender;
}
function ownerOnly() {
if (msg.sender != owner) throw;
}
modifier onlyOwner {
if (msg.sender != owner) throw;
_;
}
function transferOwnership(address newOwner) onlyOwner {
owner = newOwner;
}
}
contract Array is owned {
using LinkedList for LinkedList.data;
using LinkedList for LinkedList.Node;
LinkedList.data list;
function Array(){
if( test_callstack() != 1 ) throw;
list.construct_me();
}
function test_callstack() returns ( int ){ return 1; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.