Third-party lending markets call sync_ledger on LendingLedger every time a user deposits or withdraws cNOTE. This enables Neofinance Coordinator to continuously track lending balances and allocate incentives accordingly.
Additionally, users claim incentives from LendingLedger. This should be facilitated by a claiming interface on the lending market.
To sync the ledger, call the sync_ledger(address _lender, int256 _delta) method. The address is that of the user (liquidity provider) and the int256 is the amount of cNOTE deposited (positive) or withdrawn (negative) with 18 decimal places of precision.
Important: The sync_ledger method reverts if the caller is not a whitelisted lending market. As a result, this method should be wrapped in a try-catch block to ensure liquidity providers can still deposit/withdraw if a market is removed from the whitelist.
To claim incentives, call the claim(address _market, uint256 _claimFromTimestamp, uint256 _claimUpToTimestamp) method. The address is that of the market and the two uint256 parameters represent from and to timestamps.
await LendingLedger.claim(0x..., 0, ethers.constants.MaxUint256) // Claim all incentives