Factory Methods
Factory methods facilitate the creation, management, and configuration of funding rounds.
1. Initialize New Contract
Purpose: This method initializes the contract with essential parameters required for its operation.
Parameters:
env
: The environment in which the contract operates.caller
: The address of the user calling the initialization function.token_address
: The address of the token contract used for transactions.registry_address
: The address of the project registry contract.list_address
: The address for managing lists related to the contract.kyc_list_id
: Identifier for the KYC (Know Your Customer) list.protocol_fee_basis_points
: Optional fee structure expressed in basis points.protocol_fee_recipient
: Optional address that will receive protocol fees.default_page_size
: Optional parameter to set the default pagination size.
2. Create a Round
Purpose: This method allows users to create a new funding round by providing necessary parameters.
Parameters:
env
: The environment context for executing the method.caller
: The address of the user initiating the round creation.params
: A struct containing details about the round, such as its name, description, voting period, and expected funding amount.
Returns: A
RoundDetail
object containing information about the newly created round.
3. Upgrade Contract Code
Purpose: This method allows for upgrading the contract's code to a new version.
Parameters:
env
: The environment context for executing the upgrade.new_wasm_hash
: A hash representing the new WebAssembly (WASM) code to be deployed.
4. Transfer Ownership
Purpose: This method transfers ownership of the contract to a new address.
Parameters:
env
: The environment context for executing the transfer.new_owner
: The address of the new owner who will take over control of the contract.
5. Change Configuration
Set Default Page Size
Purpose: This method allows the current owner to set a new default page size for pagination in responses.
Parameters:
env
: The environment context for executing this configuration change.default_page_size
: The new default size for paginated results.
Set Protocol Fee Configuration
Purpose: This method enables the current owner to update the protocol fee settings.
Parameters:
env
: The environment context for executing this configuration change.protocol_fee_recipient
: Optional address that will receive protocol fees.protocol_fee_basis_points
: Optional updated fee structure expressed in basis points.
Read Methods
In addition to factory methods, there are also read methods that allow users to retrieve information from the contract:
1. Get All Rounds in Contract
Purpose: This method retrieves all funding rounds managed by the contract.
Parameters:
env
: The environment context for executing this retrieval.skip
: Optional parameter to skip a specified number of rounds (for pagination).limit
: Optional parameter to limit the number of rounds returned.
Returns: A vector of
RoundDetail
objects representing all available rounds.
2. Get Current Contract Configuration
Purpose: This method retrieves the current configuration settings of the contract.
Parameters:
env
: The environment context for executing this retrieval.
Returns: A
Config
object containing current settings such as owner address and fee configurations.
Last updated
Was this helpful?