InfiniRewards
Reference

Utility Components

Reference documentation for the InfiniRewards utility components

Utility Components

InfiniRewards includes several utility components that enhance the functionality of the core contracts.

Permission Management

The permission management system controls access to critical functions.

Permission Types

PermissionDescription
OWNERFull control over a contract
ADMINAdministrative functions
ISSUERCan issue points or tokens
REDEEMERCan redeem points or tokens
MANAGERCan manage contract settings

Methods

Check Permission

fn check_permission(
    permission: felt252,
    user: ContractAddress,
    contract: ContractAddress
) -> bool

Checks if a user has a specific permission.

ParameterTypeDescription
permissionfelt252Permission to check
userContractAddressUser address
contractContractAddressContract to check permission for

Returns: Whether the user has the permission

Session Keys

Session keys provide temporary limited permissions for specific functions.

Session Key Structure

struct SessionKey {
    public_key: felt252,
    expiry: u64,
    permitted_calls: Array<PermittedCall>
}
 
struct PermittedCall {
    to: ContractAddress,
    selector: felt252,
    calldata_len_range: (u32, u32)
}

Methods

Validate Session Transaction

fn validate_session_transaction(
    session_key_id: felt252,
    calls: Array<Call>,
    signature: Array<felt252>
) -> bool

Validates a transaction signed with a session key.

ParameterTypeDescription
session_key_idfelt252ID of the session key
callsArray<Call>Calls to validate
signatureArray<felt252>Signature to verify

Returns: Whether the transaction is valid

Policy Enforcement

Policy enforcement implements business rules and constraints for tokens and accounts.

Policy Types

PolicyDescription
TransferPolicyControls when and how tokens can be transferred
RedemptionPolicyRules for redeeming tokens
IssuancePolicyRules for issuing tokens
ExpiryPolicyHandles token expiration rules

Methods

Check Transfer Policy

fn check_transfer_policy(
    token: ContractAddress,
    from: ContractAddress,
    to: ContractAddress,
    amount: u256
) -> bool

Checks if a transfer complies with the policy.

ParameterTypeDescription
tokenContractAddressToken contract address
fromContractAddressSender address
toContractAddressRecipient address
amountu256Amount to transfer

Returns: Whether the transfer is allowed by policy

On this page