feat(ccip): cap LINK funding to deployer balance per chain; fix Arbitrum gas

- parse_link_tags: add --cap-to-deployer for fund-ccip-bridges-with-link.sh
- fund-ccip: min(target, balance//bridges) per chain; reuse one wei for both
  bridges under cap so post-transfer balance does not undershoot the second send
- Arbitrum: append legacy --gas-price from RPC (3x) with floor to clear base fee

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
defiQUG
2026-05-11 16:09:31 -07:00
parent 0561d26bcd
commit 01e0779a3d
2 changed files with 119 additions and 23 deletions

View File

@@ -171,8 +171,11 @@ parse_lockbox_tag() {
PARSE_LOCKBOX_REMAINING=("${args[@]}")
}
# Parse --link <amount> (ETH or wei if --link-wei), --dry-run. Sets LINK_AMOUNT_WEI, DRY_RUN.
# Parse --link <amount> (ETH or wei if --link-wei), --dry-run, --cap-to-deployer.
# Sets LINK_AMOUNT_WEI, DRY_RUN, CAP_LINK_TO_DEPLOYER_BALANCE (0/1).
# Default LINK_AMOUNT_WEI 10e18 (10 LINK) when unset. Unconsumed in PARSE_LINK_TAGS_REMAINING.
# --cap-to-deployer: callers (e.g. fund-ccip-bridges-with-link.sh) cap each bridge transfer to
# min(LINK_AMOUNT_WEI, deployer_LINK_balance // bridges_on_that_chain).
link_to_wei() {
local val="${1:-0}"
if [[ -z "$val" || "$val" == "0" ]]; then echo "0"; return; fi
@@ -189,6 +192,7 @@ link_to_wei() {
parse_link_tags() {
export LINK_AMOUNT_WEI="${LINK_AMOUNT_WEI:-10000000000000000000}"
export DRY_RUN="${DRY_RUN:-0}"
export CAP_LINK_TO_DEPLOYER_BALANCE="${CAP_LINK_TO_DEPLOYER_BALANCE:-0}"
local args=()
local i=0
local argv=("$@")
@@ -201,6 +205,7 @@ parse_link_tags() {
--link-wei)
[[ $((i+1)) -lt ${#argv[@]} ]] && LINK_AMOUNT_WEI="${argv[$((i+1))]}"
i=$((i+2)); ;;
--cap-to-deployer) CAP_LINK_TO_DEPLOYER_BALANCE=1; i=$((i+1)); ;;
--dry-run) DRY_RUN=1; i=$((i+1)); ;;
*) args+=("$a"); i=$((i+1)); ;;
esac