Skip to content

Commit 126245a

Browse files
committed
change minter to vault
1 parent 5f81863 commit 126245a

26 files changed

+441
-272
lines changed

SPECIFICATION.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ All of these operations require ownership of the underlying NFT or tokens being
3838
- Can unlock a permanently locked NFT to allow its voting power to decay.
3939
- Can delegate votes to other `tokenId`s for use in marshall governance to other addresses based on voting power. Voting power retrieved from `getVotes` and `getPastVotes` does not reveal locked amount balances and are used only for voting.
4040

41-
### Minter
41+
### Vault
4242

4343
The minting contract handles emissions for the Marshall DAO protocol. Emissions start fixed amount $IOTX per epoch (7 days). Liquidity providers and veIOTX holder will receive weekly emissions. The weekly emissions amount and the ratio of the LP and veIOTX can be adjust by DAO governor.
4444

contracts/RewardsDistributor.sol

+9-9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pragma solidity ^0.8.0;
44
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
55
import {IRewardsDistributor} from "./interfaces/IRewardsDistributor.sol";
66
import {IVotingEscrow} from "./interfaces/IVotingEscrow.sol";
7-
import {IMinter} from "./interfaces/IMinter.sol";
7+
import {IVault} from "./interfaces/IVault.sol";
88

99
/*
1010
* @title Curve Fee Distribution modified for ve(3,3) emissions
@@ -28,7 +28,7 @@ contract RewardsDistributor is IRewardsDistributor {
2828
/// @inheritdoc IRewardsDistributor
2929
IVotingEscrow public immutable ve;
3030
/// @inheritdoc IRewardsDistributor
31-
address public minter;
31+
address public vault;
3232
/// @inheritdoc IRewardsDistributor
3333
uint256 public tokenLastBalance;
3434

@@ -37,7 +37,7 @@ contract RewardsDistributor is IRewardsDistributor {
3737
startTime = _t;
3838
lastTokenTime = _t;
3939
ve = IVotingEscrow(_ve);
40-
minter = msg.sender;
40+
vault = msg.sender;
4141
}
4242

4343
receive() external payable {}
@@ -78,7 +78,7 @@ contract RewardsDistributor is IRewardsDistributor {
7878

7979
/// @inheritdoc IRewardsDistributor
8080
function checkpointToken() external {
81-
if (msg.sender != minter) revert NotMinter();
81+
if (msg.sender != vault) revert NotVault();
8282
_checkpointToken();
8383
}
8484

@@ -131,7 +131,7 @@ contract RewardsDistributor is IRewardsDistributor {
131131

132132
/// @inheritdoc IRewardsDistributor
133133
function claim(uint256 _tokenId) external returns (uint256) {
134-
if (IMinter(minter).activePeriod() < ((block.timestamp / WEEK) * WEEK)) revert UpdatePeriod();
134+
if (IVault(vault).activePeriod() < ((block.timestamp / WEEK) * WEEK)) revert UpdatePeriod();
135135
uint256 _timestamp = block.timestamp;
136136
uint256 _lastTokenTime = lastTokenTime;
137137
_lastTokenTime = (_lastTokenTime / WEEK) * WEEK;
@@ -151,7 +151,7 @@ contract RewardsDistributor is IRewardsDistributor {
151151

152152
/// @inheritdoc IRewardsDistributor
153153
function claimMany(uint256[] calldata _tokenIds) external returns (bool) {
154-
if (IMinter(minter).activePeriod() < ((block.timestamp / WEEK) * WEEK)) revert UpdatePeriod();
154+
if (IVault(vault).activePeriod() < ((block.timestamp / WEEK) * WEEK)) revert UpdatePeriod();
155155
uint256 _timestamp = block.timestamp;
156156
uint256 _lastTokenTime = lastTokenTime;
157157
_lastTokenTime = (_lastTokenTime / WEEK) * WEEK;
@@ -181,8 +181,8 @@ contract RewardsDistributor is IRewardsDistributor {
181181
}
182182

183183
/// @inheritdoc IRewardsDistributor
184-
function setMinter(address _minter) external {
185-
if (msg.sender != minter) revert NotMinter();
186-
minter = _minter;
184+
function setVault(address _vault) external {
185+
if (msg.sender != vault) revert NotVault();
186+
vault = _vault;
187187
}
188188
}

contracts/Minter.sol renamed to contracts/Vault.sol

+21-21
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,35 @@
22
pragma solidity ^0.8.0;
33

44
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
5-
import {IMinter} from "./interfaces/IMinter.sol";
5+
import {IVault} from "./interfaces/IVault.sol";
66
import {IRewardsDistributor} from "./interfaces/IRewardsDistributor.sol";
77
import {IVoter} from "./interfaces/IVoter.sol";
88
import {IVotingEscrow} from "./interfaces/IVotingEscrow.sol";
99

10-
/// @title Minter
10+
/// @title Vault
1111
/// @author velodrome.finance, @figs999, @pegahcarter
1212
/// @notice Controls minting of emissions and rebases for the Protocol
13-
contract Minter is IMinter {
14-
/// @inheritdoc IMinter
13+
contract Vault is IVault {
14+
/// @inheritdoc IVault
1515
IVoter public immutable voter;
16-
/// @inheritdoc IMinter
16+
/// @inheritdoc IVault
1717
IVotingEscrow public immutable ve;
18-
/// @inheritdoc IMinter
18+
/// @inheritdoc IVault
1919
IRewardsDistributor public immutable rewardsDistributor;
2020

21-
/// @inheritdoc IMinter
21+
/// @inheritdoc IVault
2222
uint256 public constant WEEK = 1 weeks;
23-
/// @inheritdoc IMinter
23+
/// @inheritdoc IVault
2424
uint256 public veRate = 1000; // 10%
25-
/// @inheritdoc IMinter
25+
/// @inheritdoc IVault
2626
uint256 public weekly = 100_000 * 1e18;
27-
/// @inheritdoc IMinter
27+
/// @inheritdoc IVault
2828
uint256 public activePeriod;
29-
/// @inheritdoc IMinter
29+
/// @inheritdoc IVault
3030
uint256 public epochCount;
31-
/// @inheritdoc IMinter
31+
/// @inheritdoc IVault
3232
address public team;
33-
/// @inheritdoc IMinter
33+
/// @inheritdoc IVault
3434
address public pendingTeam;
3535

3636
constructor(
@@ -45,22 +45,22 @@ contract Minter is IMinter {
4545
activePeriod = ((block.timestamp) / WEEK) * WEEK; // allow emissions this coming epoch
4646
}
4747

48-
/// @inheritdoc IMinter
48+
/// @inheritdoc IVault
4949
function setTeam(address _team) external {
5050
if (msg.sender != team) revert NotTeam();
5151
if (_team == address(0)) revert ZeroAddress();
5252
pendingTeam = _team;
5353
}
5454

55-
/// @inheritdoc IMinter
55+
/// @inheritdoc IVault
5656
function acceptTeam() external {
5757
if (msg.sender != pendingTeam) revert NotPendingTeam();
5858
team = pendingTeam;
5959
delete pendingTeam;
6060
emit AcceptTeam(team);
6161
}
6262

63-
/// @inheritdoc IMinter
63+
/// @inheritdoc IVault
6464
function updatePeriod() external returns (uint256 _period) {
6565
_period = activePeriod;
6666
if (block.timestamp >= _period + WEEK) {
@@ -80,19 +80,19 @@ contract Minter is IMinter {
8080

8181
voter.notifyRewardAmount{value: _emission - _veEmission}();
8282

83-
emit Mint(msg.sender, _emission);
83+
emit Emission(msg.sender, _emission);
8484
}
8585
}
8686

87-
/// @inheritdoc IMinter
87+
/// @inheritdoc IVault
8888
function changeWeekly(uint256 _weekly) external {
8989
if (msg.sender != team) revert NotTeam();
9090

9191
weekly = _weekly;
9292
emit WeeklyChanged(_weekly);
9393
}
9494

95-
/// @inheritdoc IMinter
95+
/// @inheritdoc IVault
9696
function changeVeRate(uint256 _rate) external {
9797
if (msg.sender != team) revert NotTeam();
9898
if (_rate > 5000) revert InvalidRate();
@@ -101,7 +101,7 @@ contract Minter is IMinter {
101101
emit VeRateChanged(_rate);
102102
}
103103

104-
/// @inheritdoc IMinter
104+
/// @inheritdoc IVault
105105
function withdraw(address payable _recipcient, uint256 _amount) external {
106106
if (msg.sender != team) revert NotTeam();
107107
_recipcient.transfer(_amount);
@@ -112,7 +112,7 @@ contract Minter is IMinter {
112112
emit Donation(msg.sender, msg.value);
113113
}
114114

115-
/// @inheritdoc IMinter
115+
/// @inheritdoc IVault
116116
function donate() external payable {
117117
if (msg.value == 0) revert ZeroDonation();
118118
emit Donation(msg.sender, msg.value);

contracts/Voter.sol

+12-12
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
55
import {IVotingRewardsFactory} from "./interfaces/factories/IVotingRewardsFactory.sol";
66
import {IGauge} from "./interfaces/IGauge.sol";
77
import {IGaugeFactory} from "./interfaces/factories/IGaugeFactory.sol";
8-
import {IMinter} from "./interfaces/IMinter.sol";
8+
import {IVault} from "./interfaces/IVault.sol";
99
import {IReward} from "./interfaces/IReward.sol";
1010
import {IVoter} from "./interfaces/IVoter.sol";
1111
import {IVotingEscrow} from "./interfaces/IVotingEscrow.sol";
@@ -28,7 +28,7 @@ contract Voter is IVoter, ERC2771Context, ReentrancyGuard {
2828
/// @notice Rewards are released over 7 days
2929
uint256 internal constant DURATION = 7 days;
3030
/// @inheritdoc IVoter
31-
address public minter;
31+
address public vault;
3232
/// @inheritdoc IVoter
3333
address public governor;
3434
/// @inheritdoc IVoter
@@ -78,7 +78,7 @@ contract Voter is IVoter, ERC2771Context, ReentrancyGuard {
7878
ve = _ve;
7979
factoryRegistry = _factoryRegistry;
8080
address _sender = _msgSender();
81-
minter = _sender;
81+
vault = _sender;
8282
governor = _sender;
8383
emergencyCouncil = _sender;
8484
maxVotingNum = 30;
@@ -108,13 +108,13 @@ contract Voter is IVoter, ERC2771Context, ReentrancyGuard {
108108
}
109109

110110
/// @dev requires initialization with at least rewardToken
111-
function initialize(address[] calldata _tokens, address _minter) external {
112-
if (_msgSender() != minter) revert NotMinter();
111+
function initialize(address[] calldata _tokens, address _vault) external {
112+
if (_msgSender() != vault) revert NotVault();
113113
uint256 _length = _tokens.length;
114114
for (uint256 i = 0; i < _length; i++) {
115115
_whitelistToken(_tokens[i], true);
116116
}
117-
minter = _minter;
117+
vault = _vault;
118118
}
119119

120120
/// @inheritdoc IVoter
@@ -294,10 +294,10 @@ contract Voter is IVoter, ERC2771Context, ReentrancyGuard {
294294
function killGauge(address _gauge) external {
295295
if (_msgSender() != emergencyCouncil) revert NotEmergencyCouncil();
296296
if (!isAlive[_gauge]) revert GaugeAlreadyKilled();
297-
// Return claimable back to minter
297+
// Return claimable back to valut
298298
uint256 _claimable = claimable[_gauge];
299299
if (_claimable > 0) {
300-
payable(minter).transfer(_claimable);
300+
payable(vault).transfer(_claimable);
301301
delete claimable[_gauge];
302302
}
303303
isAlive[_gauge] = false;
@@ -320,7 +320,7 @@ contract Voter is IVoter, ERC2771Context, ReentrancyGuard {
320320
/// @inheritdoc IVoter
321321
function notifyRewardAmount() external payable {
322322
address sender = _msgSender();
323-
if (sender != minter) revert NotMinter();
323+
if (sender != vault) revert NotVault();
324324
uint256 _amount = msg.value;
325325
uint256 _ratio = (_amount * 1e18) / Math.max(totalWeight, 1); // 1e18 adjustment is removed during claim
326326
if (_ratio > 0) {
@@ -362,7 +362,7 @@ contract Voter is IVoter, ERC2771Context, ReentrancyGuard {
362362
if (isAlive[_gauge]) {
363363
claimable[_gauge] += _share;
364364
} else {
365-
payable(minter).transfer(_share); // send rewards back to Minter so they're not stuck in Voter
365+
payable(vault).transfer(_share); // send rewards back to Vault so they're not stuck in Voter
366366
}
367367
}
368368
} else {
@@ -399,15 +399,15 @@ contract Voter is IVoter, ERC2771Context, ReentrancyGuard {
399399

400400
/// @inheritdoc IVoter
401401
function distribute(uint256 _start, uint256 _finish) external nonReentrant {
402-
IMinter(minter).updatePeriod();
402+
IVault(vault).updatePeriod();
403403
for (uint256 x = _start; x < _finish; x++) {
404404
_distribute(gauges[pools[x]]);
405405
}
406406
}
407407

408408
/// @inheritdoc IVoter
409409
function distribute(address[] memory _gauges) external nonReentrant {
410-
IMinter(minter).updatePeriod();
410+
IVault(vault).updatePeriod();
411411
uint256 _length = _gauges.length;
412412
for (uint256 x = 0; x < _length; x++) {
413413
_distribute(_gauges[x]);

contracts/interfaces/IRewardsDistributor.sol

+9-9
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ interface IRewardsDistributor {
77
event CheckpointToken(uint256 time, uint256 tokens);
88
event Claimed(uint256 indexed tokenId, uint256 indexed epochStart, uint256 indexed epochEnd, uint256 amount);
99

10-
error NotMinter();
10+
error NotVault();
1111
error NotManagedOrNormalNFT();
1212
error UpdatePeriod();
1313

@@ -20,15 +20,15 @@ interface IRewardsDistributor {
2020
/// @notice Timestamp of most recent claim of tokenId
2121
function timeCursorOf(uint256 tokenId) external view returns (uint256);
2222

23-
/// @notice The last timestamp Minter has called checkpointToken()
23+
/// @notice The last timestamp Vault has called checkpointToken()
2424
function lastTokenTime() external view returns (uint256);
2525

2626
/// @notice Interface of VotingEscrow.sol
2727
function ve() external view returns (IVotingEscrow);
2828

29-
/// @notice Address of Minter.sol
29+
/// @notice Address of Vault.sol
3030
/// Authorized caller of checkpointToken()
31-
function minter() external view returns (address);
31+
function vault() external view returns (address);
3232

3333
/// @notice Amount of token in contract when checkpointToken() was last called
3434
function tokenLastBalance() external view returns (uint256);
@@ -44,18 +44,18 @@ interface IRewardsDistributor {
4444

4545
/// @notice Claims rebases for a given token ID
4646
/// @dev Allows claiming of rebases up to 50 epochs old
47-
/// `Minter.updatePeriod()` must be called before claiming
47+
/// `Vault.updatePeriod()` must be called before claiming
4848
/// @param tokenId The token ID to claim for
4949
/// @return The amount of rebases claimed
5050
function claim(uint256 tokenId) external returns (uint256);
5151

5252
/// @notice Claims rebases for a list of token IDs
53-
/// @dev `Minter.updatePeriod()` must be called before claiming
53+
/// @dev `Vault.updatePeriod()` must be called before claiming
5454
/// @param tokenIds The token IDs to claim for
5555
/// @return Whether or not the claim succeeded
5656
function claimMany(uint256[] calldata tokenIds) external returns (bool);
5757

58-
/// @notice Used to set minter once on initialization
59-
/// @dev Callable once by Minter only, Minter is immutable
60-
function setMinter(address _minter) external;
58+
/// @notice Used to set vault once on initialization
59+
/// @dev Callable once by vault only, Vault is immutable
60+
function setVault(address _vault) external;
6161
}

contracts/interfaces/IMinter.sol renamed to contracts/interfaces/IVault.sol

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import {IVoter} from "./IVoter.sol";
55
import {IVotingEscrow} from "./IVotingEscrow.sol";
66
import {IRewardsDistributor} from "./IRewardsDistributor.sol";
77

8-
interface IMinter {
8+
interface IVault {
99
error NotTeam();
1010
error ZeroAddress();
1111
error ZeroDonation();
1212
error InvalidRate();
1313
error NotPendingTeam();
1414
error InsufficientFund();
1515

16-
event Mint(address indexed sender, uint256 weekly);
16+
event Emission(address indexed sender, uint256 weekly);
1717
event AcceptTeam(address indexed _newTeam);
1818
event WeeklyChanged(uint256 weekly);
1919
event VeRateChanged(uint256 rate);

contracts/interfaces/IVoter.sol

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface IVoter {
1717
error NotApprovedOrOwner();
1818
error NotGovernor();
1919
error NotEmergencyCouncil();
20-
error NotMinter();
20+
error NotVault();
2121
error NotWhitelistedNFT();
2222
error NotWhitelistedToken();
2323
error SameValue();
@@ -68,8 +68,8 @@ interface IVoter {
6868
/// @notice Factory registry for valid gauge / rewards factories
6969
function factoryRegistry() external view returns (address);
7070

71-
/// @notice Address of Minter.sol
72-
function minter() external view returns (address);
71+
/// @notice Address of Vault.sol
72+
function vault() external view returns (address);
7373

7474
/// @notice Standard OZ IGovernor using ve for vote weights.
7575
function governor() external view returns (address);
@@ -123,9 +123,9 @@ interface IVoter {
123123
/// @notice Number of pools with a Gauge
124124
function length() external view returns (uint256);
125125

126-
/// @notice Called by Minter to distribute weekly emissions rewards for disbursement amongst gauges.
126+
/// @notice Called by Vault to distribute weekly emissions rewards for disbursement amongst gauges.
127127
/// @dev Assumes totalWeight != 0 (Will never be zero as long as users are voting).
128-
/// Throws if not called by minter.
128+
/// Throws if not called by vault.
129129
function notifyRewardAmount() external payable;
130130

131131
/// @dev Utility to distribute to gauges of pools in range _start to _finish.

0 commit comments

Comments
 (0)