Skip to content

refactor: big ole proposal metadata, tests, rewards, and ranking refactor #254

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

Merged

Conversation

siobh9
Copy link
Member

@siobh9 siobh9 commented Apr 22, 2023

  • Add metadata to proposals and refactor proposal enum and struct structure
  • Remove code duplication in proposing by parsing out the data validation step
  • Add proposeWithoutProof()
  • Add metadata to rewards - allow payout to target address in addition to author
  • Update tests with metadata changes
  • Add RewardsModule tests
  • Move sorting and ranking logic into GovernorSorting from RewardsModule to simplify the latter's code and provide more functionality to the former
  • Move GovernorMerkleVotes out of extensions as it doesn't inherit Governor
  • Remove solhint
  • TODOs
  • Comments
  • Check over

An issue I ran into though (fixed in this commit)

Unfortunately have to add a few @ts-ignores though because this block in JokeDaoV2Dev/packages/react-app-revamp/contracts/bytecodeAndAbi/Contest.3.1.merkleVotes.sol/Contest.json:

{
      "inputs": [
        {
          "components": [
            {
              "internalType": "address",
              "name": "author",
              "type": "address"
            },
            {
              "internalType": "string",
              "name": "description",
              "type": "string"
            },
            {
              "internalType": "bool",
              "name": "exists",
              "type": "bool"
            },
            {
              "components": [
                {
                  "internalType": "address",
                  "name": "targetAddress",
                  "type": "address"
                }
              ],
              "internalType": "struct IGovernor.TargetMetadata",
              "name": "targetMetadata",
              "type": "tuple"
            },
            {
              "components": [
                {
                  "internalType": "address[]",
                  "name": "signers",
                  "type": "address[]"
                },
                {
                  "internalType": "uint256",
                  "name": "threshold",
                  "type": "uint256"
                }
              ],
              "internalType": "struct IGovernor.SafeMetadata",
              "name": "safeMetadata",
              "type": "tuple"
            }
          ],
          "internalType": "struct IGovernor.ProposalCore",
          "name": "proposal",
          "type": "tuple"
        },
        {
          "internalType": "bytes32[]",
          "name": "proof",
          "type": "bytes32[]"
        }
      ],
      "name": "propose",
      "outputs": [
        {
          "internalType": "uint256",
          "name": "",
          "type": "uint256"
        }
      ],
      "stateMutability": "nonpayable",
      "type": "function"
    },

makes it so that when we try to filter the ABI in JokeDaoV2Dev/packages/react-app-revamp/hooks/useContest/index.ts, it gives an error saying that there are too many signatures in the array.

Apparently this is being currently worked on by the Typescript team here and is a common problem when parsing ABIs. I found this for example, which helps, but it still ends up requiring a @ts-ignore because then el isn't typed.

Just seems like it's a problem that requires a messy workaround, as we already do in our codebase when we read ABIs, which is unfortunate - but hopefully soon the TS team merges this PR and we can do things in the right, strictly typed way.

@vercel
Copy link

vercel bot commented Apr 22, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
jokedao-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 22, 2023 2:10pm

@siobh9 siobh9 changed the title refactor: add metadata, add to Rewards, and move ranking into Contests refactor: big ole proposal, rewards, and ranking refactor Apr 22, 2023
@siobh9 siobh9 changed the title refactor: big ole proposal, rewards, and ranking refactor refactor: big ole proposal, tests, rewards, and ranking refactor Apr 22, 2023
@siobh9 siobh9 changed the title refactor: big ole proposal, tests, rewards, and ranking refactor refactor: big ole proposal metadata, tests, rewards, and ranking refactor Apr 22, 2023
@siobh9 siobh9 merged commit 6e40f62 into feat/merkle-votes Apr 22, 2023
@siobh9 siobh9 mentioned this pull request Apr 22, 2023
10 tasks
@siobh9 siobh9 deleted the refactor/move-sorting-and-ranking-to-GovCounting branch July 16, 2023 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant