Skip to content

Commit

Permalink
fix wrong function interface
Browse files Browse the repository at this point in the history
Signed-off-by: ryanwolhuter <[email protected]>
  • Loading branch information
ryanwolhuter committed Oct 31, 2023
1 parent ff199d4 commit fe12f03
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
6 changes: 4 additions & 2 deletions src/plugins/oSnap/components/HandleOutcome/HandleOutcome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,16 @@ async function updateOgProposalState() {
}
async function onApproveBond() {
if (!collateralDetails.value || !ogModuleDetails.value) return;
const txPendingId = createPendingTransaction();
try {
await ensureRightNetwork(props.network);
const approvingBond = approveBond(
props.network,
getInstance().web3,
props.moduleAddress
props.moduleAddress,
collateralDetails.value?.address,
ogModuleDetails.value?.minimumBond
);
const step = await approvingBond.next();
if (step.value)
Expand Down
18 changes: 6 additions & 12 deletions src/plugins/oSnap/utils/proposal.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
import { BigNumber } from '@ethersproject/bignumber';
import { toUtf8Bytes } from '@ethersproject/strings';
import { sendTransaction } from '@snapshot-labs/snapshot.js/src/utils';
import { ERC20_ABI, OPTIMISTIC_GOVERNOR_ABI } from '../constants';
import { Network, OptimisticGovernorTransaction } from '../types';
import { getOGProposalState } from './getters';
import { OptimisticGovernorTransaction } from '../types';

/**
* The user must approve the spend of the collateral token before they can submit a proposal.
*
* If the proposal is disputed and fails a vote, the user will lose their bond.
*/
export async function* approveBond(
network: Network,
web3: any,
moduleAddress: string,
transactions?: OptimisticGovernorTransaction[]
collateralAddress: string,
minimumBond: BigNumber,
) {
const moduleDetails = await getOGProposalState(
network,
moduleAddress,
network,
transactions
);

const approveTx = await sendTransaction(
web3,
moduleDetails.collateral,
collateralAddress,
ERC20_ABI as any,
'approve',
[moduleAddress, moduleDetails.minimumBond],
[moduleAddress, minimumBond],
{}
);
yield approveTx;
Expand Down

0 comments on commit fe12f03

Please sign in to comment.