11package taskengine
22
3+ import "strings"
4+
35// Ethereum gas cost constants
46const (
57 // StandardGasCost represents the standard gas cost for a simple Ethereum transaction (21000 gas)
@@ -25,6 +27,94 @@ const (
2527 DefaultGasPriceHex = "0x1dcd6500"
2628)
2729
30+ // DefaultGasPriceByChain provides per-chain conservative simulation gas prices (wei).
31+ // Chosen to lean slightly high so simulated cogs don't undershoot real costs.
32+ // Real-time gas pricing is a separate follow-up.
33+ var DefaultGasPriceByChain = map [uint64 ]uint64 {
34+ 1 : 5_000_000_000 , // Ethereum Mainnet — 5 gwei
35+ 11155111 : 500_000_000 , // Ethereum Sepolia — 0.5 gwei
36+ 8453 : 50_000_000 , // Base — 0.05 gwei
37+ 84532 : 10_000_000 , // Base Sepolia — 0.01 gwei
38+ }
39+
40+ // GetDefaultGasPrice returns the per-chain default simulation gas price (wei),
41+ // falling back to DefaultGasPrice (0.5 gwei) for unknown chains.
42+ func GetDefaultGasPrice (chainID uint64 ) uint64 {
43+ if v , ok := DefaultGasPriceByChain [chainID ]; ok {
44+ return v
45+ }
46+ return DefaultGasPrice
47+ }
48+
49+ // StablecoinInfo carries the display symbol and ERC20 decimals for a stablecoin
50+ // hard-coded as $1.00. Decimals are required to format raw token amounts.
51+ type StablecoinInfo struct {
52+ Symbol string
53+ Decimals uint32
54+ }
55+
56+ // Stablecoins maps chain ID → lowercased contract address → StablecoinInfo
57+ // for fully-reserved or strongly-collateralized USD stablecoins. Lookups
58+ // treat each listed address as exactly $1.00 USD without a price-service
59+ // network hop — covers the bulk of real-world value-fee calculation cases.
60+ // Tokens not in this map fall through to PriceService.GetERC20PriceUSD; on
61+ // miss the renderer prints the "$?" placeholder.
62+ //
63+ // Inclusion criteria (high bar — incorrect ≈$1.00 assumptions miscompute fees):
64+ // - Fully reserved by audited issuer (Circle, Paxos, Tether, PayPal, Ripple,
65+ // First Digital, TrueUSD, Gemini), OR
66+ // - Overcollateralized by crypto with strong peg history (DAI, USDS, LUSD,
67+ // sDAI which redeems 1:1 against DAI).
68+ //
69+ // Algorithmic / synthetic / new-untested stablecoins (USDe, USDD, USD1, USDF,
70+ // FRAX) are deliberately excluded — they go through the price service like any
71+ // other ERC20 so a depeg event surfaces correctly.
72+ var Stablecoins = map [uint64 ]map [string ]StablecoinInfo {
73+ // Ethereum Mainnet
74+ 1 : {
75+ "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" : {"USDC" , 6 },
76+ "0xdac17f958d2ee523a2206206994597c13d831ec7" : {"USDT" , 6 },
77+ "0x6b175474e89094c44da98b954eedeac495271d0f" : {"DAI" , 18 },
78+ "0xdc035d45d973e3ec169d2276ddab16f1e407384f" : {"USDS" , 18 },
79+ "0x6c3ea9036406852006290770bedfcaba0e23a0e8" : {"PYUSD" , 6 },
80+ "0x83f20f44975d03b1b09e64809b757c47f942beea" : {"sDAI" , 18 },
81+ "0xc5f0f7b66764f6ec8c8dff7ba683102295e16409" : {"FDUSD" , 18 },
82+ "0x0000000000085d4780b73119b644ae5ecd22b376" : {"TUSD" , 18 },
83+ "0x056fd409e1d7a124bd7017459dfea2f387b6d5cd" : {"GUSD" , 2 },
84+ "0x5f98805a4e8be255a32880fdec7f6728c6568ba0" : {"LUSD" , 18 },
85+ "0x8292bb45bf1ee4d140127049757c2e0ff06317ed" : {"RLUSD" , 18 },
86+ "0xe343167631d89b6ffc58b88d6b7fb0228795491d" : {"USDG" , 6 },
87+ },
88+ // Base Mainnet
89+ 8453 : {
90+ "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913" : {"USDC" , 6 }, // Circle native
91+ "0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca" : {"USDC" , 6 }, // bridged (legacy)
92+ "0xfde4c96c8593536e31f229ea8f37b2ada2699bb2" : {"USDT" , 6 },
93+ "0x50c5725949a6f0c72e6c4a641f24049a917db0cb" : {"DAI" , 18 },
94+ },
95+ // Ethereum Sepolia (testnet)
96+ 11155111 : {
97+ "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238" : {"USDC" , 6 }, // Circle test deployment
98+ "0xaa8e23fb1079ea71e0a56f48a2aa51851d8433d0" : {"USDT" , 6 },
99+ },
100+ // Base Sepolia (testnet)
101+ 84532 : {
102+ "0x036cbd53842c5426634e7929541ec2318f3dcf7e" : {"USDC" , 6 }, // Circle test deployment
103+ },
104+ }
105+
106+ // LookupStablecoin returns symbol+decimals for a stablecoin contract, or
107+ // (StablecoinInfo{}, false) if the address isn't in the chain's hard-coded
108+ // $1.00 list. Address matching is case-insensitive.
109+ func LookupStablecoin (chainID uint64 , contractAddress string ) (StablecoinInfo , bool ) {
110+ chainMap , ok := Stablecoins [chainID ]
111+ if ! ok {
112+ return StablecoinInfo {}, false
113+ }
114+ info , ok := chainMap [strings .ToLower (contractAddress )]
115+ return info , ok
116+ }
117+
28118// Contract method constants
29119const (
30120 // UnknownMethodName represents a placeholder for contract method names that need to be resolved from ABI
0 commit comments