-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: initialize #3
base: development
Are you sure you want to change the base?
chore: initialize #3
Conversation
Unused files (1)
|
@@ -0,0 +1,299 @@ | |||
export const ufaucetAbi = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just make this a JSON file its cleaner that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to take advantage of typing this way.
@0x4007 I just realized that I was previously unassigned from this task. I already raised a PR. |
@zugdev, this task has been idle for a while. Please provide an update. |
The listed criteria in #1 (comment) have been satisfied by the latest push. |
@kingsley-einstein, this task has been idle for a while. Please provide an update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Pls merge feat: add UBQ fund test script kingsley-einstein/uusd.ubq.fi#3
- Check this screenshot:
Somehow when I enter 100 UUSD to mint the actually passed amount is 100000000 while the expected amount is 100000000000000000000. There's smth wrong with decimals. Pls check all over the code.
feat: add UBQ fund test script
@rndquu |
@rndquu |
When I fill the form initially the mint button is visible. Only after the allowance check runs it displays the approval button. The button should be disabled until allowance is checked, because if user proceeds to quickly press the mint button he will get reverted. Screen.Recording.2024-11-11.180859.mp4 |
Also, displaying the minting/redeeming fees is important. In the LUSD case, currently it's 0%, but you should read it dynamically from the collateralInfo function. It's vital as the fees are a part of our planned business model and will be non-null in near future. You can refer to the code I wrote for this: https://github.com/zugdev/uusd.ubq.fi/blob/f4c6623cec130cff75e299ca47f0a45b63ace819/src/pages/mint.ts#L48-L85 |
The button seems to be generally a little inconsistent, it flickers: Screen.Recording.2024-11-11.182203.mp4I suggest on form update you check allowances to determine the button's state. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rndquu, I've left a few comments and suggestions. @kingsley-einstein, please wait for him to check them before you implement those, he might disagree with some.
|
||
const CLIENT_OR_ACCOUNT_ERROR = "Client or account not initialized"; | ||
|
||
export async function getAllCollaterals() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are creating a contract instance and a public function for every single contract method, there is no need to do that. As in viem docs, you should make a public contract instance and then you can directly call it's methods. From their official documentation:
import { getContract } from 'viem'
import { wagmiAbi } from './abi'
import { publicClient, walletClient } from './client'
// 1. Create contract instance
const contract = getContract({
address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
abi: wagmiAbi,
// 1a. Insert a single client
client: publicClient,
// 1b. Or public and/or wallet clients
client: { public: publicClient, wallet: walletClient }
})
// 2. Call contract methods, fetch events, listen to events, etc.
const result = await contract.read.totalSupply()
const logs = await contract.getEvents.Transfer()
const unwatch = contract.watchEvent.Transfer(
{ from: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e' },
{ onLogs(logs) { console.log(logs) } }
)
let maxGovernanceIn = 0; | ||
let isOneToOne = false; | ||
|
||
let isButtonInteractionsDisabled = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there is a need to have this variable as you can just use mintButton.disabled to check the status. This could be the cause for the button's inconsistency.
let dollarOutMin = 0; | ||
let maxCollateralIn = 0; | ||
let maxGovernanceIn = 0; | ||
let isOneToOne = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should initially be true.
|
||
const collateralRecord: Record<string | number, `0x${string}`> = {}; | ||
const toastActions = new ToastActions(); | ||
const publicClient = createPublicClient({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are creating multiple clients. Why not share a single client with the entire app?
const web3Client = getConnectedClient(); | ||
|
||
if (allowanceButton !== null) | ||
allowanceButton.disabled = web3Client === null || !collateralAddress || !web3Client.account || isButtonInteractionsDisabled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be prettier if you consolidated allowanceButton and mintButton into an actionButton, since they are never displayed concomitantly and share the same objective.
@@ -0,0 +1,259 @@ | |||
import { createPublicClient, http, parseUnits, BaseError } from "viem"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comments in mint.ts should make sense here too.
wallet.updateConnectButtonText(""); | ||
|
||
await wallet.connectIfAuthorized(); | ||
await mint.initCollateralList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The collateral list is shared between mint and redeem. Making it global is a good idea.
@@ -6,6 +6,6 @@ export default defineConfig({ | |||
// implement node event listeners here | |||
}, | |||
experimentalStudio: true, | |||
baseUrl: "http://localhost:8080", | |||
baseUrl: "http://localhost:10090", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8080 is the default HTML port, why change it?
} | ||
|
||
//eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
export function toSf(i: any, sf: number = 3) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This naming isn't clear
<link rel="stylesheet" href="style/style.css" /> | ||
</head> | ||
<body class="w-screen overflow-x-hidden min-h-screen drawer"> | ||
<main class="container mx-auto flex max-w-full lg:w-[80%] flex-col justify-start items-center py-4 px-4 lg:px-5 gap-12 overflow-x-hidden drawer-content"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Styling in class name / Tailwind is not used within our UIs, tho I am not sure if it matters as styling will be made in a future PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kingsley-einstein, this task has been idle for a while. Please provide an update. |
Still under review |
Resolves #1