Verified contractExactMIT
AndEligibility
Address0xdaed123e73e218fe1486c19008d6deb680da2e9f
- 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, 10,000 runs
- EVM version
- london
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,035,884
- Creation transaction
- 0x8f2e6f0785…a5d9acdd5a
2 files
src/eligibility/AndEligibility.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import {IEligibilityCondition} from "../interfaces/IEligibilityCondition.sol";
/// @notice Generischer UND-Kombinator: erfuellt nur, wenn ALLE `children` gleichzeitig
/// erfuellt sind. TraitManager.addTraitRequirement() selbst kennt nur ODER (mehrere
/// Requirements auf dieselbe Variante) -- fuer eine UND-Verknuepfung (z.B. "ETH-Schwelle
/// UND USDT-Schwelle") wird stattdessen EIN AndEligibility-Contract als einziges
/// Requirement registriert.
/// @dev Jedes Kind MUSS Code tragen -- exakt dieselbe Gefahr wie bei
/// TraitManager.addTraitRequirement (siehe dortiger Kommentar): ein codeloses Ziel
/// (Vertipper, address(0), EOA) wuerde beim internen `IEligibilityCondition(...).
/// isEligible()`-Call einen compiler-generierten extcodesize-Check ausloesen, dessen
/// Fehlschlag AUSSERHALB des schuetzenden try/catch der aufrufenden TraitManager-Ebene
/// liegt (dort isoliert gegen solc 0.8.17 verifiziert) -- ohne diese Schranke wuerde eine
/// falsche Kind-Adresse `tokenURI()` fuer die gesamte Kollektion dauerhaft brechen.
contract AndEligibility is IEligibilityCondition {
error TooFewChildren();
error InvalidChild();
address[] public children;
constructor(address[] memory children_) {
if (children_.length < 2) revert TooFewChildren();
for (uint256 i = 0; i < children_.length; i++) {
if (children_[i].code.length == 0) revert InvalidChild();
}
children = children_;
}
function childCount() external view returns (uint256) {
return children.length;
}
function isEligible(address tba, uint256 tokenId) external view returns (bool) {
for (uint256 i = 0; i < children.length; i++) {
if (!IEligibilityCondition(children[i]).isEligible(tba, tokenId)) return false;
}
return true;
}
}
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);
}
Compiler settingsShow
{
"viaIR": false,
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"optimizer": {
"runs": 10000,
"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/=lib/solmate/lib/ds-test/src/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.