List of methods provided by blockchain SDK

purchase

Purchasing a product in MTO ecosystem. During purchase, user does not need to call the approve method externally. It's done by the SDK itself. (Customer method)

async purchase(
    _productId: number,
    _merchantAddress: string,
    _amount: number,
    _escrowDisputableTime: number,
    _escrowWithdrawableTime: number,
    blockchainSpecificParams?: BlockchainSpecificParams,
    overrides?: Overrides & { from?: string | Promise<string> }
  )

approve

Approve MTO token to escrow contract. (Customer, Agent method)

async approve(
    _amount: number,
    blockchainSpecificParams?: BlockchainSpecificParams,
    overrides?: Overrides & { from?: string | Promise<string> }
  )

startDispute

Place a dispute by a customer. (Customer method)

startDispute(
    _escrowId: number,
    blockchainSpecificParams?: BlockchainSpecificParams,
    overrides?: Overrides & { from?: string | Promise<string> }
  )

applyADM

Apply Automation Dispute Management for the dispute. (Admin method)

applyADM(
    _disputeId: number,
    _decision: number,
    blockchainSpecificParams?: BlockchainSpecificParams,
  )

participate

Agent participates in a dispute to give his judgment. (Agent method)

participate(
    blockchainSpecificParams?: BlockchainSpecificParams,
    overrides?: Overrides & { from?: string | Promise<string> }
)

transferOwnership

Change ownership of the gateway contract. (admin method)

transferOwnership(
    newOwner: string,
    blockchainSpecificParams?: BlockchainSpecificParams,
    overrides?: Overrides & { from?: string | Promise<string> }
  )

resetAgentPaticipateAmount

Amount needed for an agent to participate in a dispute. (admin method)

resetAgentPaticipateAmount(
    _newAgentPaticipateAmount: number,
    blockchainSpecificParams?: BlockchainSpecificParams,
    overrides?: Overrides & { from?: string | Promise<string> }
  )

submit

agent submits his decision in a dispute. (agent method).

// Decision values
uint256 constant _APPROVED = 4;
uint256 constant _DISAPPROVED = 5;

submit(
    _disputeId: number,
    _decision: number,
    blockchainSpecificParams?: BlockchainSpecificParams,
    overrides?: Overrides & { from?: string | Promise<string> }
  )

withdraw

The amount is withdrawn by a merchant after a successful escrow. (merchant method)

withdraw(
    _escrowId: number,
    blockchainSpecificParams?: BlockchainSpecificParams,
    overrides?: Overrides & { from?: string | Promise<string> }
  )

adminWithdrawToken

In case, the admin needs to withdraw MTO from the gateway contract. (admin method)

 adminWithdrawToken(
    _amount: number,
    blockchainSpecificParams?: BlockchainSpecificParams,
    overrides?: Overrides & { from?: string | Promise<string> }
  )

agentWithdraw

An agent will withdraw his earnings after a successful dispute is completed. (agent method)

agentWithdraw(
    blockchainSpecificParams?: BlockchainSpecificParams,
    overrides?: Overrides & { from?: string | Promise<string> }
  )

pickDispute

An agent will pick a dispute randomly from the list displayed after participate. (agent method)

 pickDispute(
    _disputeId: number,
    blockchainSpecificParams?: BlockchainSpecificParams,
    overrides?: Overrides & { from?: string | Promise<string> }
  )

pickDispute

An agent will pick a dispute randomly from the list displayed after participating. (agent method)

 pickDispute(
    _disputeId: number,
    blockchainSpecificParams?: BlockchainSpecificParams,
    overrides?: Overrides & { from?: string | Promise<string> }
  )

resetCriteriaScore

Reset the minimum score an agent must have to pick a dispute. Default value 70. (admin method)

resetCriteriaScore(
    _newCriteriaScore: number,
    blockchainSpecificParams?: BlockchainSpecificParams,
    overrides?: Overrides & { from?: string | Promise<string> }
  )

resetDisputeBonusAmount

Reset the bonus amount an agent will get after successful escrow. Default value 10. (admin method)

resetDisputeBonusAmount(
    _newDisputeBonusAmount: number,
    blockchainSpecificParams?: BlockchainSpecificParams,
    overrides?: Overrides & { from?: string | Promise<string> }
  )

resetDisputeReviewConsensusCount

Reset disputeReviewConsensusCount, the minimum number of agents to give the same decision for a dispute. Default value 3. (admin method)

resetDisputeReviewConsensusCount(
    _newDisputeReviewConsensusCount: number,
    blockchainSpecificParams?: BlockchainSpecificParams,
    overrides?: Overrides & { from?: string | Promise<string> }
  )

resetDisputeReviewConsensusCount

Reset disputeReviewGroupCount. The number of agents can participate in a dispute. Default value 5. (admin method)

resetDisputeReviewGroupCount(
    _newDisputeReviewGroupCount: number,
    blockchainSpecificParams?: BlockchainSpecificParams,
    overrides?: Overrides & { from?: string | Promise<string> }
  ):

resetInitialAgentScore

Reset initialAgentScore. Default value 100. (admin method)

resetInitialAgentScore(
    _newInitialAgentScore: number,
    blockchainSpecificParams?: BlockchainSpecificParams,
    overrides?: Overrides & { from?: string | Promise<string> }
  )

resetScoreDown

Reset scoreDown. Default value 10. (admin method)

resetScoreDown(
    _newScoreDown: number,
    blockchainSpecificParams?: BlockchainSpecificParams,
    overrides?: Overrides & { from?: string | Promise<string> }
  )

resetScoreUp

Reset scoreUp. Default value 10. (admin method)

resetScoreUp(
    _newScoreUp: number,
    blockchainSpecificParams?: BlockchainSpecificParams,
    overrides?: Overrides & { from?: string | Promise<string> }
  )

resetTokenAddress

Reset token. The gateway supported the MTO token address. (admin method)

resetTokenAddress(
    _newTokenAddress: string,
    blockchainSpecificParams?: BlockchainSpecificParams,
    overrides?: Overrides & { from?: string | Promise<string> }
  )

getMerchantReputation

Calculate and pick the merchant's reputation. If reputation is greater than 50% then admin can appy the ADM. (admin method)

getMerchantReputation(
    _merchantAddress: string,
    blockchainSpecificParams?: BlockchainSpecificParams,
    overrides?: CallOverrides
  )

getMerchantReputation

The amount needed by an agent to participate in a dispute. (agent method)

agentPaticipateAmount(overrides?: CallOverrides)

criteriaScore

Get criteriaScore. An agent should have a minimum score to participate in a dispute. (agent method)

criteriaScore(overrides?: CallOverrides)

disputeBonusAmount

Get disputeBonusAmount. (agent method)

disputeBonusAmount(overrides?: CallOverrides)

disputeReviewConsensusCount

Get disputeReviewConsensusCount. (agent method)

disputeReviewConsensusCount(overrides?: CallOverrides)

disputeReviewGroupCount

Get disputeReviewGroupCount. (agent method)

disputeReviewGroupCount(overrides?: CallOverrides)

initialAgentScore

Get initialAgentScore. (agent method)

initialAgentScore(overrides?: CallOverrides)

getTokenBalance

Get user token balance.

getTokenBalance()

getEscrowById

Get escrow detail by id.

getEscrowById( _escrowId: number,  overrides?: CallOverrides)