-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathScrollBadgeWhale.sol
45 lines (35 loc) · 1.41 KB
/
ScrollBadgeWhale.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import {Attestation} from "@eas/contracts/IEAS.sol";
import {ScrollBadge} from "../ScrollBadge.sol";
import {ScrollBadgePermissionless} from "./ScrollBadgePermissionless.sol";
import {ScrollBadgeEligibilityCheck} from "../extensions/ScrollBadgeEligibilityCheck.sol";
import {Unauthorized} from "../../Errors.sol";
/// @title ScrollBadgeWhale
/// @notice A badge that shows that the user had 1000 ETH or more at the time of minting.
contract ScrollBadgeWhale is ScrollBadgePermissionless {
constructor(address resolver_) ScrollBadgePermissionless(resolver_) {
// empty
}
/// @inheritdoc ScrollBadge
function onIssueBadge(Attestation calldata attestation) internal override returns (bool) {
if (!super.onIssueBadge(attestation)) {
return false;
}
if (attestation.recipient.balance < 1000 ether) {
revert Unauthorized();
}
return true;
}
/// @inheritdoc ScrollBadge
function onRevokeBadge(Attestation calldata attestation) internal override returns (bool) {
if (!super.onRevokeBadge(attestation)) {
return false;
}
return true;
}
/// @inheritdoc ScrollBadgeEligibilityCheck
function isEligible(address recipient) external view override returns (bool) {
return !hasBadge(recipient) && recipient.balance >= 1000 ether;
}
}