Skip to content

An implementation of the business logic of the English Auction for NFTs, built on the ICP

Notifications You must be signed in to change notification settings

Kryha/NFT-english-auction

Repository files navigation

Veiling

To get started, you might want to explore the project directory structure and the default configuration file. Working with this project in your development environment will not affect any production deployment or identity tokens.

To learn more before you start working on Veiling, see the following documentation available online:

Before you start

There are a few steps to perform in order to set up the project before running it. Let's take a look.

Motoko dependencies (skip this part)

In order to be able to install Motoko dependencies you have to download Vessel package manager first. The steps are the following (assuming you are using Linux or MacOS):

  1. Go to Vessel releases page and download the latest one for your OS
  2. Open the terminal and cd inside the directory where the file has been dowloaded (e.g. Downloads)
  3. Run the following commands:
# "vessel-linux64" if you are on Linux
mv vessel-macos vessel
mv vessel /usr/local/bin
chmod 774 /usr/local/bin/vessel
  1. Close and re-open the terminal
  2. Run vessel --version, it should output the Vessel version you are currently using
  3. Congratulations! You managed to install Vessel!

NPM dependencies

Make sure you have yarn installed on your system, open the terminal in the project root directory and run yarn command in order to install the node modules.

Create an identity

To create and use a new identity, run the following:

dfx identity new admin
dfx identity use admin

Running the project locally

Starting and stopping the server

Before deploying the canisters locally, you have to start the dfx server:

# Starts the local replica, running in the background
dfx start

# Sometimes you may also want to clean things up if stuff is not working properly
dfx start --clean

After you are done, you can stop the server with:

dfx stop

Running internet identity canister locally

In order to be able to authenticate with your local deployment, you have to run internet-identity canister locally, on the same running server as Veiling.

The steps to run it properly are as follow:

  1. Make sure you started the server from the Veiling root directory.
  2. Make sure you have properly installed Rust on your computer.
  3. Clone or download the internet-identity repo in a directory external to this project.
  4. cd inside the internet-identity directory and run:
npm install
  1. After run:
npm ci
  1. Build and deploy everything with the following command (the first build may take a while):
II_FETCH_ROOT_KEY=1 dfx deploy --no-wallet --argument '(null)'

Running IC ledger locally

Follow these steps. You can skip the first 4 steps.

You can also just run make ledger, but first read the comments in Makefile.

Deploying the application

Run the following command to create the canisters:

make create

Run the following command to build and deploy the actors on the canisters:

make deploy

If you want to redeploy after doing some changes to a particular canister you can just run:

make upgrade

Or you can run:

make <canister_name>

Once the job completes, your application will be available at http://localhost:8000?canisterId={asset_canister_id}.

Additionally, if you are making frontend changes, you can start a development server with

npm start

or you can use

yarn start

Which will start a server at http://localhost:8080, proxying API requests to the replica at port 8000.

Note on frontend environment variables

If you are hosting frontend code somewhere without using DFX, you may need to make one of the following adjustments to ensure your project does not fetch the root key in production:

  • setNODE_ENV to production if you are using Webpack
  • use your own preferred method to replace process.env.NODE_ENV in the autogenerated declarations
  • Write your own createActor constructor

Testing the backend

In order to run the tests, you must have at least 2 actors and run:

# the provided principal must be different from the one used to deploy the cannisters
dfx canister call test run "(principal \"mr2qb-wnilp-33aar-ep7ht-jqv4z-5ocdt-mmz2c-tm3of-2vt7q-bjf5i-6ae\")"

About

An implementation of the business logic of the English Auction for NFTs, built on the ICP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published