97 lines
2.7 KiB
Diff
97 lines
2.7 KiB
Diff
|
10a11
|
||
|
> import { ENSNamehash } from "./utils/ENSNamehash.sol";
|
||
|
12c13,14
|
||
|
< import { TornadoStakingRewards } from "./TornadoStakingRewards.sol";
|
||
|
---
|
||
|
> import { TornadoStakingRewards } from "./staking/TornadoStakingRewards.sol";
|
||
|
> import { IENS } from "./interfaces/IENS.sol";
|
||
|
14,77c16,17
|
||
|
< interface ITornadoInstance {
|
||
|
< function token() external view returns (address);
|
||
|
<
|
||
|
< function denomination() external view returns (uint256);
|
||
|
<
|
||
|
< function deposit(bytes32 commitment) external payable;
|
||
|
<
|
||
|
< function withdraw(
|
||
|
< bytes calldata proof,
|
||
|
< bytes32 root,
|
||
|
< bytes32 nullifierHash,
|
||
|
< address payable recipient,
|
||
|
< address payable relayer,
|
||
|
< uint256 fee,
|
||
|
< uint256 refund
|
||
|
< ) external payable;
|
||
|
< }
|
||
|
<
|
||
|
< interface IENS {
|
||
|
< function owner(bytes32 node) external view returns (address);
|
||
|
< }
|
||
|
<
|
||
|
< /*
|
||
|
< * @dev Solidity implementation of the ENS namehash algorithm.
|
||
|
< *
|
||
|
< * Warning! Does not normalize or validate names before hashing.
|
||
|
< * Original version can be found here https://github.com/JonahGroendal/ens-namehash/
|
||
|
< */
|
||
|
< library ENSNamehash {
|
||
|
< function namehash(bytes memory domain) internal pure returns (bytes32) {
|
||
|
< return namehash(domain, 0);
|
||
|
< }
|
||
|
<
|
||
|
< function namehash(bytes memory domain, uint256 i) internal pure returns (bytes32) {
|
||
|
< if (domain.length <= i) return 0x0000000000000000000000000000000000000000000000000000000000000000;
|
||
|
<
|
||
|
< uint256 len = labelLength(domain, i);
|
||
|
<
|
||
|
< return keccak256(abi.encodePacked(namehash(domain, i + len + 1), keccak(domain, i, len)));
|
||
|
< }
|
||
|
<
|
||
|
< function labelLength(bytes memory domain, uint256 i) private pure returns (uint256) {
|
||
|
< uint256 len;
|
||
|
< while (i + len != domain.length && domain[i + len] != 0x2e) {
|
||
|
< len++;
|
||
|
< }
|
||
|
< return len;
|
||
|
< }
|
||
|
<
|
||
|
< function keccak(
|
||
|
< bytes memory data,
|
||
|
< uint256 offset,
|
||
|
< uint256 len
|
||
|
< ) private pure returns (bytes32 ret) {
|
||
|
< require(offset + len <= data.length);
|
||
|
< assembly {
|
||
|
< ret := keccak256(add(add(data, 32), offset), len)
|
||
|
< }
|
||
|
< }
|
||
|
< }
|
||
|
<
|
||
|
< interface IFeeManager {
|
||
|
< function instanceFeeWithUpdate(ITornadoInstance _instance) external returns (uint160);
|
||
|
< }
|
||
|
---
|
||
|
> import "./tornado-proxy/TornadoRouter.sol";
|
||
|
> import "./tornado-proxy/FeeManager.sol";
|
||
|
106c46
|
||
|
< IFeeManager public immutable feeManager;
|
||
|
---
|
||
|
> FeeManager public immutable feeManager;
|
||
|
142,143c82,83
|
||
|
< address _staking,
|
||
|
< address _feeManager
|
||
|
---
|
||
|
> bytes32 _staking,
|
||
|
> bytes32 _feeManager
|
||
|
148,149c88,89
|
||
|
< staking = TornadoStakingRewards(_staking);
|
||
|
< feeManager = IFeeManager(_feeManager);
|
||
|
---
|
||
|
> staking = TornadoStakingRewards(resolve(_staking));
|
||
|
> feeManager = FeeManager(resolve(_feeManager));
|
||
|
384c324
|
||
|
< }
|
||
|
---
|
||
|
> }
|
||
|
\ No newline at end of file
|