Skip to content

Implement DepositFromDeployment for Vault Contract #353

@arlai-mk

Description

@arlai-mk

Background

The vault contract has WithdrawForDeployment which withdraws funds to whitelisted addresses and increases the control center's deployed amount (via UpdateDeployedAmount). We need the reverse operation to return funds from deployment back to the vault.

Current limitation

Control center's UpdateDeployedAmount only adds to deployed amount. It needs to support subtraction for this feature.

Requirements

1. Update Control Center

Modify UpdateDeployedAmount to support both directions, either:

  • Option A: Create separate messages: AddToDeployedAmount and SubFromDeployedAmount
  • Option B: Add a direction parameter (add/subtract)

2. Add Vault ExecuteMsg

DepositFromDeployment {}

Implementation should:

  1. Validate caller is whitelisted (validate_address_is_whitelisted)
  2. Validate info.funds contains only the vault's deposit_denom
  3. Convert deposited amount to base tokens (using convert_deposit_token_into_base_token)
  4. Call control center to subtract from deployed amount
  5. Leave the funds in vault's balance (nothing to do)
  6. Add relevant tests

Reference implementation: Mirror withdraw_for_deployment logic (contracts/inflow/vault/src/contract.rs) but with reverse "deployed amount" update (subtract).

Files to modify (non-exhaustive list):

  • packages/interface/src/inflow_control_center.rs - ExecuteMsg
  • contracts/inflow/control-center/src/contract.rs - Handler logic
  • packages/interface/src/inflow.rs - ExecuteMsg
  • contracts/inflow/vault/src/contract.rs - Handler + helper function
  • contracts/inflow/control-center/src/testing.rs - Unit tests that use Control center's UpdateDeployedAmount
  • contracts/inflow/vault/src/testing.rs - New tests

Metadata

Metadata

Assignees

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