Appendix III: Ledger Contract Access
Note: This replaces LoyaltyContract as core functionality for capturing customer events.
Set up
Client-Side
Server-Side
Action Methods
function addPoints(address recipient,int256 pointsAmt,uint256 eventId)
This allows the owner to add a qualifying event (as defined on the Credenza-managed event table as eventId with associated points pointsAmt to member’s balance associated with public key recipient.
function redeemPoints(address recipient,int256 pointsAmt,uint256 eventId)
If points are to be converted into stored value or rewards, this can be called to reduce the current points balance for the recipient by pointsAmt, associated with a redemption event eventId.
function checkPoints(address recipient) public view returns (int256)
Returns the balance of current points owned by recipient, which takes all redemptions and forfeitures into account.
function checkLifetimePoints(address recipient)
Returns the balance of current points owned by recipient, which does NOT take all redemptions and forfeitures into account. This amount can only grow.
function forfeitPoints(address recipient, int256 amount)
Separated from redemption, this is called if points expire or other activities cause a balance to be reduced by amount without any benefit going to the member recipient.
function convertPointsToCoins(address recipient, int256 amount)
Many loyalty programs want to reward users by converting points to stored value. This transaction redeems points and increases stored value balances for recipient.
function retrieveLogs(address recipient)
Each addPoints call accumulates points, but also creates a record of each discrete item performed for the recipient. retrieveLogs returns an array with the events and points associated with recipient.