interlay / interbtc-clients

interBTC Clients | Vault, Oracle, Faucet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hardening faucet

sander2 opened this issue · comments

Last time we had a mainnet faucet, people abused it by making many requests simultaneously, which would all be processed before the faucet recorded the transaction in the db. For the Interlay launch we'll need to prevent this. Probably the best way to do this is to write to the database the moment we receive a request, rather than after it has been executed

We should also check that the T&Cs have been signed, in the UI we do this:

const res = await fetch(`${SIGNER_API_URL}/${account.address}`, {
  method: 'GET',
  headers: {
    'Content-Type': 'application/json'
  }
});

const response: { exists: boolean } = await res.json();
return response.exists;

Example:

curl https://app.interlay.io/terms/a3bQHC4voGHb5J6pPyUBzg4uvLuM3AyafD7vmtq7zx6KcPLKf