Payment Registry

The Payment Registry serves a simple but crucial role: enabling transfers to be processed through it and storing the transfer data.

When a Market Maker (MM) picks up an order to fulfill, they initiate the process by calling the transferTo function on the Payment Registry. This function takes in the orderId, usrDstAddress (the recipient's address), and expirationTimestamp (the time up until the MM has to fulfill and prove the order). The transferTo function includes the onlyAllowedAddress modifier, which would be removed in the Multiple Market Maker (MMM) approach, to allow anyone to call the function. The function ensures that msg.value > 0, confirming that actual funds are being transferred. It then encodes the orderId, usrDstAddress, and msg.value into an index, and under that index, it checks that the order hasn't been processed before, preventing double fulfillment. The order details are saved in the transfers mapping, and the funds provided by the MM are sent to the recipient.

Once the transaction is successful, a transfer event is emitted, triggering the proof process through the Operator service.

The Payment Registry's primary role is to manage transactions and capture transfer data, storing it for later verification using storage proofs. Each transaction processed via transferTo is logged in the transfers mapping, and the storage slots of this mapping are what will be used to prove that the transfer occurred. This system assumes that the smart contracts are functioning correctly, that every transfer is properly recorded in the mapping, and that every entry in the mapping corresponds to an actual transaction on the blockchain.

Last updated