Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: gas faucet #145

Closed
wants to merge 2 commits into from
Closed

Conversation

Keyrxng
Copy link
Contributor

@Keyrxng Keyrxng commented Nov 9, 2023

Resolves #142

  • I'm running this on mumbai but you decide the network when you setup the relay

  • OpenZeppelin Defender used as a relay to send the transaction.

  • Setup requires that you login to wrangler and push the secrets needed before deploying obv but my endpoints will work for QA.

  • Requires a relay be setup and that the RELAY_KEY & RELAY_SECRET are set.

Note:
I decided to just use the db schema as opposed to github api searching as we may not have auth to find everyone via that route so reliance on the current DB schema means it can be 'abused' if they update their registered wallet address.

QA:

  • Hit these endpoints yourself
  • This will say it's likely they've been subsidized based on having a permit in the DB https://ubq-gas-faucet.keyrxng7749.workers.dev/faucet?address=0x959d25B75324fBE0ADc75a454Df286eaBc7B45a7
  • This will send eth on the relay runs out ONLY because my db wont have a permit for this address https://ubq-gas-faucet.keyrxng7749.workers.dev/faucet?address=0xAe5D1F192013db889b1e2115A370aB133f359765
$ node testScript.ts
============================
This address has already been subsidized i.e has a permit in the database & is a registered wallet address
res {
  jsonrpc: '2.0',
  error: { code: -32000, message: 'Has likely been subsidized before.' },
  id: null
}
============================
This address has not been subsidized i.e has no permit in the database
res {
  jsonrpc: '2.0',
  result: {
    txHash: '0x3ca25068a7c59a190df4fb270e4e7348e46ec0b9e4b16f22ad19105b15c0dc58'
  },
  id: null
}
============================
This address has not been subsidized i.e has no permit in the database
res {
  jsonrpc: '2.0',
  error: { code: -32000, message: 'Hunter has enough gas' },
  id: null
}
============================
This address is not registered in the database
res {
  jsonrpc: '2.0',
  error: { code: -32000, message: 'Address not found' },
  id: null
}
============================
Only POST requests are allowed
res { message: 'Unsupported method: GET' }
============================
https://mumbai.polygonscan.com/tx/0xfd938289d028e65be9ba38d34532d25c68569c7beb87034a3e0708f7f70d7f48

cloudflare gas faucet
@Keyrxng Keyrxng requested review from 0x4007 and rndquu as code owners November 9, 2023 21:26
@Keyrxng
Copy link
Contributor Author

Keyrxng commented Nov 9, 2023

This could be broken off into another repo but I wasn't sure how to approach that as you fine folks would need to create the repo for me first so build first asking questions later basically 😂

I'm assuming we are just hardcoding the claim fee or should we be trying to estimate it first?

So would this be this spec completed with another bounty to be opened on the bot in regards to calling it pre-permit generation?

Copy link

ubiquibot bot commented Nov 9, 2023

@rndquu
Copy link
Member

rndquu commented Nov 10, 2023

@Keyrxng

This could be broken off into another repo

Could you open a PR to this repo https://github.com/ubiquity/faucet ?

I'm assuming we are just hardcoding the claim fee or should we be trying to estimate it first?

Ideally it should be moved to env variables

So would this be this spec completed with another bounty to be opened on the bot in regards to calling it pre-permit generation?

We'll create another issue for the bot to use the faucet when it is deployed

@rndquu
Copy link
Member

rndquu commented Nov 17, 2023

Closing the PR in favour of ubiquity/faucet#1

@rndquu rndquu closed this Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Faucet" Service
3 participants