Skip to content

Determine whether to rename FlexVotingBase._selfDelegateΒ #88

@davidlaprade

Description

@davidlaprade

FlexVotingBase currently contains the following function:

  /// @dev Delegates the present contract's voting rights with `GOVERNOR` to itself.
  function _selfDelegate() internal {
    IVotingToken(GOVERNOR.token()).delegate(address(this));
  }

But FlexVotingDelegable adds the ability to subdelegate -- i.e. for depositors to the client to allow other depositors to express voting preferences on their behalf within the client. To accomplish this, the contract adds functions like this:

  // @dev Delegates votes from the sender to `delegatee`.
  function delegate(address delegatee) public virtual {
    address account = _msgSender();
    _delegate(account, delegatee);
  }

  // @dev Returns the delegate that `account` has chosen. Assumes
  // self-delegation if no delegate has been chosen.
  function delegates(address _account) public view virtual returns (address) {
    address _proxy = _delegatee[_account];
    if (_proxy == address(0)) return _account;
    return _proxy;
  }

  // @dev Delegate all of `account`'s voting units to `delegatee`.
  //
  // Emits events {DelegateChanged} and {DelegateWeightChanged}.
  function _delegate(address account, address delegatee) internal virtual {
    address oldDelegate = delegates(account);
    _delegatee[account] = delegatee;

    int256 _delta = int256(uint256(_rawBalanceOf(account)));
    emit DelegateChanged(account, oldDelegate, delegatee);
    _updateDelegateBalance(oldDelegate, delegatee, _delta);
  }

This could potentially be confusing, given that both contracts refer to "delegates" but mean different things (i.e. voting token delegation vs flex client delegation).

Is this actually a problem, or are we just imagining it? Should we update function names to clarify, and if so, how?

If we do decide that function names should be updated, one idea would be to update FlexVotingDelegable so that functions become subdelegate, subdelegates, and _subdelegate

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions