Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed claimed field from VoterInProposal, removed unused imports #146

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions AllInteractions/tests/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { Address, BigInt, Bytes, ethereum } from "@graphprotocol/graph-ts";
import { assert } from "matchstick-as";
import { TransactionType } from "../src/entities/global/TransactionTypeEnum";
import { getTransaction as getTxEntity } from "../src/entities/transaction/Transaction";

export function getBlock(number: BigInt, timestamp: BigInt): ethereum.Block {
return new ethereum.Block(
Expand Down
2 changes: 0 additions & 2 deletions DaoPools/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,6 @@ type VoterInProposal @entity {
id: Bytes! # voter address + proposal entity id
"Boolean flag, if true - voter voted for the proposal"
isVoteFor: Boolean!
"Boolean flag, if true - rewards claimed"
claimed: Boolean!

"The total amount of vote for the proposal"
totalVote: BigInt!
Expand Down
2 changes: 0 additions & 2 deletions DaoPools/src/entities/Voters/VoterInProposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ export function getVoterInProposal(proposal: Proposal, voterInPool: VoterInPool)

voterInProposal.isVoteFor = false;

voterInProposal.claimed = false;

voterInProposal.totalVote = BigInt.zero();

voterInProposal.staticRewardUSD = BigInt.zero();
Expand Down
12 changes: 0 additions & 12 deletions DaoPools/src/entities/global/RewardTypeEnum.ts

This file was deleted.

11 changes: 3 additions & 8 deletions DaoPools/src/mappings/DaoPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import { getUSDValue } from "../helpers/PriceFeedInteractions";
import { DelegationType } from "../entities/global/DelegationTypeEnum";
import { TreasuryDelegationType } from "../entities/global/TreasuryDelegationTypeEnum";
import { getTreasuryDelegationHistory } from "../entities/TreasuryDelegationHistory";
import { RewardType } from "../entities/global/RewardTypeEnum";
import { ProposalInteractionType, getEnumBigInt } from "../entities/global/ProposalInteractionTypeEnum";
import { getNftsVotePower } from "../helpers/UserKeeperInteractions";

Expand Down Expand Up @@ -352,8 +351,6 @@ export function onRewardClaimed(event: RewardClaimed): void {
let proposal = getProposal(pool, event.params.proposalId);
let voterInProposal = getVoterInProposal(proposal, voterInPool);

voterInProposal.claimed = true;

voterInProposal.claimedRewardUSD = voterInProposal.claimedRewardUSD.plus(usdAmount);

voterInProposal.staticRewardUSD = voterInProposal.staticRewardUSD.plus(usdAmount);
Expand Down Expand Up @@ -387,11 +384,9 @@ export function onVotingRewardClaimed(event: VotingRewardClaimed): void {
let treasuryUsdAmount = getUSDValue(event.params.token, event.params.rewards.treasury);
let totalUsdAmount = personalUsdAmount.plus(micropoolUsdAmount).plus(treasuryUsdAmount);

voterInProposal.claimed = true;

voterInProposal.personalVotingRewardUSD = personalUsdAmount;
voterInProposal.micropoolVotingRewardUSD = micropoolUsdAmount;
voterInProposal.treasuryVotingRewardUSD = treasuryUsdAmount;
voterInProposal.personalVotingRewardUSD = voterInProposal.personalVotingRewardUSD.plus(personalUsdAmount);
voterInProposal.micropoolVotingRewardUSD = voterInProposal.micropoolVotingRewardUSD.plus(micropoolUsdAmount);
voterInProposal.treasuryVotingRewardUSD = voterInProposal.treasuryVotingRewardUSD.plus(treasuryUsdAmount);

voterInProposal.claimedRewardUSD = voterInProposal.claimedRewardUSD.plus(totalUsdAmount);

Expand Down
1 change: 0 additions & 1 deletion DaoPools/src/mappings/DistributionProposal.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Address } from "@graphprotocol/graph-ts";
import { pushUnique } from "@solarity/graph-lib";
import { DistributionProposalClaimed } from "../../generated/templates/DistributionProposal/DistributionProposal";
import { getDaoPool } from "../entities/DaoPool";
import { getDPContract } from "../entities/DPContract";
Expand Down
3 changes: 1 addition & 2 deletions DaoPools/src/mappings/ERC721Expert.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { pushUnique, remove } from "@solarity/graph-lib";
import { pushUnique } from "@solarity/graph-lib";
import { Transfer, TagsAdded } from "../../generated/templates/ERC721Expert/ERC721Expert";
import { getExpertNft } from "../entities/ExpertNft";
import { Address, Bytes, store } from "@graphprotocol/graph-ts";
import { getExpertNftContract } from "../entities/ExpertNftContract";
import { getVoter } from "../entities/Voters/Voter";
import { getVoterInPool } from "../entities/Voters/VoterInPool";
import { getDaoPool } from "../entities/DaoPool";
import { log } from "matchstick-as";
import { Voter, VoterInPool } from "../../generated/schema";

export function onTransfer(event: Transfer): void {
Expand Down
2 changes: 1 addition & 1 deletion DaoPools/src/mappings/TokenSale.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Address, BigDecimal, BigInt, Bytes } from "@graphprotocol/graph-ts";
import { Address, BigInt, Bytes } from "@graphprotocol/graph-ts";
import { pushUnique } from "@solarity/graph-lib";
import { Bought, TierCreated, Whitelisted } from "../../generated/templates/TokenSale/TokenSaleProposal";
import { getDaoPool } from "../entities/DaoPool";
Expand Down
25 changes: 0 additions & 25 deletions DaoPools/tests/DaoPool.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import { onSetERC20 } from "../src/mappings/UserKeeper";
import { DelegationType } from "../src/entities/global/DelegationTypeEnum";
import { getDaoPool } from "../src/entities/DaoPool";
import { TreasuryDelegationType } from "../src/entities/global/TreasuryDelegationTypeEnum";
import { RewardType } from "../src/entities/global/RewardTypeEnum";

function createProposalCreated(
proposalId: BigInt,
Expand Down Expand Up @@ -1280,12 +1279,6 @@ describe("DaoPool", () => {
onRewardClaimed(event0);

assert.fieldEquals("Voter", sender.toHexString(), "totalClaimedUSD", amounts[0].toString());
assert.fieldEquals(
"VoterInProposal",
sender.concat(contractSender).concatI32(proposalIds[0].toI32()).toHexString(),
"claimed",
"true"
);
assert.fieldEquals(
"VoterInProposal",
sender.concat(contractSender).concatI32(proposalIds[0].toI32()).toHexString(),
Expand All @@ -1308,12 +1301,6 @@ describe("DaoPool", () => {
onRewardClaimed(event1);

assert.fieldEquals("Voter", sender.toHexString(), "totalClaimedUSD", amounts[0].plus(amounts[1]).toString());
assert.fieldEquals(
"VoterInProposal",
sender.concat(contractSender).concatI32(proposalIds[1].toI32()).toHexString(),
"claimed",
"true"
);
assert.fieldEquals(
"VoterInProposal",
sender.concat(contractSender).concatI32(proposalIds[1].toI32()).toHexString(),
Expand Down Expand Up @@ -1378,12 +1365,6 @@ describe("DaoPool", () => {
onVotingRewardClaimed(event0);

assert.fieldEquals("Voter", sender.toHexString(), "totalClaimedUSD", totalAmount.toString());
assert.fieldEquals(
"VoterInProposal",
sender.concat(contractSender).concatI32(proposalIds[0].toI32()).toHexString(),
"claimed",
"true"
);
assert.fieldEquals(
"VoterInProposal",
sender.concat(contractSender).concatI32(proposalIds[0].toI32()).toHexString(),
Expand Down Expand Up @@ -1442,12 +1423,6 @@ describe("DaoPool", () => {
onVotingRewardClaimed(event1);

assert.fieldEquals("Voter", sender.toHexString(), "totalClaimedUSD", totalAmount.plus(totalAmount1).toString());
assert.fieldEquals(
"VoterInProposal",
sender.concat(contractSender).concatI32(proposalIds[1].toI32()).toHexString(),
"claimed",
"true"
);
assert.fieldEquals(
"VoterInProposal",
sender.concat(contractSender).concatI32(proposalIds[1].toI32()).toHexString(),
Expand Down
2 changes: 1 addition & 1 deletion DaoPools/tests/ERC721Expert.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Address, ethereum, BigInt, Bytes } from "@graphprotocol/graph-ts";
import { assert, beforeAll, describe, logStore, newMockEvent, test } from "matchstick-as";
import { assert, beforeAll, describe, newMockEvent, test } from "matchstick-as";
import { TagsAdded, Transfer } from "../generated/templates/ERC721Expert/ERC721Expert";
import { getBlock, getTransaction } from "./utils";
import { onTagsAdded, onTransfer } from "../src/mappings/ERC721Expert";
Expand Down
Loading