Skip to content

Instantly share code, notes, and snippets.

@arcticfloyd1984
Last active April 23, 2024 11:25
Show Gist options
  • Save arcticfloyd1984/8722f7286c94cbef5fa68dd4646dcb17 to your computer and use it in GitHub Desktop.
Save arcticfloyd1984/8722f7286c94cbef5fa68dd4646dcb17 to your computer and use it in GitHub Desktop.
contract GasTank {
mapping (address => uint) dappDespoit
function execWithRefund(invokerAddress, authSig, gasLimit, dappAddress) {
require(gasLimit * tx.gasPrice > dappDeposit[dappAddress]);
const preGas = gas.left();
invokerAddress.invoke(authSig);
const postGas = gas.left();
dappDeposit[dappAddress] -= (preGas - postGas) * tx.gasPrice;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment