mirror of
https://github.com/tornadocash/tornado-core.git
synced 2025-05-10 18:25:15 -04:00
Update feeToSetter
- Don't modify the interface to processWithdraw - Add SafeMath and use it - Add tests for all the FeeManager methods - Update existing unit test for feeToSetter
This commit is contained in:
parent
29ea4f8f08
commit
b19b1fe600
15 changed files with 13926 additions and 8662 deletions
|
@ -1,11 +1,16 @@
|
|||
pragma solidity 0.5.17;
|
||||
|
||||
contract FeeManager {
|
||||
// Maximum fee of 0.5%
|
||||
uint256 public MIN_PROTOCOL_FEE_DIVISOR = 200;
|
||||
|
||||
address public feeTo;
|
||||
address public feeToSetter;
|
||||
uint256 public protocolFeeDivisor;
|
||||
|
||||
constructor(address _feeToSetter) public {
|
||||
feeToSetter = _feeToSetter;
|
||||
protocolFeeDivisor = 0;
|
||||
}
|
||||
|
||||
function setFeeTo(address _feeTo) external {
|
||||
|
@ -17,4 +22,15 @@ contract FeeManager {
|
|||
require(msg.sender == feeToSetter, 'Poof: FORBIDDEN');
|
||||
feeToSetter = _feeToSetter;
|
||||
}
|
||||
|
||||
function setProtocolFeeDivisor(uint256 _protocolFeeDivisor) external {
|
||||
require(msg.sender == feeToSetter, 'Poof: FORBIDDEN');
|
||||
require(_protocolFeeDivisor >= MIN_PROTOCOL_FEE_DIVISOR, 'Poof: Protocol fee too high');
|
||||
protocolFeeDivisor = _protocolFeeDivisor;
|
||||
}
|
||||
|
||||
function clearFee() external {
|
||||
require(msg.sender == feeToSetter, 'Poof: FORBIDDEN');
|
||||
protocolFeeDivisor = 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue