diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 00000000..47c7c981 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,31 @@ +{ + "env": { + "browser": true, + "es2021": true + }, + "extends": [ + "eslint:recommended", + "plugin:react/recommended" + ], + "overrides": [ + ], + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module" + }, + "plugins": [ + "react" + ], + "rules": { + "react/react-in-jsx-scope": "off", + "no-case-declarations": "off", + "react/prop-types": "off", + "no-extra-boolean-cast": "off", + "react/no-unescaped-entities": "off" + }, + "settings": { + "react": { + "version": "detect" + } + } +} diff --git a/.gitignore b/.gitignore index b59ec02d..4835011a 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,5 @@ npm-debug.log* yarn-debug.log* yarn-error.log* .env +yalc.lock +.yalc/ \ No newline at end of file diff --git a/.prettierrc b/.prettierrc index e69de29b..2f1a7d15 100644 --- a/.prettierrc +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "semi": true, + "tabWidth": 2, + "printWidth": 100, + "singleQuote": false, + "trailingComma": "es5" +} \ No newline at end of file diff --git a/package.json b/package.json index 1061a196..3d202593 100644 --- a/package.json +++ b/package.json @@ -7,11 +7,13 @@ "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", - "@unioncredit/ui": "0.3.0-beta.29", + "@unioncredit/ui": "^0.4.22", "add-event-to-calendar": "^1.0.7", "buffer": "^6.0.3", "classnames": "^2.3.2", + "date-fns": "^2.29.3", "dayjs": "^1.11.6", + "eth-permit": "^0.2.3", "ethereum-blockies-base64": "^1.0.2", "ethers": "^5.7.2", "graphql": "^16.6.0", @@ -19,11 +21,12 @@ "js-confetti": "^0.11.0", "lodash": "^4.17.21", "prettier": "^2.7.1", - "qrcode.react": "^3.1.0", "react": "18.2.0", "react-dom": "18.2.0", + "react-error-boundary": "^3.1.4", "react-helmet": "^6.1.0", "react-markdown": "5.0.3", + "react-minimal-pie-chart": "^8.4.0", "react-router-dom": "^6.4.2", "react-scripts": "5.0.1", "sass": "^1.55.0", @@ -32,12 +35,13 @@ "web-vitals": "^2.1.4" }, "scripts": { - "start": "export REACT_APP_VERSION=$(git rev-parse HEAD) && react-scripts start", - "build": "export REACT_APP_VERSION=$(git rev-parse HEAD) && react-scripts build", + "start": "export REACT_APP_VERSION=$(git rev-parse HEAD) && export DISABLE_ESLINT_PLUGIN=true && react-scripts start", + "build": "export REACT_APP_VERSION=$(git rev-parse HEAD) && export DISABLE_ESLINT_PLUGIN=true && react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", "format": "prettier --write \"src/**/*.{js,scss,json,jsx}\"", - "serve": "serve build -l 3000" + "serve": "serve build -l 3000", + "lint": "eslint --ext .js,.jsx ./src" }, "eslintConfig": { "extends": [] @@ -53,5 +57,9 @@ "last 1 firefox version", "last 1 safari version" ] + }, + "devDependencies": { + "eslint": "^8.40.0", + "eslint-plugin-react": "^7.32.2" } } diff --git a/public/images/CheckIcon.svg b/public/images/CheckIcon.svg new file mode 100644 index 00000000..19b20ba9 --- /dev/null +++ b/public/images/CheckIcon.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/App.jsx b/src/App.jsx index e76f4c0a..88012e67 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,13 +1,14 @@ import { useEffect } from "react"; import { useAccount, useNetwork } from "wagmi"; -import { Box, Label, Layout, Grid } from "@unioncredit/ui"; +import { Box, Layout, Grid } from "@unioncredit/ui"; import { matchRoutes, useLocation } from "react-router-dom"; +import { ErrorBoundary } from "react-error-boundary"; import Routes from "./Routes"; import ConnectPage from "pages/Connect"; -import Header from "components/shared/Header"; -import { general as generalRoutes } from "App.routes"; +import { Header } from "components/shared/Header"; +import { allRoutes, general as generalRoutes } from "App.routes"; import ScrollToTop from "components/misc/ScrollToTop"; import Cache from "providers/Cache"; @@ -22,6 +23,10 @@ import MemberData, { useMember } from "providers/MemberData"; import { isVersionSupported, useVersion } from "providers/Version"; import Settings from "providers/Settings"; import useChainParams from "hooks/useChainParams"; +import ErrorPage from "pages/Error"; +import { BuildInfo } from "components/shared/BuildInfo"; +import LoadingPage from "pages/Loading"; +import NotFoundPage from "pages/NotFoundPage"; /** * Shim component that checks if the App is ready @@ -30,7 +35,6 @@ function AppReadyShim({ children }) { const location = useLocation(); const { chain } = useNetwork(); - const { version } = useVersion(); const { isDisconnected } = useAccount(); const { data: member = {} } = useMember(); const { appReady, setAppReady } = useAppNetwork(); @@ -50,19 +54,6 @@ function AppReadyShim({ children }) { if (chain && appReady && (isDisconnected || chain?.unsupported)) { setAppReady(false); - return; - } - - // If the user is a member, or we are accessing a general route, then - // skip the connect/ready page and auto connect straight into - // the credit page "/" - if (!appReady && member.isMember) { - // Check if the currently verions matches the network. Only if - // the version is set correctly can we proceed - if (isVersionSupported(version, chain.id)) { - setAppReady(true); - return; - } } }, [ appReady, @@ -86,16 +77,21 @@ export default function App() { const isGeneralRoute = Boolean(matchRoutes(generalRoutes, location)); + const is404 = !allRoutes.some((r) => r.path === location.pathname); + if (!version || ((chain?.unsupported || !isConnected) && !isGeneralRoute)) { return ( +
- + + {is404 ? : } + @@ -109,44 +105,50 @@ export default function App() { - - - - - - - - - - - - - {appReady ? ( - <> -
- - - ) : ( - - )} - - - - - - - - - - - - + + + + + + + + + +
+ {isVersionSupported(version, chain.id) ? ( + + + + {is404 ? ( + + ) : appReady ? ( + <> + + + + + + + ) : ( + + )} + + + + ) : ( + + )} + + + + + + + + + - - - + diff --git a/src/App.routes.js b/src/App.routes.js index d423eff6..03f21e87 100644 --- a/src/App.routes.js +++ b/src/App.routes.js @@ -1,20 +1,18 @@ -import { ContactsType } from "constants"; +import { Links } from "constants"; -import ContactsPage from "pages/Contacts"; -import GovernancePage from "pages/Governance"; -import ProposalsPage from "pages/Proposals"; import ProposalPage from "pages/Proposal"; import ProfilePage from "pages/Profile"; import RegisterPage from "pages/Register"; -import CreditPage from "pages/Credit"; -import StakePage from "pages/Stake"; +import CreditPages, { PAGES as CREDIT_PAGES } from "pages/CreditPages"; +import DaoPages, { PAGES as DAO_PAGES } from "pages/DaoPages"; // prettier-ignore export const member = [ - { path: "/", component: CreditPage, props: {} }, - { path: "/stake", component: StakePage, props: {} }, - { path: "/contacts", component: ContactsPage, props: { type: ContactsType.VOUCHEES } }, - { path: "/contacts/trusts-you", component: ContactsPage, props: { type: ContactsType.VOUCHERS } }, + { path: "/", component: CreditPages, props: { page: CREDIT_PAGES.BORROW } }, + { path: "/stake", component: CreditPages, props: { page: CREDIT_PAGES.STAKE } }, + { path: "/contacts", component: CreditPages, props: { page: CREDIT_PAGES.CONTACTS_PROVIDING } }, + { path: "/contacts/providing", component: CreditPages, props: { page: CREDIT_PAGES.CONTACTS_PROVIDING } }, + { path: "/contacts/receiving", component: CreditPages, props: { page: CREDIT_PAGES.CONTACTS_RECEIVING } }, ] // prettier-ignore @@ -25,7 +23,10 @@ export const nonMember = [ // prettier-ignore export const general = [ { path: "/profile/:addressOrEns", component: ProfilePage, props: {} }, - { path: "/governance", component: GovernancePage, props: { type: ContactsType.VOUCHERS } }, - { path: "/governance/proposals", component: ProposalsPage, props: {} }, + { path: Links.GOVERNANCE, component: DaoPages, props: { page: DAO_PAGES.VOTING } }, + { path: Links.PROTOCOL, component: DaoPages, props: { page: DAO_PAGES.PROTOCOL } }, { path: "/governance/proposals/:hash", component: ProposalPage, props: {} }, + { path: Links.LEADERBOARD, component: DaoPages, props: { page: DAO_PAGES.LEADERBOARD } }, ] + +export const allRoutes = [...member, ...nonMember, ...general]; diff --git a/src/Routes.jsx b/src/Routes.jsx index 2b064e3b..87dc9ccb 100644 --- a/src/Routes.jsx +++ b/src/Routes.jsx @@ -1,16 +1,9 @@ -import { - Route, - matchRoutes, - useLocation, - Routes as ReactRoutes, - Navigate, -} from "react-router-dom"; +import { Route, matchRoutes, useLocation, Routes as ReactRoutes, Navigate } from "react-router-dom"; import { useAccount } from "wagmi"; import * as routes from "./App.routes"; import { useMember } from "providers/MemberData"; -import ErrorPage from "pages/Error"; import LoadingPage from "pages/Loading"; export default function Routes() { @@ -22,30 +15,23 @@ export default function Routes() { const needsToConnect = !isConnected; - const getElement = (Component, props) => - isLoading ? : ; + const getElement = (Component, props) => (isLoading ? : ); /*-------------------------------------------------------------- App Routes Setup --------------------------------------------------------------*/ - const memberRoutes = routes.member.map( - ({ path, component: Component, props }) => ( - - ) - ); + const memberRoutes = routes.member.map(({ path, component: Component, props }) => ( + + )); - const nonMemberRoutes = routes.nonMember.map( - ({ path, component: Component, props }) => ( - - ) - ); + const nonMemberRoutes = routes.nonMember.map(({ path, component: Component, props }) => ( + + )); - const generalRoutes = routes.general.map( - ({ path, component: Component, props }) => ( - } /> - ) - ); + const generalRoutes = routes.general.map(({ path, component: Component, props }) => ( + } /> + )); if (isLoading) { return ; @@ -72,22 +58,7 @@ export default function Routes() { } - - { - // If we are on a valid route but we have made it to the - // fallback we should redirect the user to the app root / - } - {matchRoutes( - [...routes.member, ...routes.nonMember, ...routes.general], - location - ) && } - - } + element={matchRoutes([...routes.allRoutes], location) && } /> ); diff --git a/src/abis/bridgedToken.json b/src/abis/bridgedToken.json new file mode 100644 index 00000000..4c53ab6c --- /dev/null +++ b/src/abis/bridgedToken.json @@ -0,0 +1,600 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_l2Gateway", + "type": "address" + }, + { + "internalType": "address", + "name": "_l1TokenAddress", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_account", + "type": "address" + } + ], + "name": "Unwhitelisted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "WhitelistDisabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "WhitelistEnabled", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "_account", + "type": "address" + } + ], + "name": "Whitelisted", + "type": "event" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "bridgeBurn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "bridgeMint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "disableWhitelist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "enableWhitelist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getChainId", + "outputs": [ + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + } + ], + "name": "isWhitelisted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "l1Address", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "l2Gateway", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + } + ], + "name": "unwhitelist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + } + ], + "name": "whitelist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "whitelistEnabled", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } +] \ No newline at end of file diff --git a/src/abis/uToken.json b/src/abis/uToken.json index cda72e5e..17587d16 100644 --- a/src/abis/uToken.json +++ b/src/abis/uToken.json @@ -1474,6 +1474,49 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "repayBorrowWithPermit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [], "name": "reserveFactorMantissa", diff --git a/src/abis/v2/comptroller.json b/src/abis/v2/comptroller.json index 8fbc6f13..ad29de62 100644 --- a/src/abis/v2/comptroller.json +++ b/src/abis/v2/comptroller.json @@ -1,15 +1,59 @@ [ - { "inputs": [], "name": "DivisionByZero", "type": "error" }, - { "inputs": [], "name": "FrozenCoinAge", "type": "error" }, - { "inputs": [], "name": "InflationIndexTooSmall", "type": "error" }, - { "inputs": [], "name": "MultiplicationOverflow", "type": "error" }, - { "inputs": [], "name": "NotPaused", "type": "error" }, - { "inputs": [], "name": "NotZero", "type": "error" }, - { "inputs": [], "name": "Paused", "type": "error" }, - { "inputs": [], "name": "SenderNotAdmin", "type": "error" }, - { "inputs": [], "name": "SenderNotGuardian", "type": "error" }, - { "inputs": [], "name": "SenderNotPendingAdmin", "type": "error" }, - { "inputs": [], "name": "SenderNotUserManager", "type": "error" }, + { + "inputs": [], + "name": "DivisionByZero", + "type": "error" + }, + { + "inputs": [], + "name": "FrozenCoinAge", + "type": "error" + }, + { + "inputs": [], + "name": "InflationIndexTooSmall", + "type": "error" + }, + { + "inputs": [], + "name": "MultiplicationOverflow", + "type": "error" + }, + { + "inputs": [], + "name": "NotPaused", + "type": "error" + }, + { + "inputs": [], + "name": "NotZero", + "type": "error" + }, + { + "inputs": [], + "name": "Paused", + "type": "error" + }, + { + "inputs": [], + "name": "SenderNotAdmin", + "type": "error" + }, + { + "inputs": [], + "name": "SenderNotGuardian", + "type": "error" + }, + { + "inputs": [], + "name": "SenderNotPendingAdmin", + "type": "error" + }, + { + "inputs": [], + "name": "SenderNotUserManager", + "type": "error" + }, { "anonymous": false, "inputs": [ @@ -116,14 +160,28 @@ { "inputs": [], "name": "INIT_INFLATION_INDEX", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "admin", "type": "address" }, - { "internalType": "address", "name": "unionToken_", "type": "address" }, + { + "internalType": "address", + "name": "admin", + "type": "address" + }, + { + "internalType": "address", + "name": "unionToken_", + "type": "address" + }, { "internalType": "address", "name": "marketRegistry_", @@ -149,8 +207,16 @@ }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" }, - { "internalType": "address", "name": "token", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + } ], "name": "accrueRewards", "outputs": [], @@ -160,48 +226,100 @@ { "inputs": [], "name": "admin", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" }, - { "internalType": "address", "name": "token", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + } ], "name": "calculateRewards", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "gInflationIndex", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "gLastUpdated", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" }, - { "internalType": "address", "name": "token", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + } ], "name": "getRewardsMultiplier", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "halfDecayPoint", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, @@ -214,16 +332,32 @@ } ], "name": "inflationPerSecond", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "isAdmin", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, @@ -243,14 +377,26 @@ { "inputs": [], "name": "memberRatio", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "nonMemberRatio", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, @@ -264,34 +410,62 @@ { "inputs": [], "name": "pauseGuardian", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "paused", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "pendingAdmin", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "proxiableUUID", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "setGuardian", "outputs": [], @@ -300,7 +474,11 @@ }, { "inputs": [ - { "internalType": "uint256", "name": "point", "type": "uint256" } + { + "internalType": "uint256", + "name": "point", + "type": "uint256" + } ], "name": "setHalfDecayPoint", "outputs": [], @@ -309,7 +487,11 @@ }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "setPendingAdmin", "outputs": [], @@ -338,11 +520,25 @@ }, { "inputs": [ - { "internalType": "address", "name": "token", "type": "address" }, - { "internalType": "uint256", "name": "totalStaked", "type": "uint256" } + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "totalStaked", + "type": "uint256" + } ], "name": "updateTotalStaked", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "nonpayable", "type": "function" }, @@ -366,7 +562,11 @@ "name": "newImplementation", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } ], "name": "upgradeToAndCall", "outputs": [], @@ -375,8 +575,16 @@ }, { "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" } + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } ], "name": "users", "outputs": [ @@ -385,19 +593,37 @@ "name": "inflationIndex", "type": "uint256" }, - { "internalType": "uint256", "name": "accrued", "type": "uint256" } + { + "internalType": "uint256", + "name": "accrued", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" }, - { "internalType": "address", "name": "token", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "token", + "type": "address" + } ], "name": "withdrawRewards", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "nonpayable", "type": "function" } -] +] \ No newline at end of file diff --git a/src/abis/v2/uToken.json b/src/abis/v2/uToken.json index 9a840db7..a311c105 100644 --- a/src/abis/v2/uToken.json +++ b/src/abis/v2/uToken.json @@ -1,27 +1,119 @@ [ - { "inputs": [], "name": "AccrueBlockParity", "type": "error" }, - { "inputs": [], "name": "AccrueInterestFailed", "type": "error" }, - { "inputs": [], "name": "AmountError", "type": "error" }, - { "inputs": [], "name": "AmountExceedGlobalMax", "type": "error" }, - { "inputs": [], "name": "AmountExceedMaxBorrow", "type": "error" }, - { "inputs": [], "name": "AmountLessMinBorrow", "type": "error" }, - { "inputs": [], "name": "AmountZero", "type": "error" }, - { "inputs": [], "name": "BorrowRateExceedLimit", "type": "error" }, - { "inputs": [], "name": "CallerNotMember", "type": "error" }, - { "inputs": [], "name": "CallerNotUserManager", "type": "error" }, - { "inputs": [], "name": "DepositToAssetManagerFailed", "type": "error" }, - { "inputs": [], "name": "InitExchangeRateNotZero", "type": "error" }, - { "inputs": [], "name": "InsufficientFundsLeft", "type": "error" }, - { "inputs": [], "name": "MemberIsOverdue", "type": "error" }, - { "inputs": [], "name": "MintFeeError", "type": "error" }, - { "inputs": [], "name": "NotPaused", "type": "error" }, - { "inputs": [], "name": "OriginationFeeExceedLimit", "type": "error" }, - { "inputs": [], "name": "Paused", "type": "error" }, - { "inputs": [], "name": "ReserveFactoryExceedLimit", "type": "error" }, - { "inputs": [], "name": "SenderNotAdmin", "type": "error" }, - { "inputs": [], "name": "SenderNotGuardian", "type": "error" }, - { "inputs": [], "name": "SenderNotPendingAdmin", "type": "error" }, - { "inputs": [], "name": "WithdrawFailed", "type": "error" }, + { + "inputs": [], + "name": "AccrueBlockParity", + "type": "error" + }, + { + "inputs": [], + "name": "AccrueInterestFailed", + "type": "error" + }, + { + "inputs": [], + "name": "AmountError", + "type": "error" + }, + { + "inputs": [], + "name": "AmountExceedGlobalMax", + "type": "error" + }, + { + "inputs": [], + "name": "AmountExceedMaxBorrow", + "type": "error" + }, + { + "inputs": [], + "name": "AmountLessMinBorrow", + "type": "error" + }, + { + "inputs": [], + "name": "AmountZero", + "type": "error" + }, + { + "inputs": [], + "name": "BorrowRateExceedLimit", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotMember", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotUserManager", + "type": "error" + }, + { + "inputs": [], + "name": "DepositToAssetManagerFailed", + "type": "error" + }, + { + "inputs": [], + "name": "InitExchangeRateNotZero", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientFundsLeft", + "type": "error" + }, + { + "inputs": [], + "name": "MemberIsOverdue", + "type": "error" + }, + { + "inputs": [], + "name": "MintFeeError", + "type": "error" + }, + { + "inputs": [], + "name": "NotPaused", + "type": "error" + }, + { + "inputs": [], + "name": "OriginationFeeExceedLimit", + "type": "error" + }, + { + "inputs": [], + "name": "Paused", + "type": "error" + }, + { + "inputs": [], + "name": "ReserveFactoryExceedLimit", + "type": "error" + }, + { + "inputs": [], + "name": "SenderNotAdmin", + "type": "error" + }, + { + "inputs": [], + "name": "SenderNotGuardian", + "type": "error" + }, + { + "inputs": [], + "name": "SenderNotPendingAdmin", + "type": "error" + }, + { + "inputs": [], + "name": "WithdrawFailed", + "type": "error" + }, { "anonymous": false, "inputs": [ @@ -365,21 +457,39 @@ { "inputs": [], "name": "DOMAIN_SEPARATOR", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MIN_MINT_AMOUNT", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "WAD", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, @@ -387,8 +497,16 @@ "inputs": [ { "components": [ - { "internalType": "string", "name": "name", "type": "string" }, - { "internalType": "string", "name": "symbol", "type": "string" }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, { "internalType": "address", "name": "underlying", @@ -419,14 +537,26 @@ "name": "debtCeiling", "type": "uint256" }, - { "internalType": "uint256", "name": "maxBorrow", "type": "uint256" }, - { "internalType": "uint256", "name": "minBorrow", "type": "uint256" }, + { + "internalType": "uint256", + "name": "maxBorrow", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minBorrow", + "type": "uint256" + }, { "internalType": "uint256", "name": "overdueTime", "type": "uint256" }, - { "internalType": "address", "name": "admin", "type": "address" }, + { + "internalType": "address", + "name": "admin", + "type": "address" + }, { "internalType": "uint256", "name": "mintFeeRate", @@ -453,20 +583,36 @@ { "inputs": [], "name": "accrualTimestamp", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "accrueInterest", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "addAmount", "type": "uint256" } + { + "internalType": "uint256", + "name": "addAmount", + "type": "uint256" + } ], "name": "addReserves", "outputs": [], @@ -476,59 +622,127 @@ { "inputs": [], "name": "admin", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" } + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } ], "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "assetManager", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" } + { + "internalType": "address", + "name": "owner", + "type": "address" + } ], "name": "balanceOfUnderlying", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "name": "borrow", "outputs": [], @@ -537,67 +751,131 @@ }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "borrowBalanceView", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "borrowIndex", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "borrowRatePerSecond", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "name": "calculatingFee", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "calculatingInterest", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "checkIsOverdue", "outputs": [ - { "internalType": "bool", "name": "isOverdue", "type": "bool" } - ], + { + "internalType": "bool", + "name": "isOverdue", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "debtCeiling", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "borrower", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "name": "debtWriteOff", "outputs": [], @@ -607,13 +885,23 @@ { "inputs": [], "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, { "internalType": "uint256", "name": "subtractedValue", @@ -621,63 +909,127 @@ } ], "name": "decreaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "exchangeRateCurrent", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "exchangeRateStored", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "getBorrowed", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "getLastRepay", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getRemainingDebtCeiling", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "addedValue", "type": "uint256" } + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } ], "name": "increaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "initialExchangeRateMantissa", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, @@ -696,30 +1048,56 @@ }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "isAdmin", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "maxBorrow", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "minBorrow", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "amountIn", "type": "uint256" } + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + } ], "name": "mint", "outputs": [], @@ -729,44 +1107,84 @@ { "inputs": [], "name": "mintFeeRate", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" } + { + "internalType": "address", + "name": "owner", + "type": "address" + } ], "name": "nonces", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "originationFee", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "originationFeeMax", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "overdueTime", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, @@ -780,33 +1198,79 @@ { "inputs": [], "name": "pauseGuardian", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "paused", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "pendingAdmin", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } ], "name": "permit", "outputs": [], @@ -816,14 +1280,28 @@ { "inputs": [], "name": "proxiableUUID", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "amountIn", "type": "uint256" }, - { "internalType": "uint256", "name": "amountOut", "type": "uint256" } + { + "internalType": "uint256", + "name": "amountIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amountOut", + "type": "uint256" + } ], "name": "redeem", "outputs": [], @@ -832,8 +1310,16 @@ }, { "inputs": [ - { "internalType": "address", "name": "receiver", "type": "address" }, - { "internalType": "uint256", "name": "reduceAmount", "type": "uint256" } + { + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reduceAmount", + "type": "uint256" + } ], "name": "removeReserves", "outputs": [], @@ -842,8 +1328,16 @@ }, { "inputs": [ - { "internalType": "address", "name": "borrower", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "name": "repayBorrow", "outputs": [], @@ -852,12 +1346,36 @@ }, { "inputs": [ - { "internalType": "address", "name": "borrower", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } ], "name": "repayBorrowWithERC20Permit", "outputs": [], @@ -866,36 +1384,37 @@ }, { "inputs": [ - { "internalType": "address", "name": "borrower", "type": "address" } + { + "internalType": "address", + "name": "borrower", + "type": "address" + } ], "name": "repayInterest", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { "internalType": "address", "name": "borrower", "type": "address" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } - ], - "name": "repayInterestWithPermit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [], "name": "reserveFactorMantissa", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "assetManager_", "type": "address" } + { + "internalType": "address", + "name": "assetManager_", + "type": "address" + } ], "name": "setAssetManager", "outputs": [], @@ -904,7 +1423,11 @@ }, { "inputs": [ - { "internalType": "uint256", "name": "debtCeiling_", "type": "uint256" } + { + "internalType": "uint256", + "name": "debtCeiling_", + "type": "uint256" + } ], "name": "setDebtCeiling", "outputs": [], @@ -913,7 +1436,11 @@ }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "setGuardian", "outputs": [], @@ -935,7 +1462,11 @@ }, { "inputs": [ - { "internalType": "uint256", "name": "maxBorrow_", "type": "uint256" } + { + "internalType": "uint256", + "name": "maxBorrow_", + "type": "uint256" + } ], "name": "setMaxBorrow", "outputs": [], @@ -944,7 +1475,11 @@ }, { "inputs": [ - { "internalType": "uint256", "name": "minBorrow_", "type": "uint256" } + { + "internalType": "uint256", + "name": "minBorrow_", + "type": "uint256" + } ], "name": "setMinBorrow", "outputs": [], @@ -953,7 +1488,11 @@ }, { "inputs": [ - { "internalType": "uint256", "name": "newRate", "type": "uint256" } + { + "internalType": "uint256", + "name": "newRate", + "type": "uint256" + } ], "name": "setMintFeeRate", "outputs": [], @@ -975,7 +1514,11 @@ }, { "inputs": [ - { "internalType": "uint256", "name": "overdueTime_", "type": "uint256" } + { + "internalType": "uint256", + "name": "overdueTime_", + "type": "uint256" + } ], "name": "setOverdueTime", "outputs": [], @@ -984,7 +1527,11 @@ }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "setPendingAdmin", "outputs": [], @@ -1006,7 +1553,11 @@ }, { "inputs": [ - { "internalType": "address", "name": "userManager_", "type": "address" } + { + "internalType": "address", + "name": "userManager_", + "type": "address" + } ], "name": "setUserManager", "outputs": [], @@ -1016,70 +1567,144 @@ { "inputs": [], "name": "supplyRatePerSecond", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalBorrows", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalRedeemable", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalReserves", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "underlying", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, @@ -1110,7 +1735,11 @@ "name": "newImplementation", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } ], "name": "upgradeToAndCall", "outputs": [], @@ -1120,8 +1749,14 @@ { "inputs": [], "name": "userManager", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" } -] +] \ No newline at end of file diff --git a/src/abis/v2/userManager.json b/src/abis/v2/userManager.json index d737b80c..a54f2e2c 100644 --- a/src/abis/v2/userManager.json +++ b/src/abis/v2/userManager.json @@ -1,28 +1,137 @@ [ - { "inputs": [], "name": "AmountZero", "type": "error" }, - { "inputs": [], "name": "AssetManagerDepositFailed", "type": "error" }, - { "inputs": [], "name": "AssetManagerWithdrawFailed", "type": "error" }, - { "inputs": [], "name": "AuthFailed", "type": "error" }, - { "inputs": [], "name": "ErrorSelfVouching", "type": "error" }, - { "inputs": [], "name": "ExceedsLocked", "type": "error" }, - { "inputs": [], "name": "InsufficientBalance", "type": "error" }, - { "inputs": [], "name": "InvalidParams", "type": "error" }, - { "inputs": [], "name": "LockedRemaining", "type": "error" }, - { "inputs": [], "name": "LockedStakeNonZero", "type": "error" }, - { "inputs": [], "name": "MaxVouchees", "type": "error" }, - { "inputs": [], "name": "MaxVouchers", "type": "error" }, - { "inputs": [], "name": "NoExistingMember", "type": "error" }, - { "inputs": [], "name": "NotEnoughStakers", "type": "error" }, - { "inputs": [], "name": "NotOverdue", "type": "error" }, - { "inputs": [], "name": "NotPaused", "type": "error" }, - { "inputs": [], "name": "Paused", "type": "error" }, - { "inputs": [], "name": "SenderNotAdmin", "type": "error" }, - { "inputs": [], "name": "SenderNotGuardian", "type": "error" }, - { "inputs": [], "name": "SenderNotPendingAdmin", "type": "error" }, - { "inputs": [], "name": "StakeLimitReached", "type": "error" }, - { "inputs": [], "name": "TrustAmountLtLocked", "type": "error" }, - { "inputs": [], "name": "VouchWhenOverdue", "type": "error" }, - { "inputs": [], "name": "VoucherNotFound", "type": "error" }, + { + "inputs": [], + "name": "maxOverdueTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "AmountZero", + "type": "error" + }, + { + "inputs": [], + "name": "AssetManagerDepositFailed", + "type": "error" + }, + { + "inputs": [], + "name": "AssetManagerWithdrawFailed", + "type": "error" + }, + { + "inputs": [], + "name": "AuthFailed", + "type": "error" + }, + { + "inputs": [], + "name": "ErrorSelfVouching", + "type": "error" + }, + { + "inputs": [], + "name": "ExceedsLocked", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientBalance", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidParams", + "type": "error" + }, + { + "inputs": [], + "name": "LockedRemaining", + "type": "error" + }, + { + "inputs": [], + "name": "LockedStakeNonZero", + "type": "error" + }, + { + "inputs": [], + "name": "MaxVouchees", + "type": "error" + }, + { + "inputs": [], + "name": "MaxVouchers", + "type": "error" + }, + { + "inputs": [], + "name": "NoExistingMember", + "type": "error" + }, + { + "inputs": [], + "name": "NotEnoughStakers", + "type": "error" + }, + { + "inputs": [], + "name": "NotOverdue", + "type": "error" + }, + { + "inputs": [], + "name": "NotPaused", + "type": "error" + }, + { + "inputs": [], + "name": "Paused", + "type": "error" + }, + { + "inputs": [], + "name": "SenderNotAdmin", + "type": "error" + }, + { + "inputs": [], + "name": "SenderNotGuardian", + "type": "error" + }, + { + "inputs": [], + "name": "SenderNotPendingAdmin", + "type": "error" + }, + { + "inputs": [], + "name": "StakeLimitReached", + "type": "error" + }, + { + "inputs": [], + "name": "TrustAmountLtLocked", + "type": "error" + }, + { + "inputs": [], + "name": "VouchWhenOverdue", + "type": "error" + }, + { + "inputs": [], + "name": "VoucherNotFound", + "type": "error" + }, { "anonymous": false, "inputs": [ @@ -55,19 +164,6 @@ "name": "BeaconUpgraded", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -182,17 +278,17 @@ { "indexed": false, "internalType": "uint256", - "name": "oldMaxOverdueTime", + "name": "oldMaxOverdueBlocks", "type": "uint256" }, { "indexed": false, "internalType": "uint256", - "name": "newMaxOverdueTime", + "name": "newMaxOverdueBlocks", "type": "uint256" } ], - "name": "LogSetMaxOverdueTime", + "name": "LogSetMaxOverdueBlocks", "type": "event" }, { @@ -363,14 +459,47 @@ }, { "inputs": [ - { "internalType": "address", "name": "assetManager_", "type": "address" }, - { "internalType": "address", "name": "unionToken_", "type": "address" }, - { "internalType": "address", "name": "stakingToken_", "type": "address" }, - { "internalType": "address", "name": "comptroller_", "type": "address" }, - { "internalType": "address", "name": "admin_", "type": "address" }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "name": "__Controller_init", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "assetManager_", + "type": "address" + }, + { + "internalType": "address", + "name": "unionToken_", + "type": "address" + }, + { + "internalType": "address", + "name": "stakingToken_", + "type": "address" + }, + { + "internalType": "address", + "name": "comptroller_", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, { "internalType": "uint256", - "name": "maxOverdueTime_", + "name": "maxOverdueBlocks_", "type": "uint256" }, { @@ -378,8 +507,16 @@ "name": "effectiveCount_", "type": "uint256" }, - { "internalType": "uint256", "name": "maxVouchers_", "type": "uint256" }, - { "internalType": "uint256", "name": "maxVouchees_", "type": "uint256" } + { + "internalType": "uint256", + "name": "maxVouchers_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxVouchees_", + "type": "uint256" + } ], "name": "__UserManager_init", "outputs": [], @@ -395,7 +532,11 @@ }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "addMember", "outputs": [], @@ -405,20 +546,36 @@ { "inputs": [], "name": "admin", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "assetManager", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address[]", "name": "stakerList", "type": "address[]" } + { + "internalType": "address[]", + "name": "stakerList", + "type": "address[]" + } ], "name": "batchUpdateFrozenInfo", "outputs": [], @@ -427,8 +584,16 @@ }, { "inputs": [ - { "internalType": "address", "name": "staker", "type": "address" }, - { "internalType": "address", "name": "borrower", "type": "address" } + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + } ], "name": "cancelVouch", "outputs": [], @@ -437,10 +602,20 @@ }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "checkIsMember", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, @@ -448,20 +623,32 @@ "inputs": [], "name": "comptroller", "outputs": [ - { "internalType": "contract IComptroller", "name": "", "type": "address" } + { + "internalType": "contract IComptroller", + "name": "", + "type": "address" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "stakerAddress", "type": "address" }, + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + }, { "internalType": "address", "name": "borrowerAddress", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "uint96", + "name": "amount", + "type": "uint96" + } ], "name": "debtWriteOff", "outputs": [], @@ -471,52 +658,112 @@ { "inputs": [], "name": "effectiveCount", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "name": "frozenCoinAge", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "gLastWithdrawRewards", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "inputs": [ + { + "internalType": "address", + "name": "borrower", + "type": "address" + } + ], + "name": "getCreditLimit", + "outputs": [ + { + "internalType": "uint256", + "name": "total", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "borrower", "type": "address" } + { + "internalType": "address", + "name": "", + "type": "address" + } ], - "name": "getCreditLimit", + "name": "getLastWithdrawRewards", "outputs": [ - { "internalType": "uint256", "name": "total", "type": "uint256" } + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "staker", "type": "address" }, - { "internalType": "address", "name": "borrower", "type": "address" } + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + } ], "name": "getLockedStake", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "staker", "type": "address" } + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "uint256", + "name": "pastBlocks", + "type": "uint256" + } ], "name": "getStakeInfo", "outputs": [ - { "internalType": "bool", "name": "isMember", "type": "bool" }, { "internalType": "uint256", "name": "effectiveStaked", @@ -527,54 +774,112 @@ "name": "effectiveLocked", "type": "uint256" }, - { "internalType": "uint256", "name": "stakerFrozen", "type": "uint256" } + { + "internalType": "bool", + "name": "isMember", + "type": "bool" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "getStakerBalance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "staker", "type": "address" } + { + "internalType": "address", + "name": "staker", + "type": "address" + } ], "name": "getTotalLockedStake", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "staker", "type": "address" } + { + "internalType": "address", + "name": "staker", + "type": "address" + } ], "name": "getVoucheeCount", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "borrower", "type": "address" } + { + "internalType": "address", + "name": "borrower", + "type": "address" + } ], "name": "getVoucherCount", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "_staker", "type": "address" }, - { "internalType": "address", "name": "borrower", "type": "address" } + { + "internalType": "address", + "name": "_staker", + "type": "address" + }, + { + "internalType": "address", + "name": "borrower", + "type": "address" + } ], "name": "getVouchingAmount", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, @@ -582,66 +887,125 @@ "inputs": [], "name": "globalTotalStaked", "outputs": [ - { "internalType": "uint256", "name": "globalTotal", "type": "uint256" } + { + "internalType": "uint256", + "name": "globalTotal", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "isAdmin", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], - "name": "maxOverdueTime", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "maxOverdueBlocks", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "maxStakeAmount", - "outputs": [{ "internalType": "uint96", "name": "", "type": "uint96" }], + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "maxVouchees", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "maxVouchers", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "name": "memberFrozen", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "newMemberFee", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "borrower", "type": "address" }, - { "internalType": "uint256", "name": "overdueTime", "type": "uint256" } + { + "internalType": "address", + "name": "borrower", + "type": "address" + } ], "name": "onRepayBorrow", "outputs": [], @@ -650,7 +1014,16 @@ }, { "inputs": [ - { "internalType": "address", "name": "staker", "type": "address" } + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "uint256", + "name": "pastBlocks", + "type": "uint256" + } ], "name": "onWithdrawRewards", "outputs": [ @@ -664,7 +1037,11 @@ "name": "effectiveLocked", "type": "uint256" }, - { "internalType": "bool", "name": "isMember", "type": "bool" } + { + "internalType": "bool", + "name": "isMember", + "type": "bool" + } ], "stateMutability": "nonpayable", "type": "function" @@ -679,34 +1056,49 @@ { "inputs": [], "name": "pauseGuardian", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "paused", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "pendingAdmin", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "proxiableUUID", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "newMember", "type": "address" } + { + "internalType": "address", + "name": "newMember", + "type": "address" + } ], "name": "registerMember", "outputs": [], @@ -715,12 +1107,36 @@ }, { "inputs": [ - { "internalType": "address", "name": "newMember", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } + { + "internalType": "address", + "name": "newMember", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } ], "name": "registerMemberWithPermit", "outputs": [], @@ -742,7 +1158,11 @@ }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "setGuardian", "outputs": [], @@ -753,18 +1173,22 @@ "inputs": [ { "internalType": "uint256", - "name": "_maxOverdueTime", + "name": "_maxOverdueBlocks", "type": "uint256" } ], - "name": "setMaxOverdueTime", + "name": "setMaxOverdueBlocks", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { "internalType": "uint96", "name": "maxStakeAmount_", "type": "uint96" } + { + "internalType": "uint96", + "name": "maxStakeAmount_", + "type": "uint96" + } ], "name": "setMaxStakeAmount", "outputs": [], @@ -773,7 +1197,11 @@ }, { "inputs": [ - { "internalType": "uint256", "name": "_maxVouchees", "type": "uint256" } + { + "internalType": "uint256", + "name": "_maxVouchees", + "type": "uint256" + } ], "name": "setMaxVouchees", "outputs": [], @@ -782,7 +1210,11 @@ }, { "inputs": [ - { "internalType": "uint256", "name": "_maxVouchers", "type": "uint256" } + { + "internalType": "uint256", + "name": "_maxVouchers", + "type": "uint256" + } ], "name": "setMaxVouchers", "outputs": [], @@ -791,7 +1223,11 @@ }, { "inputs": [ - { "internalType": "uint256", "name": "amount", "type": "uint256" } + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } ], "name": "setNewMemberFee", "outputs": [], @@ -800,7 +1236,11 @@ }, { "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } + { + "internalType": "address", + "name": "account", + "type": "address" + } ], "name": "setPendingAdmin", "outputs": [], @@ -809,7 +1249,11 @@ }, { "inputs": [ - { "internalType": "address", "name": "uToken_", "type": "address" } + { + "internalType": "address", + "name": "uToken_", + "type": "address" + } ], "name": "setUToken", "outputs": [], @@ -818,7 +1262,11 @@ }, { "inputs": [ - { "internalType": "uint96", "name": "amount", "type": "uint96" } + { + "internalType": "uint96", + "name": "amount", + "type": "uint96" + } ], "name": "stake", "outputs": [], @@ -827,11 +1275,31 @@ }, { "inputs": [ - { "internalType": "uint256", "name": "amount", "type": "uint256" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } ], "name": "stakeWithERC20Permit", "outputs": [], @@ -839,15 +1307,45 @@ "type": "function" }, { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "name": "stakers", "outputs": [ - { "internalType": "bool", "name": "isMember", "type": "bool" }, - { "internalType": "uint96", "name": "stakedAmount", "type": "uint96" }, - { "internalType": "uint96", "name": "locked", "type": "uint96" }, - { "internalType": "uint64", "name": "lastUpdated", "type": "uint64" }, - { "internalType": "uint256", "name": "stakedCoinAge", "type": "uint256" }, - { "internalType": "uint256", "name": "lockedCoinAge", "type": "uint256" } + { + "internalType": "bool", + "name": "isMember", + "type": "bool" + }, + { + "internalType": "uint96", + "name": "stakedAmount", + "type": "uint96" + }, + { + "internalType": "uint96", + "name": "locked", + "type": "uint96" + }, + { + "internalType": "uint64", + "name": "lastUpdated", + "type": "uint64" + }, + { + "internalType": "uint256", + "name": "stakedCoinAge", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lockedCoinAge", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -855,21 +1353,39 @@ { "inputs": [], "name": "stakingToken", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalFrozen", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalStaked", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, @@ -877,7 +1393,11 @@ "inputs": [], "name": "uToken", "outputs": [ - { "internalType": "contract IUToken", "name": "", "type": "address" } + { + "internalType": "contract IUToken", + "name": "", + "type": "address" + } ], "stateMutability": "view", "type": "function" @@ -885,7 +1405,13 @@ { "inputs": [], "name": "unionToken", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, @@ -898,7 +1424,11 @@ }, { "inputs": [ - { "internalType": "uint96", "name": "amount", "type": "uint96" } + { + "internalType": "uint96", + "name": "amount", + "type": "uint96" + } ], "name": "unstake", "outputs": [], @@ -907,9 +1437,21 @@ }, { "inputs": [ - { "internalType": "address", "name": "borrower", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" }, - { "internalType": "bool", "name": "lock", "type": "bool" } + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint96", + "name": "amount", + "type": "uint96" + }, + { + "internalType": "bool", + "name": "lock", + "type": "bool" + } ], "name": "updateLocked", "outputs": [], @@ -918,8 +1460,16 @@ }, { "inputs": [ - { "internalType": "address", "name": "borrower", "type": "address" }, - { "internalType": "uint96", "name": "trustAmount", "type": "uint96" } + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint96", + "name": "trustAmount", + "type": "uint96" + } ], "name": "updateTrust", "outputs": [], @@ -946,7 +1496,11 @@ "name": "newImplementation", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } ], "name": "upgradeToAndCall", "outputs": [], @@ -955,54 +1509,126 @@ }, { "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" } + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } ], "name": "voucheeIndexes", "outputs": [ - { "internalType": "bool", "name": "isSet", "type": "bool" }, - { "internalType": "uint128", "name": "idx", "type": "uint128" } + { + "internalType": "bool", + "name": "isSet", + "type": "bool" + }, + { + "internalType": "uint128", + "name": "idx", + "type": "uint128" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "name": "vouchees", "outputs": [ - { "internalType": "address", "name": "borrower", "type": "address" }, - { "internalType": "uint96", "name": "voucherIndex", "type": "uint96" } + { + "internalType": "address", + "name": "borrower", + "type": "address" + }, + { + "internalType": "uint96", + "name": "voucherIndex", + "type": "uint96" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" } + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } ], "name": "voucherIndexes", "outputs": [ - { "internalType": "bool", "name": "isSet", "type": "bool" }, - { "internalType": "uint128", "name": "idx", "type": "uint128" } + { + "internalType": "bool", + "name": "isSet", + "type": "bool" + }, + { + "internalType": "uint128", + "name": "idx", + "type": "uint128" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "uint256", "name": "", "type": "uint256" } + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } ], "name": "vouchers", "outputs": [ - { "internalType": "address", "name": "staker", "type": "address" }, - { "internalType": "uint96", "name": "trust", "type": "uint96" }, - { "internalType": "uint96", "name": "locked", "type": "uint96" }, - { "internalType": "uint64", "name": "lastUpdated", "type": "uint64" } + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "uint96", + "name": "trust", + "type": "uint96" + }, + { + "internalType": "uint96", + "name": "locked", + "type": "uint96" + }, + { + "internalType": "uint64", + "name": "lastUpdated", + "type": "uint64" + } ], "stateMutability": "view", "type": "function" diff --git a/src/components/VouchFaucetButton.jsx b/src/components/VouchFaucetButton.jsx index ddbae046..0f287fc6 100644 --- a/src/components/VouchFaucetButton.jsx +++ b/src/components/VouchFaucetButton.jsx @@ -14,16 +14,14 @@ export default function VouchFaucetButton() { method: "claimVouch", contract: "vouchFaucet", args: [], - onComplete: refetchVouchers, + onComplete: refetchVouchers }); - console.log(onClick, loading, onClick); - if (![goerli.id, optimismGoerli.id].includes(chain.id)) { return ( <> No frens?{" "} - + Try Discord @@ -36,7 +34,8 @@ export default function VouchFaucetButton() { onClick={onClick} loading={loading} label="Claim a testnet vouch" - variant="secondary" + color="secondary" + variant="light" /> ); } diff --git a/src/components/connect/Banner.jsx b/src/components/connect/Banner.jsx index 90186acc..8c16f6f4 100644 --- a/src/components/connect/Banner.jsx +++ b/src/components/connect/Banner.jsx @@ -6,8 +6,8 @@ export default function Banner() {
- Welcome to Union, the place to create, manage and grow your on-chain - credit + Welcome to Union, the + place to create, manage and grow your on-chain credit
diff --git a/src/components/connect/Banner.scss b/src/components/connect/Banner.scss index 98eca5c2..cdce13cc 100644 --- a/src/components/connect/Banner.scss +++ b/src/components/connect/Banner.scss @@ -3,7 +3,6 @@ .ConnectBanner { height: 176px; display: flex; - width: 80%; align-items: center; justify-content: center; background-image: url("../../images/gradient.png"); @@ -14,12 +13,12 @@ background-size: cover; background-position: center; - @media screen and (max-width: $mobileWidth) { - height: 120px; + &__bold { + font-weight: 500; } - @media screen and (min-width: $mobileWidth - 1px) { - margin-top: -24px; + @media screen and (max-width: $mobileWidth) { + height: 120px; } .heading.heading { diff --git a/src/components/connect/NetworkSelect.jsx b/src/components/connect/NetworkSelect.jsx index 69d5f328..64eda42f 100644 --- a/src/components/connect/NetworkSelect.jsx +++ b/src/components/connect/NetworkSelect.jsx @@ -1,7 +1,8 @@ import "./NetworkSelect.scss"; +import { optimismGoerli, goerli } from "wagmi/chains"; import { useEffect, useState } from "react"; -import { Grid, Box, Button } from "@unioncredit/ui"; +import { WalletIcon, Box, Button } from "@unioncredit/ui"; import { useConnectModal } from "@rainbow-me/rainbowkit"; import { useAccount, useNetwork, useSwitchNetwork } from "wagmi"; @@ -9,9 +10,9 @@ import useNetworks from "hooks/useNetworks"; import { useAppNetwork } from "providers/Network"; import useMemberSummary from "hooks/useMemberSummary"; import { NetworkSelectOption } from "./NetworkSelectOption"; -import { optimismGoerli, goerli } from "wagmi/chains"; +import cn from "classnames"; -export default function NetworkSelect() { +export default function NetworkSelect({ version }) { const { chain } = useNetwork(); const { address, isConnected } = useAccount(); const { setAppReady } = useAppNetwork(); @@ -23,10 +24,8 @@ export default function NetworkSelect() { const [selected, setSelected] = useState(null); - const allNetworks = useNetworks(); - const networks = allNetworks.filter((x) => - ![optimismGoerli.id, goerli.id].includes(x.chainId) - ); + const allNetworks = useNetworks(false, version); + const networks = allNetworks.filter((x) => ![optimismGoerli.id, goerli.id].includes(x.chainId)); const handleChangeNetwork = async (network) => { if (!isConnected) return; @@ -49,52 +48,56 @@ export default function NetworkSelect() { }, [chain?.id, JSON.stringify(networks)]); return ( - - - - - {networks.map((network) => ( - handleChangeNetwork(network)} - active={isConnected && selected?.chainId === network.chainId} - /> - ))} - - + )} + > + + + + Column Data + + + + + ({ + ...column, + type: "radio", + checked: column.id === active.id, + }))} + onChange={(selectedId) => { + setSelectedColumn( + columns.find((column) => column.id === selectedId) + ); + setSort({ ...sort, type: selectedId }); + setOpen(false); + }} + /> + + + + { + setSort({ + ...sort, + order: sort.order === selectedId ? null : selectedId, + }); + + setOpen(false); + }} + /> + + + + )} + + + +
+ {voucher ? ( + + ) : ( + + + You're not receiving from this contact + + + )} +
+ + ); +} + +const VoucherDetails = ({ voucher }) => { + const navigate = useNavigate(); + + const { address: borrowerAddress } = useAccount(); + const { address: stakerAddress, trust = ZERO, vouch = ZERO, locking = ZERO } = voucher; + + const cancelVouchButtonProps = useWrite({ + contract: "userManager", + method: "cancelVouch", + args: [stakerAddress, borrowerAddress], // staker, borrower + enabled: locking.lte(ZERO), + onComplete: async () => { + navigate(0); // reload page + } + }); + + return ( + <> + + + +