HaiDelegatee

Git Source

Inherits: IHaiDelegatee, Ownable

This contract is used to proxy the voting power delegated to it to a delegatee

Compatible with OpenZeppelin's Governor contract

State Variables

delegatee

Get the address of the delegatee of the contract

address public delegatee;

Functions

constructor

constructor(address _owner) Ownable(_owner);

setDelegatee

Set the delegatee of the contract

function setDelegatee(address _delegatee) external onlyOwner;

Parameters

NameTypeDescription
_delegateeaddressThe address of the new delegatee

castVote

Cast a vote using the voting power delegated to this contract

function castVote(
  IGovernor _governor,
  uint256 _proposalId,
  uint8 _support
) public onlyDelegatee returns (uint256 _weight);

Parameters

NameTypeDescription
_governorIGovernorThe governor contract to vote on
_proposalIduint256The id of the proposal
_supportuint8The vote type

Returns

NameTypeDescription
_weightuint256The weight of the vote

castVoteWithReason

Cast a vote with reason using the voting power delegated to this contract

function castVoteWithReason(
  IGovernor _governor,
  uint256 _proposalId,
  uint8 _support,
  string memory _reason
) public onlyDelegatee returns (uint256 _weight);

Parameters

NameTypeDescription
_governorIGovernorThe governor contract to vote on
_proposalIduint256The id of the proposal
_supportuint8The vote type
_reasonstringThe reason for the vote

Returns

NameTypeDescription
_weightuint256The weight of the vote

castVoteWithReasonAndParams

Cast a vote with reason and params using the voting power delegated to this contract

function castVoteWithReasonAndParams(
  IGovernor _governor,
  uint256 _proposalId,
  uint8 _support,
  string memory _reason,
  bytes memory _params
) public onlyDelegatee returns (uint256 _weight);

Parameters

NameTypeDescription
_governorIGovernorThe governor contract to vote on
_proposalIduint256The id of the proposal
_supportuint8The vote type
_reasonstringThe reason for the vote
_paramsbytesThe params for the vote

onlyDelegatee

modifier onlyDelegatee();