Skip to content

Commit 38aeaa9

Browse files
authored
[Protocol3] rename ProtocolFeeManager to ProtocolFeeVault (#250)
1 parent 6203fff commit 38aeaa9

14 files changed

+47
-47
lines changed

packages/loopring_v3/ABI/version30/ILoopringV3.abi

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

packages/loopring_v3/contracts/iface/ILoopringV3.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ contract ILoopringV3
6060
uint time
6161
);
6262

63-
event ProtocolFeeManagerUpdated(
64-
address payable pfm
63+
event ProtocolFeeVaultUpdated(
64+
address payable protocolFeeVault
6565
);
6666

6767
// == Public Variables ==
@@ -95,7 +95,7 @@ contract ILoopringV3
9595
uint public targetProtocolTakerFeeStake;
9696
uint public targetProtocolMakerFeeStake;
9797

98-
address payable public pfm;
98+
address payable public protocolFeeVault;
9999

100100
// == Public Functions ==
101101
/// @dev Update the global exchange settings.
@@ -137,8 +137,8 @@ contract ILoopringV3
137137
///
138138
/// Warning: this new address will be used by existing and
139139
/// new Loopring exchanges.
140-
function setProtocolFeeManager(
141-
address payable _pfm
140+
function setProtocolFeeVault(
141+
address payable _protocolFeeVault
142142
)
143143
external;
144144

packages/loopring_v3/contracts/iface/IProtocolFeeManager.sol renamed to packages/loopring_v3/contracts/iface/IProtocolFeeVault.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
pragma solidity 0.5.7;
1818

1919

20-
/// @title IProtocolFeeManager
20+
/// @title IProtocolFeeVault
2121
/// @dev This smart contract manages the distribution of protocol fees.
2222
/// Tokens other than LRC will be auctioned off for LRC using Oedax. The owner
2323
/// of this smart contract will also have the option to withdraw non-LRC tokens
@@ -26,7 +26,7 @@ pragma solidity 0.5.7;
2626
/// For LRC token, 70% of them can be withdrawn to the UserStakingPool contract
2727
/// to reward LRC stakers; 15% of them can be withdrawn to the Loopring DAO,
2828
/// and the remaining 15% can be burned to reduce LRC's total supply.
29-
contract IProtocolFeeManager
29+
contract IProtocolFeeVault
3030
{
3131
uint public constant REWARD_PERCENTAGE = 70;
3232
uint public constant DAO_PERDENTAGE = 20;

packages/loopring_v3/contracts/iface/IUserStakingPool.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ contract IUserStakingPool
2929
uint public constant AUCTION_DURATION = 7 days;
3030

3131
address public lrcAddress;
32-
address public pfmAddress; // ProtocolFeeManager address
32+
address public protocolFeeVaultAddress;
3333

3434
uint public numAddresses;
3535

3636
event LRCStaked (address user, uint amount);
3737
event LRCWithdrawn (address user, uint amount);
3838
event LRCRewarded (address user, uint amount);
3939

40-
/// @dev Set a new IProtocolFeeManager address, only callable by the owner.
41-
/// @param _pfmAddress The new IProtocolFeeManager address.
42-
function setProtocolFeeManager(address _pfmAddress)
40+
/// @dev Set a new IProtocolFeeVault address, only callable by the owner.
41+
/// @param _protocolFeeVaultAddress The new IProtocolFeeVault address.
42+
function setProtocolFeeVault(address _protocolFeeVaultAddress)
4343
external
4444
;
4545

packages/loopring_v3/contracts/impl/LoopringV3.sol

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ contract LoopringV3 is ILoopringV3, Claimable
3838

3939
// -- Constructor --
4040
constructor(
41-
address payable _pfm,
41+
address payable _protocolFeeVault,
4242
address _lrcAddress,
4343
address _wethAddress,
4444
address _blockVerifierAddress,
@@ -54,11 +54,11 @@ contract LoopringV3 is ILoopringV3, Claimable
5454
)
5555
public
5656
{
57-
require(address(0) != _pfm, "ZERO_ADDRESS");
57+
require(address(0) != _protocolFeeVault, "ZERO_ADDRESS");
5858
require(address(0) != _lrcAddress, "ZERO_ADDRESS");
5959
require(address(0) != _wethAddress, "ZERO_ADDRESS");
6060

61-
pfm = _pfm;
61+
protocolFeeVault = _protocolFeeVault;
6262
lrcAddress = _lrcAddress;
6363
wethAddress = _wethAddress;
6464

@@ -127,16 +127,16 @@ contract LoopringV3 is ILoopringV3, Claimable
127127
emit SettingsUpdated(now);
128128
}
129129

130-
function setProtocolFeeManager(
131-
address payable _pfm
130+
function setProtocolFeeVault(
131+
address payable _protocolFeeVault
132132
)
133133
external
134134
onlyOwner
135135
{
136-
require(_pfm != address(0), "ZERO_ADDRESS");
137-
pfm = _pfm;
136+
require(_protocolFeeVault != address(0), "ZERO_ADDRESS");
137+
protocolFeeVault = _protocolFeeVault;
138138

139-
emit ProtocolFeeManagerUpdated(pfm);
139+
emit ProtocolFeeVaultUpdated(protocolFeeVault);
140140
}
141141

142142
function createExchange(

packages/loopring_v3/contracts/impl/ProtocolFeeManager.sol renamed to packages/loopring_v3/contracts/impl/ProtocolFeeVault.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
pragma solidity 0.5.7;
1818

19-
import "../iface/IProtocolFeeManager.sol";
19+
import "../iface/IProtocolFeeVault.sol";
2020

2121
import "..//lib/Claimable.sol";
2222
import "../lib/BurnableERC20.sol";
@@ -68,7 +68,7 @@ contract IAuction {
6868

6969
/// @title An Implementation of IUserStakingPool.
7070
/// @author Daniel Wang - <[email protected]>
71-
contract ProtocolFeeManager is IProtocolFeeManager, Claimable
71+
contract ProtocolFeeVault is IProtocolFeeVault, Claimable
7272
{
7373
uint public constant MIN_ETHER_TO_KEEP = 1 ether;
7474
using ERC20SafeTransfer for address;

packages/loopring_v3/contracts/impl/UserStakingPool.sol

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
pragma solidity 0.5.7;
1818

1919
import "../iface/IUserStakingPool.sol";
20-
import "../iface/IProtocolFeeManager.sol";
20+
import "../iface/IProtocolFeeVault.sol";
2121

2222
import "..//lib/Claimable.sol";
2323
import "../lib/ERC20SafeTransfer.sol";
@@ -55,12 +55,12 @@ contract UserStakingPool is IUserStakingPool, Claimable
5555
lrcAddress = _lrcAddress;
5656
}
5757

58-
function setProtocolFeeManager(address _pfmAddress)
58+
function setProtocolFeeVault(address _protocolFeeVaultAddress)
5959
external
6060
onlyOwner
6161
{
62-
require(_pfmAddress != address(0), "ZERO_ADDRESS");
63-
pfmAddress = _pfmAddress;
62+
require(_protocolFeeVaultAddress != address(0), "ZERO_ADDRESS");
63+
protocolFeeVaultAddress = _protocolFeeVaultAddress;
6464
}
6565

6666
function getTotalStaking()
@@ -174,7 +174,7 @@ contract UserStakingPool is IUserStakingPool, Claimable
174174

175175
(totalPoints, userPoints, claimedAmount) = userOutstandingReward(msg.sender);
176176

177-
IProtocolFeeManager(pfmAddress).claim(claimedAmount);
177+
IProtocolFeeVault(protocolFeeVaultAddress).claim(claimedAmount);
178178

179179
total.stake = total.stake.add(claimedAmount);
180180
total.claimedReward = total.claimedReward.add(claimedAmount);
@@ -223,7 +223,7 @@ contract UserStakingPool is IUserStakingPool, Claimable
223223
userPoints = user.stake.mul(now.sub(user.claimedAt));
224224

225225
if (totalPoints != 0 && userPoints != 0) {
226-
(, , , , , , , outstandindReward) = IProtocolFeeManager(pfmAddress).getLRCFeeStats();
226+
(, , , , , , , outstandindReward) = IProtocolFeeVault(protocolFeeVaultAddress).getLRCFeeStats();
227227
outstandindReward = outstandindReward.mul(userPoints) / totalPoints;
228228
}
229229
}

packages/loopring_v3/contracts/impl/libexchange/ExchangeWithdrawals.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ library ExchangeWithdrawals
380380
requestedBlock.blockFeeWithdrawn = true;
381381

382382
// Burn part of the fee by sending it to the protocol fee manager
383-
S.loopring.pfm().transferETH(feeAmountToBurn, gasleft());
383+
S.loopring.protocolFeeVault().transferETH(feeAmountToBurn, gasleft());
384384
// Transfer the fee to the operator
385385
feeRecipient.transferETH(feeAmountToOperator, gasleft());
386386

@@ -472,7 +472,7 @@ library ExchangeWithdrawals
472472
// If we're withdrawing from the protocol fee account sent the tokens
473473
// directly to the protocol fee manager
474474
if (accountID == 0) {
475-
to = S.loopring.pfm();
475+
to = S.loopring.protocolFeeVault();
476476
}
477477

478478
address token = S.getTokenAddress(tokenID);

packages/loopring_v3/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"ganache-cli": "6.4.3",
5050
"mocha": "^5.2.0",
5151
"node": "^10.15.3",
52-
"npm": "^6.9.0",
52+
"npm": "^6.9.2",
5353
"npm-watch": "^0.6.0",
5454
"solidity-coverage": "^0.5.11",
5555
"solium": "^1.2.4",

packages/loopring_v3/test/testExchangeBlocks.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ contract("Exchange", (accounts: string[]) => {
3939
const withdrawBlockFeeChecked = async (blockIdx: number, operator: string, totalBlockFee: BN,
4040
expectedBlockFee: BN, allowedDelta: BN = new BN(0)) => {
4141
const token = "ETH";
42-
const pfm = await loopring.pfm();
42+
const protocolFeeVault = await loopring.protocolFeeVault();
4343
const balanceOperatorBefore = await exchangeTestUtil.getOnchainBalance(operator, token);
4444
const balanceContractBefore = await exchangeTestUtil.getOnchainBalance(exchange.address, token);
45-
const balanceBurnedBefore = await exchangeTestUtil.getOnchainBalance(pfm, token);
45+
const balanceBurnedBefore = await exchangeTestUtil.getOnchainBalance(protocolFeeVault, token);
4646

4747
await exchange.withdrawBlockFee(blockIdx, operator, {from: operator, gasPrice: 0});
4848

4949
const balanceOperatorAfter = await exchangeTestUtil.getOnchainBalance(operator, token);
5050
const balanceContractAfter = await exchangeTestUtil.getOnchainBalance(exchange.address, token);
51-
const balanceBurnedAfter = await exchangeTestUtil.getOnchainBalance(pfm, token);
51+
const balanceBurnedAfter = await exchangeTestUtil.getOnchainBalance(protocolFeeVault, token);
5252

5353
const expectedBurned = totalBlockFee.sub(expectedBlockFee);
5454

0 commit comments

Comments
 (0)