Skip to content

ZigBee Mediation

bradreevmx edited this page Jul 13, 2018 · 1 revision

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.

APIs

WriteMediator
ReadMediatorList
WriteMediatorAdmin
ReadMediatorAdminList
ReadMediationState
ExitMediationState


WriteMediator

Description

The WriteMediator shall be called by any Admin on the AdminList to add/modify the list of mediators.

Input Parameters

Type Name Description
uint Index Mediator list index
address MediatorId Mediator ID to be added to the list

Return Values

Type Name Description
bool Status True if successful

Example

var Index = 0;
var MediatorId = "0x1bbe4a661fdcb10ccc698ff484549555513684dc";
ZigBee.WriteMediator(Index, AdminId, {AdminId,gas:470000});

ReadMediatorList

Description

Return the list of Mediators for the contract. Any user may call this function.

Input Parameters

Type Name Description
NULL NULL NULL

Return Values

Type Name Description
address[] MediatorList List of mediators

Example

ZigBee.ReadMediatorList();
0x2ce23c3c4692079c1eba9ffce2b7175fa43d106e,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000

WriteMediatorAdmin

Description

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.

Input Parameters

Type Name Description
uint Index Mediator list index
address AdminId Nominated AdminId from the mediator

Return Values

Type Name Description
bool Status True if successful

Example

var Index = 0;
var AdminId = "0x1bbe4a661fdcb10ccc698ff484549555513684dc";
ZigBee.WriteMediatorAdmin(Index, AdminId, {MediatorId,gas:470000});

ReadMediatorAdminList

Description

Return the list of AdminIds contained in the MediatorAdminList for the contract. Any user may call this function.

Input Parameters

Type Name Description
NULL NULL NULL

Return Values

Type Name Description
address[] Adminlist List of AdminIds

Example

ZigBee.ReadMediatorAdminList();
0x2ce23c3c4692079c1eba9ffce2b7175fa43d106e,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000

ReadMediationState

Description

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

Input Parameters

Type Name Description
NULL NULL NULL

Return Values

Type Name Description
uint MediationState Current mediation state for the contract

Example

ZigBee.ReadMediatorState();
0

ExitMediationState

Description

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.

Input Parameters

Type Name Description
null null null

Return Values

Type Name Description
bool Status True if successful

Example

ZigBee.ExitMediationState({AdminId,gas:470000});

Clone this wiki locally