Curvance
  • Protocol Overview
    • Click Less, Earn More
    • Protocol Architecture
    • Asset Types
    • Liquidity Markets
      • Borrowing
      • Liquidations
      • Interest Rates
      • Oracles
      • Collateral Caps
      • Bad Debt Socialization
    • Application Specific Sequencing
    • New Age Liquidity Mining
      • Protocols
    • How Are New Assets Integrated
    • Plugin System
    • Universal Account Balance
    • Token Approval Management
    • Lending Risks
  • Security
    • Security and Audits
  • Miscellaneous
    • RPCs and Testnet Stability
    • Glossary
    • TL;DR
      • Customer Types and Benefits
    • Brand Assets
    • Weblinks
    • Disclaimer
    • Frequently Asked Questions
  • Developer Docs
    • Overview
    • Quick Start Guides
      • Atlas Fastlane Auctions (coming soon)
      • Plugin Integration
        • List of Delegable Actions
      • Loans & Collateral
        • Lend Assets
        • Deposit into pTokens
        • Withdraw Loans
        • Withdraw pTokens
      • Borrowing & Repayment
        • Borrow
        • Repaying Debt
      • Leverage
        • Leveraging
        • Deleveraging
    • Lending Protocol
      • Market Manager
      • Position Tokens (pToken)
      • Earn Tokens (eTokens)
      • Dynamic Interest Rate Model
      • Universal Balance
    • Position Management
      • Leverage
      • Deleverage / Fold
    • Dynamic Liquidation Engine (DLE)
      • Orderflow Auction System
      • Bad Debt Socialization
    • Plugin & Delegation System
      • Transfer Lock Mechanism
      • Delegable Actions
    • Cross-Chain Functionality
      • Messaging Hub
      • Fee Manager
      • Reward Manager
    • Auxiliary Functionality
Powered by GitBook
On this page
  • Overview
  • User Interaction Functions
  • Delegation in PluginDelegable.sol
  • Delegable Actions in ActionRegistry.sol
Export as PDF
  1. Developer Docs
  2. Plugin & Delegation System

Delegable Actions

PreviousTransfer Lock MechanismNextCross-Chain Functionality

Last updated 9 days ago

Overview

Delegable Actions allow third-party contracts (plugins) to perform specific operations on behalf of users within the Curvance ecosystem. This delegation system offers a more flexible and powerful alternative to standard ERC20 approvals, enabling opportunities for automation, complex strategies, and improved user experiences.

Any Curvance contract that inherits from PluginDelegable can support delegate-triggered operations through functions that typically end with a for postfix (e.g., borrowFor, withdrawFor, leverageFor). This pattern ensures consistent delegate authorization checks across the protocol.

For a full list of delegable actions, please check out our plugin guide here:

The delegation system provides several security advantages over traditional approaches:

  • Granular control: Users can grant and revoke specific action permissions to different addresses

  • Emergency revocation: Users can revoke all delegations at once by incrementing their approval index

  • Time-lock protection: Optional delegation lockdown with a cooldown period

Delegations exist across all Curvance contracts simultaneously, using the Central Registry to track and validate delegation permissions throughout the protocol.


User Interaction Functions

Delegation in PluginDelegable.sol

isDelegate()

Description: Determines whether a delegate address has permission to act on behalf of a specified user.

Contract: CentralRegistry

Function signature:

function isDelegate(address user, address delegate) public view returns (bool)
Type
Name
Description

address

user

The address to check whether delegate has delegation permissions for.

address

delegate

The address to check delegation permissions of user.

Return data:

Type
Description

bool

Returns true if delegate is authorized to act on behalf of user.


setDelegateApproval()

Description: Approves or restricts a delegate's authority to operate on the caller's behalf. This is the primary method for users to control their delegation permissions.

Contract: CentralRegistry

Function signature:

function setDelegateApproval(address delegate, bool isApproved) external
Type
Name
Description

address

delegate

The address that will be approved or restricted from delegated actions.

bool

isApproved

Whether delegate is being approved (true) or restricted (false).

Events:

event DelegateApproval(
    address indexed owner,
    address indexed delegate,
    uint256 approvalIndex,
    bool isApproved
);

getUserApprovalIndex()

Description: Retrieves a user's current approval index from the Central Registry. This index is incremented when a user wants to revoke all delegations.

Contract: CentralRegistry

Function signature:

function getUserApprovalIndex(address user) public view returns (uint256)
Type
Name
Description

address

user

The user to check delegated approval index for.

Return data:

Type
Name
Description

address

user

The user to check delegated approval index for.


checkDelegationDisabled()

Description: Checks whether delegation is temporarily or permanently disabled for a specified user.

Contract: CentralRegistry

Function signature:

function checkDelegationDisabled(address user) public view returns (bool)
Type
Name
Description

address

user

The user to check delegation status for.

Return data:

Type
Description

bool

Returns true if user has delegation disabled or if their cooldown period has not expired.


Delegable Actions in ActionRegistry.sol

getUserApprovalIndex()

Description: Returns a user's approval index, which is used to authorize delegates across the entire protocol.

Contract: CentralRegistry

Function signature:

function getUserApprovalIndex(address user) external view returns (uint256)
Type
Name
Description

address

user

The user to check delegated approval index for.

Return data:

Type
Description

uint256

Current approval index for the specified user.


incrementApprovalIndex()

Description: Increments a caller's approval index, immediately revoking all delegate permissions across all Curvance contracts.

Contract: CentralRegistry

Function signature:

function incrementApprovalIndex() external

Events:

event ApprovalIndexIncremented(address indexed user, uint256 newIndex);

checkDelegationDisabled()

Description: Determines whether a user has delegation disabled, either intentionally or due to a cooldown period.

Function signature:

function checkDelegationDisabled(address user) external view returns (bool)
Type
Name
Description

address

user

The user to check delegation status for.

Return data:

Type
Description

bool

Returns true if user has delegation disabled or if their cooldown period has not expired.


setDelegable()

Description: Sets a caller's status for whether to allow new delegations or not. When re-enabling delegation, the user's configured cooldown period applies.

Function signature:

function setDelegable(bool delegationDisabled) external

Parameters:

Type
Name
Description

bool

delegationDisabled

true to disable delegation, false to enable delegation (after cooldown).

Events:

event DelegableStatusChanged(
    address indexed user,
    bool delegable,
    uint256 delegationEnabledTimestamp
);
List of Delegable Actions