这是indexloc提供的服务,不要输入任何密码
Skip to content

Create a proxy contract for creation of delegation pool #131

@sjoshisupra

Description

@sjoshisupra

pbo_delegation_pool.move as of now has the following initialization method signature,

 public fun initialize_delegation_pool(
        owner: &signer,
        multisig_admin: option::Option<address>,
        operator_commission_percentage: u64,
        delegation_pool_creation_seed: vector<u8>,
        delegator_address: vector<address>,
        principle_stake: vector<u64>,
        coin: Coin<SupraCoin>,
        unlock_numerators: vector<u64>,
        unlock_denominator: u64,
        unlock_start_time: u64,
        unlock_duration: u64
    ) acquires DelegationPool, GovernanceRecords, BeneficiaryForOperator, NextCommissionPercentage

Since it takes coin:Coin<SupraCoin> as a parameter, it can not be called directly via CLI or client, since Coin can not exist outside of the chain. This is the reason why this is not an public entry function but merely a public fun. Also, it takes multisig_admin: Option<address> as a parameter which can not be sent via CLI/client.

However, this also means that this method can not be called via on-chain multisig account, because on-chain multisig account can only specify EntryFunction as a payload.

Therefore, it is better to define another function as follows:

public entry fun initialize_delegation_pool_with_amount(
        owner: &signer,
        multisig_admin: address,
        operator_commission_percentage: u64,
        delegation_pool_creation_seed: vector<u8>,
        delegator_address: vector<address>,
        principle_stake: vector<u64>,
        init_grant_amount: u64,
        unlock_numerators: vector<u64>,
        unlock_denominator: u64,
        unlock_start_time: u64,
        unlock_duration: u64
    ) acquires DelegationPool, GovernanceRecords, BeneficiaryForOperator, NextCommissionPercentage {
    let coin = coin::withdraw<SupraCoin>(owner,init_grant_amount);
    pbo_delegation_pool::initialize_delegation_pool( owner, option::some(multisig_admin), operator_commission_percentage,
                                              delegation_pool_creation_seed, delegator_address,
                                              principle_stake, coin, unlock_numerators, unlock_denominator, unlock_start_time, unlock_duration );

   
}

For now, it is better to define such a method in a different module outside of a framework.
Later, this interface need to be provided in supra_framework/pbo_delegation_pool.move directly.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions