LootVoteController
Contract handling the vote logic for repartition of the global Loot budget between all the listed gauges for the Quest system. User voting power is based on their hPAL locks, transformed into a bias via the HolyPalPower contract. Votes are sticky, meaning users do not need to cast them every period, but can set their vote and update it periods later. Before an user can change its votes, a vote cooldown need to be respected.
QuestBoard
Quest Board & distributor struct
struct QuestBoard {
address board;
address distributor;
}
Point
Point struct
struct Point {
uint256 bias;
uint256 slope;
}
VotedSlope
Voted Slope struct
struct VotedSlope {
uint256 slope;
uint256 power;
uint256 end;
address caller;
}
VoteVars
Struct used for the vote method
struct VoteVars {
uint256 currentPeriod;
uint256 nextPeriod;
int128 userSlope;
uint256 userLockEnd;
uint256 oldBias;
uint256 newBias;
uint256 totalPowerUsed;
uint256 oldUsedPower;
uint256 oldWeightBias;
uint256 oldWeightSlope;
uint256 oldTotalBias;
uint256 oldTotalSlope;
}
ProxyVoter
Proxy Voter struct
struct ProxyVoter {
uint256 maxPower;
uint256 usedPower;
uint256 endTimestamp;
}
hPalPower
address hPalPower
Address of the hPalPower contract
nextBoardId
uint256 nextBoardId
Next ID to list Boards
questBoards
mapping(uint256 => struct LootVoteController.QuestBoard) questBoards
Listed Quest Boards
boardToId
mapping(address => uint256) boardToId
Match Board address to ID
distributorToId
mapping(address => uint256) distributorToId
Match Distributor address to ID
gaugeToBoardId
mapping(address => uint256) gaugeToBoardId
Match a Gauge to a Board ID
defaultCap
uint256 defaultCap
Default weight cap for gauges
gaugeCaps
mapping(address => uint256) gaugeCaps
Custom caps for gauges
isGaugeKilled
mapping(address => bool) isGaugeKilled
Flag for killed gauges
voteUserSlopes
mapping(address => mapping(address => struct LootVoteController.VotedSlope)) voteUserSlopes
User VotedSlopes for each gauge
voteUserPower
mapping(address => uint256) voteUserPower
Total vote power used by user
lastUserVote
mapping(address => mapping(address => uint256)) lastUserVote
Last user vote's timestamp for each gauge address
pointsWeight
mapping(address => mapping(uint256 => struct LootVoteController.Point)) pointsWeight
Point weight for each gauge
changesWeight
mapping(address => mapping(uint256 => uint256)) changesWeight
Slope changes for each gauge
timeWeight
mapping(address => uint256) timeWeight
Last scheduled time for gauge weight update
pointsWeightTotal
mapping(uint256 => struct LootVoteController.Point) pointsWeightTotal
Total Point weights
changesWeightTotal
mapping(uint256 => uint256) changesWeightTotal
Total weight slope changes
timeTotal
uint256 timeTotal
Last scheduled time for weight update
isProxyManager
mapping(address => mapping(address => bool)) isProxyManager
Proxy Managers set for each user
maxProxyDuration
mapping(address => mapping(address => uint256)) maxProxyDuration
Max Proxy duration allowed for Manager
proxyVoterState
mapping(address => mapping(address => struct LootVoteController.ProxyVoter)) proxyVoterState
State of Proxy Managers for each user
currentUserProxyVoters
mapping(address => address[]) currentUserProxyVoters
List of current proxy for each user
blockedProxyPower
mapping(address => uint256) blockedProxyPower
Blocked (for Proxies) voting power for each user
usedFreePower
mapping(address => uint256) usedFreePower
Used free voting power for each user
VoteForGauge
event VoteForGauge(uint256 time, address user, address gauge_addr, uint256 weight)
Event emitted when a vote is casted for a gauge
NewBoardListed
event NewBoardListed(uint256 id, address board, address distributor)
Event emitted when a new Board is listed
BoardUpdated
event BoardUpdated(uint256 id, address newDistributor)
Event emitted when a Board is udpated
NewGaugeAdded
event NewGaugeAdded(address gauge, uint256 boardId, uint256 cap)
Event emitted when a new Gauge is listed
GaugeCapUpdated
event GaugeCapUpdated(address gauge, uint256 boardId, uint256 newCap)
Event emitted when a Gauge is updated
GaugeBoardUpdated
event GaugeBoardUpdated(address gauge, uint256 newBoardId)
Event emitted when a Gauge is updated
GaugeKilled
event GaugeKilled(address gauge, uint256 boardId)
Event emitted when a Gauge is killed
GaugeUnkilled
event GaugeUnkilled(address gauge, uint256 boardId)
Event emitted when a Gauge is unkilled
SetProxyManager
event SetProxyManager(address user, address manager)
Event emitted when a Proxy Manager is set
RemoveProxyManager
event RemoveProxyManager(address user, address manager)
Event emitted when a Proxy Manager is removed
SetNewProxyVoter
event SetNewProxyVoter(address user, address proxyVoter, uint256 maxPower, uint256 endTimestamp)
Event emitted when a Proxy Voter is set
DefaultCapUpdated
event DefaultCapUpdated(uint256 newCap)
Event emitted when the default gauge cap is updated
isListedGauge
function isListedGauge(address gauge) external view returns (bool)
Is the gauge listed
Parameters
gauge
address
Address of the gauge
Return Values
[0]
bool
bool : Is the gauge listed
getBoardForGauge
function getBoardForGauge(address gauge) external view returns (address)
Returns the Quest Board assocatied to a gauge
Parameters
gauge
address
Address of the gauge
Return Values
[0]
address
address : Address of the Quest Board
getDistributorForGauge
function getDistributorForGauge(address gauge) external view returns (address)
Returns the Distributor assocatied to a gauge
Parameters
gauge
address
Address of the gauge
Return Values
[0]
address
address : Address of the Distributor
getGaugeWeight
function getGaugeWeight(address gauge) external view returns (uint256)
Returns the current gauge weight
Parameters
gauge
address
Address of the gauge
Return Values
[0]
uint256
uint256 : Current gauge weight
getGaugeWeightAt
function getGaugeWeightAt(address gauge, uint256 ts) external view returns (uint256)
Returns the gauge weight at a specific timestamp
Parameters
gauge
address
Address of the gauge
ts
uint256
Timestamp
Return Values
[0]
uint256
uint256 : Gauge weight at the timestamp
getTotalWeight
function getTotalWeight() external view returns (uint256)
Returns the current total weight
Return Values
[0]
uint256
uint256 : Total weight
getGaugeRelativeWeight
function getGaugeRelativeWeight(address gauge) external view returns (uint256)
Returns a gauge relative weight
Parameters
gauge
address
Address of the gauge
Return Values
[0]
uint256
uint256 : Gauge relative weight
getGaugeRelativeWeight
function getGaugeRelativeWeight(address gauge, uint256 ts) external view returns (uint256)
Returns a gauge relative weight at a specific timestamp
Parameters
gauge
address
Address of the gauge
ts
uint256
Timestamp
Return Values
[0]
uint256
uint256 : Gauge relative weight at the timestamp
getGaugeCap
function getGaugeCap(address gauge) external view returns (uint256)
Returns the cap relative weight for a gauge
Parameters
gauge
address
Address of the gauge
Return Values
[0]
uint256
uint256 : Gauge cap
getUserProxyVoters
function getUserProxyVoters(address user) external view returns (address[])
Returns the list of current proxies for a user
Parameters
user
address
Address of the user
Return Values
[0]
address[]
address[] : List of proxy addresses
voteForGaugeWeights
function voteForGaugeWeights(address gauge, uint256 userPower) external
Votes for a gauge weight
Votes for a gauge weight based on the given user power
Parameters
gauge
address
Address of the gauge
userPower
uint256
Power used for this gauge
voteForManyGaugeWeights
function voteForManyGaugeWeights(address[] gauge, uint256[] userPower) external
Votes for multiple gauge weights
Parameters
gauge
address[]
Address of the gauges
userPower
uint256[]
Power used for each gauge
voteForGaugeWeightsFor
function voteForGaugeWeightsFor(address user, address gauge, uint256 userPower) external
Votes for a gauge weight as another user
Parameters
user
address
Address of the user
gauge
address
Address of the gauge
userPower
uint256
Power used for this gauge
voteForManyGaugeWeightsFor
function voteForManyGaugeWeightsFor(address user, address[] gauge, uint256[] userPower) external
Votes for multiple gauge weights as another user
Parameters
user
address
Address of the user
gauge
address[]
Address of the gauges
userPower
uint256[]
Power used for each gauge
getGaugeRelativeWeightWrite
function getGaugeRelativeWeightWrite(address gauge) external returns (uint256)
Returns the updated gauge relative weight
Parameters
gauge
address
Address of the gauge
Return Values
[0]
uint256
uint256 : Updated gauge relative weight
getGaugeRelativeWeightWrite
function getGaugeRelativeWeightWrite(address gauge, uint256 ts) external returns (uint256)
Returns the updated gauge relative weight at a given timestamp
Parameters
gauge
address
Address of the gauge
ts
uint256
Timestamp
Return Values
[0]
uint256
uint256 : Updated gauge relative weight at the timestamp
updateGaugeWeight
function updateGaugeWeight(address gauge) external
Updates the gauge weight
Parameters
gauge
address
Address of the gauge
updateTotalWeight
function updateTotalWeight() external
Updates the total weight
approveProxyManager
function approveProxyManager(address manager, uint256 maxDuration) external
Approves a Proxy Manager for the caller
Parameters
manager
address
Address of the Proxy Manager
maxDuration
uint256
Maximum Proxy duration allowed to be created by the Manager (can be set to 0 for no limit)
updateProxyManagerDuration
function updateProxyManagerDuration(address manager, uint256 newMaxDuration) external
Updates the max duration allowed for a Proxy Manager
Parameters
manager
address
Address of the Proxy Manager
newMaxDuration
uint256
Maximum Proxy duration allowed to be created by the Manager (can be set to 0 for no limit)
removeProxyManager
function removeProxyManager(address manager) external
Approves a Proxy Manager for the caller
Parameters
manager
address
Address of the Proxy Manager
setVoterProxy
function setVoterProxy(address user, address proxy, uint256 maxPower, uint256 endTimestamp) external
Sets a Proxy Voter for the user
Parameters
user
address
Address of the user
proxy
address
Address of the Proxy Voter
maxPower
uint256
Max voting power allowed for the Proxy
endTimestamp
uint256
Timestamp of the Proxy expiry
clearUserExpiredProxies
function clearUserExpiredProxies(address user) external
Clears expired Proxies for a user
Parameters
user
address
Address of the user
Last updated
Was this helpful?