Skip to content

Conversation

@daffafaizan
Copy link
Collaborator

Pay-It-Forward Chain Competition is a competition wherein a group of people compete by paying it forward to their fellow man. The goal of the competition is to see who can create the longest chain involving the most unique businesses. This really fosters a sense of community with upside for the participants themselves. There will be a global prize pot (GPP) that is contributed to by the participants as they pay it forward. The GPP will be paid out to the participants of the winning chain, the businesses involved in the chain, and a charity pre-selected at the start of the competition. This aligns with our goal of wholesome community driven action.

Our project introduces the following contracts:

  • ChainContract - Manages the creation, deletion, tracking, and calculation of scores of a chain.
  • CompManager - Manages competition phases, global prize pot (GPP), business approval, and payouts.
  • IStoreFront - Handles store implementation for products and prices.

Copy link
Collaborator

@ssolit ssolit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! code is super well organized. Most of my comments are nitpicks.

Remember to add the tests when the are ready.

import "./IStoreFront.sol";

contract CompManager {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~at deploy~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would call this section constants and modifiers and move the constructor to its own sections after


// Solution to check if chain exists: https://ethereum.stackexchange.com/questions/13021/how-can-i-figure-out-if-a-certain-key-exists-in-a-mapping-struct-defined-inside

contract ChainContract {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: this name is a bit awkward. Maybe call it ChainTracker?

it would also be great it the name of the contract matched the file name, i.e. ChainTracker.sol

CompetitionPhases public competition = CompetitionPhases.PRE;

// constructor function that run at deployment
constructor(address charAddr) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: char usually means character. maybe call this charityAddr for clarity

// functions to set up the competition prior to starting it

// determines the charity we will be donating to
function selectCharity(address charityAddr) public managerOnly atStage(CompetitionPhases.PRE) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not do this in the constructor?


//don't update last PIF because it is the same
}
endCompetition(); //checks every transaction if the competition should be ended
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not standard. usually endCompetition is something people call. you don't want to have to purchase something to end the competition is the time has already passed.

I think it's reasonable to assume the organizer or someone else would just set a bot up to call endCompetition at the right time. if you want it to be fully automatic, you could call endCompetition at the start of every makeCompTransaction call and it will only actually end it if its the correct time

// check if charity address if valid
require(charity != address(0x0), "Invalid address.");
// payout charity
(bool paid,) = charity.call{value: donation}("");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't send money automatically. make the charity make its own transaction to collect the money.

If the charity messes up some how and setUpPayout reverts, all of the money would be stuck in the CompManager contract forever

}

// reset's the competition if everyone has been paid out and the wallet balance is empty
function resetCompetition() internal atStage(CompetitionPhases.POST) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is unnecessary. people can just deploy a new contract to start a new competition.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a bit unsure why this file is getting updated

@lyronctk lyronctk changed the title Pay-It-Forward Chain Competition FOLIO: A global pay-it-forward chain Feb 11, 2025
@lyronctk lyronctk merged commit 6f977d5 into SeismicSystems:main Feb 12, 2025
1 check passed
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.

4 participants