Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions contracts/ThreesixtyRouter02.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import "./interfaces/IBacker.sol";
import "./Recorder.sol";
import "./Vault.sol";

import "hardhat/console.sol";

contract ThreesixtyRouter02 is IThreesixtyRouter02 {
using SafeMath for uint256;

Expand Down Expand Up @@ -270,6 +272,13 @@ contract ThreesixtyRouter02 is IThreesixtyRouter02 {
for (uint256 i = 0; i < order; i++) {
resultHash = keccak256(abi.encodePacked(resultHash,recorder.roundTxHashes(round, i)));
}

console.log("txHash");
console.logBytes32(recorder.roundTxHashes(round, order));

console.log("proofHash");
console.logBytes32(resultHash);

require(
recorder.roundTxHashes(round, order) != txHash || proofHash != resultHash || recorder.skippedTxHashes(txHash),
"360Router: No trace!!"
Expand Down
11 changes: 3 additions & 8 deletions contracts/libraries/UniswapV2Library.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pragma solidity >=0.5.0;

import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol';
import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol';

import "./SafeMath.sol";

Expand All @@ -23,14 +24,8 @@ library UniswapV2Library {
}

// calculates the CREATE2 address for a pair without making any external calls
function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address) {
(address token0, address token1) = sortTokens(tokenA, tokenB);
return(address(uint(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.encodePacked(token0, token1)),
hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash // for test - c541af18c02455d609a9046750ab3e7523fd21870e93cbc83f1494ed505e4d54
)))));
function pairFor(address factory, address tokenA, address tokenB) internal view returns (address pair) {
pair = IUniswapV2Factory(factory).getPair(tokenA,tokenB);
}

// fetches and sorts the reserves for a pair
Expand Down
8 changes: 8 additions & 0 deletions contracts/test/TestRouter.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pragma experimental ABIEncoderV2;
pragma solidity =0.6.6;

import '@uniswap/v2-periphery/contracts/UniswapV2Router02.sol';

contract TestRouter{
UniswapV2Router02 router;
}
15 changes: 12 additions & 3 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ const config: HardhatUserConfig = {
},
},
},
{
version: "0.6.6",
settings: {
optimizer: {
enabled: true,
runs: 1000,
},
},
},
{
version: "0.6.12",
settings: {
Expand All @@ -38,15 +47,15 @@ const config: HardhatUserConfig = {
runs: 1000,
},
},
}
},
],
overrides: {},
},
paths: {
sources: "./contracts",
tests: "./test",
cache: "./cache",
artifacts: "./artifacts"
artifacts: "./artifacts",
},
networks: {
mumbai: {
Expand All @@ -66,7 +75,7 @@ const config: HardhatUserConfig = {
process.env.PRIV_R3 as any,
],
gas: 10000000,
}
},
},
};

Expand Down
Loading