Skip to content

Commit

Permalink
Merge pull request #103 from hansmrtn/temp-gnosis-workaround
Browse files Browse the repository at this point in the history
gnosis-workaround
  • Loading branch information
hmrtn authored Jan 13, 2022
2 parents e569189 + b935605 commit aef1831
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions packages/react-app/src/routes/party/components/Distribute.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const Distribute = ({
}
},
);
setHasApprovedAllowance(false);
};

const handleApproval = res => {
Expand All @@ -63,7 +62,7 @@ export const Distribute = ({

// Approve total token amount
const approve = async () => {
// setIsApprovalLoading(true);
setIsApprovalLoading(true);
tx(tokenInstance?.approve(readContracts.Distributor.address, total), handleApproval);
};

Expand Down Expand Up @@ -95,6 +94,11 @@ export const Distribute = ({
setAmounts(amts);
setAddresses(adrs);
}
// Check ERC20 allowance
// if (total && tokenInstance) {
// const allowance = await tokenInstance.allowance(address, readContracts.Distributor.address);
// setHasApprovedAllowance(allowance.gte(total));
// }
};

const handleReceipt = res => {
Expand Down Expand Up @@ -137,15 +141,14 @@ export const Distribute = ({
const DistributeButton = () => {
return (
<>
{tokenInstance && !hasApprovedAllowance ? (
{tokenInstance && (
<Button onClick={approve} isLoading={isApprovalLoading}>
Approve
</Button>
) : (
<Button onClick={distribute} isLoading={isDistributionLoading}>
Distribute
</Button>
)}
<Button onClick={distribute} isLoading={isDistributionLoading}>
Distribute
</Button>
</>
);
};
Expand Down

0 comments on commit aef1831

Please sign in to comment.