The Nota Primitive
Notas can function as proof of funds, proof of prior payments, or invoices to request payments. The primary Nota contract stores the deposited funds and NFT metadata, utilizing the widely recognized ERC721 standard. Notas can be collected, traded, aggregated, or used as collateral, among other functionalities. Representing payments as NFTs enables numerous use cases, including invoice factoring.
Notas can be minted by either the payer or the recipient of the funds. When the payer creates a nota, it acts as a payment receipt. If the recipient mints a nota, it serves as an invoice or request for payment, stating the requested amount but initially lacking funds. The payer can later fund the nota with the requested amount to complete the payment.
The Nota standard includes an interface that enables the implementation of custom logic in notas. Each nota refers to a module, which is a smart contract following the INotaModule standard. The module contains the logic that decides the status of the payment, which is separated from the primary Nota contract.
The module determines when a nota can be written, transferred, funded, or cashed, among other actions. The module's logic specifies conditions attached to the payment, such as allowing the buyer to unilaterally cancel the payment with a partial discount.
The
write
function is used to create a nota based on the provided module data.import { DirectPayData, write } from '@denota-labs/denota-sdk';
const directPayData: DirectPayData = {
moduleName: "direct",
type: "invoice",
creditor: "0x...",
debitor: "0x...",
};
const writeProps = {
currency: "DAI",
amount: 10,
metadata: { type: "raw", notes: "Example invoice" },
module: directPayData,
};
const result = await write(writeProps);
console.log(result);
Metadata can be attached in two forms. If the metadata has already been uploaded to IFPS, it can be attached to the nota:
const writeProps = {
currency: "DAI",
amount: 10,
metadata: { type: "uploaded", ipfsHash, imageUrl },
module: directPayData,
};
If the metadata hasn't been uploaded yet, it can be uploaded through the SDK:
const writeProps = {
currency: "DAI",
amount: 10,
metadata: {
type: "raw",
notes: "Example invoice",
file: exampleFile,
tags: "logo"
},
module: directPayData,
};
The
fund
function is used to fund a nota based on the nota ID.Usage:
import { fund } from '@denota-labs/denota-sdk';
const fundProps = {
notaId: "12345", // Replace with the actual nota ID
};
const result = await fund(fundProps);
console.log(result);
The
cash
function is used to move a payment out of escrow based on the nota ID and the action type ("reversal" or "release").import { cash } from '@denota-labs/denota-sdk';
const cashPaymentProps = {
notaId: "12345", // Replace with the actual nota ID
type: "release",
};
const result = await cash(cashPaymentProps);
console.log(result);
Coming soon
Last modified 8h ago