Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a proxy contract for creation of delegation pool #131

Open
sjoshisupra opened this issue Nov 25, 2024 · 3 comments
Open

Create a proxy contract for creation of delegation pool #131

sjoshisupra opened this issue Nov 25, 2024 · 3 comments
Assignees

Comments

@sjoshisupra
Copy link

sjoshisupra commented Nov 25, 2024

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.

@anshuman-supraoracles
Copy link

Dr @sjoshisupra

is it possible to pass this arg multisig_admin: option::Option<address>, as a param from CLI ?

@sjoshisupra
Copy link
Author

@anshuman-supraoracles , no it's not possible. Let's change to address instead of Option<address>,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants