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:
Brian Li 2021-04-11 18:33:03 -07:00
parent 29ea4f8f08
commit b19b1fe600
15 changed files with 13926 additions and 8662 deletions

View file

@ -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;
}
}