Paladin Docs
  • Overview
  • Quest V2
    • Overview
    • Quest Types & Features
    • Creating a Quest
      • Fixed Quests
      • Ranged Quests
    • Voting for Quests
    • Delegating your vote
    • Claiming rewards
    • Reward Distribution
    • Smart Contracts (v2.1)
      • QuestDataTypes
      • QuestBoard
      • MultiMerkleDistributorV2
    • Smart Contracts (V2)
      • QuestDataTypes
      • QuestBoard
      • BiasCalculator
      • MultiMerkleDistributor
      • ExtraRewardsMultiMerkle
  • Vote Flywheel
    • Overview
    • Smart Contracts
      • HolyPalPower
      • Loot
      • LootCreator
      • LootVoteController
      • LootReserve
      • Boost
  • Warlord
    • Overview
    • $WAR
    • Minting and Staking WAR
    • Redeeming WAR
    • Smart contracts
  • Dullahan
    • Overview
    • Depositing stkAAVE
    • Borrowing discounted GHO
    • Smart contracts
      • DullahanVault
      • DullahanRewardsStaking
      • DullahanPod
      • DullahanPodManager
      • DullahanDiscountCalculator
      • DullahanFeeModule
      • OracleModule
      • DullahanRegistry
      • DullahanZapDeposit
  • Warden Boost
    • Boost Market
    • How to Use Warden
      • As a Seller
        • Through the UI
        • Through Smart Contracts
      • As a Buyer
        • Through the UI
        • Through Smart Contracts
    • Smart Contract
    • MultiBuy
  • Warden Pledge
    • Overview
    • How to use Pledge
      • Create a Pledge
      • Delegating veBoosts
    • Smart Contract
  • Paladin Lending
    • Protocol Overview
    • Liquidity Mining
    • Technical docs
      • PalPool
      • PalToken
      • Delegators
      • Controller
      • Interest Calculator
      • PalLoan
      • PalLoanToken
      • PalPool Variants
      • Price Oracle
      • Error Codes
  • Governance
    • $PAL
    • Holy PAL (hPAL)
      • Smart Contract
    • Delegation
    • Voting
    • Voting Proposal Framework
  • Warden Quest (V1) - Deprecated
    • Creating a Quest
    • Smart contracts
      • QuestBoard
      • MultiMerkleDistributor
      • ExtraRewardsMultiMerkle
    • Covenant
  • Deployed contracts
    • Mainnet
    • Crosschain
    • Sonic
    • Admin
    • Audits
  • Resources
    • Paladin Whitepaper
  • Twitter
  • Discord
  • Forum
  • Snapshot
Powered by GitBook
On this page
  • Storage :
  • Constants :
  • pledges() :
  • pledgeOwner(uint256) :
  • onwerPledges(address) :
  • pledgeAvailableRewardAmounts(uint256) :
  • votingEscrow() :
  • delegationBoost() :
  • minAmountRewardToken(address) :
  • rewardTokenTotalAmount(address) :
  • protocolFeeRatio() :
  • chestAddress() :
  • minVoteDiff() :
  • Structs :
  • Events :
  • View Methods :
  • nextPledgeIndex() :
  • getUserPledges() :
  • getAllPledges() :
  • State-changing Methods :
  • pledge() :
  • pledgePercent() :
  • createPledge() :
  • extendPledge() :
  • increasePledgeRewardPerVote() :
  • closePledge() :

Was this helpful?

  1. Warden Pledge

Smart Contract

Storage :

Constants :

/** @notice Minimum Pledge duration */
uint256 public constant MIN_PLEDGE_DURATION = 1 weeks;
/** @notice Minimum delegation time when pledging */
uint256 public constant MIN_DELEGATION_DURATION = 2 days;

pledges() :

/** @notice List of all Pledges */
Pledge[] public pledges;

pledgeOwner(uint256) :

/** @notice Owner of each Pledge (ordered by index in the pledges list) */
mapping(uint256 => address) public pledgeOwner;

onwerPledges(address) :

/** @notice List of all Pledges for each owner */
mapping(address => uint256[]) public ownerPledges;

pledgeAvailableRewardAmounts(uint256) :

/** @notice Amount of rewards available for each Pledge */
// sorted by Pledge index
mapping(uint256 => uint256) public pledgeAvailableRewardAmounts;

votingEscrow() :

/** @notice Address of the votingToken to delegate */
IVotingEscrow public immutable votingEscrow;

delegationBoost() :

/** @notice Address of the Delegation Boost contract */
IBoostV2 public immutable delegationBoost;

minAmountRewardToken(address) :

/** @notice Minimum amount of reward per vote for each reward token */
// Also used to whitelist the tokens for rewards
mapping(address => uint256) public minAmountRewardToken;

rewardTokenTotalAmount(address) :

/** @notice Total amount held in Pledge for the reward amount */
mapping(address => uint256) public rewardTokenTotalAmount;

protocolFeeRatio() :

/** @notice ratio of fees to pay the protocol (in BPS) */
uint256 public protocolFeeRatio;

chestAddress() :

/** @notice Address to receive protocol fees */
address public chestAddress;

minVoteDiff() :

/** @notice Minimum vote difference for a Pledge */
uint256 public minVoteDiff;

Structs :

struct Pledge{
    // Target amount of veCRV (balance scaled by Boost v2, fetched as adjusted_balance)
    uint256 targetVotes;
    // Price per vote per week, set by the owner
    uint256 rewardPerVotePerWeek;
    // Address to receive the Boosts
    address receiver;
    // Address of the token given as rewards to Boosters
    address rewardToken;
    // Timestamp of end of the Pledge
    uint64 endTimestamp;
    // Set to true if the Pledge is cancelled, or when closed after the endTimestamp
    bool closed;
}

