Hats-Protocol / agreement-eligibility

MIT License
0 stars 4 forks source link

Handle agreement replacement #7

Open spengrah opened 2 months ago

spengrah commented 2 months ago

As of v0.2.0, if an owner makes a mistake when adding a new agreement and quickly replaces it with another new agreement, all wearers who signed the existing agreement will be made ineligible even still within the original grace period.

To resolve this, if a wearer has not signed the latest agreement, we can instead check whether we are still within the grace period of the agreement they have signed, regardless of how many new agreements there have been since the one they signed.

This would involve the following changes:

  1. introducing an Agreement struct enabling tracking of all historical agreements.
struct Agreement {
  string agreement;
  uint256 graceEndsAt;
}

mapping(uint256 id => Agreement agreement) public agreements;

// replaced
// string public currentAgreement;
// uint256 public graceEndsAt;
  1. Setting a new agreement would increment the currentAgreementId but not overwrite the previous agreement or change a global graceEndsAt.

❓ An open question is whether the new grace period should start immediately or not until after the end of the existing grace period.

  1. Wearers would now be eligible if either of the following were true:
    • a) They have signed the most recent agreement
    • b) The grace period for the agreement they most recently signed has not ended

Timing

Given the open question above, together with the non-trivial change to the contract interface and indexable data involved in this change, I recommend conducting additional user research before implementing it.

scottrepreneur commented 3 weeks ago

Closed by #8