-
Notifications
You must be signed in to change notification settings - Fork 0
ZigBee Mediation
Mediation provides a method to recover control of Compliance Contract in which the current set of administrators are unresponsive. When a Compliance Contract is first created, two to five mediators may be added by any of the users in the AdminList.
In order to enter mediation, the original owner of the contract shall request mediation from each mediator on the MediatorList. The owner must supply a new AdminId to the mediators, and the mediators must securely prove the request is valid, and the new AdminId belongs to the owner. The methods in which this occurs is not defined in this SmartContract.
The contract shall enter the "MediationStateInMediation" state once the first mediator submits a new AdminId using the WriteMediatorAdmin API. The contract shall enter the "MediationStateReadyForNewAdmin" state once all mediators have assigned the same AdminId. At this point, the new AdminId may be used to go back to the "MediationStateNormal" by calling the ExitMediationState API.
WriteMediator
ReadMediatorList
WriteMediatorAdmin
ReadMediatorAdminList
ReadMediationState
ExitMediationState
The WriteMediator shall be called by any Admin on the AdminList to add/modify the list of mediators.
| Type | Name | Description |
|---|---|---|
| uint | Index | Mediator list index |
| address | MediatorId | Mediator ID to be added to the list |
| Type | Name | Description |
|---|---|---|
| bool | Status | True if successful |
var Index = 0;
var MediatorId = "0x1bbe4a661fdcb10ccc698ff484549555513684dc";
ZigBee.WriteMediator(Index, AdminId, {AdminId,gas:470000});
Return the list of Mediators for the contract. Any user may call this function.
| Type | Name | Description |
|---|---|---|
| NULL | NULL | NULL |
| Type | Name | Description |
|---|---|---|
| address[] | MediatorList | List of mediators |
ZigBee.ReadMediatorList();
0x2ce23c3c4692079c1eba9ffce2b7175fa43d106e,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000
The Mediator contained in the MediatorList shall be allowed to nominate a new Admin by writing the suggested AdminId to the MediatorAdminList corresponding to the Mediator's Index in the MediatorList. The list is cleared once the contract exits mediation.
| Type | Name | Description |
|---|---|---|
| uint | Index | Mediator list index |
| address | AdminId | Nominated AdminId from the mediator |
| Type | Name | Description |
|---|---|---|
| bool | Status | True if successful |
var Index = 0;
var AdminId = "0x1bbe4a661fdcb10ccc698ff484549555513684dc";
ZigBee.WriteMediatorAdmin(Index, AdminId, {MediatorId,gas:470000});
Return the list of AdminIds contained in the MediatorAdminList for the contract. Any user may call this function.
| Type | Name | Description |
|---|---|---|
| NULL | NULL | NULL |
| Type | Name | Description |
|---|---|---|
| address[] | Adminlist | List of AdminIds |
ZigBee.ReadMediatorAdminList();
0x2ce23c3c4692079c1eba9ffce2b7175fa43d106e,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000
Return the current Mediation State for the contract. Any user may call this function.
The defined states are:
| State | Description |
|---|---|
| 0 | MediationStateNormal |
| 1 | MediationStateInMediation |
| 2 | MediationStateReadyForNewAdmin |
| Type | Name | Description |
|---|---|---|
| NULL | NULL | NULL |
| Type | Name | Description |
|---|---|---|
| uint | MediationState | Current mediation state for the contract |
ZigBee.ReadMediatorState();
0
Once all the mediators have submitted a new AdminId, and they all agree upon the same AdminId, then that AdminId may move the contract back to "MediationStateNormal" through the ExitMediationState API.
| Type | Name | Description |
|---|---|---|
| null | null | null |
| Type | Name | Description |
|---|---|---|
| bool | Status | True if successful |
ZigBee.ExitMediationState({AdminId,gas:470000});