tornado-core/contracts/cTornado.sol

40 lines
1.6 KiB
Solidity
Raw Normal View History

2021-03-10 10:27:15 +01:00
// https://tornado.cash
/*
* d888888P dP a88888b. dP
* 88 88 d8' `88 88
* 88 .d8888b. 88d888b. 88d888b. .d8888b. .d888b88 .d8888b. 88 .d8888b. .d8888b. 88d888b.
* 88 88' `88 88' `88 88' `88 88' `88 88' `88 88' `88 88 88' `88 Y8ooooo. 88' `88
* 88 88. .88 88 88 88 88. .88 88. .88 88. .88 dP Y8. .88 88. .88 88 88 88
* dP `88888P' dP dP dP `88888P8 `88888P8 `88888P' 88 Y88888P' `88888P8 `88888P' dP dP
* ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
*/
// SPDX-License-Identifier: MIT
2021-03-11 21:05:59 +01:00
pragma solidity ^0.7.0;
2021-03-10 10:27:15 +01:00
2021-03-10 17:28:44 +01:00
import "./ERC20Tornado.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
2021-03-10 10:27:15 +01:00
2021-03-11 20:56:02 +01:00
contract cTornado is ERC20Tornado {
2021-03-10 10:27:15 +01:00
address public immutable governance = 0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce;
2021-03-10 17:28:44 +01:00
IERC20 public immutable comp;
2021-03-10 10:27:15 +01:00
2021-03-10 17:28:44 +01:00
constructor(
IERC20 _comp,
IVerifier _verifier,
IHasher _hasher,
uint256 _denomination,
uint32 _merkleTreeHeight,
IERC20 _token
2021-03-11 21:05:59 +01:00
) ERC20Tornado(_verifier, _hasher, _denomination, _merkleTreeHeight, _token) {
2021-03-11 20:56:02 +01:00
require(address(_comp) != address(0), "Invalid COMP token address");
2021-03-10 17:28:44 +01:00
comp = _comp;
2021-03-10 10:27:15 +01:00
}
2021-03-10 17:28:44 +01:00
/// @dev Moves earned yield of the COMP token to the tornado governance contract
2021-03-11 20:56:02 +01:00
/// To make it work you might need to call `comptroller.claimComp(cPoolAddress)` first
2021-03-10 17:28:44 +01:00
function claimComp() external {
comp.transfer(governance, comp.balanceOf(address(this)));
2021-03-10 10:27:15 +01:00
}
}