Skip to content

DelegateApprovals

Description

Implemented in SIP 10: Upgrade Delegate Powers & SIP 14: Allow delegation of Synthetix Exchange function to another address

This contract is used by FeePool, Synthetix, to enable SNX holders (the delegator) to permit other addresses (the delegate) to perform actions on their befhalf including;

  1. Claim fees & rewards for them,
  2. Burn Synths on behalf or Burn to Target c-ratio on behalf
  3. Issue or IssueMax Synths on behalf
  4. Exchange Synths

In Synthetix this was intended to allow mobile or hot wallets such as metamask to claim fees for a cold storage wallet which can be done via the delegatr mobile dapp

In principle it is generic, as the approver just marks a number of delegates as authorised to perform some action on their behalf, with no reference to what that action is, or who the delegates are.

User guide to delegation

Source: contracts/DelegateApprovals.sol

Architecture

DelegateApprovals architecture graph

Details
  • FeePool: This contract allows the fee pool to delegate fee withdrawals.

  • Synthetix: This contract allows Synthetix to delegate issuing Synths, Burning Synths and exchanging Synths.

Variables

APPROVE_ALL

Source

Type: bytes32

BURN_FOR_ADDRESS

Source

Type: bytes32

CLAIM_FOR_ADDRESS

Source

Type: bytes32

EXCHANGE_FOR_ADDRESS

Source

Type: bytes32

ISSUE_FOR_ADDRESS

Source

Type: bytes32

eternalStorage

Source

Type: contract EternalStorage

Constructor

constructor

Source

Initialises the inherited State instance.

Details

Signature

constructor(address _owner, contract EternalStorage _eternalStorage)

Visibility

public

State Mutability

``

Views

approvedAll

Source

Details

Signature

approvedAll(address authoriser, address delegate) view returns (bool)

Visibility

public

State Mutability

view

canBurnFor

Source

Details

Signature

canBurnFor(address authoriser, address delegate) view returns (bool)

Visibility

external

State Mutability

view

canClaimFor

Source

Details

Signature

canClaimFor(address authoriser, address delegate) view returns (bool)

Visibility

external

State Mutability

view

canExchangeFor

Source

Details

Signature

canExchangeFor(address authoriser, address delegate) view returns (bool)

Visibility

external

State Mutability

view

canIssueFor

Source

Details

Signature

canIssueFor(address authoriser, address delegate) view returns (bool)

Visibility

external

State Mutability

view

Restricted Functions

setEternalStorage

Source

Details

Signature

setEternalStorage(contract EternalStorage _eternalStorage)

Visibility

external

State Mutability

``

Requires

Modifiers

Emits

Internal Functions

_checkApproval

Source

Details

Signature

_checkApproval(bytes32 action, address authoriser, address delegate) view returns (bool)

Visibility

internal

State Mutability

view

_getKey

Source

Details

Signature

_getKey(bytes32 _action, address _authoriser, address _delegate) pure returns (bytes32)

Visibility

internal

State Mutability

pure

_setApproval

Source

Details

Signature

_setApproval(bytes32 action, address authoriser, address delegate)

Visibility

internal

State Mutability

``

Requires

Emits

_withdrawApproval

Source

Details

Signature

_withdrawApproval(bytes32 action, address authoriser, address delegate)

Visibility

internal

State Mutability

``

External Functions

approveAllDelegatePowers

Source

Details

Signature

approveAllDelegatePowers(address delegate)

Visibility

external

State Mutability

``

approveBurnOnBehalf

Source

Details

Signature

approveBurnOnBehalf(address delegate)

Visibility

external

State Mutability

``

approveClaimOnBehalf

Source

Details

Signature

approveClaimOnBehalf(address delegate)

Visibility

external

State Mutability

``

approveExchangeOnBehalf

Source

Details

Signature

approveExchangeOnBehalf(address delegate)

Visibility

external

State Mutability

``

approveIssueOnBehalf

Source

Details

Signature

approveIssueOnBehalf(address delegate)

Visibility

external

State Mutability

``

removeAllDelegatePowers

Source

Details

Signature

removeAllDelegatePowers(address delegate)

Visibility

external

State Mutability

``

removeBurnOnBehalf

Source

Details

Signature

removeBurnOnBehalf(address delegate)

Visibility

external

State Mutability

``

removeClaimOnBehalf

Source

Details

Signature

removeClaimOnBehalf(address delegate)

Visibility

external

State Mutability

``

removeExchangeOnBehalf

Source

Details

Signature

removeExchangeOnBehalf(address delegate)

Visibility

external

State Mutability

``

removeIssueOnBehalf

Source

Details

Signature

removeIssueOnBehalf(address delegate)

Visibility

external

State Mutability

``

Events

Approval

Source

The delegate was approved to act on the authoriser's behalf for the given action.

Signature: Approval(address authoriser, address delegate, bytes32 action)

EternalStorageUpdated

Source

The address of the eternal storage contract has changed.

Signature: EternalStorageUpdated(address newEternalStorage)

WithdrawApproval

Source

The delegate was disapproved to act on the authoriser's behalf.

Signature: WithdrawApproval(address authoriser, address delegate, bytes32 action)