Agoric / agoric-sdk

monorepo for the Agoric Javascript smart contract platform
Apache License 2.0
327 stars 208 forks source link

support StakingAccountActions & StakingAccountQueries in LocalOrchestrationAccount #10048

Open 0xpatrickdev opened 2 months ago

0xpatrickdev commented 2 months ago

What is the Problem Being Solved?

External CosmosOrchestrationAccount supports the StakingAccountActions and StakingAccountQueries interfaces. https://github.com/Agoric/agoric-sdk/blob/67275c2ac643b53bb74422cc92fe1f3565150d12/packages/orchestration/src/cosmos-api.ts#L144-L192

  1. LocalOrchestrationAccount presents a different interface for delegate and undelegate - it currently takes (string, ertpAmount) instead of (ChainAddress, AmountArg)

  2. There is incongruity between undelegate and delegate/redelegate in the StakingActions interface - the former takes an array of delegations while the latter two only accept a single delegation.

  3. Some StakingActions have yet to be implemented in LocalOrchestrationAccount.

### Unification Tasks
- [ ] `LocalOrchestrationAccount` `.delegate` and `.undelegate` should take `ChainAddress` and `AmountArg` as params (currently, `(string, ertpAmount)`) to match `StakingActions`
- [ ]  `CosmosOrchestrationAccount` `.delegate` and `.redelegate` should take an array of delegations, like `.undelegate`
### Completeness Tasks
- [ ] `LocalOrchestrationAccount` `withdrawReward(validator)` is not implemented
- [ ] `LocalOrchestrationAccount` `redelegate` is not implemented
- [ ] `withdrawRewards()` is not implemented on  `LocalOrchestrationAccount` and `CosmosOrchestrationAccount`
- [ ] The methods of `StakingAccountQueries`

Description of the Design

Security Considerations

Scaling Considerations

Test Plan

Upgrade Considerations

0xpatrickdev commented 1 week ago

Note: https://github.com/Agoric/agoric-sdk/issues/10370