An open API service indexing awesome lists of open source software.

https://github.com/valiantlynx/variant

Val coin. A decentralized coin for trading in the nft marketplace(openval), anime&manga website(animevariant.com) as well as all future websites from variantlynx.)
https://github.com/valiantlynx/variant

blockchain decentralized marketplace nft

Last synced: 4 months ago
JSON representation

Val coin. A decentralized coin for trading in the nft marketplace(openval), anime&manga website(animevariant.com) as well as all future websites from variantlynx.)

Awesome Lists containing this project

README

        

# variant_backend

Welcome to your new variant_backend project and to the internet computer development community. By default, creating a new project adds this README and some template files to your project directory. You can edit these template files to customize your project and to include your own code to speed up the development cycle.

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 variant_backends.

To learn more before you start working with variant_backend, see the following documentation available online:

- [Quick Start](https://sdk.dfinity.org/docs/quickstart/quickstart-intro.html)
- [SDK Developer Tools](https://sdk.dfinity.org/docs/developers-guide/sdk-guide.html)
- [Motoko Programming Language Guide](https://sdk.dfinity.org/docs/language-guide/motoko.html)
- [Motoko Language Quick Reference](https://sdk.dfinity.org/docs/language-guide/language-manual.html)
- [JavaScript API Reference](https://erxue-5aaaa-aaaab-qaagq-cai.raw.ic0.app)

If you want to start working on your project right away, you might want to try the following commands:

```bash
cd variant_backend/
dfx help
dfx config --help
```

## Running the project locally

If you want to test your project locally, you can use the following commands:

```bash
# Starts the replica, running in the background
dfx start --background

# Deploys your canisters to the replica and generates your candid interface
dfx deploy
```

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

```bash
npm 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:

- set`NODE_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

# Check your Balance

1. Find out your principal id:

```
dfx identity get-principal
```

2. Save it somewhere.

e.g. My principal id is: 7ifjt-pl5fu-m3gxd-v4moj-ac6g2-mydtb-hbypc-m2dam-jm5lt-orrmh-hqe

3. Format and store it in a command line variable:
```
OWNER_PUBLIC_KEY="principal \"$( \dfx identity get-principal )\""
```

4. Check that step 3 worked by printing it out:
```
echo $OWNER_PUBLIC_KEY
```

5. Check the owner's balance:
```
dfx canister call variant_backend balanceOf "( $OWNER_PUBLIC_KEY )"
```

# Charge the Canister

1. Check canister ID:
```
dfx canister id variant_backend
```

2. Save canister ID into a command line variable:
```
CANISTER_PUBLIC_KEY="principal \"$( \dfx canister id variant_backend )\""
```

3. Check canister ID has been successfully saved:
```
echo $CANISTER_PUBLIC_KEY
```

4. Transfer half a billion variant_backends to the canister Principal ID:
```
dfx canister call variant_backend transfer "($CANISTER_PUBLIC_KEY, 500_000_000)"
```

# Deploy the Project to the Live IC Network

1. Create and deploy canisters:

```
dfx deploy --network ic
```

2. Check the live canister ID:
```
dfx canister --network ic id variant_backend
```

3. Save the live canister ID to a command line variable:
```
LIVE_CANISTER_KEY="principal \"$( \dfx canister --network ic id variant_backend )\""
```

4. Check that it worked:
```
echo $LIVE_CANISTER_KEY
```

5. Transfer some variant_backends to the live canister:
```
dfx canister --network ic call variant_backend transfer "($LIVE_CANISTER_KEY, 50_000_000)"
```

6. Get live canister front-end id:
```
dfx canister --network ic id variant_frontend
```
7. Copy the id from step 6 and add .raw.ic0.app to the end to form a URL.
e.g. 5ilw3-6iaaa-aaaak-acxbq-cai.raw.ic0.app

# To Deploy

1. Find out your principal id:

```
dfx identity get-principal
```

2. Replace the in main.mo with the principal you got from step 1.

```
let owner : Principal = Principal.fromText("7ifjt-pl5fu-m3gxd-v4moj-ac6g2-mydtb-hbypc-m2dam-jm5lt-orrmh-hqe");
```

3. Open up a new terminal in this VSCode project and deploy the variant_backend canister:

```
dfx deploy
```

4. Start the frontend:

```
npm start
```

5. Set the canister id to a local variable:

```
CANISTER_PUBLIC_KEY="principal \"$( \dfx canister id variant_backend )\""
```

6. Transfer half a billion variant_backends to the canister Principal ID:

```
dfx canister call variant_backend transfer "($CANISTER_PUBLIC_KEY, 500_000_000)"
```

7. Claim the variant_backends from the faucet on the frontend website.

8. Get variant_backend canister id:

```
dfx canister id variant_backend
```

add my principal as controller from wallet
dfx canister --network ic --wallet rno2w-sqaaa-aaaaa-aaacq-cai update-settings --add-controller 7ifjt-pl5fu-m3gxd-v4moj-ac6g2-mydtb-hbypc-m2dam-jm5lt-orrmh-hqe --all