Created
March 10, 2018 02:11
-
-
Save wjmelements/a949117a87305b17482d2f517aa1c6e7 to your computer and use it in GitHub Desktop.
[EVM] Sponsored, inefficient with push/pop
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
pragma solidity^0.4.19; | |
// like a less-liquid GasToken | |
contract Sponsored { | |
uint256[] wastedSpace; | |
function sponsor() external { | |
wastedSpace.push(1); | |
wastedSpace.push(1); | |
wastedSpace.push(1); | |
wastedSpace.push(1); | |
wastedSpace.push(1); | |
} | |
modifier sponsored { | |
_; | |
if (wastedSpace.length != 0) { | |
wastedSpace.pop(); | |
wastedSpace.pop(); | |
wastedSpace.pop(); | |
wastedSpace.pop(); | |
wastedSpace.pop(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment