rainbow-bridge-client icon indicating copy to clipboard operation
rainbow-bridge-client copied to clipboard

Used proofs in workflows (Ethereum -> NEAR) / (Ethereum -> Aurora)

Open mfornet opened this issue 3 years ago • 3 comments

We need to determine when proofs to transfer assets from Ethereum to NEAR have been already used. (Mentioned by @sept-en in https://github.com/aurora-is-near/rainbow-bridge-client/issues/40#issuecomment-850717612)

This needs to be handled for:

  • [ ] ethConnector
  • [ ] eNEAR
  • [ ] erc20

We should have a similar function as the one described in #40:

function proofInNearExists(nearProvider, connectorType, address, proof) {
    // Return true if the proof already exists, false otherwise
    // connectorType can be one of ["EthConnector", "eNEAR", "Erc20"]
}

One option that doesn't involve changing contracts, is querying directly the state. This is an example about how to do it:

curl --location --request POST 'https://archival-rpc.testnet.near.org/' \
--header 'Content-Type: application/json' \
--data-raw '{
  "jsonrpc": "2.0",
  "id": "dontcare",
  "method": "query",
  "params": {
    "request_type": "view_state",
    "finality": "final",
    "account_id": "dev-1620133090135-4688553",
    "prefix_base64": "U1RBVEU="
  }
}'

mfornet avatar Jun 01 '21 15:06 mfornet