Skip to content

Commit 25e0ca0

Browse files
authored
UI bugs (#263)
* removing amount pre-population * ordering active geysers first * fixed geyser name * fixed create2Vault tx creation
1 parent 70e1d70 commit 25e0ca0

File tree

4 files changed

+33
-34
lines changed

4 files changed

+33
-34
lines changed

frontend/src/components/GeyserFirst/GeyserStakeView.tsx

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -66,31 +66,36 @@ export const GeyserStakeView = () => {
6666
setParsedUserInput(BigNumber.from('0'))
6767
}
6868

69-
const setDefaultInputAmount = () => {
70-
if (stakingTokenInfo.price > 0) {
71-
const initialStakeAmountUSD = 1000
72-
const stakeAmt = Math.max(initialStakeAmountUSD / stakingTokenInfo.price, 0.0000001).toFixed(
73-
stakingTokenInfo.decimals,
74-
)
75-
const stakeAmtFP = parseUnits(stakeAmt, stakingTokenInfo.decimals)
76-
setUserInput(stakeAmt)
77-
setParsedUserInput(BigNumber.from(stakeAmtFP))
78-
}
79-
}
69+
// NOTE: Disabling pre-populating, because some users find it confusing
70+
// TODO: Remove entirely.
71+
// const setDefaultInputAmount = () => {
72+
// if (stakingTokenInfo.price > 0) {
73+
// const initialStakeAmountUSD = 1000
74+
// const stakeAmt = Math.max(initialStakeAmountUSD / stakingTokenInfo.price, 0.0000001).toFixed(
75+
// stakingTokenInfo.decimals,
76+
// )
77+
// const stakeAmtFP = parseUnits(stakeAmt, stakingTokenInfo.decimals)
78+
// setUserInput(stakeAmt)
79+
// setParsedUserInput(BigNumber.from(stakeAmtFP))
80+
// }
81+
// }
82+
// useEffect(() => {
83+
// refreshInputAmount()
84+
// if (geyserAction === GeyserAction.STAKE) {
85+
// if (!ready) {
86+
// setDefaultInputAmount()
87+
// } else if (currentStakeAmount.eq(0) && stakableAmount.eq(0)) {
88+
// setDefaultInputAmount()
89+
// } else if (ready && currentStakeAmount.eq(0) && stakableAmount.gt(0)) {
90+
// setUserInput(formatUnits(stakableAmount, stakingTokenDecimals))
91+
// setParsedUserInput(stakableAmount)
92+
// }
93+
// }
94+
// }, [ready, geyserAction, stakingTokenBalance, currentStakeable])
8095

8196
useEffect(() => {
8297
refreshInputAmount()
83-
if (geyserAction === GeyserAction.STAKE) {
84-
if (!ready) {
85-
setDefaultInputAmount()
86-
} else if (currentStakeAmount.eq(0) && stakableAmount.eq(0)) {
87-
setDefaultInputAmount()
88-
} else if (currentStakeAmount.eq(0) && stakableAmount.gt(0)) {
89-
setUserInput(formatUnits(stakableAmount, stakingTokenDecimals))
90-
setParsedUserInput(stakableAmount)
91-
}
92-
}
93-
}, [ready, geyserAction, stakingTokenBalance, currentStakeable])
98+
}, [geyserAction])
9499

95100
const handleGeyserInteraction = () => {
96101
if (geyserAction === GeyserAction.STAKE) {

frontend/src/components/Home.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export const Home = () => {
6060
if (geysersToShow.length === 0) {
6161
geysersToShow = geyserData.slice(0, 3)
6262
}
63+
geysersToShow = geysersToShow.sort((g1, g2) => g2.active - g1.active)
6364

6465
return (
6566
<Container>

frontend/src/config/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ const geyserList: AppGeysersList = {
9797
// },
9898

9999
{
100-
name: 'Riverside I (STAMPL)',
100+
name: 'Riverside I (stAMPL)',
101101
address: '0xa19604b951592170DDa857CBE46609B85AB00Dee',
102102
stakingToken: StakingToken.STAMPL,
103103
rewardToken: RewardToken.FORTH,

frontend/src/sdk/actions.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,13 @@ export const approveCreateDepositStake = async (geyserAddress: string, amount: B
129129
const token = new Contract(tokenAddress, ERC20_ABI, signer)
130130

131131
const salt = randomBytes(32)
132-
const vaultAddress = await router.callStatic.create2Vault(
133-
config.VaultFactory.address,
134-
salt,
135-
await signer.getAddress(),
136-
)
132+
const vaultAddress = await router.connect(signer).callStatic.create2Vault(config.VaultFactory.address, salt)
133+
137134
const vault = new Contract(vaultAddress, config.VaultTemplate.abi, signer)
138135
const lockPermission = await signPermission('Lock', vault, signer, geyserAddress, token.address, amount, '0')
139136
const args = [geyserAddress, config.VaultFactory.address, await signer.getAddress(), amount, salt, lockPermission]
140137

141-
const allowance = await token.allowance(signer.getAddress(), router.address)
138+
const allowance = await token.allowance(await signer.getAddress(), router.address)
142139
if (allowance.lt(amount)) {
143140
await (await token.approve(router.address, amount)).wait()
144141
}
@@ -190,11 +187,7 @@ export const permitCreateDepositStake = async (geyserAddress: string, amount: Bi
190187
}
191188

192189
const salt = randomBytes(32)
193-
const vaultAddress = await router.callStatic.create2Vault(
194-
config.VaultFactory.address,
195-
salt,
196-
await signer.getAddress(),
197-
)
190+
const vaultAddress = await router.connect(signer).callStatic.create2Vault(config.VaultFactory.address, salt)
198191
const vault = new Contract(vaultAddress, config.VaultTemplate.address, signer)
199192

200193
const permit = await signPermitEIP2612(signer, tokenAddress, router.address, amount, deadline)

0 commit comments

Comments
 (0)