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 _fee, _usrSrcAddress, and _destinationChainId. 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 hashes all of the order details, and under that hash, it checks that the order hasn't been processed before, preventing double fulfillment. Then under the order hash that we just calculated, we mark the order as fulfilled, send over the funds to the designated recipient, and emit a successful Transfer event.

The Payment Registry's primary role is to manage transactions and capture transfer data, storing it for later verification using HDP. 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