Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const config: CodegenConfig = {
},
},
"src/generated/gql/pintostalk-cache/": {
schema: "https://graph.bean.money/cache",
schema: "https://graph.pinto.money/cache",
documents: ["src/queries/beanstalk/**/*.cache.graphql"],
preset: "client",
presetConfig: {
Expand Down
19 changes: 17 additions & 2 deletions src/components/WalletButtonClaim.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,32 @@ export default function WalletButtonClaim() {
args: [account.address, tokensToMow],
});

const claimFlood = encodeFunctionData({
const claimAllPlenty = encodeFunctionData({
abi: beanstalkAbi,
functionName: "claimAllPlenty",
args: [Number(balanceTo)],
});

// claimAllPlenty only iterates currently-whitelisted SOP wells, so plenty
// sitting in storage for dewhitelisted wells (e.g. PINTO_WETH, PINTO_WSOL)
// is skipped. Issue an explicit claimPlenty(well) for each dewhitelisted
// well the user has nonzero plenty in.
const whitelistedAddresses = new Set(whitelistedTokens.map((t) => t.address.toLowerCase()));
const dewhitelistedClaims = farmerSilo.flood.farmerSops
.filter((sop) => sop.wellsPlenty.plenty.gt(0) && !whitelistedAddresses.has(sop.well.address.toLowerCase()))
.map((sop) =>
encodeFunctionData({
abi: beanstalkAbi,
functionName: "claimPlenty",
args: [sop.well.address as `0x${string}`, Number(balanceTo)],
}),
);

return writeWithEstimateGas({
address: diamond,
abi: beanstalkAbi,
functionName: "farm",
args: [[mow, claimFlood]],
args: [[mow, claimAllPlenty, ...dewhitelistedClaims]],
});
} catch (e) {
console.error(e);
Expand Down
Loading
Loading