-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial sponsored transaction enabled auction
- Loading branch information
Showing
68 changed files
with
15,139 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Sponsored Transactions Auction Web Application | ||
|
||
This repository includes a dApp example of an auction. Users can bid for the items in the auction contract by using a sponsored-transaction-enabled token as a payment method (no CCD required in the user's wallet). The project has a front end and a back end. | ||
|
||
Clone the root repo with the following command: | ||
|
||
```shell | ||
git clone --recurse-submodules [email protected]:Concordium/concordium-dapp-examples.git | ||
``` | ||
|
||
or | ||
```shell | ||
git clone --recurse-submodules https://github.com/Concordium/concordium-dapp-examples.git | ||
``` | ||
|
||
To set up the project locally, complete the steps in the `README.md` file in the `sponsoredTransactions/frontend` folder and then complete the steps in the `README.md` file in the `sponsoredTransactions/backend` folder. | ||
|
||
Alternatively, follow the steps to deploy the docker container below. This docker container will set up the frontend as well as the backend. | ||
|
||
## Run as docker | ||
|
||
Add your `ACCOUNT_KEY_FILE` to the repository's root folder and run the dockerfile from the repository's root folder with the command: | ||
```shell | ||
docker build -t sponsored_transactions -f sponsoredTransactions/Dockerfile . | ||
``` | ||
|
||
|
||
The image can then be run with: | ||
```shell | ||
docker run -p 8080:8080 --mount type=bind,source="$(pwd)"/<ACCOUNT_KEY_FILE>,target=/KEY_FILE,readonly sponsored_transactions | ||
``` | ||
|
||
e.g. | ||
|
||
```shell | ||
docker run -p 8080:8080 --mount type=bind,source="$(pwd)"/3PXwJYYPf6fyVb4GJquxSZU8puxrHfzc4XogdMVot8MUQK53tW.export,target=/KEY_FILE,readonly sponsored_transactions | ||
``` | ||
|
||
Note: To get your `ACCOUNT_KEY_FILE` (the `3PXwJYYPf6fyVb4GJquxSZU8puxrHfzc4XogdMVot8MUQK53tW.export` file), export it from the Concordium Browser Wallet for Web. | ||
|
||
<img src="./backend/pic/pic1.png" width="200" /> | ||
<img src="./backend/pic/pic2.png" width="200" /> | ||
<img src="./backend/pic/pic3.png" width="200" /> | ||
|
||
See the [docker file](./Dockerfile) to explore the environment variables that can set. | ||
|
||
Note: Use the same smart contract index for the frontend and backend. In other words, use the smart contract index from the `./frontend/package.json` file in the dockerfile. | ||
|
||
|
||
|
||
## Explore the tutorial | ||
|
||
You can find an associated tutorial on the [developer documentation](./https://developer.concordium.software/en/mainnet/smart-contracts/tutorials/index.html). | ||
|
||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
ARG node_base_image=node:16-slim | ||
ARG rust_base_image=rust:1.65 | ||
|
||
FROM ${node_base_image} AS frontend | ||
|
||
WORKDIR /app | ||
COPY ./sponsoredTransactions/frontend ./ | ||
|
||
RUN yarn && yarn cache clean | ||
RUN yarn build | ||
|
||
FROM ${rust_base_image} AS backend | ||
|
||
WORKDIR /backend | ||
COPY ./deps/concordium-rust-sdk /deps/concordium-rust-sdk | ||
COPY ./sponsoredTransactions/backend ./ | ||
|
||
RUN cargo build --release | ||
|
||
FROM ubuntu:22.04 | ||
WORKDIR /build | ||
|
||
ENV PORT=8080 | ||
ENV NODE=http://node.testnet.concordium.com:20000 | ||
ENV LOG_LEVEL=info | ||
ENV SMART_CONTRACT_INDEX=6372 | ||
|
||
ENV ACCOUNT_KEY_FILE=/KEY_FILE | ||
|
||
COPY --from=backend ./backend/target/release/sponsored-transaction-backend ./main | ||
COPY --from=frontend ./app/dist ./public | ||
|
||
RUN chmod +x ./main | ||
|
||
CMD ./main --node "${NODE}" --port "${PORT}" --account "${ACCOUNT_KEY_FILE}" --smart-contract-index "${SMART_CONTRACT_INDEX}" --log-level "${LOG_LEVEL}" --public-folder public |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## Unreleased changes | ||
|
||
## 2.0.0 | ||
|
||
- Use `AccountSignatures` type for the input parameter to the `permit` function. The sponsored transaction smart contract uses the `check_account_signature` host function with the `AccountSignatures` type as input parameter to verify signatures in the smart contract now. | ||
|
||
## 1.0.0 | ||
|
||
- Initial sponsored transaction back end. |
Oops, something went wrong.