-
Notifications
You must be signed in to change notification settings - Fork 594
Expand file tree
/
Copy pathRewardExtLib.sol
More file actions
121 lines (96 loc) · 4.11 KB
/
RewardExtLib.sol
File metadata and controls
121 lines (96 loc) · 4.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// SPDX-License-Identifier: Apache-2.0
// Copyright 2024 Aztec Labs.
pragma solidity >=0.8.27;
import {
FeeLib,
ManaMinFeeComponents,
L1FeeData,
EthPerFeeAssetE12,
EthValue
} from "@aztec/core/libraries/rollup/FeeLib.sol";
import {ProposeLib} from "@aztec/core/libraries/rollup/ProposeLib.sol";
import {RewardLib, RewardConfig} from "@aztec/core/libraries/rollup/RewardLib.sol";
import {STFLib} from "@aztec/core/libraries/rollup/STFLib.sol";
import {Epoch, Timestamp} from "@aztec/core/libraries/TimeLib.sol";
import {
RewardBooster,
RewardBoostConfig,
IBoosterCore,
IValidatorSelection
} from "@aztec/core/reward-boost/RewardBooster.sol";
import {IRewardDistributor} from "@aztec/governance/interfaces/IRewardDistributor.sol";
library RewardExtLib {
function setConfig(RewardConfig memory _config) external {
RewardLib.setConfig(_config);
}
function claimSequencerRewards(address _sequencer) external returns (uint256) {
return RewardLib.claimSequencerRewards(_sequencer);
}
function claimProverRewards(address _prover, Epoch[] memory _epochs) external returns (uint256) {
return RewardLib.claimProverRewards(_prover, _epochs);
}
function deployRewardBooster(RewardBoostConfig memory _config) external returns (IBoosterCore) {
RewardBooster booster = new RewardBooster(IValidatorSelection(address(this)), _config);
return IBoosterCore(address(booster));
}
// View wrappers - delegated from Rollup.sol to avoid inlining RewardLib into Rollup bytecode
function getSpecificProverRewardsForEpoch(Epoch _epoch, address _prover) external view returns (uint256) {
return RewardLib.getSpecificProverRewardsForEpoch(_epoch, _prover);
}
function getSharesFor(address _prover) external view returns (uint256) {
return RewardLib.getSharesFor(_prover);
}
function getSequencerRewards(address _sequencer) external view returns (uint256) {
return RewardLib.getSequencerRewards(_sequencer);
}
function getCollectiveProverRewardsForEpoch(Epoch _epoch) external view returns (uint256) {
return RewardLib.getCollectiveProverRewardsForEpoch(_epoch);
}
function getHasSubmitted(Epoch _epoch, uint256 _length, address _prover) external view returns (bool) {
return RewardLib.getHasSubmitted(_epoch, _length, _prover);
}
function getHasClaimed(address _prover, Epoch _epoch) external view returns (bool) {
return RewardLib.getHasClaimed(_prover, _epoch);
}
function getCheckpointReward() external view returns (uint256) {
return RewardLib.getCheckpointReward();
}
function getRewardConfig() external view returns (RewardConfig memory) {
return RewardLib.getStorage().config;
}
function getRewardDistributor() external view returns (IRewardDistributor) {
return RewardLib.getStorage().config.rewardDistributor;
}
// FeeLib/STFLib/ProposeLib view wrappers - overflow from RollupOperationsExtLib
function getManaMinFeeComponentsAt(Timestamp _timestamp, bool _inFeeAsset)
external
view
returns (ManaMinFeeComponents memory)
{
return ProposeLib.getManaMinFeeComponentsAt(_timestamp, _inFeeAsset);
}
function canPruneAtTime(Timestamp _ts) external view returns (bool) {
return STFLib.canPruneAtTime(_ts);
}
function getEpochForCheckpoint(uint256 _checkpointNumber) external view returns (Epoch) {
return STFLib.getEpochForCheckpoint(_checkpointNumber);
}
function getL1FeesAt(Timestamp _timestamp) external view returns (L1FeeData memory) {
return FeeLib.getL1FeesAt(_timestamp);
}
function getEthPerFeeAssetAtCheckpoint(uint256 _checkpointNumber) external view returns (EthPerFeeAssetE12) {
return FeeLib.getEthPerFeeAssetAtCheckpoint(_checkpointNumber);
}
function getProvingCostPerMana() external view returns (EthValue) {
return FeeLib.getProvingCostPerMana();
}
function getManaTarget() external view returns (uint256) {
return FeeLib.getManaTarget();
}
function getManaLimit() external view returns (uint256) {
return FeeLib.getManaLimit();
}
function summedMinFee(ManaMinFeeComponents memory _components) external pure returns (uint256) {
return FeeLib.summedMinFee(_components);
}
}