diff --git a/AllInteractions/abis/DaoPool.json b/AllInteractions/abis/DaoPool.json index 351d74fb..60612b4c 100644 --- a/AllInteractions/abis/DaoPool.json +++ b/AllInteractions/abis/DaoPool.json @@ -2,32 +2,49 @@ { "anonymous": false, "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "to", - "type": "address" - }, { "indexed": false, "internalType": "uint256", - "name": "amount", + "name": "proposalId", "type": "uint256" }, { "indexed": false, - "internalType": "uint256[]", - "name": "nfts", - "type": "uint256[]" + "internalType": "address", + "name": "voter", + "type": "address" }, { "indexed": false, "internalType": "bool", - "name": "isDelegate", + "name": "isVoteFor", "type": "bool" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "personal", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "micropool", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "treasury", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct IGovPool.Votes", + "name": "votes", + "type": "tuple" } ], - "name": "DelegatedTreasury", + "name": "VoteChanged", "type": "event" }, { @@ -35,14 +52,14 @@ "inputs": [ { "indexed": false, - "internalType": "address", - "name": "user", - "type": "address" + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" }, { "indexed": false, "internalType": "address", - "name": "token", + "name": "rewardToken", "type": "address" }, { @@ -50,19 +67,6 @@ "internalType": "uint256", "name": "amount", "type": "uint256" - } - ], - "name": "StakingRewardClaimed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "resultsHash", - "type": "string" }, { "indexed": false, @@ -71,28 +75,9 @@ "type": "address" } ], - "name": "OffchainResultsSaved", + "name": "RewardCanceled", "type": "event" }, - { - "inputs": [ - { - "internalType": "string", - "name": "resultsHash", - "type": "string" - } - ], - "name": "getSignHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, { "anonymous": false, "inputs": [ @@ -161,6 +146,44 @@ "name": "RewardCredited", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "resultsHash", + "type": "string" + }, + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "OffchainResultsSaved", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "resultsHash", + "type": "string" + } + ], + "name": "getSignHash", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, { "anonymous": false, "inputs": [ @@ -173,29 +196,23 @@ { "indexed": false, "internalType": "address", - "name": "sender", + "name": "user", "type": "address" }, { "indexed": false, - "internalType": "enum IGovPool.VoteType", - "name": "voteType", - "type": "uint8" + "internalType": "address", + "name": "token", + "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isVoteFor", - "type": "bool" } ], - "name": "Voted", + "name": "MicropoolRewardClaimed", "type": "event" }, { @@ -371,6 +388,12 @@ { "anonymous": false, "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "to", + "type": "address" + }, { "indexed": false, "internalType": "uint256", @@ -385,42 +408,17 @@ }, { "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "Deposited", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" + "internalType": "bool", + "name": "isDelegate", + "type": "bool" } ], - "name": "Initialized", + "name": "DelegatedTreasury", "type": "event" }, { "anonymous": false, "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "to", - "type": "address" - }, { "indexed": false, "internalType": "uint256", @@ -432,9 +430,28 @@ "internalType": "uint256[]", "name": "nfts", "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "sender", + "type": "address" } ], - "name": "Requested", + "name": "Deposited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", "type": "event" }, { @@ -462,19 +479,6 @@ "name": "Withdrawn", "type": "event" }, - { - "inputs": [], - "name": "PERCENTAGE_MICROPOOL_REWARDS", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -489,19 +493,24 @@ "name": "userKeeperAddress", "type": "address" }, + { + "internalType": "address payable", + "name": "validatorsAddress", + "type": "address" + }, { "internalType": "address", - "name": "distributionAddress", + "name": "expertNftAddress", "type": "address" }, { "internalType": "address", - "name": "validatorsAddress", + "name": "nftMultiplierAddress", "type": "address" }, { "internalType": "address", - "name": "expertNftAddress", + "name": "votePowerAddress", "type": "address" } ], @@ -509,21 +518,6 @@ "name": "govPoolDeps", "type": "tuple" }, - { - "internalType": "address", - "name": "nftMultiplierAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "regularVoteModifier", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expertVoteModifier", - "type": "uint256" - }, { "internalType": "address", "name": "_verifier", @@ -556,16 +550,16 @@ "type": "function" }, { - "inputs": [], - "name": "babt", - "outputs": [ + "inputs": [ { - "internalType": "contract ISBT721", - "name": "", - "type": "address" + "internalType": "uint256", + "name": "proposalId", + "type": "uint256" } ], - "stateMutability": "view", + "name": "cancelVote", + "outputs": [], + "stateMutability": "nonpayable", "type": "function" }, { @@ -597,17 +591,17 @@ { "inputs": [ { - "internalType": "uint256", - "name": "regularModifier", - "type": "uint256" + "internalType": "uint256[]", + "name": "proposalIds", + "type": "uint256[]" }, { - "internalType": "uint256", - "name": "expertModifier", - "type": "uint256" + "internalType": "address", + "name": "delegatee", + "type": "address" } ], - "name": "changeVoteModifiers", + "name": "claimMicropoolRewards", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -645,11 +639,6 @@ "name": "_descriptionURL", "type": "string" }, - { - "internalType": "string", - "name": "misc", - "type": "string" - }, { "components": [ { @@ -723,6 +712,29 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegatee", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "nftIds", + "type": "uint256[]" + } + ], + "name": "delegateTreasury", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [], "name": "deployerBABTid", @@ -772,19 +784,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "dexeExpertNft", - "outputs": [ - { - "internalType": "contract IERC721Expert", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -813,12 +812,29 @@ }, { "inputs": [], - "name": "expertNft", + "name": "getCreditInfo", "outputs": [ { - "internalType": "contract IERC721Expert", + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "monthLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "currentWithdrawLimit", + "type": "uint256" + } + ], + "internalType": "struct IGovPool.CreditInfoView[]", "name": "", - "type": "address" + "type": "tuple[]" } ], "stateMutability": "view", @@ -826,40 +842,50 @@ }, { "inputs": [ + { + "internalType": "uint256[]", + "name": "proposalIds", + "type": "uint256[]" + }, { "internalType": "address", "name": "delegator", "type": "address" + }, + { + "internalType": "address", + "name": "delegatee", + "type": "address" } ], - "name": "getDelegatorStakingRewards", + "name": "getDelegatorRewards", "outputs": [ { - "components": [ - { - "internalType": "address", - "name": "micropool", - "type": "address" - }, + "components": [ { "internalType": "address[]", "name": "rewardTokens", "type": "address[]" }, { - "internalType": "uint256[]", - "name": "expectedRewards", - "type": "uint256[]" + "internalType": "bool[]", + "name": "isVoteFor", + "type": "bool[]" + }, + { + "internalType": "bool[]", + "name": "isClaimed", + "type": "bool[]" }, { "internalType": "uint256[]", - "name": "realRewards", + "name": "expectedRewards", "type": "uint256[]" } ], - "internalType": "struct IGovPool.UserStakeRewardsView[]", + "internalType": "struct IGovPool.DelegatorRewards", "name": "", - "type": "tuple[]" + "type": "tuple" } ], "stateMutability": "view", @@ -905,7 +931,12 @@ }, { "internalType": "address", - "name": "distributionProposal", + "name": "poolRegistry", + "type": "address" + }, + { + "internalType": "address", + "name": "votePower", "type": "address" } ], @@ -918,7 +949,35 @@ "outputs": [ { "internalType": "address", - "name": "_injector", + "name": "injector_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNftContracts", + "outputs": [ + { + "internalType": "address", + "name": "nftMultiplier", + "type": "address" + }, + { + "internalType": "address", + "name": "expertNft", + "type": "address" + }, + { + "internalType": "address", + "name": "dexeExpertNft", + "type": "address" + }, + { + "internalType": "address", + "name": "babt", "type": "address" } ], @@ -927,8 +986,13 @@ }, { "inputs": [], - "name": "getOffchainResultsHash", + "name": "getOffchainInfo", "outputs": [ + { + "internalType": "address", + "name": "validator", + "type": "address" + }, { "internalType": "string", "name": "resultsHash", @@ -1151,11 +1215,6 @@ "name": "settings", "type": "tuple" }, - { - "internalType": "bool", - "name": "executed", - "type": "bool" - }, { "internalType": "uint64", "name": "voteEnd", @@ -1166,6 +1225,11 @@ "name": "executeAfter", "type": "uint64" }, + { + "internalType": "uint64", + "name": "executionTime", + "type": "uint64" + }, { "internalType": "uint256", "name": "votesFor", @@ -1180,6 +1244,11 @@ "internalType": "uint256", "name": "nftPowerSnapshotId", "type": "uint256" + }, + { + "internalType": "uint256", + "name": "givenRewards", + "type": "uint256" } ], "internalType": "struct IGovPool.ProposalCore", @@ -1303,11 +1372,6 @@ "internalType": "uint256", "name": "requiredValidatorsQuorum", "type": "uint256" - }, - { - "internalType": "uint64", - "name": "executeAfter", - "type": "uint64" } ], "internalType": "struct IGovPool.ProposalView[]", @@ -1331,9 +1395,9 @@ "type": "address" }, { - "internalType": "bool", - "name": "isMicropool", - "type": "bool" + "internalType": "enum IGovPool.VoteType", + "name": "voteType", + "type": "uint8" } ], "name": "getTotalVotes", @@ -1353,6 +1417,25 @@ "name": "", "type": "uint256" }, + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "getUserActiveProposalsCount", + "outputs": [ { "internalType": "uint256", "name": "", @@ -1375,9 +1458,9 @@ "type": "address" }, { - "internalType": "bool", - "name": "isMicropool", - "type": "bool" + "internalType": "enum IGovPool.VoteType", + "name": "voteType", + "type": "uint8" } ], "name": "getUserVotes", @@ -1385,33 +1468,28 @@ { "components": [ { - "internalType": "uint256", - "name": "totalVotedFor", - "type": "uint256" + "internalType": "bool", + "name": "isVoteFor", + "type": "bool" }, { "internalType": "uint256", - "name": "totalVotedAgainst", + "name": "totalVoted", "type": "uint256" }, { "internalType": "uint256", - "name": "tokensVotedFor", + "name": "tokensVoted", "type": "uint256" }, { "internalType": "uint256", - "name": "tokensVotedAgainst", + "name": "powerVoted", "type": "uint256" }, { "internalType": "uint256[]", - "name": "nftsVotedFor", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "nftsVotedAgainst", + "name": "nftsVoted", "type": "uint256[]" } ], @@ -1423,67 +1501,12 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "getVerifier", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "getVoteModifierForUser", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getVoteModifiers", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { "internalType": "address", "name": "delegator", "type": "address" - }, - { - "internalType": "address", - "name": "delegatee", - "type": "address" } ], "name": "getWithdrawableAssets", @@ -1560,19 +1583,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "nftMultiplier", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -1701,22 +1711,17 @@ { "inputs": [ { - "internalType": "address", - "name": "delegatee", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" + "internalType": "string", + "name": "resultsHash", + "type": "string" }, { - "internalType": "uint256[]", - "name": "nftIds", - "type": "uint256[]" + "internalType": "bytes", + "name": "signature", + "type": "bytes" } ], - "name": "request", + "name": "saveOffchainResults", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -1724,17 +1729,17 @@ { "inputs": [ { - "internalType": "string", - "name": "resultsHash", - "type": "string" + "internalType": "address[]", + "name": "tokens", + "type": "address[]" }, { - "internalType": "bytes", - "name": "signature", - "type": "bytes" + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" } ], - "name": "saveOffchainResults", + "name": "setCreditInfo", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -1745,6 +1750,11 @@ "internalType": "address", "name": "contractsRegistry", "type": "address" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" } ], "name": "setDependencies", @@ -1756,7 +1766,7 @@ "inputs": [ { "internalType": "address", - "name": "_injector", + "name": "injector_", "type": "address" } ], @@ -1797,6 +1807,29 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "address", + "name": "destination", + "type": "address" + } + ], + "name": "transferCreditAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -1824,39 +1857,34 @@ "inputs": [ { "internalType": "address", - "name": "user", + "name": "delegatee", "type": "address" }, { - "internalType": "bool", - "name": "isMicropool", - "type": "bool" + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "nftIds", + "type": "uint256[]" } ], - "name": "unlock", + "name": "undelegateTreasury", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { - "internalType": "uint256[]", - "name": "proposalIds", - "type": "uint256[]" - }, { "internalType": "address", "name": "user", "type": "address" - }, - { - "internalType": "bool", - "name": "isMicropool", - "type": "bool" } ], - "name": "unlockInProposals", + "name": "unlock", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -1868,33 +1896,10 @@ "name": "proposalId", "type": "uint256" }, - { - "internalType": "uint256", - "name": "voteAmount", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "voteNftIds", - "type": "uint256[]" - }, { "internalType": "bool", "name": "isVoteFor", "type": "bool" - } - ], - "name": "vote", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "proposalId", - "type": "uint256" }, { "internalType": "uint256", @@ -1905,14 +1910,9 @@ "internalType": "uint256[]", "name": "voteNftIds", "type": "uint256[]" - }, - { - "internalType": "bool", - "name": "isVoteFor", - "type": "bool" } ], - "name": "voteDelegated", + "name": "vote", "outputs": [], "stateMutability": "nonpayable", "type": "function" diff --git a/AllInteractions/abis/Insurance.json b/AllInteractions/abis/Insurance.json deleted file mode 100644 index eaac44c0..00000000 --- a/AllInteractions/abis/Insurance.json +++ /dev/null @@ -1,359 +0,0 @@ -[ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "investor", - "type": "address" - } - ], - "name": "Deposited", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "insurancePayout", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "userStakePayout", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "investor", - "type": "address" - } - ], - "name": "Paidout", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address", - "name": "investor", - "type": "address" - } - ], - "name": "Withdrawn", - "type": "event" - }, - { - "inputs": [], - "name": "__Insurance_init", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "url", - "type": "string" - }, - { - "internalType": "address[]", - "name": "users", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" - } - ], - "name": "acceptClaim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "acceptedClaimsCount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "deposit", - "type": "uint256" - } - ], - "name": "buyInsurance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getInjector", - "outputs": [ - { - "internalType": "address", - "name": "_injector", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "getInsurance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMaxTreasuryPayout", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "deposit", - "type": "uint256" - } - ], - "name": "getReceivedInsurance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "offset", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "limit", - "type": "uint256" - } - ], - "name": "listAcceptedClaims", - "outputs": [ - { - "internalType": "string[]", - "name": "urls", - "type": "string[]" - }, - { - "components": [ - { - "internalType": "address[]", - "name": "claimers", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" - } - ], - "internalType": "struct IInsurance.AcceptedClaims[]", - "name": "info", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "contractsRegistry", - "type": "address" - } - ], - "name": "setDependencies", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_injector", - "type": "address" - } - ], - "name": "setInjector", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "userInfos", - "outputs": [ - { - "internalType": "uint256", - "name": "stake", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastDepositTimestamp", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amountToWithdraw", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] \ No newline at end of file diff --git a/AllInteractions/abis/PoolFactory.json b/AllInteractions/abis/PoolFactory.json index 300d71c5..025785ee 100644 --- a/AllInteractions/abis/PoolFactory.json +++ b/AllInteractions/abis/PoolFactory.json @@ -1,4 +1,23 @@ [ + { + "inputs": [ + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + } + ], + "name": "predictTokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "anonymous": false, "inputs": [ @@ -40,6 +59,11 @@ "internalType": "address", "name": "nftMultiplierAddress", "type": "address" + }, + { + "internalType": "address", + "name": "votePowerAddress", + "type": "address" } ], "indexed": false, @@ -436,7 +460,7 @@ "type": "uint256[]" } ], - "internalType": "struct IERC20Sale.ConstructorParams", + "internalType": "struct IERC20Gov.ConstructorParams", "name": "tokenParams", "type": "tuple" } @@ -446,14 +470,26 @@ "type": "tuple" }, { - "internalType": "uint256", - "name": "regularVoteModifier", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expertVoteModifier", - "type": "uint256" + "components": [ + { + "internalType": "enum IPoolFactory.VotePowerType", + "name": "voteType", + "type": "uint8" + }, + { + "internalType": "bytes", + "name": "initData", + "type": "bytes" + }, + { + "internalType": "address", + "name": "presetAddress", + "type": "address" + } + ], + "internalType": "struct IPoolFactory.VotePowerDeployParams", + "name": "votePowerParams", + "type": "tuple" }, { "internalType": "address", diff --git a/AllInteractions/schema.graphql b/AllInteractions/schema.graphql index 258ec690..131513b8 100644 --- a/AllInteractions/schema.graphql +++ b/AllInteractions/schema.graphql @@ -21,7 +21,7 @@ type Transaction @entity { daoPoolCreate: [DaoPoolCreate!]! @derivedFrom(field: "transaction") daoPoolDelegate: [DaoPoolDelegate!]! @derivedFrom(field: "transaction") - daoPoolVote: [DaoPoolVote!]! @derivedFrom(field: "transaction") + daoPoolProposalInteraction: [DaoPoolProposalInteraction!]! @derivedFrom(field: "transaction") daoProposalCreate: [DaoProposalCreate!]! @derivedFrom(field: "transaction") daoPoolExecute: [DaoPoolExecute!]! @derivedFrom(field: "transaction") daoPoolRewardClaim: [DaoPoolRewardClaim!]! @derivedFrom(field: "transaction") @@ -74,13 +74,15 @@ type DaoPoolDelegate @entity(immutable: true) { # @param isVoteFor bool flag, if true - vote for, if false - vote against # @param amount the vote amount # @param transaction the transaction entity id -type DaoPoolVote @entity(immutable: true) { +type DaoPoolProposalInteraction @entity(immutable: true) { id: Bytes! # tx hash + interactionCount pool: Pool! - voteType: BigInt! - isVoteFor: Boolean! - amount: BigInt! + personalVote: BigInt! + micropoolVote: BigInt! + treasuryVote: BigInt! + + interactionType: BigInt! transaction: Transaction! } diff --git a/AllInteractions/src/entities/dao-pool/DaoPoolProposalInteraction.ts b/AllInteractions/src/entities/dao-pool/DaoPoolProposalInteraction.ts new file mode 100644 index 00000000..4d17ef6a --- /dev/null +++ b/AllInteractions/src/entities/dao-pool/DaoPoolProposalInteraction.ts @@ -0,0 +1,29 @@ +import { Address, BigInt, Bytes } from "@graphprotocol/graph-ts"; +import { DaoPoolProposalInteraction } from "../../../generated/schema"; + +export function getDaoPoolProposalInteraction( + hash: Bytes, + pool: Address, + interactionType: BigInt, + personal: BigInt, + micropool: BigInt, + treasury: BigInt, + count: BigInt +): DaoPoolProposalInteraction { + let id = hash.concatI32(count.toI32()); + let interaction = DaoPoolProposalInteraction.load(id); + + if (interaction == null) { + interaction = new DaoPoolProposalInteraction(id); + interaction.pool = pool; + interaction.interactionType = interactionType; + + interaction.personalVote = personal; + interaction.micropoolVote = micropool; + interaction.treasuryVote = treasury; + + interaction.transaction = Bytes.empty(); + } + + return interaction; +} diff --git a/AllInteractions/src/entities/dao-pool/DaoPoolVote.ts b/AllInteractions/src/entities/dao-pool/DaoPoolVote.ts deleted file mode 100644 index cfe8da95..00000000 --- a/AllInteractions/src/entities/dao-pool/DaoPoolVote.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { Address, BigInt, Bytes } from "@graphprotocol/graph-ts"; -import { DaoPoolVote } from "../../../generated/schema"; - -export function getDaoPoolVote( - hash: Bytes, - pool: Address, - voteType: BigInt, - amount: BigInt, - count: BigInt, - isVoteFor: boolean -): DaoPoolVote { - let id = hash.concatI32(count.toI32()); - let daoPoolVote = DaoPoolVote.load(id); - - if (daoPoolVote == null) { - daoPoolVote = new DaoPoolVote(id); - daoPoolVote.pool = pool; - daoPoolVote.voteType = voteType; - daoPoolVote.amount = amount; - daoPoolVote.isVoteFor = isVoteFor; - - daoPoolVote.transaction = Bytes.empty(); - } - - return daoPoolVote; -} diff --git a/AllInteractions/src/entities/global/ProposalInteractionTypeEnum.ts b/AllInteractions/src/entities/global/ProposalInteractionTypeEnum.ts new file mode 100644 index 00000000..3b2c9c6d --- /dev/null +++ b/AllInteractions/src/entities/global/ProposalInteractionTypeEnum.ts @@ -0,0 +1,11 @@ +import { BigInt } from "@graphprotocol/graph-ts"; + +export enum ProposalInteractionType { + VOTE_FOR = 1, + VOTE_AGAINST = 2, + VOTE_CANCEL = 3, +} + +export function getEnumBigInt(operation: ProposalInteractionType): BigInt { + return BigInt.fromI32(operation as i32); +} diff --git a/AllInteractions/src/entities/global/TransactionTypeEnum.ts b/AllInteractions/src/entities/global/TransactionTypeEnum.ts index e44668a7..95832cd8 100644 --- a/AllInteractions/src/entities/global/TransactionTypeEnum.ts +++ b/AllInteractions/src/entities/global/TransactionTypeEnum.ts @@ -8,20 +8,21 @@ export enum TransactionType { DAO_POOL_CREATED = 3, DAO_POOL_PROPOSAL_CREATED = 4, DAO_POOL_PROPOSAL_VOTED = 5, - DAO_POOL_PROPOSAL_EXECUTED = 6, + DAO_POOL_PROPOSAL_VOTE_CANCELED = 6, + DAO_POOL_PROPOSAL_EXECUTED = 7, - DAO_POOL_DELEGATED = 7, - DAO_POOL_UNDELEGATED = 8, - DAO_POOL_REQUESTED = 9, - DAO_POOL_REWARD_CLAIMED = 10, - DAO_POOL_DEPOSITED = 11, - DAO_POOL_WITHDRAWN = 12, - DAO_POOL_MOVED_TO_VALIDATORS = 13, - DAO_POOL_OFFCHAIN_RESULTS_SAVED = 14, + DAO_POOL_DELEGATED = 8, + DAO_POOL_UNDELEGATED = 9, + DAO_POOL_REQUESTED = 10, + DAO_POOL_REWARD_CLAIMED = 11, + DAO_POOL_DEPOSITED = 12, + DAO_POOL_WITHDRAWN = 13, + DAO_POOL_MOVED_TO_VALIDATORS = 14, + DAO_POOL_OFFCHAIN_RESULTS_SAVED = 15, - DAO_VALIDATORS_VOTED = 15, - DAO_VALIDATORS_PROPOSAL_CREATED = 16, - DAO_VALIDATORS_PROPOSAL_EXECUTED = 17, + DAO_VALIDATORS_VOTED = 16, + DAO_VALIDATORS_PROPOSAL_CREATED = 17, + DAO_VALIDATORS_PROPOSAL_EXECUTED = 18, } export function getEnumBigInt(operation: TransactionType): BigInt { diff --git a/AllInteractions/src/entities/global/VoteTypeEnum.ts b/AllInteractions/src/entities/global/VoteTypeEnum.ts deleted file mode 100644 index cdfe619b..00000000 --- a/AllInteractions/src/entities/global/VoteTypeEnum.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { BigInt } from "@graphprotocol/graph-ts"; - -export enum VoteType { - PERSONAL = 1, - MICROPOOL = 2, - DELEGATED = 3, - TREASURY = 4, -} - -export function getEnumBigInt(operation: VoteType): BigInt { - return BigInt.fromI32(operation as i32); -} diff --git a/AllInteractions/src/mappings/DaoPool.ts b/AllInteractions/src/mappings/DaoPool.ts index 7c482281..5978789b 100644 --- a/AllInteractions/src/mappings/DaoPool.ts +++ b/AllInteractions/src/mappings/DaoPool.ts @@ -7,22 +7,25 @@ import { ProposalCreated, ProposalExecuted, RewardClaimed, - Voted, + VoteChanged, Withdrawn, - Requested, } from "../../generated/templates/DaoPool/DaoPool"; import { getDaoPoolDelegate } from "../entities/dao-pool/DaoPoolDelegate"; import { getDaoPoolVest } from "../entities/dao-pool/DaoPoolVest"; import { getDaoPoolMovedToValidators } from "../entities/dao-pool/DaoPoolMovedToValidators"; import { getDaoPoolExecute } from "../entities/dao-pool/DaoPoolProposalExecute"; import { getDaoPoolRewardClaim } from "../entities/dao-pool/DaoPoolRewardClaim"; -import { getDaoPoolVote } from "../entities/dao-pool/DaoPoolVote"; +import { getDaoPoolProposalInteraction } from "../entities/dao-pool/DaoPoolProposalInteraction"; import { getDaoProposalCreate } from "../entities/dao-pool/DaoProposalCreate"; import { getEnumBigInt, TransactionType } from "../entities/global/TransactionTypeEnum"; import { getTransaction } from "../entities/transaction/Transaction"; import { getDaoPoolOffchainResult } from "../entities/dao-pool/DaoOffchainResults"; import { push } from "../helpers/ArrayHelper"; import { getPool } from "../entities/dao-pool/Pool"; +import { + getEnumBigInt as getProposalInteractionBigInt, + ProposalInteractionType, +} from "../entities/global/ProposalInteractionTypeEnum"; export function onProposalCreated(event: ProposalCreated): void { getPool(event.address).save(); @@ -73,52 +76,46 @@ export function onDelegated(event: Delegated): void { delegated.save(); } -export function onRequested(event: Requested): void { +export function onVoteChanged(event: VoteChanged): void { getPool(event.address).save(); let transaction = getTransaction( event.transaction.hash, event.block.number, event.block.timestamp, - event.params.from, + event.params.voter, event.address ); - let delegated = getDaoPoolDelegate( - event.transaction.hash, - event.address, - event.params.amount, - transaction.interactionsCount - ); - transaction.interactionsCount = transaction.interactionsCount.plus(BigInt.fromI32(1)); - transaction.type = push(transaction.type, getEnumBigInt(TransactionType.DAO_POOL_REQUESTED)); - delegated.transaction = transaction.id; - transaction.save(); - delegated.save(); -} + let txType = TransactionType.DAO_POOL_PROPOSAL_VOTED; + let interactionType = event.params.isVoteFor + ? ProposalInteractionType.VOTE_FOR + : ProposalInteractionType.VOTE_AGAINST; -export function onVoted(event: Voted): void { - getPool(event.address).save(); - let transaction = getTransaction( - event.transaction.hash, - event.block.number, - event.block.timestamp, - event.params.sender, - event.address - ); - let voted = getDaoPoolVote( + if ( + isZero(event.params.votes.personal) && + isZero(event.params.votes.micropool) && + isZero(event.params.votes.treasury) + ) { + txType = TransactionType.DAO_POOL_PROPOSAL_VOTE_CANCELED; + interactionType = ProposalInteractionType.VOTE_CANCEL; + } + + let interaction = getDaoPoolProposalInteraction( event.transaction.hash, event.address, - getEnumBigInt(event.params.voteType), - event.params.amount, - transaction.interactionsCount, - event.params.isVoteFor + getProposalInteractionBigInt(interactionType), + event.params.votes.personal, + event.params.votes.micropool, + event.params.votes.treasury, + transaction.interactionsCount ); + transaction.interactionsCount = transaction.interactionsCount.plus(BigInt.fromI32(1)); - transaction.type = push(transaction.type, getEnumBigInt(TransactionType.DAO_POOL_PROPOSAL_VOTED)); - voted.transaction = transaction.id; + transaction.type = push(transaction.type, getEnumBigInt(txType)); + interaction.transaction = transaction.id; transaction.save(); - voted.save(); + interaction.save(); } export function onProposalExecuted(event: ProposalExecuted): void { @@ -267,3 +264,7 @@ export function onOffchainResultsSaved(event: OffchainResultsSaved): void { transaction.save(); offchainResultsSaved.save(); } + +function isZero(val: BigInt): boolean { + return val.equals(BigInt.zero()); +} diff --git a/AllInteractions/subgraph.yaml b/AllInteractions/subgraph.yaml index d761525c..5f2fa28a 100644 --- a/AllInteractions/subgraph.yaml +++ b/AllInteractions/subgraph.yaml @@ -20,7 +20,7 @@ dataSources: - name: PoolFactory file: ./abis/PoolFactory.json eventHandlers: - - event: DaoPoolDeployed(string,address,(address,address,address,address,address),address,address,address,address) + - event: DaoPoolDeployed(string,address,(address,address,address,address,address,address),address,address,address,address) handler: onDaoPoolDeployed - kind: ethereum/contract @@ -67,12 +67,14 @@ templates: handler: onProposalCreated - event: Delegated(address,address,uint256,uint256[],bool) handler: onDelegated - - event: Voted(uint256,address,uint8,uint256,bool) - handler: onVoted + - event: VoteChanged(uint256,address,bool,(uint256,uint256,uint256)) + handler: onVoteChanged - event: ProposalExecuted(uint256,bool,address) handler: onProposalExecuted - event: RewardClaimed(uint256,address,address,uint256) handler: onRewardClaimed + - event: RewardCanceled(uint256,address,uint256,address) + handler: onRewardCanceled - event: Deposited(uint256,uint256[],address) handler: onDeposited - event: Withdrawn(uint256,uint256[],address) @@ -81,8 +83,6 @@ templates: handler: onMovedToValidators - event: OffchainResultsSaved(string,address) handler: onOffchainResultsSaved - - event: Requested(address,address,uint256,uint256[]) - handler: onRequested - kind: ethereum/contract name: DaoValidators network: chapel diff --git a/AllInteractions/tests/DaoPool.test.ts b/AllInteractions/tests/DaoPool.test.ts index e97095dd..8df15950 100644 --- a/AllInteractions/tests/DaoPool.test.ts +++ b/AllInteractions/tests/DaoPool.test.ts @@ -9,16 +9,15 @@ import { ProposalCreated, ProposalExecuted, RewardClaimed, - Voted, + RewardCanceled, + VoteChanged, Withdrawn, - Requested, } from "../generated/templates/DaoPool/DaoPool"; import { onDelegated, - onRequested, onProposalCreated, onProposalExecuted, - onVoted, + onVoteChanged, onRewardClaimed, onDeposited, onWithdrawn, @@ -26,7 +25,7 @@ import { onOffchainResultsSaved, } from "../src/mappings/DaoPool"; import { TransactionType } from "../src/entities/global/TransactionTypeEnum"; -import { VoteType, getEnumBigInt } from "../src/entities/global/VoteTypeEnum"; +import { ProposalInteractionType } from "../src/entities/global/ProposalInteractionTypeEnum"; function createProposalCreated( proposalId: BigInt, @@ -85,48 +84,30 @@ function createDelegated( return event; } -function createRequested( - from: Address, - to: Address, - amount: BigInt, - nfts: Array, - contractSender: Address, - block: ethereum.Block, - tx: ethereum.Transaction -): Requested { - let event = changetype(newMockEvent()); - event.parameters = new Array(); - - event.parameters.push(new ethereum.EventParam("from", ethereum.Value.fromAddress(from))); - event.parameters.push(new ethereum.EventParam("to", ethereum.Value.fromAddress(to))); - event.parameters.push(new ethereum.EventParam("amount", ethereum.Value.fromUnsignedBigInt(amount))); - event.parameters.push(new ethereum.EventParam("nfts", ethereum.Value.fromUnsignedBigIntArray(nfts))); - - event.block = block; - event.transaction = tx; - event.address = contractSender; - - return event; -} - -function createVoted( +function createVoteChanged( proposalId: BigInt, sender: Address, - voteType: BigInt, - amount: BigInt, + personal: BigInt, + micropool: BigInt, + treasury: BigInt, isVoteFor: boolean, contractSender: Address, block: ethereum.Block, tx: ethereum.Transaction -): Voted { - let event = changetype(newMockEvent()); +): VoteChanged { + let event = changetype(newMockEvent()); event.parameters = new Array(); + const votes = new ethereum.Tuple(3); + + votes[0] = ethereum.Value.fromUnsignedBigInt(personal); + votes[1] = ethereum.Value.fromUnsignedBigInt(micropool); + votes[2] = ethereum.Value.fromUnsignedBigInt(treasury); + event.parameters.push(new ethereum.EventParam("proposalId", ethereum.Value.fromUnsignedBigInt(proposalId))); - event.parameters.push(new ethereum.EventParam("sender", ethereum.Value.fromAddress(sender))); - event.parameters.push(new ethereum.EventParam("voteType", ethereum.Value.fromUnsignedBigInt(voteType))); - event.parameters.push(new ethereum.EventParam("amount", ethereum.Value.fromUnsignedBigInt(amount))); + event.parameters.push(new ethereum.EventParam("voter", ethereum.Value.fromAddress(sender))); event.parameters.push(new ethereum.EventParam("isVoteFor", ethereum.Value.fromBoolean(isVoteFor))); + event.parameters.push(new ethereum.EventParam("votes", ethereum.Value.fromTuple(votes))); event.block = block; event.transaction = tx; @@ -348,68 +329,129 @@ describe("DaoPool", () => { ); }); - test("should handle Requested", () => { - let from = Address.fromString("0x86e08f7d84603AEb97cd1c89A80A9e914f181671"); - let to = Address.fromString("0x86e08f7d84603AEb97cd1c89A80A9e914f181672"); - let amount = BigInt.fromI32(100).pow(18); - let nfts = [BigInt.fromI32(1), BigInt.fromI32(2)]; - - let event0 = createRequested(from, to, amount, nfts, contractSender, block, tx); - - onRequested(event0); - - assert.fieldEquals("Pool", contractSender.toHexString(), "id", contractSender.toHexString()); - assert.fieldEquals("DaoPoolDelegate", tx.hash.concatI32(0).toHexString(), "pool", contractSender.toHexString()); - assert.fieldEquals("DaoPoolDelegate", tx.hash.concatI32(0).toHexString(), "amount", amount.toString()); + test("should handle VoteChanged", () => { + let proposalId = BigInt.fromI32(1); + let sender = Address.fromString("0x86e08f7d84603AEb97cd1c89A80A9e914f181671"); + let personal = BigInt.fromI32(1000); + let micropool = BigInt.fromI32(1000); + let treasury = BigInt.fromI32(1000); + let isVoteFor = true; - assertTransaction( - tx.hash, - event0.params.from, + let event = createVoteChanged( + proposalId, + sender, + personal, + micropool, + treasury, + isVoteFor, + contractSender, block, - `[${TransactionType.DAO_POOL_REQUESTED}]`, - BigInt.fromI32(1), - contractSender + tx ); - let event1 = createRequested(from, to, amount, nfts, contractSender, block, tx); - - onRequested(event1); + onVoteChanged(event); - assert.fieldEquals("DaoPoolDelegate", tx.hash.concatI32(0).toHexString(), "pool", contractSender.toHexString()); - assert.fieldEquals("DaoPoolDelegate", tx.hash.concatI32(0).toHexString(), "amount", amount.toString()); + assert.fieldEquals("Pool", contractSender.toHexString(), "id", contractSender.toHexString()); + assert.fieldEquals( + "DaoPoolProposalInteraction", + tx.hash.concatI32(0).toHexString(), + "pool", + contractSender.toHexString() + ); + assert.fieldEquals( + "DaoPoolProposalInteraction", + tx.hash.concatI32(0).toHexString(), + "personalVote", + personal.toString() + ); + assert.fieldEquals( + "DaoPoolProposalInteraction", + tx.hash.concatI32(0).toHexString(), + "micropoolVote", + micropool.toString() + ); + assert.fieldEquals( + "DaoPoolProposalInteraction", + tx.hash.concatI32(0).toHexString(), + "treasuryVote", + treasury.toString() + ); + assert.fieldEquals( + "DaoPoolProposalInteraction", + tx.hash.concatI32(0).toHexString(), + "interactionType", + ProposalInteractionType.VOTE_FOR.toString() + ); assertTransaction( tx.hash, - event1.params.from, + event.params.voter, block, - `[${TransactionType.DAO_POOL_REQUESTED}, ${TransactionType.DAO_POOL_REQUESTED}]`, - BigInt.fromI32(2), + `[${TransactionType.DAO_POOL_PROPOSAL_VOTED}]`, + BigInt.fromI32(1), contractSender ); }); - test("should handle Voted", () => { + test("should handle VoteChanged (cancel)", () => { let proposalId = BigInt.fromI32(1); let sender = Address.fromString("0x86e08f7d84603AEb97cd1c89A80A9e914f181671"); - let voteType = getEnumBigInt(VoteType.PERSONAL); - let amount = BigInt.fromI32(1000); + let personal = BigInt.fromI32(0); + let micropool = BigInt.fromI32(0); + let treasury = BigInt.fromI32(0); let isVoteFor = true; - let event = createVoted(proposalId, sender, voteType, amount, isVoteFor, contractSender, block, tx); + let event = createVoteChanged( + proposalId, + sender, + personal, + micropool, + treasury, + isVoteFor, + contractSender, + block, + tx + ); - onVoted(event); + onVoteChanged(event); assert.fieldEquals("Pool", contractSender.toHexString(), "id", contractSender.toHexString()); - assert.fieldEquals("DaoPoolVote", tx.hash.concatI32(0).toHexString(), "pool", contractSender.toHexString()); - assert.fieldEquals("DaoPoolVote", tx.hash.concatI32(0).toHexString(), "voteType", voteType.toString()); - assert.fieldEquals("DaoPoolVote", tx.hash.concatI32(0).toHexString(), "amount", amount.toString()); - assert.fieldEquals("DaoPoolVote", tx.hash.concatI32(0).toHexString(), "isVoteFor", isVoteFor.toString()); + assert.fieldEquals( + "DaoPoolProposalInteraction", + tx.hash.concatI32(0).toHexString(), + "pool", + contractSender.toHexString() + ); + assert.fieldEquals( + "DaoPoolProposalInteraction", + tx.hash.concatI32(0).toHexString(), + "personalVote", + personal.toString() + ); + assert.fieldEquals( + "DaoPoolProposalInteraction", + tx.hash.concatI32(0).toHexString(), + "micropoolVote", + micropool.toString() + ); + assert.fieldEquals( + "DaoPoolProposalInteraction", + tx.hash.concatI32(0).toHexString(), + "treasuryVote", + treasury.toString() + ); + assert.fieldEquals( + "DaoPoolProposalInteraction", + tx.hash.concatI32(0).toHexString(), + "interactionType", + ProposalInteractionType.VOTE_CANCEL.toString() + ); assertTransaction( tx.hash, - event.params.sender, + event.params.voter, block, - `[${TransactionType.DAO_POOL_PROPOSAL_VOTED}]`, + `[${TransactionType.DAO_POOL_PROPOSAL_VOTE_CANCELED}]`, BigInt.fromI32(1), contractSender );