Skip to content

feat: Support specifying team names #122

@mittal-parth

Description

@mittal-parth

We have the option to create teams currently but don't support team names. We didnt deem this necessary initially but with #120, a team name would be nice to display on the leaderboard.

Contract changes

  1. Add a field in the struct Team to store the team name in the Khoj contract.
    struct Team {
        address owner;
        uint256 huntId;
        // TODO: Add a name
        uint256 memberCount;
        ...
    }
  1. Also add it to TeamInfo and functions where team is created / queried for like createTeam. No checks on whether the team name has already been taken. It will simply be set.
  2. Update the tests in Khoj.test.js to assert for successful team name creation.

Contract will have to be deployed here to integrate with the frontend.

Backend changes

  1. The attestation structure will also have to be updated in sign-protocol.js to include a teamName string field.
  2. Accept this as an input in the attest-clue endpoint.

Front-end changes

  1. Add an input box above the button Create Team & Generate Invite in HuntDetails.tsx to take the team name input. Make this field mandatory and max 20 characters. Pass this along with the huntId in HuntDetails while calling the createTeam function in the contract.
      const transaction = prepareContractCall({
        contract: {
          address: contractAddress as `0x${string}`,
          abi: huntABI,
          chain: currentChain,
          client,
        },
        method: "createTeam",
        params: [BigInt(huntId || 0)], // TODO: Add here
      });
  1. Show this team name next to Your Team in HuntDetails.tsx.
  2. Use this team name (with ellipses for big team names) on Leaderboard.tsx
  3. While creating the attestation, pass the teamName also. If its an individual user, pass their address. We can now always show the teamName field from the attestation.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions