InfiniRewards
Reference

InfiniRewardsPoints

Reference documentation for the InfiniRewardsPoints contract

InfiniRewardsPoints

An ERC20-based contract that manages the points system within InfiniRewards.

Storage Variables

NameTypeDescription
nameByteArrayName of the points token
symbolByteArraySymbol of the points token
decimalsu8Decimals for the points token (typically 18)
merchantContractAddressAddress of the merchant who owns this points contract
transfer_whitelistMap<ContractAddress, bool>Addresses allowed to receive point transfers
points_multipliersMap<ContractAddress, u256>Special multipliers for specific users

Events

EventParametersDescription
ERC20EventInheritedStandard ERC20 events (Transfer, Approval)
PointsIssuedto: ContractAddress, amount: u256Emitted when points are issued to a user
PointsRedeemedfrom: ContractAddress, amount: u256Emitted when points are redeemed
MultiplierSetuser: ContractAddress, multiplier: u256Emitted when a user's points multiplier is updated

Key Methods

Constructor

fn constructor(
    ref self: ContractState,
    name: ByteArray,
    symbol: ByteArray,
    merchant: ContractAddress
)

Initializes a new points token contract.

ParameterTypeDescription
nameByteArrayName of the points token
symbolByteArraySymbol of the points token
merchantContractAddressAddress of the merchant who owns this contract

Issue Points

fn issue_points(
    ref self: ContractState,
    to: ContractAddress,
    amount: u256
)

Issues new points to a user (merchant only).

ParameterTypeDescription
toContractAddressRecipient of the points
amountu256Amount of points to issue

Issue Points With Receipt

fn issue_points_with_receipt(
    ref self: ContractState,
    to: ContractAddress,
    amount: u256,
    receipt_id: felt252,
    timestamp: u64
)

Issues points with a receipt ID for tracking purposes.

ParameterTypeDescription
toContractAddressRecipient of the points
amountu256Amount of points to issue
receipt_idfelt252Unique identifier for the transaction
timestampu64Timestamp of the transaction

Redeem Points

fn redeem_points(
    ref self: ContractState,
    from: ContractAddress,
    amount: u256
)

Redeems (burns) points from a user (merchant only).

ParameterTypeDescription
fromContractAddressUser to redeem points from
amountu256Amount of points to redeem

Set Points Multiplier

fn set_points_multiplier(
    ref self: ContractState,
    user: ContractAddress,
    multiplier: u256
)

Sets a points multiplier for a specific user (merchant only).

ParameterTypeDescription
userContractAddressTarget user address
multiplieru256Multiplier value (e.g., 150 for 1.5x)

Add To Transfer Whitelist

fn add_to_transfer_whitelist(
    ref self: ContractState,
    address: ContractAddress
)

Adds an address to the transfer whitelist, allowing it to receive points transfers.

ParameterTypeDescription
addressContractAddressAddress to add to the whitelist

On this page