Currently there are two ledgers in the postgres database, PaymentLedger and RelayLedger. Payment ledger is CREDITed when a user burns ERC-20 via event watcher, this increases the balance on the account. As relays are used the RelayLedger is CREDITed to indicate usage (also refers to app and chain (endpoint) for reference. We need a process that occasionally (daily, weekly, etc) DEBITs both ledgers with the corresponding tx to balance them. Basically a DEBIT to the PaymentLedger will show up on the accounting page as ledgers used. The DEBIT on the relay ledger will indicate that those relays have been accounted for.
I'm not sure where is the best place for this process to live as it is a sort of admin function that we don't have in our stack currently. It should be as simple as a SQL query, so perhaps we program it into the backend and have an external process call it on whatever cadence we wish. Thoughts?
I'm thinking a good place for this until we find something better will be a backend endpoint (we'll want some authorization). We can decide to manually run it for now, come up with a plan for automating.
Currently there are two ledgers in the postgres database, PaymentLedger and RelayLedger. Payment ledger is CREDITed when a user burns ERC-20 via event watcher, this increases the balance on the account. As relays are used the RelayLedger is CREDITed to indicate usage (also refers to app and chain (endpoint) for reference. We need a process that occasionally (daily, weekly, etc) DEBITs both ledgers with the corresponding tx to balance them. Basically a DEBIT to the PaymentLedger will show up on the accounting page as ledgers used. The DEBIT on the relay ledger will indicate that those relays have been accounted for.
I'm not sure where is the best place for this process to live as it is a sort of admin function that we don't have in our stack currently. It should be as simple as a SQL query, so perhaps we program it into the backend and have an external process call it on whatever cadence we wish. Thoughts?