Last active
August 29, 2015 14:22
-
-
Save kvhnuke/4ef6d2412c949ea1ccab to your computer and use it in GitHub Desktop.
huge Storage ethereum contract
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
contract hugeStorage { | |
address owner; | |
uint counter; | |
uint maxLoop = 10; | |
mapping(uint => bytes32) storage; | |
mapping(uint => bytes) dataStorage; | |
event Logger(uint cntr, uint cntr2, bytes32 data, uint gas); | |
function hugeStorage(){ | |
owner = msg.sender; | |
counter = 0; | |
} | |
function addData(bytes32 data){ | |
uint counts = 0; | |
for(uint i=0; i<maxLoop;i++){ | |
storage[counter]=data; | |
dataStorage[counter] = msg.data; | |
counter++; | |
counts++; | |
} | |
Logger(counter,counts,data,msg.gas); | |
} | |
function epicLoop(bytes32 data){ | |
uint counts = 0; | |
while(msg.gas>10000){ | |
storage[counter]=data; | |
dataStorage[counter] = msg.data; | |
counter++; | |
counts++; | |
} | |
Logger(counter,counts,data,msg.gas); | |
} | |
function getCounter() returns (uint){ | |
return counter; | |
} | |
function setMaxLoop(uint mloop) { | |
maxLoop = mloop; | |
} | |
function getByteLength(uint id) returns (uint){ | |
return dataStorage[id].length; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment