Skip to content

Commit

Permalink
attempted fix for issue with tokensRequested
Browse files Browse the repository at this point in the history
  • Loading branch information
EdNoepel committed Jul 27, 2023
1 parent 93cdff2 commit eead61b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/grant-fund.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ import {
ProposalParams,
DistributionPeriodStarted,
ScreeningVote,
VoteCast,
DistributionPeriodVote
VoteCast
} from "../generated/schema"

import { ONE_BI, THREE_PERCENT_BI, ZERO_ADDRESS, ZERO_BD } from './utils/constants'
import { addressArrayToBytesArray, addressToBytes, bigIntToBytes, bytesToBigInt, wadToDecimal } from "./utils/convert"
import { getProposalParamsId, getProposalsInSlate, loadOrCreateProposal, removeProposalFromList } from './utils/grants/proposal'
import { getProposalParamsId, getProposalsInSlate, loadOrCreateProposal } from './utils/grants/proposal'
import { getCurrentDistributionId, getCurrentStage, loadOrCreateDistributionPeriod } from './utils/grants/distribution'
import { getFundingStageVotingPower, getFundingVoteId, getFundingVotingPowerUsed, getScreeningStageVotingPower, getScreeningVoteId, loadOrCreateDistributionPeriodVote } from './utils/grants/voter'
import { getFundingStageVotingPower, getFundingVoteId, getFundingVotingPowerUsed, getScreeningVoteId, loadOrCreateDistributionPeriodVote } from './utils/grants/voter'
import { getTreasury, loadOrCreateGrantFund } from './utils/grants/fund'
import { loadOrCreateAccount } from './utils/account'
import { wmul } from './utils/math'
Expand Down Expand Up @@ -178,7 +177,7 @@ export function handleProposalCreated(event: ProposalCreatedEvent): void {
// decode the calldata to get the recipient and tokens requested
const decoded = ethereum.decode('(address,uint256)', proposalParams.calldata)!
proposalParams.recipient = decoded.toTuple()[0].toAddress()
const tokensRequested = decoded.toTuple()[1].toBigInt().toBigDecimal()
const tokensRequested = wadToDecimal(decoded.toTuple()[1].toBigInt())
proposalParams.tokensRequested = tokensRequested
totalTokensRequested = totalTokensRequested.plus(tokensRequested)

Expand Down

0 comments on commit eead61b

Please sign in to comment.