Loot
Contract hosting the Loot reward logic. A Loot is a struct holding the data for PAL & extra rewards allocated to an user based on distribution, user voting rewards from Quest and boosting power from their hPAL locks. The PAL rewards in the Loot are vested for a given duration, and can be claimed beforehand but are slashed based on the remaining duration of the vesting. The extra rewards are not vested and not slashed.
LootData
Loot Data strcut
struct LootData {
uint256 id;
uint256 palAmount;
uint256 extraAmount;
uint256 startTs;
uint256 endTs;
bool claimed;
}
pal
contract IERC20 pal
PAL token
extraToken
contract IERC20 extraToken
Extra reward token
tokenReserve
address tokenReserve
Address of the Reserve contract holding token to be distributed
lootCreator
contract ILootCreator lootCreator
Loot Creator contract
vestingDuration
uint256 vestingDuration
Duration of vesting for Loots
userLoots
mapping(address => struct Loot.LootData[]) userLoots
List of Loot for each user
LootCreated
event LootCreated(address user, uint256 id, uint256 palAmount, uint256 extraAmount, uint256 startTs)
Event emitted when a Loot is created
LootClaimed
event LootClaimed(address user, uint256 id, uint256 palAmount, uint256 extraAmount)
Event emitted when a Loot is claimed
VestingDurationUpdated
event VestingDurationUpdated(uint256 oldDuration, uint256 newDuration)
Event emitted when the vesting duration is updated
LootCreatorUpdated
event LootCreatorUpdated(address oldCreator, address newCreator)
Event emitted when the Loot Creator address is updated
setInitialLootCreator
function setInitialLootCreator(address _lootCreator) external
Sets the Loot Creator contract address
Parameters
_lootCreator
address
Address of the Loot Creator contract
getLootData
function getLootData(address user, uint256 id) external view returns (uint256 palAmount, uint256 extraAmount, uint256 startTs, uint256 endTs, bool claimed)
Returns the data of a Loot for a user & an id
Parameters
user
address
Address of the user
id
uint256
ID of the Loot
Return Values
palAmount
uint256
(uint256) : Amount of PAL
extraAmount
uint256
(uint256) : Amount of extra token
startTs
uint256
(uint256) : Timestamp at which the vesting starts
endTs
uint256
(uint256) : Timestamp at which the vesting ends
claimed
bool
(uint256) : Is Loot already claimed
getAllUserLootIds
function getAllUserLootIds(address user) external view returns (uint256[])
Returns all the user Loot IDs
Parameters
user
address
Address of the user
Return Values
[0]
uint256[]
uint256[] : List of Loot IDs
getAllActiveUserLootIds
function getAllActiveUserLootIds(address user) external view returns (uint256[])
Returns all the user active Loot IDs
Parameters
user
address
Address of the user
Return Values
[0]
uint256[]
uint256[] : List of active Loot IDs
getAllUserLoot
function getAllUserLoot(address user) external view returns (struct Loot.LootData[])
Returns all the user Loots
Parameters
user
address
Address of the user
Return Values
[0]
struct Loot.LootData[]
LootData[] : List of Loots
getAllActiveUserLoot
function getAllActiveUserLoot(address user) external view returns (struct Loot.LootData[])
Returns all the user active Loots
Parameters
user
address
Address of the user
Return Values
[0]
struct Loot.LootData[]
LootData[] : List of active Loots
createLoot
function createLoot(address user, uint256 startTs, uint256 palAmount, uint256 extraAmount) external returns (int256)
Creates a new Loot for a user
Parameters
user
address
Address of the user
startTs
uint256
Timestamp at which the vesting starts
palAmount
uint256
Amount of PAL
extraAmount
uint256
Amount of extra token
claimLoot
function claimLoot(uint256 id, address receiver) external
Claims a Loot for a user
Parameters
id
uint256
ID of the Loot
receiver
address
Address to receive the PAL & extra token
claimMultipleLoot
function claimMultipleLoot(uint256[] ids, address receiver) external
Claims multiple Loots for a user
Parameters
ids
uint256[]
List of Loot IDs
receiver
address
Address to receive the PAL & extra token
Last updated
Was this helpful?