From 86fdb74441e1d91c7c5ee68f3814efdcf5c6b6ef Mon Sep 17 00:00:00 2001 From: ParthSareen Date: Sat, 5 Nov 2022 16:11:38 -0400 Subject: [PATCH 1/2] [WIP] Removed shares and some references to Merkle tree --- foundry.toml | 4 ++-- src/shrines/SnapshotShrine.sol | 18 ++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/foundry.toml b/foundry.toml index b0aca45..aa364fc 100644 --- a/foundry.toml +++ b/foundry.toml @@ -1,11 +1,11 @@ # Full reference # https://book.getfoundry.sh/reference/config.html -[default] +[profile.default] solc_version = "0.8.13" optimizer = true optimizer_runs = 20000 gas_reports = ["*"] -[ci] +[profile.ci] verbosity = 4 fuzz_runs = 65536 diff --git a/src/shrines/SnapshotShrine.sol b/src/shrines/SnapshotShrine.sol index d214954..6d351e8 100644 --- a/src/shrines/SnapshotShrine.sol +++ b/src/shrines/SnapshotShrine.sol @@ -1,8 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity >=0.8.11; -import {MerkleProof} from "openzeppelin-contracts/utils/cryptography/MerkleProof.sol"; - import {ERC20, SafeTransferLib} from "@omniprotocol/libraries/SafeTransferLib.sol"; import {ReentrancyGuard} from "@omniprotocol/mixins/ReentrancyGuard.sol"; import {Stewarded} from "@omniprotocol/mixins/Stewarded.sol"; @@ -46,12 +44,11 @@ contract SnapshotShrine is Stewarded, ReentrancyGuard { /// Structs /// ----------------------------------------------------------------------- - /// @param snapshotId The Merkle treesnapshotId + /// @param snapshotId The snapshotId /// @param token The ERC-20 token to be claimed /// @param champion The Champion address. If the Champion rights /// have been transferred, the tokens will be sent to its owner. - /// @param shares The share amount of the Champion - /// @param merkleProof The Merkle proof showing the Champion is part of this Shrine's Merkle tree + struct ClaimInfo { uint256 snapshotId; ERC20 token; @@ -59,10 +56,8 @@ contract SnapshotShrine is Stewarded, ReentrancyGuard { } /// @param metaShrine The shrine to claim from - /// @param snapshotId The Merkle treesnapshotId + /// @param snapshotId The snapshotId /// @param token The ERC-20 token to be claimed - /// @param shares The share amount of the Champion - /// @param merkleProof The Merkle proof showing the Champion is part of this Shrine's Merkle tree struct MetaShrineClaimInfo { SnapshotShrine metaShrine; uint256 snapshotId; @@ -106,6 +101,7 @@ contract SnapshotShrine is Stewarded, ReentrancyGuard { /// User actions /// ----------------------------------------------------------------------- + // TODO: Update below notice to reflect structure /// @notice Offer ERC-20 tokens to the MerkleShrine and distribute them to Champions proportional /// to their shares in the Shrine. Callable by anyone. /// @param token The ERC-20 token being offered to the Shrine @@ -119,9 +115,11 @@ contract SnapshotShrine is Stewarded, ReentrancyGuard { emit Offer(msg.sender, token, amount); } + // TODO: Update below notice to reflect structure /// @notice A Champion or the owner of a Champion may call this to /// claim their share of the tokens offered to this Shrine. /// Requires a Merkle proof to prove that the Champion is part of this Shrine's Merkle tree. + // TODO: what kind of proof does it need now? /// Only callable by the champion (if the right was never transferred) or the owner /// (that the original champion transferred their rights to) /// @param claimInfo The info of the claim @@ -208,6 +206,7 @@ contract SnapshotShrine is Stewarded, ReentrancyGuard { } } + // TODO: Update below notice to reflect structure /// @notice If this MerkleShrine is a Champion of another MerkleShrine (MetaShrine), /// calling this can claim the tokens /// from the MetaShrine and distribute them to this Shrine's Champions. Callable by anyone. @@ -254,8 +253,7 @@ contract SnapshotShrine is Stewarded, ReentrancyGuard { /// ----------------------------------------------------------------------- /// @notice Computes the amount of a particular ERC-20 token claimable by a Champion from - /// a particular snapshotId of the Merkle tree. - /// @param snapshot The Merkle treesnapshotId + /// @param snapshot The snapshotId /// @param token The ERC-20 token to be claimed /// @param champion The Champion address /// @param shares The share amount of the Champion From 90258a774bf7607832ec77bd56ae5361135594cc Mon Sep 17 00:00:00 2001 From: ParthSareen Date: Sat, 5 Nov 2022 17:44:51 -0400 Subject: [PATCH 2/2] Removed comments for merkle --- src/shrines/SnapshotShrine.sol | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/shrines/SnapshotShrine.sol b/src/shrines/SnapshotShrine.sol index 6d351e8..9f792be 100644 --- a/src/shrines/SnapshotShrine.sol +++ b/src/shrines/SnapshotShrine.sol @@ -101,8 +101,7 @@ contract SnapshotShrine is Stewarded, ReentrancyGuard { /// User actions /// ----------------------------------------------------------------------- - // TODO: Update below notice to reflect structure - /// @notice Offer ERC-20 tokens to the MerkleShrine and distribute them to Champions proportional + /// @notice Offer ERC-20 tokens to the SnapshotShrine and distribute them to Champions proportional /// to their shares in the Shrine. Callable by anyone. /// @param token The ERC-20 token being offered to the Shrine /// @param amount The amount of tokens to offer @@ -115,11 +114,8 @@ contract SnapshotShrine is Stewarded, ReentrancyGuard { emit Offer(msg.sender, token, amount); } - // TODO: Update below notice to reflect structure /// @notice A Champion or the owner of a Champion may call this to /// claim their share of the tokens offered to this Shrine. - /// Requires a Merkle proof to prove that the Champion is part of this Shrine's Merkle tree. - // TODO: what kind of proof does it need now? /// Only callable by the champion (if the right was never transferred) or the owner /// (that the original champion transferred their rights to) /// @param claimInfo The info of the claim @@ -162,7 +158,7 @@ contract SnapshotShrine is Stewarded, ReentrancyGuard { /// @notice A variant of {claim} that combines multiple claims for the /// same Champion & snapshotId into a single call. /// @dev This is more efficient than {claimMultiple} since - /// it only checks Champion ownership & verifies Merkle proof once. + /// it only checks Champion ownership once. function claimMultipleTokensForChampion( address recipient, uint256 snapshot, @@ -206,8 +202,7 @@ contract SnapshotShrine is Stewarded, ReentrancyGuard { } } - // TODO: Update below notice to reflect structure - /// @notice If this MerkleShrine is a Champion of another MerkleShrine (MetaShrine), + /// @notice If this SnapshotShrine is a Champion of another SnapshotShrine (MetaShrine), /// calling this can claim the tokens /// from the MetaShrine and distribute them to this Shrine's Champions. Callable by anyone. /// @param claimInfo The info of the claim