Skip to content

Commit

Permalink
fix allowance read
Browse files Browse the repository at this point in the history
  • Loading branch information
uncoolzero committed Oct 11, 2024
1 parent 55a2ab6 commit 811abd1
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions projects/ui/src/pages/l1delegate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ export default function L1Delegate() {
"function tokenAllowance(address account, address spender, address token) public view returns (uint256)"
])

const beanL1MiniAbi = new ethers.utils.Interface([
"function allowance(address owner, address spender) returns (uint256)"
])

const l1ReadResults = useReadContracts({
contracts: [
{
Expand All @@ -74,11 +78,11 @@ export default function L1Delegate() {
args: [account, beanL1Address]
},
{
address: beanstalkL1Address as `0x${string}`,
abi: JSON.parse(beanstalkL1MiniAbi.format(ethers.utils.FormatTypes.json) as string),
functionName: "tokenAllowance",
address: beanL1Address as `0x${string}`,
abi: JSON.parse(beanL1MiniAbi.format(ethers.utils.FormatTypes.json) as string),
functionName: "allowance",
// @ts-ignore
args: [account, beanstalkL1Address, beanL1Address]
args: [account, beanstalkL1Address]
},
],
query: {
Expand Down Expand Up @@ -337,7 +341,7 @@ export default function L1Delegate() {
migrated and automatically sent to the specified address on Arbitrum.
</Typography>
<Button
disabled={(!isAddressValid && beanBalance.eq(0)) || !destinationAccount || beanComplete}
disabled={!isAddressValid || (!isAddressValid && beanBalance.eq(0)) || !destinationAccount || beanComplete}
sx={{
width: '100%',
height: 60,
Expand All @@ -355,7 +359,7 @@ export default function L1Delegate() {
specified.
</Typography>
<Button
disabled={(!isAddressValid && !migrateInternal) || !destinationAccount || internalComplete}
disabled={!isAddressValid || (!isAddressValid && !migrateInternal) || !destinationAccount || internalComplete}
sx={{
width: '100%',
height: 60,
Expand Down

0 comments on commit 811abd1

Please sign in to comment.