-
Notifications
You must be signed in to change notification settings - Fork 0
added modal for staking #15
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
Conversation
Deployed on https://add-staking-action.pwn-staking-ui.pages.dev! |
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.
mostly good, just few comments and also feature changes here and in notion
pages/index.vue
Outdated
@@ -296,6 +308,12 @@ const chainIdToToggleTo = computed(() => getChainIdToToggleTo(chainId.value)) | |||
const switchChain = () => { | |||
toggleActiveChain(chainId.value) | |||
} | |||
|
|||
const createStakeModal = ref() |
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.
question: hmm that's an interesting approach but i'm wondering what is a benefit of doing this instead of just simple store that would hold the global values that we need to also access/set outside of the component itself?
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.
tACK
components/CreateStakeModal.vue
Outdated
if (pwnTokenBalance.value === undefined || pwnTokenBalance.value === 0n) { | ||
return "0"; | ||
} | ||
return formatDecimalPoint(formatUnits(pwnTokenBalance.value, 18)); |
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.
Not sure if decimals amount would even change but would make sense to reference it as a contsant
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.
agree, updated
components/CreateStakeModal.vue
Outdated
// Add computed properties for potential voting power | ||
// const potentialMultiplier = computed(() => { | ||
// if (!lockUpEpochs.value) return 0 | ||
// return getMultiplierForLockUpEpochs(lockUpEpochs.value) | ||
// }) | ||
|
||
// const potentialVotingPower = computed(() => { | ||
// if (!stakeAmount.value || !lockUpEpochs.value) return '0' | ||
// return getFormattedVotingPower(stakeAmount.value, potentialMultiplier.value) | ||
// }) |
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.
anything to do here?
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.
no, this was just unused after i've enabled the linter, removed the uncommented code
utils/useTransactions.ts
Outdated
console.log("Starting to send a transaction with following parameters:"); | ||
console.log(transaction); | ||
// console.log(`Additional UI parameter passed to sendTransaction: step=${step?.text}, safeAddress=${safeAddress}`) | ||
|
||
const { address: userAddress } = getAccount(wagmiAdapter.wagmiConfig) | ||
const connectedChainId = getAccount(wagmiAdapter.wagmiConfig).chainId; | ||
console.log( | ||
`connectedChainId=${connectedChainId}; transaction.chainId=${transaction.chainId}`, | ||
); | ||
|
||
// @ts-expect-error probably some type mismatch between writeContract and simulateContract | ||
await simulateContract(wagmiAdapter.wagmiConfig, transaction) | ||
if (connectedChainId !== transaction.chainId) { | ||
console.log( | ||
`Switching chain from ${connectedChainId} to ${transaction.chainId}.`, | ||
); | ||
const switchedChain = await switchChain(wagmiAdapter.wagmiConfig, { | ||
chainId: transaction.chainId!, | ||
}); | ||
if (switchedChain.id !== transaction.chainId) { | ||
throw new Error("User denied switching chains before sending a tx."); | ||
} | ||
} |
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.
Do you plan to keep these console.logs here?
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.
yes i think it does not hurt anything:)
https://www.notion.so/pwndao/Add-staking-action-to-the-UI-121dc8b817b4806fb2f4fcdc1d23cb6c?pvs=4