Skip to content

Commit

Permalink
fix: issues
Browse files Browse the repository at this point in the history
  • Loading branch information
bhargavaparoksham committed May 24, 2024
1 parent b7c3ce7 commit a5ab394
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
5 changes: 1 addition & 4 deletions packages/common/src/allo/backends/allo-v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -755,10 +755,7 @@ export class AlloV1 implements Allo {
const roundAddress = getAddress(args.roundId);
let tx;

if (
args.tokenAddress === zeroAddress ||
args.requireTokenApproval === false
) {
if (args.tokenAddress === zeroAddress || !args.requireTokenApproval) {
emit("tokenApprovalStatus", success(null));
} else {
const approvalTx = await sendTransaction(this.transactionSender, {
Expand Down
18 changes: 9 additions & 9 deletions packages/common/src/allo/backends/allo-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,9 @@ export class AlloV2 implements Allo {
factoryType: "DVMDT",
});

const txData = strategyFactory.getCreateStrategyDataByChainId(this.chainId);
const txData = strategyFactory.getCreateStrategyDataByChainId(
this.chainId
);

const txResult = await sendRawTransaction(this.transactionSender, {
to: txData.to,
Expand Down Expand Up @@ -559,8 +561,9 @@ export class AlloV2 implements Allo {
factoryType: "DGL",
});

const txData = strategyFactory.getCreateStrategyDataByChainId(this.chainId);

const txData = strategyFactory.getCreateStrategyDataByChainId(
this.chainId
);

const txResult = await sendRawTransaction(this.transactionSender, {
to: txData.to,
Expand All @@ -571,7 +574,7 @@ export class AlloV2 implements Allo {
if (txResult.type === "error") {
return txResult;
}

try {
const receipt = await this.transactionSender.wait(txResult.value);
const strategyCreatedEvent = decodeEventFromReceipt({
Expand Down Expand Up @@ -895,7 +898,7 @@ export class AlloV2 implements Allo {
tokenAddress: Address;
roundId: string;
amount: bigint;
requrieTokenApproval?: boolean;
requireTokenApproval?: boolean;
}): AlloOperation<
Result<null>,
{
Expand All @@ -912,10 +915,7 @@ export class AlloV2 implements Allo {

const poolId = BigInt(args.roundId);

if (
args.tokenAddress === zeroAddress ||
args.requrieTokenApproval === false
) {
if (args.tokenAddress === zeroAddress || !args.requireTokenApproval) {
emit("tokenApprovalStatus", success(null));
} else {
const approvalTx = await sendTransaction(this.transactionSender, {
Expand Down
7 changes: 6 additions & 1 deletion packages/round-manager/src/features/round/FundContract.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,11 @@ export default function FundContract(props: {

let requireTokenApproval = false;

const amount = ethers.utils.parseUnits(
amountToFund.toString(),
matchingFundPayoutToken.decimal
);

const alloVersion = props.round?.tags?.includes("allo-v2") ? "v2" : "v1";
const roundAddress =
alloVersion === "v1" ? props.round?.id : getAlloAddress(chainId);
Expand All @@ -679,7 +684,7 @@ export default function FundContract(props: {
address as string,
roundAddress as string
);
if (tokenAllowance.lt(BigNumber.from(amountToFund))) {
if (tokenAllowance.lt(amount)) {
requireTokenApproval = true;
}
}
Expand Down

0 comments on commit a5ab394

Please sign in to comment.