Skip to content

Commit

Permalink
Merge pull request #437 from curvefi/fix/fix-dao-parameter
Browse files Browse the repository at this point in the history
fix: fix dao PARAMETER
  • Loading branch information
fedorovdg authored Jan 1, 2025
2 parents e480c06 + 265557d commit e39be2c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@curvefi/api",
"version": "2.65.24",
"version": "2.65.25",
"description": "JavaScript library for curve.fi",
"main": "lib/index.js",
"author": "Macket",
Expand Down
8 changes: 4 additions & 4 deletions src/dao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ export const userProposalVotes = async (address = ""): Promise<IDaoProposalUserL
const proposalList = await _getDaoProposalList();
const calls = [];
for (const proposal of proposalList) {
if (proposal.voteType == "PARAMETER") {
if (proposal.voteType.toUpperCase() == "PARAMETER") {
calls.push(curve.contracts[curve.constants.ALIASES.voting_parameter].multicallContract.getVoterState(proposal.voteId, address));
} else {
calls.push(curve.contracts[curve.constants.ALIASES.voting_ownership].multicallContract.getVoterState(proposal.voteId, address));
Expand All @@ -364,7 +364,7 @@ export const userProposalVotes = async (address = ""): Promise<IDaoProposalUserL

const _voteForProposal = async (type: TVoteType, id: number, support: boolean, estimateGas: boolean): Promise<string | number | number[]> => {
if (curve.chainId !== 1) throw Error("Ethereum-only method")
const contractAddress = type === "PARAMETER" ? curve.constants.ALIASES.voting_parameter : curve.constants.ALIASES.voting_ownership;
const contractAddress = type.toUpperCase() === "PARAMETER" ? curve.constants.ALIASES.voting_parameter : curve.constants.ALIASES.voting_ownership;
const contract = curve.contracts[contractAddress].contract;
const yesPct = support ? BigInt(10**18) : BigInt(0);
const noPct = BigInt(10**18) - yesPct;
Expand All @@ -386,7 +386,7 @@ export const voteForProposal = async (type: TVoteType, id: number, support: bool

const _executeVote = async (type: TVoteType, id: number, estimateGas = false): Promise<string | number | number[]> => {
if (curve.chainId !== 1) throw Error("Ethereum-only method")
const contractAddress = type === "PARAMETER" ? curve.constants.ALIASES.voting_parameter : curve.constants.ALIASES.voting_ownership;
const contractAddress = type.toUpperCase() === "PARAMETER" ? curve.constants.ALIASES.voting_parameter : curve.constants.ALIASES.voting_ownership;
const contract = curve.contracts[contractAddress].contract;
const gas = await contract.executeVote.estimateGas(id, curve.constantOptions);
if (estimateGas) return smartNumber(gas);
Expand All @@ -406,7 +406,7 @@ export const executeVote = async (type:TVoteType, id: number): Promise<string> =

export const isCanVoteExecute = async (type: TVoteType, id: number): Promise<boolean> => {
if (curve.chainId !== 1) throw Error("Ethereum-only method")
const contractAddress = type === "PARAMETER" ? curve.constants.ALIASES.voting_parameter : curve.constants.ALIASES.voting_ownership;
const contractAddress = type.toUpperCase() === "PARAMETER" ? curve.constants.ALIASES.voting_parameter : curve.constants.ALIASES.voting_ownership;
const contract = curve.contracts[contractAddress].contract;

return await contract.canExecute(id, { ...curve.options });
Expand Down

0 comments on commit e39be2c

Please sign in to comment.