-
Notifications
You must be signed in to change notification settings - Fork 9
Introduction of Inflow adapters - Mars & IBC adapters #355
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
base: main
Are you sure you want to change the base?
Conversation
… for immediate deposit+withdraw
…ons query implementation
🛡️ Immunefi PR ReviewsWe noticed that your project isn't set up for automatic code reviews. If you'd like this PR reviewed by the Immunefi team, you can request it manually using the link below: Once submitted, we'll take care of assigning a reviewer and follow up here. |
| let user_input = format!("{}{}", proof_addr, lock_tokens_msg.maximum_amount); | ||
| let hash = sha2::Sha256::digest(user_input.as_bytes()) | ||
| .as_slice() | ||
| let digest = sha2::Sha256::digest(user_input.as_bytes()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why perform changes to this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to fix a clippy (v0.1.91) warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces the Inflow adapters infrastructure, enabling the vault to deploy funds to external DeFi protocols through specialized smart contract interfaces. The implementation includes two adapters: Mars Adapter for automated lending operations and IBC Adapter for manual cross-chain transfers.
Key Changes
- Adapter interface definition with standardized execute/query messages for protocol integrations
- Vault contract enhanced with automated allocation logic and adapter management functions
- Control Center updated to support bidirectional deployed amount tracking (add/subtract)
Reviewed changes
Copilot reviewed 88 out of 109 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
packages/interface/src/inflow_adapter.rs |
New adapter interface with standard messages and serialization helpers |
packages/interface/src/inflow_vault.rs |
Vault interface with adapter management messages (replaces inflow.rs) |
packages/interface/src/inflow_control_center.rs |
Added DeploymentDirection enum for tracking add/subtract operations |
contracts/inflow/vault/src/contract.rs |
Core vault logic with adapter allocation, registration, and deposit/withdrawal routing |
contracts/inflow/vault/src/state.rs |
Added ADAPTERS storage map for adapter registry |
contracts/inflow/vault/src/error.rs |
New adapter-specific error types |
contracts/inflow/vault/src/testing_adapters.rs |
Comprehensive test suite for adapter functionality (2863 lines) |
contracts/inflow/vault/src/testing_mocks.rs |
Mock adapter infrastructure for testing |
ts_types/*.ts |
TypeScript type definitions generated from contract schemas |
scripts/deploy-inflow-test.sh |
Deployment script for test environment setup |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| retry_command() { | ||
| set +e | ||
| local output | ||
| local status | ||
| local max_attempts=${2:-0} # Optional second parameter for max attempts (0 = infinite) | ||
| local attempt=1 | ||
|
|
||
| while true; do | ||
| output=$(eval "$1" 2>&1) |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The retry_command helper uses eval on a constructed command string (eval "$1"), and that string incorporates values loaded from the external config file (e.g., neutron_rpc_node via NEUTRON_NODE_FLAG and neutron_binary/neutron_dir via NEUTRON_CLI). If an attacker can influence the config file or any other caller-provided value passed into retry_command, they can inject shell metacharacters (such as ;, backticks, or $(...)) and achieve arbitrary command execution when the script runs. To avoid this, refactor retry_command to execute commands via positional parameters (e.g., using "$@" without eval) or otherwise ensure that untrusted data is never interpolated into a shell command string executed by eval.
Description
This PR introduces the Inflow adapters.
What are Adapters?
Adapters are specialized smart contracts that enable the Inflow vault to deploy funds to external DeFi protocols (like Mars Protocol for lending), or execute some specific action (like IBC transfers to other chains, swap tokens, redeem dATOM).
Each adapter acts as a secure interface between the vault and a specific protocol, handling deposits, withdrawals, and position tracking.
Automation & Hot Wallet Permissions
Adapters solve a critical operational challenge: secure automation without giving full admin access to hot wallets.
Instead of requiring multisig signatures for every routine operation, adapters use a three-tier permission model:
This enables automated operations (rebalancing, cross-chain transfers, yield optimization) while maintaining strong security boundaries. Hot wallets can only execute specific, pre-configured actions. They cannot change settings, add new routes, or access admin functions.
Adapter Configuration Types
AllocationMode
Controls whether an adapter participates in automated fund allocation:
calculate_venues_allocation. The vault can automatically route funds to/from this adapter during depositing/withdrawing.DepositToAdapter/WithdrawFromAdapteroperations. Typically used for adapters that require deliberate admin actions (e.g., IBC transfers to specific chains).DeploymentTracking
Controls whether adapter operations update the Control Center's (manually) deployed amount:
UpdateDeployedAmounton the Control Center. The deployed funds are included in the total deployment reporting.DepositorPositionbut not included in the Control Center's deployed amount. Useful for automated adapters that can track the depositors positions, and report back to the vault.TrackedwithAutomatedallocation can create race conditions if manualSubmitDeployedAmountproposals are in flight. The recommendation is to useNotTrackedfor automated adapters.Adapters in This PR
Mars Adapter (
AllocationMode::Automated,DeploymentTracking::NotTracked)IBC Adapter (
AllocationMode::Manual,DeploymentTracking::Tracked)Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
.changelogmake compileand included content of the artifacts directory into the PRmake schemaand included generated files into the PR