Skip to content

Commit

Permalink
payout
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKurt committed May 2, 2024
1 parent 3c00278 commit 6ec7b5f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/common/src/allo/backends/allo-v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1242,7 +1242,7 @@ export class AlloV1 implements Allo {
return error(new AlloError("vault is required"));
}

if (!args.applicationIndex) {
if (typeof args.applicationIndex !== "number") {
return error(new AlloError("applicationIndex is required"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export function usePayout() {
recipientAddress: payoutWallet,
recipientId: applicationId,
applicationIndex: applicationIndex,
vault: payoutVault,
})
.on("transaction", (res) => {
if (res.type === "success") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { getPayoutTokenOptions } from "../api/payoutTokens";
import { usePayouts } from "./usePayouts";
import { Hex } from "viem";
import { useDataLayer } from "data-layer";
import { getConfig } from "common/src/config";

const schema = yup.object().shape({
amount: yup
Expand Down Expand Up @@ -152,14 +153,18 @@ export default function ApplicationDirectPayout({
}

if (allo) {
console.log("applicationIndex", application.applicationIndex);
try {
const isV2 = getConfig().allo.version === "allo-v2";

await triggerPayout({
address,
signer,
token: tokenInfo,
applicationId: application.anchorAddress as Hex,
applicationId: (application.anchorAddress ||
application.projectId) as Hex,
applicationIndex: application.applicationIndex,
roundId: round.id as Hex,
roundId: isV2 ? (round.id as Hex) : (round.payoutStrategy.id as Hex),
roundAddress: round.payoutStrategy.id as Hex,
payoutAmount: BigInt(amountBN.toString()),
payoutVault: data.address as Hex,
Expand All @@ -168,7 +173,7 @@ export default function ApplicationDirectPayout({
allo,
});

window.location.reload();
// window.location.reload();
} catch (error) {
console.error(error);
setTimeout(() => {
Expand Down
8 changes: 0 additions & 8 deletions packages/round-manager/src/features/round/usePayouts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,12 @@ export function usePayouts(args: {
return [];
}

console.log("Fetching payouts", {
chainId: args.chainId,
roundId: args.roundId,
recipientId: args.projectId,
});

const result = await args.dataLayer.getPayoutsByChainIdRoundIdProjectId({
chainId: args.chainId,
roundId: args.roundId,
projectId: args.projectId,
});

console.log("result", result);

const payouts =
result.applications[0]
.applicationsPayoutsByChainIdAndRoundIdAndApplicationId;
Expand Down

0 comments on commit 6ec7b5f

Please sign in to comment.