Skip to content
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

add example contracts for scout game #15

Merged
merged 1 commit into from
Oct 23, 2024
Merged

add example contracts for scout game #15

merged 1 commit into from
Oct 23, 2024

Conversation

mattcasey
Copy link
Member

No description provided.

@mattcasey mattcasey requested a review from motechFR October 23, 2024 07:01
Attestation calldata attestation,
uint256 /*value*/
) internal override returns (bool) {
uint256 addedBalance = 10 * DECIMALS;
Copy link
Contributor

Choose a reason for hiding this comment

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

This would be a good place to add validations on who can attest

Example here
https://docs.attest.org/docs/tutorials/resolver-contracts#attester-resolver

mapping(address => uint256) private _unclaimedBalances;

// Define a constant for 18 decimals
uint256 constant DECIMALS = 10 ** 18;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be preferable to read this value directly from the ERC20 token

}

// Allow the sender to claim their balance as ERC20 tokens
function claimBalance(uint256 amount) public returns (bool) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why add an amount here? We could just make it claimBalance, and zero out the user's balance

_pause();
}

function unpause() public virtual {
Copy link
Contributor

Choose a reason for hiding this comment

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

I see alot of use of virtuals here, which mainly applies for overriding from inheriting contracts.

What is the use case for having virtuals everywhere?

Attestation calldata attestation,
uint256 /*value*/
) internal override returns (bool) {
uint256 addedBalance = 10 * DECIMALS;
Copy link
Contributor

@motechFR motechFR Oct 23, 2024

Choose a reason for hiding this comment

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

We will need some upgradeable way to evolve the balances calculation

"Insufficient unclaimed balance"
);
uint256 contractHolding = token.balanceOf(address(this));
require(contractHolding >= amount, "Insufficient balance in contract");
Copy link
Contributor

Choose a reason for hiding this comment

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

This raises an interesting product question of users having claimable balances that can't be claimed, something to look at

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, we could just build the revert logic into the transfer method of the ERC20

token.transferFrom(msg.sender, address(this), amount);
}

function decodeValue(
Copy link
Contributor

Choose a reason for hiding this comment

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

Unused code so far?

}

// Deposit funds to the contract
function depositFunds(uint256 amount) public {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the use case for depositFunds?

_mint(to, amount);
}

function mintForVesting(address to, uint256 amount) public virtual {
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if this could be simplified, and the vesting contract hardcoded

import "@openzeppelin/contracts/access/extensions/AccessControlEnumerable.sol";
import "@openzeppelin/contracts/utils/Context.sol";

contract ScoutToken is Context, AccessControlEnumerable, ERC20Pausable {
Copy link
Contributor

Choose a reason for hiding this comment

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

Noticing we don't have a max total supply here, that would be a useful safeguard to add

@motechFR
Copy link
Contributor

motechFR commented Oct 23, 2024

Adding some notes here from my overall understanding of mechanics

ScoutGame protocol

  • Keeps track of token claims, and enable claiming of funds
  • Exposes onAttest hook to EAS for increasing token claimable balances given X logic

ScoutGame vesting

  • Maintains its own ScoutGame token balance
  • Tracks vesting claims, and transfers tokens from its balance to the vestee

ScoutGame token

  • Standard ERC20

One overall observation, I don't see any interfacing between the ERC1155 builder nft and this set of contracts, this would be good to understand

Also, I see we have vesting in place for the protocol itself, wondering if there's a simpler way to handle this

Finally, not seeing the pattern for upgrading the protocol itself, although I do see an updateScoutGameProtocol method in the vesting contract

@mattcasey mattcasey merged commit 4feecff into main Oct 23, 2024
1 check failed
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.

2 participants