-1

https://polygonscan.com/tx/0x0a37f5af0aa5b15431e339a7dc4ce3bdc77f229e8bd69025a4740812e0c55e6f

the transaction name that appears in the metamaks is collect_from_tiles.

looking for this function in the contract. I noticed that she is in another contract. https://polygonscan.com/address/0x068adc06faff086ee9ef826c0b83e7710e223c3d#writeContract

how to find out which values ​​to pass? Is there any tool to catch traffic when confirming in the metamask or something?

every transaction I go through. hangs until it fails.


def get_token_abi(token):
    url = f'https://api.polygonscan.com/api?module=contract&action=getabi&address={token}'
    response = requests.get(url).json()
    return json.loads(response['result'])

    tiles = [(-1, 1, 0), (-1, 0, 1), (0, -1, 1), (1, 0, -1), (0, 1, -1)]
    v = ?
    r = ?
    s = ?

    tx_collector = contract_collect.functions.collectFromTiles(tiles, v, r, s).build_transaction({
        'type': '0x2',
        'gas': 361075,
        'maxFeePerGas': 35000000000,
        'maxPriorityFeePerGas': 35000000000,
        'chainId': 137,
        'nonce': nonce,
    })

enter image description here

enter image description here

how to find out the parameters that are passed in the transaction time?

Dion
  • 1
  • 1

1 Answers1

0

Going through the contract's source code itself, you can see that on line 223 of MissionControl.sol, a checkSignature method is called. This signature is referring to ECDSA's signature algorithm. In which you can look into more detail in this article and this forum thread.

Long story short, you have to use this algorithm to sign some input (perhaps just the tiles itself or a specific message), and then pass the signature as an r, s, and v format.

In order to do that you also need an ECDSA keys (private and public) and sign the message with the private key. This is basically a way to prove that you are really the person you are supposed to be.

P.S. I am not sure if any generated ECDSA key pair works (as in they just check the message integrity rather than authenticating the user) or it has to be the one that corresponds to the public key on the contract. It very much depends on what the use case here.

Ping34
  • 206
  • 1
  • 10
  • look what you sent. I started to understand better about it. Now I have other doubts. default is EIP712Domain --- how to know if it has some additional fields? or with a successful transaction that was done via metamask and looking at the polygonscan I can use recover from this DATA to see the json? to see the correct structure? – Dion Jan 20 '23 at 17:58
  • I actually am not too sure about the EIPs itself as I am not that well verse in smart contracts either. I found this [article](https://medium.com/@ashwin.yar/eip-712-structured-data-hashing-and-signing-explained-c8ad00874486) about this specific EIP that maybe able to give some more ideas (seems like the signing here is just for identification but I could be wrong). Apart from that in this case maybe it's best to both look at the source code you can find alongside the details of the EIP itself. – Ping34 Jan 20 '23 at 18:23