-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replace system contract with uniswap router
- Loading branch information
Showing
14 changed files
with
46 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2780,10 +2780,10 @@ | |
resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-9.0.0.tgz#c20ad5da43f6f3676f31556b303d1cb4ea17357e" | ||
integrity sha512-L4A8bddlyhjaBAsIv/x1Bvxc38RJz8U8rbbBtxK5oVyOAd5Zz04ZiT3HqzO4FuKq6RGGM1uiA8jvUfmRkKchXw== | ||
|
||
"@zetachain/[email protected]rc7": | ||
version "13.0.0-rc7" | ||
resolved "https://registry.yarnpkg.com/@zetachain/toolkit/-/toolkit-13.0.0-rc7.tgz#d8710dfeed6c84d7d5808de253887da3e67bf050" | ||
integrity sha512-rh9q66iipRF3XJ4jlkawYqc10eA2mYgIS2rl1PiWvcqi39R1PgUzperKVwwoVmRuJi0FxE5fetP4SmqzfkfBXw== | ||
"@zetachain/[email protected]rc8": | ||
version "13.0.0-rc8" | ||
resolved "https://registry.yarnpkg.com/@zetachain/toolkit/-/toolkit-13.0.0-rc8.tgz#1f8b975428f6f1b7bdef4ccc0a1312de81f90e7d" | ||
integrity sha512-lXAyyMpgN/dsGIUTR/hi5M+6/tsnzONLAaisAnJzsrEUB4nYkoZtQCR4lwP4oWhNl4i3SK5k+bFjAfBo1DU3iw== | ||
dependencies: | ||
"@coral-xyz/anchor" "^0.30.1" | ||
"@inquirer/prompts" "^2.1.1" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ import "@zetachain/protocol-contracts/contracts/zevm/interfaces/IGatewayZEVM.sol | |
import {GatewayZEVM} from "@zetachain/protocol-contracts/contracts/zevm/GatewayZEVM.sol"; | ||
|
||
contract Swap is UniversalContract { | ||
SystemContract public systemContract; | ||
address public immutable uniswapRouter; | ||
GatewayZEVM public gateway; | ||
uint256 constant BITCOIN = 18332; | ||
|
||
|
@@ -21,8 +21,8 @@ contract Swap is UniversalContract { | |
_; | ||
} | ||
|
||
constructor(address systemContractAddress, address payable gatewayAddress) { | ||
systemContract = SystemContract(systemContractAddress); | ||
constructor(address payable gatewayAddress, address uniswapRouterAddress) { | ||
Check notice Code scanning / Slither Missing zero address validation Low
Swap.constructor(address,address).uniswapRouterAddress lacks a zero-check on :
- uniswapRouter = uniswapRouterAddress |
||
uniswapRouter = uniswapRouterAddress; | ||
gateway = GatewayZEVM(gatewayAddress); | ||
} | ||
|
||
|
@@ -74,7 +74,7 @@ contract Swap is UniversalContract { | |
swapAmount = amount - gasFee; | ||
} else { | ||
inputForGas = SwapHelperLib.swapTokensForExactTokens( | ||
systemContract, | ||
uniswapRouter, | ||
inputToken, | ||
gasFee, | ||
gasZRC20, | ||
|
@@ -84,7 +84,7 @@ contract Swap is UniversalContract { | |
} | ||
|
||
uint256 outputAmount = SwapHelperLib.swapExactTokensForTokens( | ||
systemContract, | ||
uniswapRouter, | ||
inputToken, | ||
swapAmount, | ||
targetToken, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ import "@zetachain/protocol-contracts/contracts/zevm/interfaces/IWZETA.sol"; | |
import {GatewayZEVM} from "@zetachain/protocol-contracts/contracts/zevm/GatewayZEVM.sol"; | ||
|
||
contract SwapToAnyToken is UniversalContract { | ||
SystemContract public systemContract; | ||
address public immutable uniswapRouter; | ||
GatewayZEVM public gateway; | ||
uint256 constant BITCOIN = 18332; | ||
|
||
|
@@ -22,8 +22,8 @@ contract SwapToAnyToken is UniversalContract { | |
_; | ||
} | ||
|
||
constructor(address systemContractAddress, address payable gatewayAddress) { | ||
systemContract = SystemContract(systemContractAddress); | ||
constructor(address payable gatewayAddress, address uniswapRouterAddress) { | ||
Check notice Code scanning / Slither Missing zero address validation Low
SwapToAnyToken.constructor(address,address).uniswapRouterAddress lacks a zero-check on :
- uniswapRouter = uniswapRouterAddress |
||
uniswapRouter = uniswapRouterAddress; | ||
gateway = GatewayZEVM(gatewayAddress); | ||
} | ||
|
||
|
@@ -92,7 +92,7 @@ contract SwapToAnyToken is UniversalContract { | |
swapAmount = amount - gasFee; | ||
} else { | ||
inputForGas = SwapHelperLib.swapTokensForExactTokens( | ||
systemContract, | ||
uniswapRouter, | ||
inputToken, | ||
gasFee, | ||
gasZRC20, | ||
|
@@ -103,7 +103,7 @@ contract SwapToAnyToken is UniversalContract { | |
} | ||
|
||
uint256 outputAmount = SwapHelperLib.swapExactTokensForTokens( | ||
systemContract, | ||
uniswapRouter, | ||
inputToken, | ||
swapAmount, | ||
targetToken, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2513,25 +2513,15 @@ | |
"@zetachain/networks" "^10.0.0" | ||
ethers "5.6.8" | ||
|
||
"@zetachain/[email protected]": | ||
version "10.0.0-rc11" | ||
resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-10.0.0-rc11.tgz#53f55ead492f7b5802b1feae4e51abc75730af33" | ||
integrity sha512-qWazjqnIGRngf4OmyeSIv7sHICQRdMQ1CKPIQIqxA8qFR+gHhDHSfvMdRAvgWbsfkimXOIFiHVIATypyWhviJw== | ||
dependencies: | ||
"@openzeppelin/contracts" "^5.0.2" | ||
"@openzeppelin/contracts-upgradeable" "^5.0.2" | ||
"@zetachain/networks" "^10.0.0" | ||
ethers "^6.13.1" | ||
|
||
"@zetachain/[email protected]": | ||
version "9.0.0" | ||
resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-9.0.0.tgz#c20ad5da43f6f3676f31556b303d1cb4ea17357e" | ||
integrity sha512-L4A8bddlyhjaBAsIv/x1Bvxc38RJz8U8rbbBtxK5oVyOAd5Zz04ZiT3HqzO4FuKq6RGGM1uiA8jvUfmRkKchXw== | ||
|
||
"@zetachain/[email protected]rc7": | ||
version "13.0.0-rc7" | ||
resolved "https://registry.yarnpkg.com/@zetachain/toolkit/-/toolkit-13.0.0-rc7.tgz#d8710dfeed6c84d7d5808de253887da3e67bf050" | ||
integrity sha512-rh9q66iipRF3XJ4jlkawYqc10eA2mYgIS2rl1PiWvcqi39R1PgUzperKVwwoVmRuJi0FxE5fetP4SmqzfkfBXw== | ||
"@zetachain/[email protected]rc8": | ||
version "13.0.0-rc8" | ||
resolved "https://registry.yarnpkg.com/@zetachain/toolkit/-/toolkit-13.0.0-rc8.tgz#1f8b975428f6f1b7bdef4ccc0a1312de81f90e7d" | ||
integrity sha512-lXAyyMpgN/dsGIUTR/hi5M+6/tsnzONLAaisAnJzsrEUB4nYkoZtQCR4lwP4oWhNl4i3SK5k+bFjAfBo1DU3iw== | ||
dependencies: | ||
"@coral-xyz/anchor" "^0.30.1" | ||
"@inquirer/prompts" "^2.1.1" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2758,7 +2758,7 @@ | |
hardhat "^2.22.8" | ||
wait-on "^7.2.0" | ||
|
||
"@zetachain/networks@^10.0.0": | ||
"@zetachain/networks@10.0.0", "@zetachain/networks@^10.0.0": | ||
version "10.0.0" | ||
resolved "https://registry.yarnpkg.com/@zetachain/networks/-/networks-10.0.0.tgz#dd5d14a0870f6b658644aded8c96859f15531089" | ||
integrity sha512-FPolaO19oVkSLSPDUA/Hu+8AhG3lDEslRDpLnMzbMbnNSC669Fkah0/TEf+6egrQbAifBRfFLzwWidAGs8oxtA== | ||
|
@@ -2780,10 +2780,10 @@ | |
resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-9.0.0.tgz#c20ad5da43f6f3676f31556b303d1cb4ea17357e" | ||
integrity sha512-L4A8bddlyhjaBAsIv/x1Bvxc38RJz8U8rbbBtxK5oVyOAd5Zz04ZiT3HqzO4FuKq6RGGM1uiA8jvUfmRkKchXw== | ||
|
||
"@zetachain/[email protected]rc4": | ||
version "13.0.0-rc4" | ||
resolved "https://registry.yarnpkg.com/@zetachain/toolkit/-/toolkit-13.0.0-rc4.tgz#e137fc16043f1416469f709c48808cfa301d9299" | ||
integrity sha512-4z4MKbQKjRIeNruUyDBjZDRO5oTLa1w/7wVn+PfMsXn++mFFGkiawkLcitnkH9dadBJiERzmo89MRJxsLQ3U6w== | ||
"@zetachain/[email protected]rc8": | ||
version "13.0.0-rc8" | ||
resolved "https://registry.yarnpkg.com/@zetachain/toolkit/-/toolkit-13.0.0-rc8.tgz#1f8b975428f6f1b7bdef4ccc0a1312de81f90e7d" | ||
integrity sha512-lXAyyMpgN/dsGIUTR/hi5M+6/tsnzONLAaisAnJzsrEUB4nYkoZtQCR4lwP4oWhNl4i3SK5k+bFjAfBo1DU3iw== | ||
dependencies: | ||
"@coral-xyz/anchor" "^0.30.1" | ||
"@inquirer/prompts" "^2.1.1" | ||
|
@@ -2794,12 +2794,13 @@ | |
"@solana/web3.js" "^1.95.3" | ||
"@uniswap/v2-periphery" "^1.1.0-beta.0" | ||
"@zetachain/faucet-cli" "^4.1.1" | ||
"@zetachain/networks" "^10.0.0" | ||
"@zetachain/networks" "10.0.0" | ||
"@zetachain/protocol-contracts" "9.0.0" | ||
axios "^1.4.0" | ||
bech32 "^2.0.0" | ||
bip39 "^3.1.0" | ||
bitcoinjs-lib "^6.1.3" | ||
bs58 "^6.0.0" | ||
dotenv "16.0.3" | ||
ecpair "^2.1.0" | ||
envfile "^6.18.0" | ||
|