additive fees; burnSwapAmounts fix

This commit is contained in:
tim
2025-11-04 16:58:16 -04:00
parent 590acdd4dc
commit dc2e186331
10 changed files with 103 additions and 100 deletions

View File

@@ -117,20 +117,19 @@ if __name__ == "__main__":
if alerts:
log.warning("Some fee configuration may produce large values (bps): %s", alerts)
print("\nPair fees [per-asset fee -> total]:")
# Per-asset diagnostic: show per-asset fee (interpreted vs USDC)
for n, w in weights.items():
f_token = per_asset_fee(w)
print(f"{n:>12} {bps(f_token):>12}")
print()
for (name_a, w_a), (name_b, w_b) in combinations(weights.items(), 2):
f_eff_ab, f_i_ab, f_j_ab = fee_for_pair(w_a, w_b)
print(
f"{name_a}/{name_b}: per-asset_in={bps(f_i_ab)}, per-asset_out={bps(f_j_ab)}, total={bps(f_eff_ab)}"
f"{name_a+'-'+name_b:>12} {bps(f_eff_ab):>12}"
)
# Per-asset diagnostic: show per-asset fee (interpreted vs USDC)
print("\nPer-asset diagnostics (fees interpreted vs USDC):")
for n, w in weights.items():
f_token = per_asset_fee(w)
print(f"{n}: target_vs_USDC={w:.6f} bps, per_asset_fee={bps(f_token)}")
# -- Solidity (ABDK Q64.64) output --
# Print derived per-asset fees and cap as Solidity int128 Q64.64 constants that can be pasted
# into a Solidity file using ABDK's 64.64 fixed-point representation (int128 constants).