feat: bridges, PMM, flash workflow, token-aggregation, and deployment docs
- CCIP/trustless bridge contracts, GRU tokens, DEX/PMM tests, reserve vault. - Token-aggregation service routes, planner, chain config, relay env templates. - Config snapshots and multi-chain deployment markdown updates. - gitignore services/btc-intake/dist/ (tsc output); do not track dist. Run forge build && forge test before deploy (large solc graph). Made-with: Cursor
This commit is contained in:
@@ -35,17 +35,25 @@ fi
|
||||
|
||||
case "$TOKEN" in
|
||||
weth9)
|
||||
BRIDGE_ADDR="${CCIPWETH9_BRIDGE_MAINNET:?set in .env}"
|
||||
BRIDGE_ADDR="${MAINNET_CCIP_WETH9_BRIDGE:-${CCIPWETH9_BRIDGE_MAINNET:-}}"
|
||||
TOKEN_ADDR="${WETH9_ADDRESS:?set in .env}"
|
||||
;;
|
||||
weth10)
|
||||
BRIDGE_ADDR="${CCIPWETH10_BRIDGE_MAINNET:?set in .env}"
|
||||
BRIDGE_ADDR="${MAINNET_CCIP_WETH10_BRIDGE:-${CCIPWETH10_BRIDGE_MAINNET:-}}"
|
||||
TOKEN_ADDR="${WETH10_ADDRESS:?set in .env}"
|
||||
;;
|
||||
*) log_error "Invalid --token: $TOKEN"; exit 1;;
|
||||
esac
|
||||
|
||||
FEE_TOKEN="${CCIP_FEE_TOKEN:?LINK address in .env}"
|
||||
if [[ -z "$BRIDGE_ADDR" ]]; then
|
||||
log_error "Mainnet bridge address is not set in .env"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! FEE_TOKEN="$(cast call "$BRIDGE_ADDR" 'feeToken()(address)' --rpc-url "$RPC_URL" 2>/dev/null | tail -n1)"; then
|
||||
log_error "Could not resolve fee token from bridge $BRIDGE_ADDR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log_section "CCIP SEND"
|
||||
log_info "Bridge: $BRIDGE_ADDR"
|
||||
@@ -57,6 +65,22 @@ log_info "Amount: $AMOUNT"
|
||||
|
||||
DRY_RUN="${DRY_RUN:-0}"
|
||||
run() { if [ "$DRY_RUN" = "1" ]; then echo "[DRY RUN] $*"; else "$@"; fi }
|
||||
trim_word() { echo "$1" | awk '{print $1}'; }
|
||||
|
||||
calculate_fee_or_die() {
|
||||
local out
|
||||
if ! out="$(cast call "$BRIDGE_ADDR" "calculateFee(uint64,uint256)(uint256)" "$SELECTOR" "$AMOUNT" --rpc-url "$RPC_URL" 2>&1)"; then
|
||||
log_error "Fee quote failed on source bridge $BRIDGE_ADDR for selector $SELECTOR."
|
||||
log_error "This source bridge/router path is currently blocked until the quote/send path is repaired."
|
||||
log_error "$(echo "$out" | tail -n 1)"
|
||||
exit 1
|
||||
fi
|
||||
trim_word "$out"
|
||||
}
|
||||
|
||||
log_subsection "Preflighting source fee quote"
|
||||
FEE_QUOTE="$(calculate_fee_or_die)"
|
||||
log_info "Quoted fee: $FEE_QUOTE"
|
||||
|
||||
# Approve LINK fee to router via bridge (bridge approves downstream internally; here user approves bridge to pull fee)
|
||||
log_subsection "Approving LINK fee allowance to bridge"
|
||||
|
||||
Reference in New Issue
Block a user