Skip to content

Model Info Mediation

bradreevmx edited this page Jul 13, 2018 · 1 revision

Mediation provides a method to recover control of Model records in which the current set of administrators are unresponsive. When a Model record 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 record 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 model record shall enter the "MediationStateInMediation" state once the first mediator submits a new AdminId using the WriteMediatorAdmin API. The model record 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
address ModelId ModelId for the model.
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 ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507";
var Index = 0;
var MediatorId = "0x1bbe4a661fdcb10ccc698ff484549555513684dc";
ModelInfo.WriteMediator(ModelId, Index, AdminId, {AdminId,gas:470000});

ReadMediatorList

Description

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

Input Parameters

Type Name Description
address ModelId ModelId for the model.

Return Values

Type Name Description
address[] MediatorList List of mediators

Example

var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507";
ModelInfo.ReadMediatorList(ModelId);
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 model record exits mediation.

Input Parameters

Type Name Description
address ModelId ModelId for the model.
uint Index Mediator list index
address AdminId Nominated AdminId from the mediator

Return Values

Type Name Description
bool Status True if successful

Example

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

ReadMediatorAdminList

Description

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

Input Parameters

Type Name Description
address ModelId ModelId for the model.

Return Values

Type Name Description
address[] Adminlist List of AdminIds

Example

var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507";
ModelInfo.ReadMediatorAdminList(ModelId);
0x2ce23c3c4692079c1eba9ffce2b7175fa43d106e,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000

ReadMediationState

Description

Return the current Mediation State for the model record. Any user may call this function. The defined states are:

State Description
0 MediationStateNormal
1 MediationStateInMediation
2 MediationStateReadyForNewAdmin

Input Parameters

Type Name Description
address ModelId ModelId for the model.

Return Values

Type Name Description
uint MediationState Current mediation state for the Model record

Example

var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507";
ModelInfo.ReadMediatorState(ModelId);
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 Model record back to "MediationStateNormal" through the ExitMediationState API.

Input Parameters

Type Name Description
address ModelId ModelId for the model.

Return Values

Type Name Description
bool Status True if successful

Example

var ModelId = "0xbd4d579e0819c4ab3d1b6d59b8429218fc923507";
ModelInfo.ExitMediationState(ModelId,{AdminId,gas:470000});

Clone this wiki locally