2019-02-14 02:06:35 -02:00
|
|
|
pragma solidity >=0.5.0 <0.6.0;
|
2018-08-08 07:02:03 -03:00
|
|
|
|
2019-02-14 10:41:11 -02:00
|
|
|
interface Delegation {
|
2018-08-08 07:02:03 -03:00
|
|
|
|
2019-02-14 10:41:11 -02:00
|
|
|
event Delegate(address who, address to);
|
2018-08-08 07:02:03 -03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @notice Changes the delegation of `msg.sender` to `_to`. if _to 0x00: delegate to self.
|
|
|
|
* In case of having a parent proxy, if never defined, fall back to parent proxy.
|
|
|
|
* If once defined and want to delegate to parent proxy, set `_to` as parent address.
|
|
|
|
* @param _to To what address the caller address will delegate to.
|
|
|
|
*/
|
2019-02-14 10:41:11 -02:00
|
|
|
function delegate(address _to) external;
|
2018-08-08 07:02:03 -03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @notice Reads `_who` configured delegation in this level,
|
|
|
|
* or from parent level if `_who` never defined/defined to parent address.
|
|
|
|
* @param _who What address to lookup.
|
|
|
|
* @return The address `_who` choosen delegate to.
|
2019-02-14 10:41:11 -02:00
|
|
|
*/
|
2018-08-08 07:02:03 -03:00
|
|
|
function delegatedTo(address _who)
|
2019-02-14 10:41:11 -02:00
|
|
|
external
|
2018-08-08 07:02:03 -03:00
|
|
|
view
|
2019-02-14 10:41:11 -02:00
|
|
|
returns (address directDelegate);
|
|
|
|
|
2018-08-08 07:02:03 -03:00
|
|
|
/**
|
|
|
|
* @notice Reads the final delegate of `_who` at block number `_block`.
|
|
|
|
* @param _who Address to lookup.
|
|
|
|
* @return Final delegate address.
|
|
|
|
*/
|
|
|
|
function delegationOf(address _who)
|
2019-02-14 10:41:11 -02:00
|
|
|
external
|
2018-08-08 07:02:03 -03:00
|
|
|
view
|
2019-02-14 10:41:11 -02:00
|
|
|
returns(address finalDelegate);
|
2018-08-08 07:02:03 -03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @notice Reads `_who` configured delegation at block number `_block` in this level,
|
|
|
|
* or from parent level if `_who` never defined/defined to parent address.
|
|
|
|
* @param _who What address to lookup.
|
|
|
|
* @param _block Block number of what height in history.
|
|
|
|
* @return The address `_who` choosen delegate to.
|
|
|
|
*/
|
|
|
|
function delegatedToAt(
|
|
|
|
address _who,
|
|
|
|
uint _block
|
|
|
|
)
|
2019-02-14 10:41:11 -02:00
|
|
|
external
|
2018-08-08 07:02:03 -03:00
|
|
|
view
|
2019-02-14 10:41:11 -02:00
|
|
|
returns (address directDelegate);
|
|
|
|
|
2018-08-08 07:02:03 -03:00
|
|
|
/**
|
|
|
|
* @notice Reads the final delegate of `_who` at block number `_block`.
|
|
|
|
* @param _who Address to lookup.
|
|
|
|
* @param _block From what block.
|
|
|
|
* @return Final delegate address.
|
|
|
|
*/
|
|
|
|
function delegationOfAt(
|
|
|
|
address _who,
|
|
|
|
uint _block
|
|
|
|
)
|
2019-02-14 10:41:11 -02:00
|
|
|
external
|
2018-08-08 07:02:03 -03:00
|
|
|
view
|
2019-02-14 10:41:11 -02:00
|
|
|
returns(address finalDelegate);
|
2018-08-08 07:02:03 -03:00
|
|
|
|
|
|
|
}
|