-
A novel Uniswap protocol that mitigates Sandwich Attacks in AMM
-
The scenario involves a user wishing to exchange tokens on Uniswap, using Token A to purchase Token B. We establish a defense mechanism by grouping flippers and stakers among nodes, creating distrust.
-
Hardhat
-
Fork from the ETH Mainnet
-
Instead of genuinely simulating N nodes locally, I emulate N wallet accounts using local variables.
-
Some communication details have been omitted, with a primary focus on the contract aspect, the overall system implementation and the performance of the entire system, specifically in terms of gas fees.
- Forking ETH Mainnet
- wBTC->DAI
- AmountIn = 100000000n; AmountOutMin = 26283178705806160790323n
- swap 100000000n wBTC to 26283178705806160790323n DAI
- Staker Number: 10
- Secret sharing threshold: 10
-
git clone the repository and please install yarn.
-
Run 'yarn install' in the command line.
-
Run 'yarn generate' in the command line.
- To generate 12 private keys which we will use later. The key will be outputted in the 'secret-keys.txt' file.
-
fill up .env file.
- SEPOLIA_RPC_URL: you can go to Alchemy to register a https format sepolia testnet api key.
- PRIVATE_KEY: PRIVATE_KEY is the private key for "user" in our design. You can use the private key we generated before.
- COINMARKETCAP_API_KEY: you can go to CoinMarketCap to get your coinmarketcap api key.
- ETHMAINNET_RPC_URL: you can go to Alchemy to register a https format eth-mainnet api key.
- PRIVATE_KEY_0-10: PRIVATE_KEY_0 is the private key for "flipper" in our design and PRIVATE_KEY1-10 are the private keys for "staker1-10" in our design. You can use the private key we generated before.
-
Run 'yarn deploy' in the command line.
-
Run 'yarn test' in the command line.