InfiniRewards
Reference

InfiniRewardsFactory

Reference documentation for the InfiniRewardsFactory contract

InfiniRewardsFactory

A factory contract for deploying and managing InfiniRewards components.

Storage Variables

NameTypeDescription
adminContractAddressAddress of the platform administrator
merchant_implementationsMap<felt252, ClassHash>Maps merchant types to their implementation hashes
user_implementationsMap<felt252, ClassHash>Maps user types to their implementation hashes
points_implementationClassHashImplementation hash for points contracts
collectible_implementationClassHashImplementation hash for collectible contracts
merchantsMap<ContractAddress, bool>Registered merchant addresses
usersMap<ContractAddress, bool>Registered user addresses

Events

EventParametersDescription
MerchantCreatedmerchant: ContractAddress, merchant_type: felt252Emitted when a new merchant account is created
UserCreateduser: ContractAddress, user_type: felt252Emitted when a new user account is created
PointsContractCreatedpoints: ContractAddress, merchant: ContractAddressEmitted when a new points contract is created
CollectibleContractCreatedcollectible: ContractAddress, merchant: ContractAddressEmitted when a new collectible contract is created

Key Methods

Constructor

fn constructor(
    ref self: ContractState,
    admin: ContractAddress
)

Initializes the factory contract.

ParameterTypeDescription
adminContractAddressAddress of the platform administrator

Create Merchant Account

fn create_merchant_account(
    ref self: ContractState,
    merchant_type: felt252,
    public_key: felt252
) -> ContractAddress

Creates a new merchant account.

ParameterTypeDescription
merchant_typefelt252Type of merchant (e.g., "retail", "restaurant")
public_keyfelt252Public key of the merchant

Returns: The address of the created merchant account

Create User Account

fn create_user_account(
    ref self: ContractState,
    user_type: felt252,
    public_key: felt252
) -> ContractAddress

Creates a new user account.

ParameterTypeDescription
user_typefelt252Type of user
public_keyfelt252Public key of the user

Returns: The address of the created user account

Create Points Contract

fn create_points_contract(
    ref self: ContractState,
    merchant: ContractAddress,
    name: ByteArray,
    symbol: ByteArray
) -> ContractAddress

Creates a new points contract for a merchant.

ParameterTypeDescription
merchantContractAddressAddress of the merchant
nameByteArrayName of the points token
symbolByteArraySymbol of the points token

Returns: The address of the created points contract

Create Collectible Contract

fn create_collectible_contract(
    ref self: ContractState,
    merchant: ContractAddress,
    name: ByteArray,
    metadata: ByteArray,
    points_contract: ContractAddress
) -> ContractAddress

Creates a new collectible contract for a merchant.

ParameterTypeDescription
merchantContractAddressAddress of the merchant
nameByteArrayName of the collectible token collection
metadataByteArrayBase metadata URI
points_contractContractAddressAssociated points contract address

Returns: The address of the created collectible contract

Update Implementation

fn update_implementation(
    ref self: ContractState,
    contract_type: felt252,
    implementation: ClassHash
)

Updates a contract implementation (admin only).

ParameterTypeDescription
contract_typefelt252Type of contract to update (e.g., "points", "collectible")
implementationClassHashNew implementation hash

On this page