dERP.Frontend

visit: https://github.com/lunarspace/dERP.Frontend/

The dERP.Frontend is an Angular CLI project built using Angular version 13.3.9. To set up the development environment, you'll need to install NodeJS (currently using version 16.14.2), run npm i to install the project dependencies, and edit your hosts file to include the following IP addresses:

  • 127.0.0.1 sandbox.test-portal.com

  • 127.0.0.1 lsi.test-portal.com

To spin up the dev server, run npm run dev:lsi and navigate to http://lsi.test-portal.com:4200/. The code formatting can be handled using npm run prettier:write and linting errors can be checked with npm run lint.

Unit tests can be run using ng test, while end-to-end tests can be run using ng e2e. However, to use the ng e2e command, you'll need to add a package that implements end-to-end testing capabilities.

dERP Base Contract

The dERP Base Contract is a smart contract that is instantiated for each company onboarded to dERP. This contract is responsible for managing user/admin access and minting dERP Soulbound Tokens (SBTs).

dERP SBT Contract

The dERP SBT Contract is a standalone contract that handles the minting of SBTs and SBT authentication. The SBT Contract uses a custom CW721 to mint SBTs and authenticate users who are trying to log in.

Contract Relationship

The dERP Base Contract and the dERP SBT Contract are smart contracts that are used to manage and interact with the dERP platform. Both contracts use the JSON-Schema to define the contract's structure and the input/output parameters for each function. The dERP Base Contract uses Rust, TypeScript and Shell code, in order to provide the necessary functionality for the platform.

Instantiation

The dERP Base Contract has an instantiate function that takes in several required parameters such as the denomination of the token, the ID of the contract, the owner of the contract, the SBT address of the contract and the URL of the contract. The execute function of the dERP Base Contract allows for several different actions to be taken, such as minting new SBT, setting the SBT address, changing the owner, creating a user, archiving a user, unarchiving a user, enabling admin access, disabling admin access, adding a minter, and removing a minter. Each of these actions takes in specific required parameters, such as the address of the user for actions like creating a user or changing the owner.

The dERP SBT Contract also has an instantiate function that takes in three required parameters, the admin of the SBT, the name of the SBT and the symbol of the SBT. The execute function of the dERP SBT Contract allows for several different actions to be taken, such as minting new SBT, adding a minter, and removing a minter. The mint action takes in an owner and 'token_uri' as required parameters. The 'add_minter' and 'remove_minter' actions take in the minter address as a required parameter.

Querying

The query function of the dERP SBT Contract has several query options, such as 'holds_sbt', 'owner_of', 'total_supply' and 'metadata_of', each of which return different information about the SBT. The holds_sbt query takes in an address as a parameter and returns a boolean indicating if the address holds any of the SBT. The 'owner_of' query takes in a token ID as a parameter and returns the address of the owner of that specific token. The 'total_supply' query returns the total number of tokens currently in circulation. The 'metadata_of' query takes in a token ID as a parameter and returns the metadata associated with that specific token.

Cosmos SDK

Both contracts use the Cosmos SDK, a modular blockchain development framework, to perform the necessary functions and interactions with the blockchain. The Cosmos SDK provides a set of modules that can be used to perform various functions such as governance, staking, and token transfer. The dERP Base Contract and dERP SBT Contract both utilize the Cosmos SDK to interact with the blockchain and perform the necessary actions.

Last updated