Skip to content

Commit

Permalink
feat: formatting and console log removing
Browse files Browse the repository at this point in the history
  • Loading branch information
Valazan committed Sep 5, 2024
1 parent fea9979 commit e02db18
Show file tree
Hide file tree
Showing 6 changed files with 433 additions and 454 deletions.
19 changes: 5 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ Shared configurations and utility functions to unify and simplify your developme

Configure your environment variables for seamless integration:

### Frontend

Place your `.env` files in `apps/frontend`:

### Backend

Store your environment-specific `.env` files in `apps/backend`. `.env.development.local` & `.env.production.local` allow for custom environment variables based on the environment:
Expand Down Expand Up @@ -102,12 +98,14 @@ To start deploy contract locally you must run a local instance of the Vechain Th
```bash
yarn contracts:solo-up
```

At this point you can deploy the contracts to the local network by running:

```bash
yarn contracts:deploy:solo
```
Once the deployment is complete successfully you can go ahead and start the frontend and backend:

Once the deployment is completed successfully you can go ahead and start the frontend and backend:

> ⚠️ **Warning:**
> Remeber to set the OPENAI_API_KEY env variable in the backend .env.development.local file. Refer to the [Environment Variables](#environment-variables) section for more information.
Expand All @@ -116,14 +114,10 @@ Once the deployment is complete successfully you can go ahead and start the fron
yarn dev
```

At this point you can access the frontend at [http://localhost:8082/](http://localhost:8082/).
At this point you can access the frontend at [http://localhost:8082/](http://localhost:8082/).

Start uploading a receipt!





## Deploying on Testnet 🚀

To distribute rewards this contract needs of a valid APP_ID provided by VeBetterDAO when joining the ecosystem.
Expand All @@ -136,9 +130,7 @@ For deploying on Testnet you should check that you have the correct addresses in

When deploying on the SOLO network the script will deploy for you the mocked VeBetterDAO contracts and generate an APP_ID.


Once everything is set up you can deploy the contracts to the testnet by running:

Once everything is set up you can deploy the contracts to the testnet by running:

```bash
yarn contracts:deploy:testnet
Expand All @@ -150,7 +142,6 @@ The deployment scripts will configure the 1st cycle for you with a reward of 100

To start a new cycle and set the rewards you can follow the steps below:


### Testnet

Read the [VeBetterDAO documentation](https://docs.vebetterdao.org/developer-guides/test-environmnet) to learn how to set up rewards for your users and use the Testnet environment.
Expand Down
6 changes: 3 additions & 3 deletions apps/backend/src/controllers/submission.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ export class SubmissionController {
const validityFactor = validationResult['validityFactor'];

if (validityFactor > 0.5) {
if (!await this.contracts.registerSubmission(submissionRequest)){
throw new HttpException(500, 'Error registering submission and sending rewards');
}
if (!(await this.contracts.registerSubmission(submissionRequest))) {
throw new HttpException(500, 'Error registering submission and sending rewards');
}
}

res.status(200).json({ validation: validationResult });
Expand Down
11 changes: 1 addition & 10 deletions apps/backend/src/services/contracts.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ export class ContractsService {
public async registerSubmission(submission: Submission): Promise<boolean> {
let isSuccess = false;
try {
const result = await (await ecoEarnContract.transact.registerValidSubmission(submission.address, 1000n)).wait();

console.log('Result', result);
const result = await (await ecoEarnContract.transact.registerValidSubmission(submission.address, 1000000000000000000n)).wait();
isSuccess = !result.reverted;
} catch (error) {
console.log('Error', error);
Expand All @@ -21,13 +19,6 @@ export class ContractsService {

public async validateSubmission(submission: Submission): Promise<void> {
const isMaxSubmissionsReached = (await ecoEarnContract.read.isUserMaxSubmissionsReached(submission.address))[0];
// const currentcyle = (await ecoEarnContract.read.getCurrentCycle())[0];
// //
// // await (await ecoEarnContract.transact.setNextCycle(2n)).wait();
// //
// // await (await ecoEarnContract.transact.setRewardsAmount(40000000n)).wait();
// const rewards = (await ecoEarnContract.read.rewards(1n))[0];

if (Boolean(isMaxSubmissionsReached) === true) throw new HttpException(409, `EcoEarn: Max submissions reached for this cycle`);
}
}
2 changes: 0 additions & 2 deletions apps/backend/src/services/openai.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ export class OpenaiService {
prompt,
});

console.log(gptResponse.choices[0].message.content);

const responseJSONStr = openAIHelper.getResponseJSONString(gptResponse);

return openAIHelper.parseChatGPTJSONString(responseJSONStr);
Expand Down
1 change: 0 additions & 1 deletion apps/frontend/.env.example

This file was deleted.

Loading

0 comments on commit e02db18

Please sign in to comment.