Skip to content

Commit 9c930d9

Browse files
authored
Merge pull request #146 from Brgndy25/main
Tokenvest investment platform
2 parents f885cc1 + c1f63c0 commit 9c930d9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+14119
-0
lines changed

3-lending/Tokenvest/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

3-lending/Tokenvest/README.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Tokenvest
2+
3+
## Idea
4+
Tokenvest is an investment deFi platform powered by blockchain, using the **Radix** decentralized network which is the best suit for deFi applications.
5+
6+
With this platform, users will have the opportunity to invest in products and to create a product/idea to get an investment.
7+
Products are getting stored in the blockchain, and transactions are being made via *RDX* token.
8+
9+
## Application
10+
Application as an MVP consists of 3 pages
11+
1. Home - user details being shown, including name, connected accounts number, and status.
12+
2. Products - list of created products.
13+
3. Create a Product - create product functionality
14+
15+
## Technology
16+
The architecture consists of 3 main concepts(folders).
17+
1. Smart Contracts - All the Radix smart contracts
18+
2. Frontend - all the UI code, including interactions with smart contracts
19+
3. [strapi](https://strapi.io) - the headless CMS implementation to sync products in our database.
20+
21+
## How to run
22+
23+
### Requirements
24+
NodeJs version 14 or higher
25+
as a test project .env variable is directly pushed to the strapi folder so it will run automatically.
26+
27+
### Commands
28+
1. yarn
29+
2. yarn setup
30+
3. yarn start:strapi
31+
4. yarn start:frontend
32+
33+
### Wallet
34+
1. setup the [radix mobile application](https://docs-babylon.radixdlt.com/main/getting-started-developers/wallet-and-connector.html)
35+
2. install the [connector extension](https://docs-babylon.radixdlt.com/main/getting-started-developers/wallet-and-connector.html#_install_the_connector)
36+
3. Transfer tokens to your account from radix betanet.
37+
4. connect your account in our platform using the **connect** button in the header
38+
39+
![image](https://user-images.githubusercontent.com/23248910/227128067-6824769e-92c9-4aea-990c-82d5ab1d9097.png)
40+
41+
Specific business logic is described in the video
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
.pnpm-debug.log*
27+
28+
# local env files
29+
.env*.local
30+
31+
# vercel
32+
.vercel
33+
34+
# typescript
35+
*.tsbuildinfo
36+
next-env.d.ts
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2+
3+
## Getting Started
4+
5+
First, run the development server:
6+
7+
```bash
8+
npm run dev
9+
# or
10+
yarn dev
11+
# or
12+
pnpm dev
13+
```
14+
15+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
16+
17+
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
18+
19+
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.
20+
21+
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
22+
23+
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
24+
25+
## Learn More
26+
27+
To learn more about Next.js, take a look at the following resources:
28+
29+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
30+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
31+
32+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
33+
34+
## Deploy on Vercel
35+
36+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
37+
38+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/** @type {import('next').NextConfig} */
2+
const nextConfig = {
3+
reactStrictMode: true,
4+
}
5+
6+
module.exports = nextConfig
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "application",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"dev": "next dev",
7+
"build": "next build",
8+
"start": "next start",
9+
"lint": "next lint"
10+
},
11+
"dependencies": {
12+
"@emotion/react": "^11.10.6",
13+
"@emotion/styled": "^11.10.6",
14+
"@mui/material": "^5.11.12",
15+
"@radixdlt/radix-dapp-toolkit": "^0.1.0",
16+
"@types/node": "18.14.6",
17+
"@types/react": "18.0.28",
18+
"@types/react-dom": "18.0.11",
19+
"eslint": "8.35.0",
20+
"eslint-config-next": "13.2.3",
21+
"next": "13.2.3",
22+
"react": "18.2.0",
23+
"react-dom": "18.2.0",
24+
"typescript": "4.9.5"
25+
}
26+
}
25.3 KB
Binary file not shown.
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
export const styles = {
2+
header: {
3+
width: "100%",
4+
height: "80px",
5+
display: "flex",
6+
alignItems: "center",
7+
justifyContent: "space-between",
8+
paddingX: "24px",
9+
boxShadow: "0 30px 40px rgba(0,0,0,.1)"
10+
},
11+
linksWrapper: {
12+
display: "flex",
13+
gap: "64px",
14+
width: "100%",
15+
justifyContent: "center"
16+
},
17+
link: {
18+
color: "black",
19+
fontWeight: "400",
20+
fontFamily: "monospace",
21+
fontSize: "24px"
22+
},
23+
linkActive: {
24+
color: "#115fce"
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { ROUTES } from "@/constants/routes";
2+
import { Box } from "@mui/material"
3+
import Link from "next/link";
4+
import { useRouter } from "next/router";
5+
import { Fragment } from "react";
6+
import { styles } from "./Header.styles";
7+
8+
declare global {
9+
namespace JSX {
10+
interface IntrinsicElements {
11+
"radix-connect-button": React.DetailedHTMLProps<
12+
React.HTMLAttributes<HTMLElement>,
13+
HTMLElement
14+
>;
15+
}
16+
}
17+
}
18+
19+
const Header = () => {
20+
21+
const router = useRouter();
22+
23+
const activeRoute = router.asPath.split("/")[1];
24+
25+
26+
return (
27+
<Box sx={styles.header}>
28+
<Box sx={styles.linksWrapper}>
29+
{ROUTES.map((item, index) => {
30+
return (
31+
<Fragment key={index}>
32+
<Link
33+
href={item.slug}
34+
style={activeRoute === item.slug.replace("/", "") ? { ...styles.link, ...styles.linkActive } : styles.link}
35+
>{item.title}</Link>
36+
</Fragment>
37+
)
38+
})}
39+
</Box>
40+
<Box>
41+
<radix-connect-button></radix-connect-button>
42+
</Box>
43+
</Box>
44+
);
45+
}
46+
47+
export default Header;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export const CMS_API:string = "http://localhost:1337/api";
2+
export const CMS_URL:string = "http://localhost:1337";
3+
export const CMS_PRODUCTS:string = "/products";
4+
export const CMS_UPLOAD:string = "/upload";
5+
export const CMS_PRODUCTS_REF:string = "api::product.product";
6+
export const IMAGE_FIELD:string = "image";
7+
export const POPULATE_ALL:string = "?populate=*";
8+
export const DEFAULT_RAISED_AMOUNT = "0";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const PACKAGE_ID:string = "package_tdx_b_1q9qmxmsw703jj8qn50r07s982p6vqvlx7cwk3luvnwzsy6fes7";
2+
export const GATEWAY_URL:string = "https://nebunet-gateway.radixdlt.com/transaction/committed-details";
3+
export const GATEWAY_URL_RESOURCES:string = "https://nebunet-gateway.radixdlt.com/entity/resources";
4+
export const GATEWAY_URL_DETAILS:string = "https://nebunet-gateway.radixdlt.com/entity/details";
5+
export const TRANSACTION_SUCCESSFUL:string = "committed_success";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export const HOME = "/";
2+
export const PRODUCTS = "/products";
3+
export const CREATE_PRODUCT = "/create-product";
4+
5+
export const ROUTES = [
6+
{
7+
title: "Home",
8+
slug:HOME
9+
},
10+
{
11+
title: "Products",
12+
slug:PRODUCTS
13+
},
14+
{
15+
title: "Create Product",
16+
slug:CREATE_PRODUCT
17+
}
18+
];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { useRdtState } from "./useRdtState";
2+
3+
export const useAccounts = () => {
4+
const state = useRdtState();
5+
6+
return state?.accounts ?? [];
7+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { useRdtState } from "./useRdtState";
2+
3+
export const useConnected = () => {
4+
const state = useRdtState();
5+
6+
return state?.connected ?? false;
7+
};

0 commit comments

Comments
 (0)