Denota
  • Introduction
    • 🐐Revolutionizing Crypto Escrows
      • 🧘‍♂️Our Journey
      • 🔭Our Vision
    • 🟣Denota Protocol
      • 🏦The Nota Registrar
      • ✉️The Nota Primitive
      • 🪝Nota Hooks
      • 🌱Our Ecosystem
      • 🤔Use-cases
    • ⛓️Denota SDK
    • 💸NotaPay App
  • Integration/Development
    • 🤓Protocol Reference
      • 🏗️NotaRegistrar
      • 🏡Contract Addresses
    • 😎SDK Reference
  • Release Notes
    • 🔁SDK Updates
  • Support/Feedback
    • 📬Contact Us
Powered by GitBook
On this page

Was this helpful?

  1. Integration/Development
  2. Protocol Reference

NotaRegistrar

The guts of the protocol

PreviousProtocol ReferenceNextContract Addresses

Last updated 1 year ago

Was this helpful?

The full code can be seen on our .

Abbreviated Code

Here is the structure of the main functions that explain how the registrar works in simpler terms.

contract NotaRegistrar {

    // Mint a Nota and escrow tokens inside
    function write(currencyAddress, escrowedAmount, instantAmount, ownerAddress, hookAddress, hookBytes) {
        validateWrite(currencyAddress, hookAddress);
        
        // Reverts on validation OR hookBytes is stored on the hook
        hookFee = hookAddress.beforeWrite();
        
        transferEscrowAndInstantTokens();
        mintNotaToOwner();
        increaseHookRevenue();
        
        emit Write();
        return incrementedTotalSupply();
    }

    // Transfer your Nota to another owner
    function safeTransferFrom(fromAddress, toAddress, notaId, hookBytes) {
        // Reverts on validation OR hookBytes is stored on the hook
        hookFee = nota.hook.beforeTransfer();
        
        reduceNotaEscrow();
        increaseHookRevenue();
        ERC721.safeTransferFrom();
    }

    // Add more tokens inside your Nota
    function fund(notaId, escrowAmount, instantAmount, hookBytes) {
        // Reverts on validation OR hookBytes is stored on the hook
        hookFee = nota.hook.beforeFund();

        transferEscrowAndInstantTokens();
        increaseNotaEscrow();
        increaseHookRevenue();
        
        emit Fund();
    }

    // Remove tokens from inside your Nota
    function cash(notaId, cashAmount, recipientAddress, hookBytes) {
        // Reverts on validation OR hookBytes is stored on the hook
        hookFee = nota.hook.beforeCash();

        decreaseNotaEscrow();
        unEscrowCashingAmount();
        increaseHookRevenue();

        emit Cash();
    }

    // Approve an address to transfer your Nota
    function approve(approvedAddress, notaId) {
        // Reverts on validation OR hookBytes is stored on the hook
        hookFee = nota.hook.beforeApprove();
        
        decreaseNotaEscrow();
        increaseHookRevenue();
        
        ERC721.approve();
    }

    // Get metadata about your Nota
    function tokenURI(notaId) {
        HookJSONString = nota.hook.beforeTokenURI();
        
        return constructNotaJSON(notaId, JSONString);
    }
}

Note that transferFrom() is the exact same as safeTransferFrom() but with empty bytes for the bytesData parameter.

🤓
🏗️
Github here