Skip to content

Instantly share code, notes, and snippets.

View arcticfloyd1984's full-sized avatar

Yashasvi Chaudhary arcticfloyd1984

View GitHub Profile
// SPDX-License-Identifier: MIT
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import {
ERC2771Context
} from "@gelatonetwork/relay-context/contracts/vendor/ERC2771Context.sol";
return (async () => {
const relay = new GelatoRelay();
const account = privateKeyToAccount('0x215816ad5bfd524e13dc8b6b2ed2674d8f8973f403ad80909111dfe3757bc9d6');
const client = createWalletClient({
account,
transport: http(
'https://arb-sepolia.g.alchemy.com/v2/MVGOoAkMUxl6jrN3qLaSt7Z9dDB7iLUU', // RPC URL of the network where themint method is to be called
),
});
return (async () => {
const relay = new GelatoRelay();
console.log("Web3Function invoked");
const account = privateKeyToAccount('0x215816ad5bfd524e13dc8b6b2ed2674d8f8973f403ad80909111dfe3757bc9d6');
const client = createWalletClient({
account,
transport: http(
'https://opt-sepolia.g.alchemy.com/v2/hL0i6G6Rrp5GgKc_pa5JvezbgDLloVgz', // RPC URL of the network where the mint method is to be called
),
});
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;
@arcticfloyd1984
arcticfloyd1984 / payload.txt
Created February 11, 2024 10:40
eth_call payload
{
"method": "eth_call",
"params": [
{
"to": "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
"data": "0xc26e8909000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c9c38000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500081e858f7a214cfe4f729f0321ee0e24f900f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000a14e0000000000000000000000000000000000000000000000000000000001c9c38000000000000000000000000000000000000000000000000000000000000142410000000000000000000000000000000000000000000
@arcticfloyd1984
arcticfloyd1984 / package.json
Last active February 9, 2024 17:35
Paymaster Scripts
{
"name": "scripts",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
Traces:
[4149056] VerificationGasEstimationSimulatorTest::test_basicEstimation()
├─ [0] VM::createSelectFork(https://polygon-mainnet.g.alchemy.com/v2/kKdrb3TqOnfFa6RdeTUNBW6M3mseqzEg, 52880533 [5.288e7])
│ └─ ← 0
├─ [4031685] → new VerificationGasEstimationSimulator@0x2e234DAe75C793f67A35089C9d99245E1C58470b
│ ├─ [75329] → new SenderCreator@0xffD4505B3452Dc22f8473616d50503bA9E1710Ac
│ │ └─ ← 376 bytes of code
│ └─ ← 19488 bytes of code
├─ [0] VM::etch(0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789, 0x60806040526004361015610023575b361561001957600080fd5b610021611a63565b005b60003560e01c80630396cb60146101a35780630bd28e3b1461019e5780631b2e01b8146101995780631d732756146101945780631fad948c1461018f578063205c28781461018a5780633505dedb1461018557806335567e1a146101805780634b1d7cf51461017b5780635287ce12146101765780635af959c01461017157806370a082311461016c5780638f41ec5a146101675780638f60d79814610162578063957122ab1461015d5780639b249f6914610158578063a619353114610153578063b760faf91461014e57
/**
** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.
** Only one instance required on each chain.
**/
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.12;
/* solhint-disable avoid-low-level-calls */
/* solhint-disable no-inline-assembly */
@arcticfloyd1984
arcticfloyd1984 / CallGasEstimationProxy.sol
Created January 10, 2024 12:16
CallGasEstimationProxy
/**
** Account-Abstraction (EIP-4337) singleton EntryPoint implementation.
** Only one instance required on each chain.
**/
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.12;
import "@openzeppelin/contracts/utils/math/Math.sol";
/* solhint-disable avoid-low-level-calls */
@arcticfloyd1984
arcticfloyd1984 / paymaster-deposit.ts
Last active March 23, 2024 05:57
Script to make deposit to paymaster
import { ethers } from "ethers";
const paymasterAddress = '0x00000f79b7faf42eebadba19acc07cd08af44789';
const paymasterAbi = [{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"contract IEntryPoint","name":"_entryPoint","type":"address"},{"internalType":"address","name":"_verifyingSigner","type":"address"}],"stateMutability":"payable","type":"constructor"},{"inputs":[{"internalType":"address","name":"caller","type":"address"}],"name":"CallerIsNotAnEntryPoint","type":"error"},{"inputs":[],"name":"CanNotWithdrawToZeroAddress","type":"error"},{"inputs":[],"name":"DepositCanNotBeZero","type":"error"},{"inputs":[],"name":"EntryPointCannotBeZero","type":"error"},{"inputs":[{"internalType":"uint256","name":"amountRequired","type":"uint256"},{"internalType":"uint256","name":"currentBalance","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[{"internalType":"uint256","name":"sigLength","type":"uint256"}],"name":"InvalidPaymasterSignatureLength","type":"erro