Rust proof of concept for moving a user STRK deposit on Starknet into USDC on Base, then executing an Intent Connect transfer to a final EVM vault address.
The binary coordinates two external services:
- Aurora Swap API: quotes and executes the STRK to USDC cross-chain swap.
- Intent Connect API: provides an intermediary EVM address, builds the EVM execution payload, and accepts the backend signature.
- Load runtime configuration from
.env. - Connect to Starknet and wait until
STRK_VAULT_ADDRESSreceives more STRK. - Request the backend intermediary EVM address from Intent Connect.
- Create an Aurora Swap quote for STRK on Starknet to USDC on Base, with the intermediary address as the recipient.
- Transfer the detected STRK deposit from the Starknet vault account to the Aurora-provided deposit address.
- Poll Base until the intermediary address receives USDC.
- Dry-run the Intent Connect step request to calculate the network fee.
- Build the real Intent Connect step request for
USDC.transfer(VAULT_ON_EVM, amountAfterFee). - Sign the payload with
BACKEND_EVM_PRIVATE_KEYusing ERC-191 signing. - Submit the signature and poll Base until
VAULT_ON_EVMreceives the final USDC transfer.
- STRK on Starknet:
0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d - USDC on Base:
0x833589fcd6edb6e08f4c7c32d4f71b54bda02913 - Aurora origin asset:
nep141:starknet.omft.near - Aurora destination asset:
nep141:base-0x833589fcd6edb6e08f4c7c32d4f71b54bda02913.omft.near
- Rust toolchain with support for edition 2024.
- A Starknet RPC endpoint.
- A Base RPC endpoint. If
BASE_RPC_URLis not set, the app defaults tohttps://mainnet.base.org. - Aurora Swap API URL and API key.
- Intent Connect API URL.
- Funded Starknet vault account that can transfer STRK and pay Starknet transaction fees.
- Backend EVM private key authorized for the configured Intent Connect backend address.
Create a .env file in the project root:
STARKNET_RPC_URL=https://your-starknet-rpc.example
STRK_VAULT_ADDRESS=0x...
STRK_VAULT_PRIVATE_KEY=0x...
BASE_RPC_URL=https://your-base-rpc.example
VAULT_ON_EVM=0x...
BACKEND_EVM_ADDRESS=0x...
BACKEND_EVM_PRIVATE_KEY=0x...
INTENT_CONNECT_API_URL=https://intent-connect.example
AURORA_SWAP_API_URL=https://aurora-swap.example
AURORA_SWAP_API_KEY=...Environment variables:
| Name | Required | Description |
|---|---|---|
STARKNET_RPC_URL |
Yes | Starknet JSON-RPC endpoint. |
STRK_VAULT_ADDRESS |
Yes | Starknet account address that receives the initial STRK deposit and sends STRK to Aurora Swap. |
STRK_VAULT_PRIVATE_KEY |
Yes | Private key for STRK_VAULT_ADDRESS. |
BASE_RPC_URL |
No | Base RPC endpoint. Defaults to https://mainnet.base.org. |
VAULT_ON_EVM |
Yes | Final EVM destination address for the USDC transfer. |
BACKEND_EVM_ADDRESS |
Yes | Backend EVM address registered with Intent Connect. |
BACKEND_EVM_PRIVATE_KEY |
Yes | Private key used to sign the Intent Connect payload. |
INTENT_CONNECT_API_URL |
Yes | Base URL for the Intent Connect API. |
AURORA_SWAP_API_URL |
Yes | Base URL for the Aurora Swap API. |
AURORA_SWAP_API_KEY |
Yes | API key used in the Aurora quote endpoint path. |
Do not commit real .env files or private keys.
cargo check
cargo buildcargo runAfter startup, the program waits for an increase in the STRK balance of STRK_VAULT_ADDRESS. Send STRK to that account to trigger the flow.
The process logs each major step:
- detected STRK deposit amount;
- Intent Connect intermediary EVM address;
- Starknet transfer transaction hash;
- detected USDC deposit on the intermediary EVM address;
- calculated Intent Connect network fee;
- generated signature;
- final USDC deposit received by
VAULT_ON_EVM.
Press Ctrl+C while the app is polling for deposits to stop it cleanly.
src/main.rs End-to-end orchestration for the STRK to USDC flow.
src/intents.rs Aurora Swap and Intent Connect request/response helpers.
src/utils.rs Starknet provider, STRK transfer, Base ERC-20 balance, and signing helpers.
Cargo.toml Rust package metadata and dependencies.
- This is a single-run POC. It tracks the balance increase observed after startup and processes that deposit amount.
- The polling loops check balances every 2 seconds.
- Amounts are handled in token base units. The console output formats the initial STRK amount as
deposit.low() / 1e18. - The Intent Connect request first runs in dry mode to obtain the network fee, then submits a second non-dry request using the deposit amount minus that fee.
- The current step request transfers USDC from the intermediary account to
VAULT_ON_EVM. Replacecreate_steps_requestinsrc/intents.rsif the final Base-side action should be different.
quote not found: inspect the Aurora Swap response, API URL, API key, asset IDs, amount, and sponsor/refund address.intermediary address not found: verifyINTENT_CONNECT_API_URLandBACKEND_EVM_ADDRESS.networkFee field not found: the Intent Connect response shape differs from what this POC expects, or the dry-run request failed semantically.- No progress after startup: confirm that
STRK_VAULT_ADDRESSreceived a new STRK balance increase after the process started. - No USDC detected on Base: check the Starknet transfer transaction, Aurora Swap quote/deposit status, the Base RPC endpoint, and the intermediary EVM address.