Skip to content

Commit

Permalink
Staging (#34)
Browse files Browse the repository at this point in the history
* Merge from main (#31)

* Fixed sweeping gas handling following EIP-4844 upgrades on optimism (#35)

* Fixed gas issues following EIP-4844 upgrade on optimism
  • Loading branch information
Avelous authored Mar 14, 2024
1 parent 18274d1 commit 0ef3901
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/nextjs/hooks/useSweepWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ const useSweepWallet = ({ game, token }: { game?: Game; token?: string }) => {

const gasPrice = await provider.getGasPrice();

const gasLimit = 21000000;
let gasCost = gasPrice.mul(42000000); // gasLimit * 2
const gasLimit = 21000;
let gasCost = gasPrice.mul(42000); // gasLimit * 2

let totalToSend = balance.sub(gasCost);

Expand Down Expand Up @@ -90,7 +90,7 @@ const useSweepWallet = ({ game, token }: { game?: Game; token?: string }) => {
setIsSweeping(false);
} catch (error: any) {
try {
gasCost = gasPrice.mul(84000000); // gasLimit * 4
gasCost = gasPrice.mul(84000); // gasLimit * 4

totalToSend = balance.sub(gasCost);

Expand Down Expand Up @@ -124,7 +124,7 @@ const useSweepWallet = ({ game, token }: { game?: Game; token?: string }) => {
setIsSweeping(false);
} catch (error: any) {
try {
gasCost = gasPrice.mul(168000000); // gasLimit * 8
gasCost = gasPrice.mul(168000); // gasLimit * 8

totalToSend = balance.sub(gasCost);

Expand Down

0 comments on commit 0ef3901

Please sign in to comment.