Deals
The Deals SDK offers developers a way to digitise commercial agreement term sheets and payment terms through smart contracts.
Create Deal
A deal is the representation of a term sheet with certain deliverables and associated payment schedules. Payments can have programmed rules attached for their release. Payments are initially locked into the vault upon the commencement of the agreement, prior to meeting the specific rules / tests allowing their release. Users can specify the value of the initial payments locked into the escrow function of the vault. This could be partial or complete collateralisation of the payments potentially due under the term sheet agreement.
The deal is created by the party expecting to be to be paid. Creation of the deal implied an acceptance to the terms by the payee, because otherwise, why would one create a deal with those terms?
Instructions
First, ensure you've imported the required libraries:
Instantiate the NotVault, Tokens, Files, and Deals classes:
This initialization is crucial for managing deals, tokens, and files within the NotVault.
Create a deal
These initialisations provide the necessary setup to manage deals, tokens, and files within the NotVault.
The create
method of the Deals
class is used to create a deal. It returns a deal_cid (content identifier) for the newly created deal. Provide the required parameters:
Token Address
: The address of the token to be used in the deal.Oracle Address
: The address of the oracle.An object containing deal details:
Deal Name
: The name of the deal.Email or Address
: The address of the recipient of the deal.Deal Description
: A description of the deal.notional
: The total amount of tokens involved in the deal.initial
: The initial amount to start the deal.unlock_sender
: The date when the sender can withdraw from the deal, represented in UNIX format.unlock_receiver
: The date when the receiver can withdraw from the deal, represented in UNIX format.Owner Address
: The address of the deal's owner.oracle_key
: The key provided by the oracle.oracle_value
: The value provided by the oracle.
An object representing deal's associated data:
created
: The creation timestamp.data
: The base64 encoded data of the file.name
: The name of the file.
Accept Deal
Once a deal has been created, the payor accepts the terms and payment schedule and creates a payment linked to the agreed upon initial collateral amount stated in the deal term sheet.
The accept
method of the Deals
class is used to accept a deal, and it returns a hash ID for the accepted deal. You need to provide the required parameters:
Token Address
: The address of the token being used in the deal.Email or Address
: The address of the recipient of the deal.token amount
: The amount of the token in the deal. The provided value is multiplied by 10^18 to account for the token's decimal places.deal ID
: A unique identifier for the deal.Oracle Address
: The address of the oracle.Owner Address
: The address of the owner.Oracle Value
: The value provided by the oracle.Oracle Key
: The key provided by the oracle.date when payer can withdraw
: The date when the payer can withdraw from the deal, represented in UNIX format.date when payee can withdraw
: The date when the payee can withdraw from the deal, also represented in UNIX format.
Last updated