controlled delegation and set default delegate
This commit is contained in:
parent
03da756dfe
commit
fe7e4cdf7e
|
@ -1,13 +1,14 @@
|
||||||
pragma solidity >=0.5.0 <0.6.0;
|
pragma solidity >=0.5.0 <0.6.0;
|
||||||
|
|
||||||
import "../../deploy/InstanceAbstract.sol";
|
import "../../deploy/InstanceAbstract.sol";
|
||||||
|
import "../../common/Controlled.sol";
|
||||||
import "./Delegation.sol";
|
import "./Delegation.sol";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title DelegationAbstract
|
* @title DelegationAbstract
|
||||||
* @author Ricardo Guilherme Schmidt (Status Research & Development GmbH).
|
* @author Ricardo Guilherme Schmidt (Status Research & Development GmbH).
|
||||||
*/
|
*/
|
||||||
contract DelegationAbstract is InstanceAbstract, Delegation {
|
contract DelegationAbstract is InstanceAbstract, Controlled, Delegation {
|
||||||
struct DelegateSet {
|
struct DelegateSet {
|
||||||
uint96 fromBlock; //when this was updated
|
uint96 fromBlock; //when this was updated
|
||||||
address to; //who recieved this delegaton
|
address to; //who recieved this delegaton
|
||||||
|
|
|
@ -17,7 +17,7 @@ contract DelegationBase is DelegationAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice Changes the delegation of `msg.sender` to `_to`. if _to 0x00: delegate to self.
|
* @notice Changes the delegation of `msg.sender` to `_to`.
|
||||||
* In case of having a parent proxy, if never defined, fall back to parent proxy.
|
* 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.
|
* 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.
|
* @param _to To what address the caller address will delegate to.
|
||||||
|
@ -26,6 +26,16 @@ contract DelegationBase is DelegationAbstract {
|
||||||
updateDelegate(msg.sender, _to);
|
updateDelegate(msg.sender, _to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notice Changes the delegation of `address(0)` to `_to`.
|
||||||
|
* By default accounts delegate to `address(0)`.
|
||||||
|
* Therefore the delegate of `address(0)` is the default delegate of all accounts.
|
||||||
|
* @param _defaultDelegate default delegate address
|
||||||
|
*/
|
||||||
|
function setDefaultDelegate(address _defaultDelegate) external onlyController {
|
||||||
|
updateDelegate(address(0), _defaultDelegate);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notice Reads `_who` configured delegation in this level,
|
* @notice Reads `_who` configured delegation in this level,
|
||||||
* or from parent level if `_who` never defined/defined to parent address.
|
* or from parent level if `_who` never defined/defined to parent address.
|
||||||
|
|
Loading…
Reference in New Issue