Skip to content

Commit

Permalink
Merge branch 'dev' into upgradable-contract-first
Browse files Browse the repository at this point in the history
  • Loading branch information
kamikazebr committed Jul 31, 2024
2 parents 3d22017 + 733909e commit 7eec96b
Show file tree
Hide file tree
Showing 194 changed files with 315,667 additions and 11,216 deletions.
9 changes: 2 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
module.exports = {
root: true,
// This tells ESLint to load the config from the package `eslint-config-custom`
root: true, // This tells ESLint to load the config from the package `eslint-config-custom`
extends: ["custom"],
settings: {
next: {
rootDir: ["apps/*/"],
},
},
settings: { next: { rootDir: ["apps/*/"] } },
};
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
url = https://github.com/OpenZeppelin/openzeppelin-contracts
[submodule "lib/openzeppelin-contracts-upgradeable"]
path = lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
7 changes: 4 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
"solidity.packageDefaultDependenciesContractsDirectory": "pkg/contracts/src",
"solidity.packageDefaultDependenciesDirectory": "lib",
"[solidity]": {
"editor.defaultFormatter": "JuanBlanco.solidity",
"editor.defaultFormatter": "NomicFoundation.hardhat-solidity",
"editor.formatOnSave": true
},
"solidity.formatter": "forge"
}
"solidity.formatter": "forge",
"editor.formatOnSave": true,
}
1 change: 1 addition & 0 deletions apps/docs/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from "react";
import { Button } from "ui";

export default function Docs() {
Expand Down
85 changes: 79 additions & 6 deletions apps/web/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,88 @@
* @type {import('eslint').Linter.Config}
*/
module.exports = {
extends: ["next/core-web-vitals", "turbo", "prettier"],
ignorePatterns: ["node_modules", "dist"],
env: {
browser: true,
es2021: true,
node: true,
},
extends: [
"airbnb/hooks",
"airbnb-typescript",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:jsx-a11y/recommended",
"next/core-web-vitals",
"prettier/prettier",
],
plugins: ["react"],
ignorePatterns: ["node_modules", "dist", "src/generated.ts", "public"],
parser: "@typescript-eslint/parser",
parserOptions: {
babelOptions: {
presets: [require.resolve("next/babel")],
},
project: "./tsconfig.json",
},
rules: {
"react/jsx-filename-extension": [
2,
{ extensions: [".js", ".jsx", ".ts", ".tsx"] },
],
"react-hooks/exhaustive-deps": "off",
"no-html-link-for-pages": "off",
"@next/next/no-html-link-for-pages": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@next/next/no-page-custom-font": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/prefer-nullish-coalescing": "error",
"react/self-closing-comp": [
"error",
{
component: true,
html: true,
},
],
"no-unreachable": "warn",
"import/order": [
"error",
{
groups: ["builtin", "external", "internal"],
pathGroups: [
{
pattern: "react",
group: "external",
position: "before",
},
],
pathGroupsExcludedImportTypes: ["react"],
alphabetize: {
order: "asc",
caseInsensitive: true,
},
},
],
"no-console": [
"warn",
{
allow: ["warn", "error", "info", "debug", "table"],
},
],
"prefer-const": "off",
"@typescript-eslint/consistent-type-definitions": "off",
"no-unused-expressions": "error",
"no-unsafe-optional-chaining": "error",
"import/extensions": "off",
"@typescript-eslint/quotes": ["error", "double"],
"@typescript-eslint/no-use-before-define": "off",
"jsx-a11y/no-static-element-interactions": "off",
"react/no-array-index-key": "warn",
indent: "off",
"@typescript-eslint/indent": "off",
},
};
7 changes: 2 additions & 5 deletions apps/web/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"recommendations": [
"skillhub.daisy-ui-latest-snippets",
"bradlc.vscode-tailwindcss"
]
}
"recommendations": ["skillhub.daisy-ui-latest-snippets", "bradlc.vscode-tailwindcss"]
}
2 changes: 1 addition & 1 deletion apps/web/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Next.js: debug server-side",
"type": "node-terminal",
"request": "launch",
"command": "pnpm dev",
"command": "pnpm dev"
},
{
"name": "Next.js: debug client-side",
Expand Down
18 changes: 18 additions & 0 deletions apps/web/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always"
},
"[typescriptreact]": {
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
},
"[typescript]": {
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
},
"css.lint.unknownAtRules": "ignore",
"[javascript]": {
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint"
},
"editor.tabSize": 2,
}
36 changes: 19 additions & 17 deletions apps/web/actions/getProposals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export async function getProposals(
strategy: LightCVStrategy,
) {
try {
async function fetchIPFSDataBatch(
const fetchIPFSDataBatch = async function (
proposals: LightProposal[],
batchSize = 5,
delay = 300,
Expand Down Expand Up @@ -41,28 +41,30 @@ export async function getProposals(
}

return results;
}
};

async function transformProposals(strategy: LightCVStrategy) {
const proposalsData = await fetchIPFSDataBatch(strategy.proposals);
const transformedProposals = proposalsData.map((data, index) => {
const p = strategy.proposals[index];
return {
...p,
voterStakedPointsPct: 0,
stakedAmount: strategy.proposals[index].stakedAmount,
title: data.title,
type: strategy.config?.proposalType as number,
status: strategy.proposals[index].proposalStatus,
};
});
const transformProposals = async function (_strategy: LightCVStrategy) {
const proposalsData = await fetchIPFSDataBatch(_strategy.proposals);
const transformedProposals = proposalsData
.map((data, index) => {
const p = _strategy.proposals[index];
return {
...p,
voterStakedPointsPct: 0,
stakedAmount: _strategy.proposals[index].stakedAmount,
title: data.title,
type: _strategy.config?.proposalType as number,
status: _strategy.proposals[index].proposalStatus,
};
})
.sort((a, b) => +a.proposalNumber - +b.proposalNumber); // Sort by proposal number ascending

return transformedProposals;
}
};
let transformedProposals = await transformProposals(strategy);

return transformedProposals;
} catch (error) {
console.log(error);
console.error("Error while getting proposal ipfs metadata", error);
}
}
2 changes: 1 addition & 1 deletion apps/web/app/(app)/docs/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";

export default function Docs() {
export default function Page() {
return <div>Docs...</div>;
}
Loading

0 comments on commit 7eec96b

Please sign in to comment.