πŸ†
GrantPicks
AppGithubPotlock
  • πŸ—ΊοΈOverview
  • πŸ“šUser Guides
    • Getting Started
    • Exploring Rounds
    • User Classes
      • β€πŸ’Ό Projects
        • Applying for A Round
        • Editing Project
        • Creating A Project
        • KYC/Compliance
      • πŸ‘¨β€πŸ’» Round Managers
        • Create A Round
        • Get A Round Funded
        • Reviewing Applications
        • Setting Payouts
        • Triggering Payouts
      • πŸ—³οΈ Voters
        • Voting in a Round
        • Create Challenges
        • Funding A Vaulted Round
      • πŸ•΅οΈ Observers
    • πŸ‘―β€β™‚οΈPairwise Voting Explained
    • Getting Started with Stellar
  • πŸ› οΈDevelopers
    • Smart Contracts - Stellar
      • Project Registry
      • Rounds
        • Factory Methods
        • Round & Vote Methods
        • Events For Indexer
    • Forking the App
    • Smart Contracts on NEAR
  • πŸ™EXTRA
    • πŸ“šGlossary
Powered by GitBook
On this page

Was this helpful?

  1. Developers
  2. Smart Contracts - Stellar
  3. Rounds

Factory Methods

Factory methods facilitate the creation, management, and configuration of funding rounds.

1. Initialize New Contract

rustfn initialize(
    env: &Env,
    caller: Address,
    token_address: Address,
    registry_address: Address,
    list_address: Address,
    kyc_list_id: u128,
    protocol_fee_basis_points: Option<u32>,
    protocol_fee_recipient: Option<Address>,
    default_page_size: Option<u64>,
)

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

rustfn create_round(env: &Env, caller: Address, params: CreateRoundParams) -> RoundDetail

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

rustfn upgrade(env: &Env, new_wasm_hash: BytesN<32>)

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

rustfn transfer_ownership(env: &Env, new_owner: Address)

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

rustfn owner_set_default_page_size(env: &Env, default_page_size: u64)

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

rustfn owner_set_protocol_fee_config(
    env: &Env,
    protocol_fee_recipient: Option<Address>,
    protocol_fee_basis_points: Option<u32>,
)

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

rustfn get_rounds(env: &Env, skip: Option<u64>, limit: Option<u64>) -> Vec<RoundDetail>

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

rustfn get_config(env: &Env) -> Config

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.

PreviousRoundsNextRound & Vote Methods

Last updated 7 months ago

Was this helpful?

πŸ› οΈ