Skip to content

docs: improve README H1 and add Flow ecosystem footer #317

docs: improve README H1 and add Flow ecosystem footer

docs: improve README H1 and add Flow ecosystem footer #317

Workflow file for this run

name: YieldVault Operations CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
setup-and-test:
name: YieldVault Integration Tests
runs-on: ubuntu-latest
steps:
# === COMMON SETUP ===
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_PAT }}
submodules: recursive
- name: Install Flow CLI
run: sh -ci "$(curl -fsSL https://raw.githubusercontent.com/onflow/flow-cli/master/install.sh)"
- name: Update PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Verify Flow CLI Installation
run: flow version
- name: Initialize submodules
run: git submodule update --init --recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: stable
- name: Install Solidity dependencies
working-directory: ./solidity
run: forge install --no-git
- name: Make scripts executable
run: |
chmod +x ./local/setup_and_run_emulator.sh
chmod +x ./local/deploy_full_stack.sh
- name: Setup and Run Emulator
run: |
./local/setup_and_run_emulator.sh &
sleep 80 # Wait for the emulator to be fully up
- name: Deploy Full Stack
run: |
set -o pipefail
MAX_ATTEMPTS=2
ATTEMPT=1
while [ $ATTEMPT -le $MAX_ATTEMPTS ]; do
echo "Deploy attempt $ATTEMPT/$MAX_ATTEMPTS"
if ./local/deploy_full_stack.sh 2>&1 | tee deploy_full_stack.log; then
break
fi
if [ $ATTEMPT -eq $MAX_ATTEMPTS ]; then
echo "Deploy Full Stack failed after $MAX_ATTEMPTS attempts"
exit 1
fi
echo "Deploy failed, retrying once..."
ATTEMPT=$((ATTEMPT + 1))
sleep 5
done
FLOW_VAULTS_REQUESTS_CONTRACT=$(grep "FlowYieldVaultsRequests Contract:" deploy_full_stack.log | tail -n 1 | sed 's/.*: //')
if [ -z "$FLOW_VAULTS_REQUESTS_CONTRACT" ]; then
echo "Failed to extract FlowYieldVaultsRequests contract address from deploy output"
exit 1
fi
echo "CONTRACT_ADDRESS=$FLOW_VAULTS_REQUESTS_CONTRACT" >> $GITHUB_ENV
- name: Detect Strategy Identifier
run: |
echo "Detecting supported strategy identifier..."
YIELDVAULT_CHECK=$(flow scripts execute ./cadence/scripts/check_yieldvault_details.cdc 0x045a1763c93006ca)
echo "$YIELDVAULT_CHECK"
SUPPORTED_STRATEGIES=$(echo "$YIELDVAULT_CHECK" | grep -oE '"supportedStrategies": \[[^]]*\]' || true)
if [ -z "$SUPPORTED_STRATEGIES" ]; then
echo "❌ Could not parse supported strategy list"
exit 1
fi
STRATEGY_LIST=$(echo "$SUPPORTED_STRATEGIES" | sed -E 's/^"supportedStrategies": \[(.*)\]$/\1/' | tr -d '"' | tr ',' '\n' | sed 's/^ *//;s/ *$//' | sed '/^$/d')
STRATEGY_IDENTIFIER=$(echo "$STRATEGY_LIST" | grep 'TracerStrategy' | head -n 1 || true)
if [ -z "$STRATEGY_IDENTIFIER" ]; then
STRATEGY_IDENTIFIER=$(echo "$STRATEGY_LIST" | head -n 1)
fi
if [ -z "$STRATEGY_IDENTIFIER" ]; then
echo "❌ No supported strategy identifier found"
exit 1
fi
echo "Using strategy identifier: $STRATEGY_IDENTIFIER"
echo "STRATEGY_IDENTIFIER=$STRATEGY_IDENTIFIER" >> $GITHUB_ENV
# === TEST 1: BASIC YIELDVAULT CREATION ===
- name: Test 1 - Create YieldVault (10 FLOW)
run: |
echo "========================================="
echo "TEST 1: BASIC YIELDVAULT CREATION"
echo "========================================="
forge script ./solidity/script/FlowYieldVaultsYieldVaultOperations.s.sol:FlowYieldVaultsYieldVaultOperations \
--root ./solidity \
--sig "createYieldVault(address)" ${{ env.CONTRACT_ADDRESS }} \
--rpc-url http://localhost:8545 \
--broadcast \
--legacy
env:
AMOUNT: 10000000000000000000
- name: Process Create Request
run: |
flow transactions send ./cadence/transactions/process_requests.cdc 0 10 --signer emulator-flow-yield-vaults --compute-limit 9999
- name: Verify YieldVault Creation
run: |
echo "=== Verifying YieldVault Creation ==="
# Check yieldvault details using the account-level script
YIELDVAULT_CHECK=$(flow scripts execute ./cadence/scripts/check_yieldvault_details.cdc 0x045a1763c93006ca)
echo "$YIELDVAULT_CHECK"
# Verify that we have at least one EVM address with yieldvaults
if echo "$YIELDVAULT_CHECK" | grep -q '"totalEVMAddresses": 1'; then
echo "✅ EVM address registered"
else
echo "❌ No EVM addresses found"
exit 1
fi
# Verify that we have at least one yieldvault created
if echo "$YIELDVAULT_CHECK" | grep -q '"totalMappedYieldVaults": 1'; then
echo "✅ YieldVault created successfully"
else
echo "❌ No yieldvaults found"
exit 1
fi
# Verify the specific EVM address has the yieldvault
if echo "$YIELDVAULT_CHECK" | grep -q '6813eb9362372eef6200f3b1dbc3f819671cba69'; then
echo "✅ YieldVault mapped to correct EVM address"
else
echo "❌ EVM address mapping not found"
exit 1
fi
echo "✅ Test 1 Passed: Basic yieldvault creation verified"
# === TEST 2: FULL YIELDVAULT LIFECYCLE ===
- name: Test 2 - Deposit Additional Funds (20 FLOW)
run: |
echo "========================================="
echo "TEST 2: FULL YIELDVAULT LIFECYCLE"
echo "========================================="
echo "Step 1: Depositing additional 20 FLOW..."
# Note: Using yieldvault Id 0 based on the event logs from your output
forge script ./solidity/script/FlowYieldVaultsYieldVaultOperations.s.sol:FlowYieldVaultsYieldVaultOperations \
--root ./solidity \
--sig "depositToYieldVault(address,uint64)" ${{ env.CONTRACT_ADDRESS }} 0 \
--rpc-url http://localhost:8545 \
--broadcast \
--legacy
env:
AMOUNT: 20000000000000000000
- name: Process Deposit Request
run: |
flow transactions send ./cadence/transactions/process_requests.cdc 0 10 --signer emulator-flow-yield-vaults --compute-limit 9999
- name: Verify Deposit
run: |
echo "Verifying deposit (should still have 1 yieldvault with more balance)..."
YIELDVAULT_CHECK=$(flow scripts execute ./cadence/scripts/check_yieldvault_details.cdc 0x045a1763c93006ca)
echo "$YIELDVAULT_CHECK"
# Should still have 1 yieldvault
if echo "$YIELDVAULT_CHECK" | grep -q '"totalMappedYieldVaults": 1'; then
echo "✅ Still has 1 yieldvault after deposit"
else
echo "❌ YieldVault count changed unexpectedly"
exit 1
fi
- name: Test 2 - Withdraw Half (15 FLOW)
run: |
echo "Step 2: Withdrawing 15 FLOW..."
forge script ./solidity/script/FlowYieldVaultsYieldVaultOperations.s.sol:FlowYieldVaultsYieldVaultOperations \
--root ./solidity \
--sig "withdrawFromYieldVault(address,uint64,uint256)" ${{ env.CONTRACT_ADDRESS }} 0 15000000000000000000 \
--rpc-url http://localhost:8545 \
--broadcast \
--legacy
- name: Process Withdraw Request
run: |
flow transactions send ./cadence/transactions/process_requests.cdc 0 10 --signer emulator-flow-yield-vaults --compute-limit 9999
- name: Verify Withdrawal
run: |
echo "Verifying withdrawal (should still have 1 yieldvault with less balance)..."
YIELDVAULT_CHECK=$(flow scripts execute ./cadence/scripts/check_yieldvault_details.cdc 0x045a1763c93006ca)
echo "$YIELDVAULT_CHECK"
# Should still have 1 yieldvault
if echo "$YIELDVAULT_CHECK" | grep -q '"totalMappedYieldVaults": 1'; then
echo "✅ Still has 1 yieldvault after withdrawal"
else
echo "❌ YieldVault count changed unexpectedly"
exit 1
fi
- name: Test 2 - Close YieldVault
run: |
echo "Step 3: Closing yieldvault (withdrawing remaining funds)..."
forge script ./solidity/script/FlowYieldVaultsYieldVaultOperations.s.sol:FlowYieldVaultsYieldVaultOperations \
--root ./solidity \
--sig "closeYieldVault(address,uint64)" ${{ env.CONTRACT_ADDRESS }} 0 \
--rpc-url http://localhost:8545 \
--broadcast \
--legacy
- name: Process Close Request
run: |
flow transactions send ./cadence/transactions/process_requests.cdc 0 10 --signer emulator-flow-yield-vaults --compute-limit 9999
- name: Verify YieldVault Closed
run: |
echo "Verifying yieldvault was closed..."
YIELDVAULT_CHECK=$(flow scripts execute ./cadence/scripts/check_yieldvault_details.cdc 0x045a1763c93006ca)
echo "$YIELDVAULT_CHECK"
# After closing, should have 0 yieldvaults or the yieldvault should be marked as closed
if echo "$YIELDVAULT_CHECK" | grep -q '"totalMappedYieldVaults": 0'; then
echo "✅ YieldVault successfully closed and removed"
elif echo "$YIELDVAULT_CHECK" | grep -q '"totalEVMAddresses": 0'; then
echo "✅ No more active yieldvaults for EVM addresses"
else
echo "⚠️ YieldVault may still exist but should be in closed state"
# Don't fail here as the close transaction succeeded
fi
echo "✅ Test 2 Passed: Full yieldvault lifecycle completed"
# === FINAL SUMMARY ===
- name: Test Summary
run: |
echo "========================================="
echo "ALL INTEGRATION TESTS PASSED"
echo "========================================="
echo "✅ Test 1: Basic YieldVault Creation - PASSED"
echo "✅ Test 2: Full YieldVault Lifecycle - PASSED"
echo "========================================="