tornado-governance/diffs/RelayerRegistry.diff
AlienTornadosaurusHex 75cf27d7d4 scope require comment, natspec, update diffs (no change)
Signed-off-by: AlienTornadosaurusHex <>
2023-05-23 21:41:03 +00:00

92 lines
2.6 KiB
Diff

11d10
< import { ENSNamehash } from "./utils/ENSNamehash.sol";
13,14c12
< import { TornadoStakingRewards } from "./staking/TornadoStakingRewards.sol";
< import { IENS } from "./interfaces/IENS.sol";
---
> import { TornadoStakingRewards } from "./TornadoStakingRewards.sol";
16,17c14,77
< import "./tornado-proxy/TornadoRouter.sol";
< import "./tornado-proxy/FeeManager.sol";
---
> 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);
> }
46c106
< FeeManager public immutable feeManager;
---
> IFeeManager public immutable feeManager;
82,83c142,143
< bytes32 _staking,
< bytes32 _feeManager
---
> address _staking,
> address _feeManager
88,89c148,149
< staking = TornadoStakingRewards(resolve(_staking));
< feeManager = FeeManager(resolve(_feeManager));
---
> staking = TornadoStakingRewards(_staking);
> feeManager = IFeeManager(_feeManager);