---
description: 'visit: https://github.com/lunarspace/dERP.Frontend/'
---

# 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:&#x20;

* 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/**_](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.
