Last active
March 10, 2018 08:03
-
-
Save wjmelements/fab8c6961cff3dbd8715c7c55d29d660 to your computer and use it in GitHub Desktop.
Sponsored gas plugin
This file contains hidden or 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 { | |
uint256 len = wastedSpace.length; | |
wastedSpace.length = len + 5; | |
wastedSpace[len] = 1; | |
wastedSpace[len+1] = 1; | |
wastedSpace[len+2] = 1; | |
wastedSpace[len+3] = 1; | |
wastedSpace[len+4] = 1; | |
} | |
modifier sponsored { | |
_; | |
uint256 len = wastedSpace.length; | |
if (len != 0) { | |
wastedSpace[--len] = 0; | |
wastedSpace[--len] = 0; | |
wastedSpace[--len] = 0; | |
wastedSpace[--len] = 0; | |
wastedSpace[--len] = 0; | |
wastedSpace.length = len; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to use: