Skip to content

Instantly share code, notes, and snippets.

@D-Nice
Created June 15, 2018 19:19
Show Gist options
  • Save D-Nice/e664d70c18203d4d343193895ee67dc8 to your computer and use it in GitHub Desktop.
Save D-Nice/e664d70c18203d4d343193895ee67dc8 to your computer and use it in GitHub Desktop.
storage array which refs to storage slot 0, overwrites whatever is in storage 0
pragma solidity ^0.4.0;
import "browser/oraclizeapi.sol";
contract brokenWOraclize is usingOraclize {
event DEBUG(uint[] a);
function brokenWOraclize() {
oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
}
function t() {
uint256[] prices;
for (uint i = 0; i < 2; i++) {
prices.push(2);
}
//DEBUG(prices);
}
}
contract notBrokenWOOraclize is usingOraclize {
event DEBUG(uint[] a);
uint fake1;
uint[] cscope;
function notBrokenWOOraclize() {
//oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
fake1 = 5000;
}
function t() returns (uint256) {
uint256[] prices = cscope;
for (uint i = 0; i < 2; i++) {
prices.push(2);
}
//prices;
DEBUG(prices);
return day;
}
}
contract notBroken {
event DEBUG(uint[] a);
function notBroken() {
//oraclize_setProof(proofType_TLSNotary | proofStorage_IPFS);
}
function t() {
uint256[] prices;
for (uint i = 0; i < 2; i++) {
prices.push(2);
}
//prices;
DEBUG(prices);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment