ErasureAgreement

ErasureAgreement

new ErasureAgreement(config)

Parameters:
Name Type Description
config Object
Properties
Name Type Description
type 'simple' | 'countdown'
staker address
counterparty address
web3Provider Object
protocolVersion string
agreementAddress address

Methods

(static) contract() → {Object}

Access the web3 contract class
Returns:
contract object
Type
Object

(static) address() → {address}

Get the address of this agreement
Returns:
address of the agreement
Type
address

(static) type() → {'simple'|'countdown'}

Get the type of this agreement (simple | countdown)
Returns:
type of the agreement
Type
'simple' | 'countdown'

(static) staker() → {address}

Get the address of the staker of this agreement
Returns:
address of the staker
Type
address

(static) counterparty() → {address}

Get the address of the counterparty of this agreement
Returns:
address of the counterparty
Type
address

(static) stake(amount) → {Promise}

Called by staker to increase the stake
Parameters:
Name Type Description
amount string amount by which to increase the stake
Returns:
transaction receipt
Type
Promise

(static) reward(amount) → {Promise}

Called by counterparty to increase the stake
Parameters:
Name Type Description
amount string amount by which to increase the stake (in NMR)
Returns:
transaction receipt
Type
Promise

(static) punish(amount, message) → {Promise|Promise}

Called by counterparty to burn some stake
Parameters:
Name Type Description
amount string punishment amount to burn from the stake (in NMR)
message string message to indicate reason for the punishment
Returns:
  • amount it cost to punish
    Type
    Promise
  • transaction receipt
    Type
    Promise

(static) release(amount) → {Promise}

Called by counterparty to release the stake
Parameters:
Name Type Description
amount string amount to release from the stake (in NMR)
Returns:
transaction receipt
Type
Promise

(static) requestWithdraw() → {Promise|Promise}

Called by staker to start the countdown to withdraw the stake
Returns:
  • deadline timestamp when withdraw will be available
    Type
    Promise
  • transaction receipts
    Type
    Promise

(static) withdraw(recipient) → {Promise|Promise}

Called by staker to withdraw the stake
Parameters:
Name Type Description
recipient address
Returns:
  • amount withdrawn
    Type
    Promise
  • transaction receipt
    Type
    Promise

(static) checkStatus() → {Promise}

Get the status of the agreement
Returns:
object with all relevant data
Type
Promise