Verified contractExactMIT
HolderClaimCountEligibility
Address0xc913decd7fa81b9425ba31876fb1ce12de02bf26
- Balance
0 ETH
- Transactions
1
- Compiler
solc 0.8.17
- Same code
Only this contract
Details
- Compiler
- solc 0.8.17+commit.8df45f5f
- Language
- solidity
- Optimization
- Yes, 1,000 runs
- EVM version
- london
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,330,279
- Creation transaction
- 0x7fe9865981…fa52f574ef
src/eligibility/HolderClaimCountEligibility.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import {HolderThresholdEligibility} from "./HolderThresholdEligibility.sol";
import {IClaimCountOf} from "../interfaces/IClaimCountOf.sol";
/// @notice Erfuellt, wenn der AKTUELLE HALTER (ownerOf(tokenId)) bereits mindestens
/// `threshold` Mal erfolgreich Royalties aus RoyaltyVault abgeholt hat. Anders als
/// HolderBurnCountEligibility (nft dient dort doppelt als ownerOf- UND burnCount-Quelle)
/// liegen hier zwei verschiedene Contracts vor: `nft` fuer ownerOf() (geerbt von
/// HolderThresholdEligibility), `vault` fuer claimCount().
contract HolderClaimCountEligibility is HolderThresholdEligibility {
address public immutable vault;
constructor(address nft_, address vault_, uint256 threshold_) HolderThresholdEligibility(nft_, threshold_) {
vault = vault_;
}
function _metric(address holder) internal view override returns (uint256) {
return IClaimCountOf(vault).claimCount(holder);
}
}
src/eligibility/HolderThresholdEligibility.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import {IEligibilityCondition} from "../interfaces/IEligibilityCondition.sol";
import {IOwnerOf} from "../interfaces/IOwnerOf.sol";
/// @notice Schwester von ThresholdEligibility, prueft aber das Wallet des AKTUELLEN
/// Halters (ownerOf(tokenId) auf dem uebergebenen `nft`-Contract) statt der TBA. Der
/// `tba`-Parameter aus IEligibilityCondition wird bewusst ignoriert -- der Holder wird
/// pro Aufruf frisch aus `tokenId` aufgeloest, bleibt also live korrekt bei jedem
/// Besitzerwechsel.
abstract contract HolderThresholdEligibility is IEligibilityCondition {
address public immutable nft;
uint256 public immutable threshold;
constructor(address nft_, uint256 threshold_) {
nft = nft_;
threshold = threshold_;
}
function _metric(address holder) internal view virtual returns (uint256);
function isEligible(address, uint256 tokenId) external view returns (bool) {
address holder = IOwnerOf(nft).ownerOf(tokenId);
return _metric(holder) >= threshold;
}
}
src/interfaces/IClaimCountOf.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
/// @notice Minimales Interface fuer den Abhol-Zaehler aus RoyaltyVault.sol.
/// Schwester von IBurnCountOf, gleiches Minimalprinzip wie IBalanceOf/IOwnerOf.
interface IClaimCountOf {
function claimCount(address wallet) external view returns (uint256);
}
src/interfaces/IEligibilityCondition.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
/// @notice Ja/Nein-Gegenstueck zu ITraitCondition: statt eine Tier-Stufe liefert
/// isEligible() nur "erfuellt der Halter diese eine Bedingung gerade oder nicht" --
/// Grundlage fuer TraitManagers freischaltbare Wahl-Traits (equipTrait).
interface IEligibilityCondition {
function isEligible(address tba, uint256 tokenId) external view returns (bool);
}
src/interfaces/IOwnerOf.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
/// @notice Minimales gemeinsames Interface fuer ownerOf(uint256) -- fuer JEDEN ERC-721,
/// nicht nur die eigene Kollektion (anders als INftTraitView, das zusaetzlich tbaOf()
/// verlangt und damit nur fuer den eigenen NFT-Contract passt). Gleiches Minimalprinzip
/// wie IBalanceOf.
interface IOwnerOf {
function ownerOf(uint256 tokenId) external view returns (address);
}
Compiler settingsShow
{
"viaIR": false,
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"optimizer": {
"runs": 1000,
"enabled": true
},
"evmVersion": "london",
"remappings": [
"solady/=lib/solady/src/",
"forge-std/=lib/forge-std/src/",
"ERC721A/=lib/ERC721A/contracts/",
"solmate/=lib/solmate/src/",
"utility-contracts/=lib/utility-contracts/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/",
"seadrop/=lib/seadrop/",
"ds-test/=/home/philipp/Schreibtisch/Projekte/Crypto/Auditors-EigeneKollektion/contract/contracts/lib/solmate/lib/ds-test/src/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.