Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -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
21 changes: 7 additions & 14 deletions src/shrines/SnapshotShrine.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -46,23 +44,20 @@ 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;
address champion;
}

/// @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;
Expand Down Expand Up @@ -106,7 +101,7 @@ contract SnapshotShrine is Stewarded, ReentrancyGuard {
/// User actions
/// -----------------------------------------------------------------------

/// @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
Expand All @@ -121,7 +116,6 @@ contract SnapshotShrine is Stewarded, ReentrancyGuard {

/// @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.
/// 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
Expand Down Expand Up @@ -164,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,
Expand Down Expand Up @@ -208,7 +202,7 @@ contract SnapshotShrine is Stewarded, ReentrancyGuard {
}
}

/// @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
Expand Down Expand Up @@ -254,8 +248,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
Expand Down