Biggest Coq

There's one thing we know for certain about Coqs, they like Coq measuring contests.

As avid members of the Coq community, we noticed there wasn't an official way to measure who had the biggest Coq. That's why when forking COQ, we implemented the biggestCoq functionality into our code.

This added functionality allows the COQWIF token to keep track of the biggest Coq in the block. This title is like a title belt or a trophy, you must Claim it or else you won't be recognized. If you become the BIGGEST COQ, don't get too comfortable for another Coq may come along and steal your title with his magnificent COQWIF.

To claim your title you must call the claimBiggestCoq() on the COQWIF contract. You must also have MORE COQWIF than the current biggestCoq. We outline the functionality below:

View Biggest Coq:

Use balanceOf(biggestCoq) to see how much COQWIF you need to become the biggest COQ. If you have more you can then claimBiggestCoq() under WRITE CONTRACT in the COQWIF token:

If you are a nerdy coqer like ourselves, you will appreciate the technical side of COQWIF. In short, we'll break down the claimBiggestCoq() functionality and it's implications.

      function claimBiggestCoq() public {
        require(balanceOf(msg.sender) > balanceOf(biggestCoq), "Your Coqwif is too small.");
        require(msg.sender != biggestCoq, "You already have the biggest Coqwif.");
        require(currentBigCoqIndex < 6969696969696969696969);
        biggestCoq = msg.sender;
        pastBigCoqs[currentBigCoqIndex] = msg.sender;
        pastBigCoqsBalances[currentBigCoqIndex] = balanceOf(msg.sender);
        currentBigCoqIndex++;
        emit LargerCoqInTown(biggestCoq, balanceOf(biggestCoq), block.timestamp);
   }
  1. We have 3 require statements: First we make sure the claimant has more COQWIF than the current biggestCoq. Secondly, to prevent exploitation we ensure that the Biggest Coq doesn't steal his own belt. Thirdly, we have added a simple index mechanism to eliminate the possibility of data being overwritten in the pastBigCoqs and pastBigCoqsBalances mappings because of overflow.

  2. We store the balance and address of our new biggestCoq using the currentBigCoqIndex mapping.

  3. Lastly we let every Coq in the universe know what's up by emitting a "LargerCoqInTown" event.

If you are developing a community oriented page for Coqwif, you can use the pastBigCoqsBalances[] and pastBigCoqs[] to display a Leaderboard of previous biggestCoqs. It is also possible to ascertain who has been the biggestCoq for the longest time, by reading the LargerCoqInTown events.

We will be implementing this functionality inside of www.coqwif.meme

Last updated