Skip to content

Commit

Permalink
Track swap1 correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
af-afk committed Jun 10, 2024
1 parent c299bf3 commit 5544d67
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion db/migrations/1712766721-events_seawater.sql
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ CREATE TABLE events_seawater_mintPosition (
);

CREATE UNIQUE INDEX ON events_seawater_mintPosition (pos_id);
CREATE UNIQUE INDEX ON events_seawater_mintPosition (owner, pool);
CREATE INDEX ON events_seawater_mintPosition (owner, pool);

CREATE TABLE events_seawater_transferPosition (
id SERIAL PRIMARY KEY,
Expand Down
2 changes: 1 addition & 1 deletion lib/events/seawater/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type (
Swap1 struct {
events.Event

User types.Address `json:"user_"`
User types.Address `json:"user_" gorm:"column:user_"`
Pool types.Address `json:"pool_"`
ZeroForOne bool `json:"zeroForOne"`
Amount0 types.UnscaledNumber `json:"amount0"`
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/stake/pool/confirm-liquidity/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export default function ConfirmAddLiquidity() {
const params = useSearchParams()
const positionId = params.get("positionId")

return <ConfirmStake mode="existing" positionId={positionId ?? ""} />;
return <ConfirmStake mode="existing" positionId={positionId} />;
}
20 changes: 11 additions & 9 deletions web/src/components/ConfirmStake.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ type ConfirmStakeProps = {
positionId?: never,
} | {
mode: "existing",
positionId: string,
positionId: string | null,
};

export const ConfirmStake = ({ mode, positionId }: ConfirmStakeProps) => {
const router = useRouter();

const { address } = useAccount();

if (!positionId) throw new Error("bad position id");

const {
token0,
token1,
Expand Down Expand Up @@ -232,10 +234,10 @@ export const ConfirmStake = ({ mode, positionId }: ConfirmStakeProps) => {

// step 1 pending
if (isMintPending || (mintData && result?.isPending)) {
return <Confirm
text={"Stake"}
fromAsset={{symbol: token0.symbol, amount: token0Amount ?? "0"}}
toAsset={{symbol: token1.symbol, amount: token1Amount ?? "0"}}
return <Confirm
text={"Stake"}
fromAsset={{symbol: token0.symbol, amount: token0Amount ?? "0"}}
toAsset={{symbol: token1.symbol, amount: token1Amount ?? "0"}}
transactionHash={mintData}
/>;
}
Expand Down Expand Up @@ -271,10 +273,10 @@ export const ConfirmStake = ({ mode, positionId }: ConfirmStakeProps) => {
isUpdatePositionPending ||
(updatePositionData && updatePositionResult?.isPending)
) {
return <Confirm
text={"Stake"}
fromAsset={{symbol: token0.symbol, amount: token0Amount ?? "0"}}
toAsset={{symbol: token1.symbol, amount: token1Amount ?? "0"}}
return <Confirm
text={"Stake"}
fromAsset={{symbol: token0.symbol, amount: token0Amount ?? "0"}}
toAsset={{symbol: token1.symbol, amount: token1Amount ?? "0"}}
transactionHash={updatePositionData}
/>;
}
Expand Down

0 comments on commit 5544d67

Please sign in to comment.