Events :

    /** @notice Event emitted when a new Pledge is created */
    event NewPledge(
        address indexed creator,
        address indexed receiver,
        address indexed rewardToken,
        uint256 id,
        uint256 targetVotes,
        uint256 rewardPerVotePerWeek,
        uint256 endTimestamp
    );
    /** @notice Event emitted when a Pledge duration is extended */
    event ExtendPledgeDuration(uint256 indexed pledgeId, uint256 oldEndTimestamp, uint256 newEndTimestamp);
    /** @notice Event emitted when a Pledge reward per vote is increased */
    event IncreasePledgeRewardPerVote(uint256 indexed pledgeId, uint256 oldrewardPerVotePerWeek, uint256 newrewardPerVotePerWeek);
    /** @notice Event emitted when a Pledge is closed */
    event ClosePledge(uint256 indexed pledgeId);
    /** @notice Event emitted when rewards are retrieved from a closed Pledge */
    event RetrievedPledgeRewards(uint256 indexed pledgeId, address receiver, uint256 amount);

    /** @notice Event emitted when an user delegate to a Pledge */
    event Pledged(uint256 indexed pledgeId, address indexed user, uint256 amount, uint256 endTimestamp);

    /** @notice Event emitted when a new reward token is added to the list */
    event NewRewardToken(address indexed token, uint256 minRewardPerWeek);
    /** @notice Event emitted when a reward token parameter is updated */
    event UpdateRewardToken(address indexed token, uint256 minRewardPerWeek);
    /** @notice Event emitted when a reward token is removed from the list */
    event RemoveRewardToken(address indexed token);

    /** @notice Event emitted when the address for the Chest is updated */
    event ChestUpdated(address oldChest, address newChest);
    /** @notice Event emitted when the platform fee is updated */
    event PlatformFeeUpdated(uint256 oldFee, uint256 newFee);
    /** @notice Event emitted when the minimum vote difference value is updated */
    event MinVoteDiffUpdated(uint256 oldMinVoteDiff, uint256 newMinVoteDiff);

View Methods :

nextPledgeIndex() :

/**
* @notice Amount of Pledges listed in this contract
* @return uint256: Amount of Pledges listed in this contract
*/
function nextPledgeIndex() public view returns(uint256);

getUserPledges() :

/**
* @notice Get all Pledges created by the user
* @param user Address of the user
* @return uint256[]: List of Pledges IDs
*/
function getUserPledges(address user) external view returns(uint256[] memory);

getAllPledges() :

/**
* @notice Get all the Pledges
* @return Pledge[]: List of Pledge structs
*/
function getAllPledges() external view returns(Pledge[] memory);

State-changing Methods :

pledge() :

/**
* @notice Delegates boost to a given Pledge & receive rewards
* @param pledgeId Pledge to delegate to
* @param amount Amount to delegate
* @param endTimestamp End of delegation
*/
function pledge(uint256 pledgeId, uint256 amount, uint256 endTimestamp) external;

pledgePercent() :

/**
* @notice Delegates boost (using a percentage of the balance) to a given Pledge & receive rewards
* @param pledgeId Pledge to delegate to
* @param percent Percent of balance to delegate
* @param endTimestamp End of delegation
*/
function pledgePercent(uint256 pledgeId, uint256 percent, uint256 endTimestamp) external;

createPledge() :

/**
* @notice Creates a new Pledge
* @param receiver Address to receive the boost delegation
* @param rewardToken Address of the token distributed as reward
* @param targetVotes Maximum target of votes to have (own balance + delegation) for the receiver
* @param rewardPerVotePerWeek Amount of reward given for each vote delegation (per week)
* @param endTimestamp End of the Pledge
* @param maxTotalRewardAmount Maximum total reward amount allowed to be pulled by this contract
* @return uint256: Newly created Pledge ID
*/ 
function createPledge(
    address receiver,
    address rewardToken,
    uint256 targetVotes,
    uint256 rewardPerVotePerWeek, // reward/veToken/week
    uint256 endTimestamp,
    uint256 maxTotalRewardAmount
) external returns(uint256);

extendPledge() :

/**
* @notice Extends the Pledge duration
* @param pledgeId ID of the Pledge
* @param newEndTimestamp New end of the Pledge
* @param maxTotalRewardAmount Maximum added total reward amount allowed to be pulled by this contract
*/
function extendPledge(
    uint256 pledgeId,
    uint256 newEndTimestamp,
    uint256 maxTotalRewardAmount
) external;

increasePledgeRewardPerVote() :

/**
* @notice Increases the Pledge reward per vote delegated
* @param pledgeId ID of the Pledge
* @param newRewardPerVotePerWeek New amount of reward given for each vote delegation (per week)
* @param maxTotalRewardAmount Maximum added total reward amount allowed to be pulled by this contract
*/
function increasePledgeRewardPerVote(
    uint256 pledgeId,
    uint256 newRewardPerVotePerWeek,
     uint256 maxTotalRewardAmount
) external;

closePledge() :

/**
* @notice Closes a Pledge and retrieves all non-distributed rewards from a Pledge
* @param pledgeId ID of the Pledge to close
* @param receiver Address to receive the remaining rewards
*/
function closePledge(uint256 pledgeId, address receiver) external;

PreviousDelegating veBoostsNextProtocol Overview

Last updated 1 year ago

Was this helpful?