web3go-xyz / web3go.xyz

Discovery data value of Web3
Apache License 2.0
11 stars 4 forks source link

delegate 加入某个Collator,成为它的 delegator #88

Open wangminqi opened 2 years ago

wangminqi commented 2 years ago

pub fn delegate( origin: OriginFor, candidate: T::AccountId, amount: BalanceOf, candidate_delegation_count: u32, delegation_count: u32, ) https://github.com/OAK-Foundation/moonbeam/blob/oak-staging/pallets/parachain-staking/src/lib.rs#L1162

candidate : The collator accountId amount: The amount delegation amount

delegation_count: make sure this number is larger than delegator (this extrinsic sender)'s total number of delegations . candidate_delegation_count: make sure this number is larger than candidate (target collator)'s total number of delegations.

wangminqi commented 2 years ago

Do you need a document for how to get candidate (target collator) / delegator (this extrinsic sender)'s total number of delegations? @bianyunjian

bianyunjian commented 2 years ago

Do you need a document for how to get candidate (target collator) / delegator (this extrinsic sender)'s total number of delegations? @bianyunjian

we can query it, or just assign a bit number? should it be an accurate number?

wangminqi commented 2 years ago

As long as the input numbers are larger than expected, it should be okay. But these two number effects the transaction fee users pay. The larger the numbers, the higher total gas. It will be best if we keep them as small as possible, so ideally we query and make them equal to candidate (target collator) / delegator (this extrinsic sender)'s total number of delegations.

wangminqi commented 2 years ago

https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frpc.turing.oak.tech#/chainstate Anyway, I leave the query method on polkadot.js here.

image

For candiate (collator) delegation number

image

For delegator's delegation number