From 85e6474f05e7c520bd2bfbc8650bd247dd35862a Mon Sep 17 00:00:00 2001 From: buck54321 Date: Thu, 7 Sep 2023 09:49:16 -0700 Subject: [PATCH] add wbtc and weth tokens to polygon --- client/asset/eth/eth.go | 10 +- client/asset/polygon/polygon.go | 4 + .../webserver/site/src/html/bodybuilder.tmpl | 2 +- client/webserver/site/src/img/coins/wbtc.png | Bin 0 -> 7543 bytes client/webserver/site/src/img/coins/wbtc.svg | 1 + client/webserver/site/src/img/coins/weth.png | Bin 0 -> 6302 bytes client/webserver/site/src/img/coins/weth.svg | 1 + client/webserver/site/src/js/doc.ts | 4 +- dex/bip-id.go | 2 + dex/networks/polygon/params.go | 101 ++++++++++++++++++ server/asset/polygon/polygon.go | 4 + 11 files changed, 125 insertions(+), 4 deletions(-) create mode 100644 client/webserver/site/src/img/coins/wbtc.png create mode 100644 client/webserver/site/src/img/coins/wbtc.svg create mode 100644 client/webserver/site/src/img/coins/weth.png create mode 100644 client/webserver/site/src/img/coins/weth.svg diff --git a/client/asset/eth/eth.go b/client/asset/eth/eth.go index 6c74078569..7fbed41352 100644 --- a/client/asset/eth/eth.go +++ b/client/asset/eth/eth.go @@ -3737,6 +3737,8 @@ func (w *assetWallet) resubmitRedemption(tx *types.Transaction, contractVersion var replacementHash common.Hash copy(replacementHash[:], txs[0]) + w.log.Infof("Redemption transaction %s was broadcast to replace transaction %s (original tx: %s)", replacementHash, monitoredTx.tx.Hash(), tx.Hash()) + if monitoredTx != nil { err = w.recordReplacementTx(monitoredTx, replacementHash) if err != nil { @@ -4535,7 +4537,11 @@ func getFileCredentials(chain, path string, net dex.Network) (seed []byte, provi return nil, nil, fmt.Errorf("must provide both seeds in credentials file") } seed = p.Seed - providers = p.Providers[chain][net.String()] + for _, uri := range p.Providers[chain][net.String()] { + if !strings.HasPrefix(uri, "#") && !strings.HasPrefix(uri, ";") { + providers = append(providers, uri) + } + } if net == dex.Simnet && len(providers) == 0 { u, _ := user.Current() switch chain { @@ -5213,7 +5219,7 @@ func getGasEstimates(ctx context.Context, cl, acl ethFetcher, c contractor, ac t copy(randomAddr[:], encode.RandomBytes(20)) transferTx, err := tc.transfer(txOpts, randomAddr, big.NewInt(1)) if err != nil { - return fmt.Errorf("error estimating transfer gas: %w", err) + return fmt.Errorf("transfer error: %w", err) } if err = waitForConfirmation(ctx, cl, transferTx.Hash()); err != nil { return fmt.Errorf("error waiting for transfer tx: %w", err) diff --git a/client/asset/polygon/polygon.go b/client/asset/polygon/polygon.go index d3a7c9b246..7e584198bc 100644 --- a/client/asset/polygon/polygon.go +++ b/client/asset/polygon/polygon.go @@ -30,6 +30,8 @@ func init() { asset.Register(BipID, &Driver{}) registerToken(simnetTokenID, "A token wallet for the DEX test token. Used for testing DEX software.", dex.Simnet) registerToken(usdcTokenID, "The USDC Ethereum ERC20 token.", dex.Mainnet, dex.Testnet) + registerToken(wbtcTokenID, "Wrapped BTC.", dex.Mainnet) + registerToken(wethTokenID, "Wrapped ETH.", dex.Mainnet) } const ( @@ -43,6 +45,8 @@ const ( var ( simnetTokenID, _ = dex.BipSymbolID("dextt.polygon") usdcTokenID, _ = dex.BipSymbolID("usdc.polygon") + wethTokenID, _ = dex.BipSymbolID("weth.polygon") + wbtcTokenID, _ = dex.BipSymbolID("wbtc.polygon") // WalletInfo defines some general information about a Polygon Wallet(EVM // Compatible). diff --git a/client/webserver/site/src/html/bodybuilder.tmpl b/client/webserver/site/src/html/bodybuilder.tmpl index ea413e7cc6..4f1f6dca67 100644 --- a/client/webserver/site/src/html/bodybuilder.tmpl +++ b/client/webserver/site/src/html/bodybuilder.tmpl @@ -103,7 +103,7 @@ {{end}} {{define "bottom"}} - + {{end}} diff --git a/client/webserver/site/src/img/coins/wbtc.png b/client/webserver/site/src/img/coins/wbtc.png new file mode 100644 index 0000000000000000000000000000000000000000..e89565a9327d6090c6d277d82624733c507d4c66 GIT binary patch literal 7543 zcmV--9f;zIP)pF8FWQhbW?9;ba!ELWdL_~cP?peYja~^aAhuUa%Y?FJQ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mD_|ZxUJhAlQ#mUIl(h~b2I9s*CU#86&linqQZVF_|+%dI+KcJ2(C5j!g!($9hZPT?=_yg%&n&JIsG z(h&+#kU?y@A|nlYRw5Mnv&$=wRTEqfB&~HsS>T4xO@|)6!9g!}BW^e%WKtkjm-Nlf zE0q6H;j>ZduS^Id6bgCakS*@ZO8!uzakm}j&K?U3sSieC7l@Gy62e%u>dj1*;G;Og z04d$HyMI>5(zT!cPQ6FJg~h)S-Y>Eu7k`RMrf$DpEpL<5I;abMD*Tp zDApk+OZmzTcL@4fC(9aY@`&cnG23xy&>!Xdj%geCa5eQObY*`+OCS^Zs9Zu2!D+)t1_qLQ3R60Zw3T;puDvDwnXf~ zf&#Yge1F(vl-uzK0}$Y9JlPzsvx^%;ZT3tD14D-nHI21;aX4gGTHzTw9;*>j;p)6X zb7kU8s;8c+&OY_zv;Tnb&33ep=M0K`p|8j3^~)JlYgTMHI*P1-_77B^%+kzjK02o@ zSXg7do~c%U19Wzh%+sj+PBQmB;U3J@p9t@cohU{wQ=ynnPNr7)OOU`<-Lnp#UAbYT zsyu=l|2|Ir``kg%>-*zS<9=C5Po6z)mkmZ{DDteoL@(Me`~O+?bX79mM{a@qvuMG>$C(Rj&@yMcb&(cTkU*>i@&n~Y#)_Q?oi^?b3Rf!1t&8f4;^(nkz2R;tO zNuOnx@*hu)gvkr=NKC1Z%iZ;1b}>F38I;degL-<9Zd@t~WSn0!g5zrY5lK_2%moolhrg z00-Map9Lx~W@9koZR+Wf*%hTP9TWBB3==bFs&FRp5QbfKdkQ?MhC36-avV$?bb%yL zQc_}yPCWa3WAy7FbLjre>OJ5c;2lNY7f41)P}CSG(D?;nLKwPX^wPBbSLjNHKJR``1CMWZ;DN~BVX=@x{92Np`vHE{s z8g5KrHo`2>^GI=ub046<%fK@TtGyOkeJ}> \ No newline at end of file diff --git a/client/webserver/site/src/img/coins/weth.png b/client/webserver/site/src/img/coins/weth.png new file mode 100644 index 0000000000000000000000000000000000000000..1824b081237839c6a559b7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IWkU$CobEk|`MB)c`Pv!04};$rAZflcOdP1iI^p=uSzs_QI$8D2u(AOa=YE0(0xnDQ^2{NT0xl!iSsS|c&ZgJ47GuEh zcW83PQjHdD>%M~mSB{UD;$eO~tQryTXLCgi8ZiCAj>`&6(>r}F20%X$ zL@IsDO3=itU(UjiGgq*SWkas7Pkr%2&0$@;wG-=w|8Uue2l2Te003eB>uP8W^I!iG z0<}i$^g06q00hogofKDT&tIr)NwFjQ%v&EMeMP?z1OOmXyx|9IN4uX}2emW?r&i)H z!pPa`cb(DFxb=stp#b<9Uk348={JG^0CWVZUv4uZymmJ_=FNUE# zdj8vAqwrQeIJEwNov1oFU(qVRSgjkvBBq+bgH01zQu{}aae zi-md6NMq=+;sc{Qza_R+Z&B|2xi$_6H0Rc$>HbK+7X$!+N5gA+BN*P^iF2GF0RRXWZ)l>CefE1_(~)W|+`LkV0q`wkK$S002S-A6+9b%w4k^$Evl^00?2gfD10DPgbdn zadsOyV<5$i?)an($P)-Dd9~J(K^;5;G6FDdwh{J|rRpIV!();D>&t!ZpQ{YW5z@uE z@dfV~&7f>GqLDQ!<3t+MZ%f4+j{Dj#cNoxuWEU0DOqOL105l+gJ?D;0TIXw@+@;_A zJDIBlb2hg&q1-IL_>RVGk@w%L>um;M1& literal 0 HcmV?d00001 diff --git a/client/webserver/site/src/img/coins/weth.svg b/client/webserver/site/src/img/coins/weth.svg new file mode 100644 index 0000000000..2f2b3c084d --- /dev/null +++ b/client/webserver/site/src/img/coins/weth.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/webserver/site/src/js/doc.ts b/client/webserver/site/src/js/doc.ts index 9dbcb37006..c83f3b3102 100644 --- a/client/webserver/site/src/js/doc.ts +++ b/client/webserver/site/src/js/doc.ts @@ -29,7 +29,9 @@ const BipIDs: Record = { 60000: 'dextt.eth', 60001: 'usdc.eth', 966000: 'dextt.polygon', - 966001: 'usdc.polygon' + 966001: 'usdc.polygon', + 966002: 'weth.polygon', + 966003: 'wbtc.polygon' } const BipSymbols = Object.values(BipIDs) diff --git a/dex/bip-id.go b/dex/bip-id.go index de8cb2e83e..e4e411406d 100644 --- a/dex/bip-id.go +++ b/dex/bip-id.go @@ -617,6 +617,8 @@ var bipIDs = map[uint32]string{ // Polygon reserved token range 966000-966999 966000: "dextt.polygon", 966001: "usdc.polygon", + 966002: "weth.polygon", + 966003: "wbtc.polygon", // END Polygon reserved token range 1171337: "ilt", 1313114: "etho", diff --git a/dex/networks/polygon/params.go b/dex/networks/polygon/params.go index 714968bc50..82ad4251db 100644 --- a/dex/networks/polygon/params.go +++ b/dex/networks/polygon/params.go @@ -52,6 +52,8 @@ var ( testTokenID, _ = dex.BipSymbolID("dextt.polygon") usdcTokenID, _ = dex.BipSymbolID("usdc.polygon") + wethTokenID, _ = dex.BipSymbolID("weth.polygon") + wbtcTokenID, _ = dex.BipSymbolID("wbtc.polygon") Tokens = map[uint32]*dexeth.Token{ testTokenID: { @@ -179,6 +181,105 @@ var ( }, }, }, + wethTokenID: TokenWETH, + wbtcTokenID: TokenWBTC, + } + + // Wrapped ETH + TokenWETH = &dexeth.Token{ + Token: &dex.Token{ + ParentID: PolygonBipID, + Name: "WETH", + UnitInfo: dex.UnitInfo{ + AtomicUnit: "gwei", + Conventional: dex.Denomination{ + Unit: "WETH", + ConversionFactor: 1e9, + }, + }, + }, + NetTokens: map[dex.Network]*dexeth.NetToken{ + dex.Mainnet: { + Address: common.HexToAddress("0x7ceb23fd6bc0add59e62ac25578270cff1b9f619"), // https://polygonscan.com/token/0x7ceb23fd6bc0add59e62ac25578270cff1b9f619 + SwapContracts: map[uint32]*dexeth.SwapContract{ + 0: { + // deploy tx: https://polygonscan.com/tx/0xc569774add0a9f41eace3ff6289eafd4c17fbcaafcf8b7758e0a5c4d74dcf307 + // swap contract: https://polygonscan.com/address/0x878dF60d47Afa9C665dFaDCB6BF4e303C080032f + Address: common.HexToAddress("0x878dF60d47Afa9C665dFaDCB6BF4e303C080032f"), + Gas: dexeth.Gases{ + // First swap used 158846 gas Recommended Gases.Swap = 206499 + // 4 additional swaps averaged 112618 gas each. Recommended Gases.SwapAdd = 146403 + // [158846 271461 384064 496691 609318] + Swap: 206_499, + SwapAdd: 146_403, + // First redeem used 70222 gas. Recommended Gases.Redeem = 91288 + // 4 additional redeems averaged 31629 gas each. recommended Gases.RedeemAdd = 41117 + // [70222 101851 133468 165110 196739] + Redeem: 91_288, + RedeemAdd: 41_117, + // Average of 5 refunds: 50354. Recommended Gases.Refund = 65460 + // [50350 50362 50338 50362 50362] + Refund: 65_460, + // Average of 2 approvals: 36762. Recommended Gases.Approve = 47790 + // [46712 26812] + Approve: 47_790, + // Average of 1 transfers: 51910. Recommended Gases.Transfer = 67483 + // [51910] + Transfer: 67_483, + }, + }, + }, + }, + }, + } + + // Wrapped BTC + TokenWBTC = &dexeth.Token{ + EVMFactor: new(int64), + Token: &dex.Token{ + ParentID: PolygonBipID, + Name: "Wrapped Bitcoin", + UnitInfo: dex.UnitInfo{ + AtomicUnit: "Sats", + Conventional: dex.Denomination{ + Unit: "WBTC", + ConversionFactor: 1e8, + }, + }, + }, + NetTokens: map[dex.Network]*dexeth.NetToken{ + dex.Mainnet: { + Address: common.HexToAddress("0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6"), // https://polygonscan.com/token/0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6 + SwapContracts: map[uint32]*dexeth.SwapContract{ + 0: { + // deploy tx: https://polygonscan.com/tx/0xcd84a1fa2f890d5fc1fcb0dde6c5a3bb50d9b25927ec5666b96b5ad3d6902b0a + // swap contract: https://polygonscan.com/address/0x625B7Ecd21B25b0808c4221dA281CD3A82f8b797 + Address: common.HexToAddress("0x625B7Ecd21B25b0808c4221dA281CD3A82f8b797"), + Gas: dexeth.Gases{ + // First swap used 181278 gas Recommended Gases.Swap = 235661 + // 4 additional swaps averaged 112591 gas each. Recommended Gases.SwapAdd = 146368 + // [181278 293857 406460 519039 631642] + Swap: 235_661, + SwapAdd: 146_368, + // First redeem used 70794 gas. Recommended Gases.Redeem = 92032 + // 4 additional redeems averaged 31629 gas each. recommended Gases.RedeemAdd = 41117 + // [70794 102399 134052 165646 197311] + Redeem: 92_032, + RedeemAdd: 41_117, + // Average of 5 refunds: 63126. Recommended Gases.Refund = 82063 + // [63126 63126 63126 63126 63126] + Refund: 82_063, + // Average of 2 approvals: 52072. Recommended Gases.Approve = 67693 + // [52072 52072] + Approve: 67_693, + // Average of 1 transfers: 57270. Recommended Gases.Transfer = 74451 + // [57270] + Transfer: 74_451, + }, + }, + }, + }, + }, } ) diff --git a/server/asset/polygon/polygon.go b/server/asset/polygon/polygon.go index 183ba79271..46cf78f298 100644 --- a/server/asset/polygon/polygon.go +++ b/server/asset/polygon/polygon.go @@ -43,6 +43,8 @@ func init() { registerToken(testTokenID, 0) registerToken(usdcID, 0) + registerToken(wethTokenID, 0) + registerToken(wbtcTokenID, 0) if blockPollIntervalStr != "" { blockPollInterval, _ = time.ParseDuration(blockPollIntervalStr) @@ -61,6 +63,8 @@ const ( var ( testTokenID, _ = dex.BipSymbolID("dextt.polygon") usdcID, _ = dex.BipSymbolID("usdc.polygon") + wethTokenID, _ = dex.BipSymbolID("weth.polygon") + wbtcTokenID, _ = dex.BipSymbolID("wbtc.polygon") // blockPollInterval is the delay between calls to bestBlockHash to check // for new blocks. Modify at compile time via blockPollIntervalStr: