Skip to content

Instantly share code, notes, and snippets.

View arcticfloyd1984's full-sized avatar

Yashasvi Chaudhary arcticfloyd1984

View GitHub Profile
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
const provider = createPublicClient({
transport: http("https://polygon-mumbai-pokt.nodies.app"),
});
async function sendRawTransaction() {
try {
const privateKey = "<ADD_PRIVATE_KEY>";
const account = privateKeyToAccount(privateKey);
const nonce = await provider.getTransactionCount({
address: account.address,
import { ethers } from "ethers"
const fundingIds = [
"0x00009cc27c811a3e0fdd2fd737afcc721b67ee8e",
"0x00f088b36ad905a0b4e9b8a86c9db2315e286e90",
"0x018b3f28d8b4d485cdb0f1b75fa73dab2c44094e",
"0x329a7f8b91ce7479035cb1b5d62ab41845830ce8",
"0x943a2d7a129c1073031221c192cd250efbab0563",
"0xded2e0148795e710bac08bc23dd0757bccbe2177",
"0x06f51420215daf49b6abbe928dbceb7debd40d2a",
@arcticfloyd1984
arcticfloyd1984 / app.ts
Last active December 19, 2023 06:25
Datadog tracer
// in app.ts we set the request id in header
app.use(logger({
genReqId(req, res) {
const existingID = req.id ?? req.headers['x-request-id'];
if (existingID) return existingID;
const id = randomUUID();
res.setHeader('Request-Id', id);
req.headers['x-request-id'] = id;
return id;
},