@ballkidz/defifa 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ADMINISTRATION.md +3 -3
- package/ARCHITECTURE.md +2 -0
- package/AUDIT_INSTRUCTIONS.md +422 -0
- package/CRYPTO_ECON.md +5 -5
- package/README.md +1 -1
- package/RISKS.md +38 -335
- package/SKILLS.md +1 -1
- package/USER_JOURNEYS.md +691 -0
- package/package.json +7 -7
- package/script/Deploy.s.sol +14 -3
- package/script/helpers/DefifaDeploymentLib.sol +13 -15
- package/src/DefifaDeployer.sol +221 -192
- package/src/DefifaGovernor.sol +286 -276
- package/src/DefifaHook.sol +68 -34
- package/src/DefifaProjectOwner.sol +27 -4
- package/src/DefifaTokenUriResolver.sol +136 -134
- package/src/enums/DefifaGamePhase.sol +1 -1
- package/src/enums/DefifaScorecardState.sol +1 -1
- package/src/interfaces/IDefifaDeployer.sol +52 -50
- package/src/interfaces/IDefifaGamePhaseReporter.sol +2 -2
- package/src/interfaces/IDefifaGamePotReporter.sol +1 -1
- package/src/interfaces/IDefifaGovernor.sol +53 -54
- package/src/interfaces/IDefifaHook.sol +104 -103
- package/src/interfaces/IDefifaTokenUriResolver.sol +2 -2
- package/src/libraries/DefifaFontImporter.sol +11 -9
- package/src/libraries/DefifaHookLib.sol +66 -53
- package/src/structs/DefifaAttestations.sol +1 -1
- package/src/structs/DefifaDelegation.sol +1 -1
- package/src/structs/DefifaLaunchProjectData.sol +4 -4
- package/src/structs/DefifaOpsData.sol +1 -1
- package/src/structs/DefifaScorecard.sol +1 -1
- package/src/structs/DefifaTierCashOutWeight.sol +1 -1
- package/src/structs/DefifaTierParams.sol +2 -1
- package/test/DefifaAdversarialQuorum.t.sol +602 -0
- package/test/DefifaAuditLowGuards.t.sol +304 -0
- package/test/DefifaFeeAccounting.t.sol +37 -16
- package/test/DefifaGovernor.t.sol +43 -19
- package/test/DefifaHookRegressions.t.sol +14 -12
- package/test/DefifaMintCostInvariant.t.sol +31 -12
- package/test/DefifaNoContest.t.sol +34 -16
- package/test/DefifaSecurity.t.sol +46 -28
- package/test/DefifaUSDC.t.sol +45 -36
- package/test/Fork.t.sol +43 -43
- package/test/SVG.t.sol +2 -2
- package/test/TestAuditGaps.sol +982 -0
- package/test/TestQALastMile.t.sol +511 -0
- package/test/regression/FulfillmentBlocksRatification.t.sol +36 -30
- package/test/regression/GracePeriodBypass.t.sol +15 -10
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity 0.8.
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
import {IJBController} from "@bananapus/core-v6/src/interfaces/IJBController.sol";
|
|
3
5
|
|
|
4
6
|
import {DefifaScorecardState} from "../enums/DefifaScorecardState.sol";
|
|
5
7
|
import {DefifaTierCashOutWeight} from "../structs/DefifaTierCashOutWeight.sol";
|
|
6
|
-
import {IJBController} from "@bananapus/core-v6/src/interfaces/IJBController.sol";
|
|
7
8
|
|
|
8
9
|
/// @notice Manages the ratification of Defifa scorecards through attestation-based governance.
|
|
9
10
|
interface IDefifaGovernor {
|
|
@@ -11,6 +12,10 @@ interface IDefifaGovernor {
|
|
|
11
12
|
uint256 indexed gameId, uint256 attestationStartTime, uint256 attestationGracePeriod, address caller
|
|
12
13
|
);
|
|
13
14
|
|
|
15
|
+
event ScorecardAttested(uint256 indexed gameId, uint256 indexed scorecardId, uint256 weight, address caller);
|
|
16
|
+
|
|
17
|
+
event ScorecardRatified(uint256 indexed gameId, uint256 indexed scorecardId, address caller);
|
|
18
|
+
|
|
14
19
|
event ScorecardSubmitted(
|
|
15
20
|
uint256 indexed gameId,
|
|
16
21
|
uint256 indexed scorecardId,
|
|
@@ -19,42 +24,31 @@ interface IDefifaGovernor {
|
|
|
19
24
|
address caller
|
|
20
25
|
);
|
|
21
26
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
/// @notice The number of attestations for a scorecard.
|
|
28
|
+
/// @param gameId The ID of the game.
|
|
29
|
+
/// @param scorecardId The ID of the scorecard.
|
|
30
|
+
/// @return The attestation count.
|
|
31
|
+
function attestationCountOf(uint256 gameId, uint256 scorecardId) external view returns (uint256);
|
|
25
32
|
|
|
26
|
-
|
|
33
|
+
/// @notice The grace period after attestation starts during which attestation is still allowed.
|
|
34
|
+
/// @param gameId The ID of the game.
|
|
35
|
+
/// @return The grace period in seconds.
|
|
36
|
+
function attestationGracePeriodOf(uint256 gameId) external view returns (uint256);
|
|
27
37
|
|
|
28
|
-
/// @notice The
|
|
29
|
-
/// @
|
|
30
|
-
|
|
38
|
+
/// @notice The timestamp when attestation begins for a game.
|
|
39
|
+
/// @param gameId The ID of the game.
|
|
40
|
+
/// @return The attestation start time.
|
|
41
|
+
function attestationStartTimeOf(uint256 gameId) external view returns (uint256);
|
|
31
42
|
|
|
32
43
|
/// @notice The Juicebox controller used to manage projects.
|
|
33
44
|
/// @return The controller contract.
|
|
34
|
-
function
|
|
45
|
+
function CONTROLLER() external view returns (IJBController);
|
|
35
46
|
|
|
36
47
|
/// @notice The scorecard proposal submitted by the default attestation delegate for a game.
|
|
37
48
|
/// @param gameId The ID of the game.
|
|
38
49
|
/// @return The scorecard ID.
|
|
39
50
|
function defaultAttestationDelegateProposalOf(uint256 gameId) external view returns (uint256);
|
|
40
51
|
|
|
41
|
-
/// @notice The ID of the ratified scorecard for a game.
|
|
42
|
-
/// @param gameId The ID of the game.
|
|
43
|
-
/// @return The ratified scorecard ID, or 0 if none.
|
|
44
|
-
function ratifiedScorecardIdOf(uint256 gameId) external view returns (uint256);
|
|
45
|
-
|
|
46
|
-
/// @notice Compute the scorecard ID for a given hook and tier weights.
|
|
47
|
-
/// @param gameHook The game hook address.
|
|
48
|
-
/// @param tierWeights The tier cash out weights.
|
|
49
|
-
/// @return The scorecard ID.
|
|
50
|
-
function scorecardIdOf(address gameHook, DefifaTierCashOutWeight[] calldata tierWeights) external returns (uint256);
|
|
51
|
-
|
|
52
|
-
/// @notice The state of a scorecard.
|
|
53
|
-
/// @param gameId The ID of the game.
|
|
54
|
-
/// @param scorecardId The ID of the scorecard.
|
|
55
|
-
/// @return The scorecard state.
|
|
56
|
-
function stateOf(uint256 gameId, uint256 scorecardId) external view returns (DefifaScorecardState);
|
|
57
|
-
|
|
58
52
|
/// @notice Get the attestation weight for an account at a specific timestamp.
|
|
59
53
|
/// @param gameId The ID of the game.
|
|
60
54
|
/// @param account The account to check.
|
|
@@ -69,12 +63,6 @@ interface IDefifaGovernor {
|
|
|
69
63
|
view
|
|
70
64
|
returns (uint256 attestationPower);
|
|
71
65
|
|
|
72
|
-
/// @notice The number of attestations for a scorecard.
|
|
73
|
-
/// @param gameId The ID of the game.
|
|
74
|
-
/// @param scorecardId The ID of the scorecard.
|
|
75
|
-
/// @return The attestation count.
|
|
76
|
-
function attestationCountOf(uint256 gameId, uint256 scorecardId) external view returns (uint256);
|
|
77
|
-
|
|
78
66
|
/// @notice Whether an account has attested to a specific scorecard.
|
|
79
67
|
/// @param gameId The ID of the game.
|
|
80
68
|
/// @param scorecardId The ID of the scorecard.
|
|
@@ -82,37 +70,31 @@ interface IDefifaGovernor {
|
|
|
82
70
|
/// @return True if the account has attested.
|
|
83
71
|
function hasAttestedTo(uint256 gameId, uint256 scorecardId, address account) external view returns (bool);
|
|
84
72
|
|
|
85
|
-
/// @notice The
|
|
86
|
-
/// @
|
|
87
|
-
|
|
88
|
-
function attestationStartTimeOf(uint256 gameId) external view returns (uint256);
|
|
89
|
-
|
|
90
|
-
/// @notice The grace period after attestation starts during which attestation is still allowed.
|
|
91
|
-
/// @param gameId The ID of the game.
|
|
92
|
-
/// @return The grace period in seconds.
|
|
93
|
-
function attestationGracePeriodOf(uint256 gameId) external view returns (uint256);
|
|
73
|
+
/// @notice The maximum tier ID that contributes attestation power.
|
|
74
|
+
/// @return The maximum attestation power tier.
|
|
75
|
+
function MAX_ATTESTATION_POWER_TIER() external view returns (uint256);
|
|
94
76
|
|
|
95
77
|
/// @notice The quorum required to ratify a scorecard.
|
|
96
78
|
/// @param gameId The ID of the game.
|
|
97
79
|
/// @return The quorum threshold.
|
|
98
80
|
function quorum(uint256 gameId) external view returns (uint256);
|
|
99
81
|
|
|
100
|
-
/// @notice
|
|
82
|
+
/// @notice The ID of the ratified scorecard for a game.
|
|
101
83
|
/// @param gameId The ID of the game.
|
|
102
|
-
/// @
|
|
103
|
-
|
|
104
|
-
function initializeGame(uint256 gameId, uint256 attestationStartTime, uint256 attestationGracePeriod) external;
|
|
84
|
+
/// @return The ratified scorecard ID, or 0 if none.
|
|
85
|
+
function ratifiedScorecardIdOf(uint256 gameId) external view returns (uint256);
|
|
105
86
|
|
|
106
|
-
/// @notice
|
|
107
|
-
/// @param
|
|
87
|
+
/// @notice Compute the scorecard ID for a given hook and tier weights.
|
|
88
|
+
/// @param gameHook The game hook address.
|
|
108
89
|
/// @param tierWeights The tier cash out weights.
|
|
109
90
|
/// @return The scorecard ID.
|
|
110
|
-
function
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
91
|
+
function scorecardIdOf(address gameHook, DefifaTierCashOutWeight[] calldata tierWeights) external returns (uint256);
|
|
92
|
+
|
|
93
|
+
/// @notice The state of a scorecard.
|
|
94
|
+
/// @param gameId The ID of the game.
|
|
95
|
+
/// @param scorecardId The ID of the scorecard.
|
|
96
|
+
/// @return The scorecard state.
|
|
97
|
+
function stateOf(uint256 gameId, uint256 scorecardId) external view returns (DefifaScorecardState);
|
|
116
98
|
|
|
117
99
|
/// @notice Attest to a submitted scorecard.
|
|
118
100
|
/// @param gameId The ID of the game.
|
|
@@ -120,6 +102,12 @@ interface IDefifaGovernor {
|
|
|
120
102
|
/// @return weight The attestation weight applied.
|
|
121
103
|
function attestToScorecardFrom(uint256 gameId, uint256 scorecardId) external returns (uint256 weight);
|
|
122
104
|
|
|
105
|
+
/// @notice Initialize a game's governance parameters.
|
|
106
|
+
/// @param gameId The ID of the game.
|
|
107
|
+
/// @param attestationStartTime The timestamp when attestation begins.
|
|
108
|
+
/// @param attestationGracePeriod The grace period duration in seconds.
|
|
109
|
+
function initializeGame(uint256 gameId, uint256 attestationStartTime, uint256 attestationGracePeriod) external;
|
|
110
|
+
|
|
123
111
|
/// @notice Ratify a scorecard that has reached quorum.
|
|
124
112
|
/// @param gameId The ID of the game.
|
|
125
113
|
/// @param tierWeights The tier cash out weights (must match the scorecard).
|
|
@@ -130,4 +118,15 @@ interface IDefifaGovernor {
|
|
|
130
118
|
)
|
|
131
119
|
external
|
|
132
120
|
returns (uint256);
|
|
121
|
+
|
|
122
|
+
/// @notice Submit a scorecard for attestation.
|
|
123
|
+
/// @param gameId The ID of the game.
|
|
124
|
+
/// @param tierWeights The tier cash out weights.
|
|
125
|
+
/// @return The scorecard ID.
|
|
126
|
+
function submitScorecardFor(
|
|
127
|
+
uint256 gameId,
|
|
128
|
+
DefifaTierCashOutWeight[] calldata tierWeights
|
|
129
|
+
)
|
|
130
|
+
external
|
|
131
|
+
returns (uint256);
|
|
133
132
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity 0.8.
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
3
|
|
|
4
|
-
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
5
|
-
import {IJBRulesets} from "@bananapus/core-v6/src/interfaces/IJBRulesets.sol";
|
|
6
4
|
import {IJB721Hook} from "@bananapus/721-hook-v6/src/interfaces/IJB721Hook.sol";
|
|
7
5
|
import {IJB721TiersHookStore} from "@bananapus/721-hook-v6/src/interfaces/IJB721TiersHookStore.sol";
|
|
8
6
|
import {IJB721TokenUriResolver} from "@bananapus/721-hook-v6/src/interfaces/IJB721TokenUriResolver.sol";
|
|
9
|
-
import {JB721TiersMintReservesConfig} from "@bananapus/721-hook-v6/src/structs/JB721TiersMintReservesConfig.sol";
|
|
10
7
|
import {JB721TierConfig} from "@bananapus/721-hook-v6/src/structs/JB721TierConfig.sol";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
8
|
+
import {JB721TiersMintReservesConfig} from "@bananapus/721-hook-v6/src/structs/JB721TiersMintReservesConfig.sol";
|
|
9
|
+
import {IJBRulesets} from "@bananapus/core-v6/src/interfaces/IJBRulesets.sol";
|
|
10
|
+
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
11
|
+
|
|
12
|
+
import {DefifaDelegation} from "../structs/DefifaDelegation.sol";
|
|
13
|
+
import {DefifaTierCashOutWeight} from "../structs/DefifaTierCashOutWeight.sol";
|
|
13
14
|
import {IDefifaGamePhaseReporter} from "./IDefifaGamePhaseReporter.sol";
|
|
14
15
|
import {IDefifaGamePotReporter} from "./IDefifaGamePotReporter.sol";
|
|
15
16
|
|
|
@@ -40,47 +41,52 @@ interface IDefifaHook is IJB721Hook {
|
|
|
40
41
|
|
|
41
42
|
event TierCashOutWeightsSet(DefifaTierCashOutWeight[] tierWeights, address caller);
|
|
42
43
|
|
|
43
|
-
/// @notice The total
|
|
44
|
-
/// @return The total
|
|
45
|
-
function
|
|
46
|
-
|
|
47
|
-
/// @notice The Defifa project token used for token allocations.
|
|
48
|
-
/// @return The Defifa ERC-20 token.
|
|
49
|
-
function defifaToken() external view returns (IERC20);
|
|
44
|
+
/// @notice The total amount redeemed from this game (refunds not counted).
|
|
45
|
+
/// @return The total redeemed amount.
|
|
46
|
+
function amountRedeemed() external view returns (uint256);
|
|
50
47
|
|
|
51
48
|
/// @notice The base protocol token used for token allocations.
|
|
52
49
|
/// @return The base protocol ERC-20 token.
|
|
53
|
-
function
|
|
50
|
+
function BASE_PROTOCOL_TOKEN() external view returns (IERC20);
|
|
51
|
+
|
|
52
|
+
/// @notice The base URI for token metadata.
|
|
53
|
+
/// @return The base URI string.
|
|
54
|
+
function baseURI() external view returns (string memory);
|
|
55
|
+
|
|
56
|
+
/// @notice Whether the cash out weights have been set by the game's governor.
|
|
57
|
+
/// @return True if cash out weights are set.
|
|
58
|
+
function cashOutWeightIsSet() external view returns (bool);
|
|
54
59
|
|
|
55
60
|
/// @notice The cash out weight of a specific token based on its tier's scorecard weight.
|
|
56
61
|
/// @param tokenId The token ID to look up.
|
|
57
62
|
/// @return The cash out weight.
|
|
58
63
|
function cashOutWeightOf(uint256 tokenId) external view returns (uint256);
|
|
59
64
|
|
|
60
|
-
/// @notice The cash out weights for all tiers (up to 128).
|
|
61
|
-
/// @return The array of tier cash out weights.
|
|
62
|
-
function tierCashOutWeights() external view returns (uint256[128] memory);
|
|
63
|
-
|
|
64
65
|
/// @notice The address of the code origin contract used as an implementation for clones.
|
|
65
66
|
/// @return The code origin address.
|
|
66
|
-
function
|
|
67
|
+
function CODE_ORIGIN() external view returns (address);
|
|
67
68
|
|
|
68
|
-
/// @notice
|
|
69
|
-
/// @return
|
|
70
|
-
function
|
|
69
|
+
/// @notice The contract-level metadata URI.
|
|
70
|
+
/// @return The contract URI string.
|
|
71
|
+
function contractURI() external view returns (string memory);
|
|
71
72
|
|
|
72
73
|
/// @notice The current supply of a specific tier.
|
|
73
74
|
/// @param tierId The ID of the tier.
|
|
74
75
|
/// @return The current supply.
|
|
75
76
|
function currentSupplyOfTier(uint256 tierId) external view returns (uint256);
|
|
76
77
|
|
|
77
|
-
/// @notice The
|
|
78
|
-
/// @return The
|
|
79
|
-
function
|
|
78
|
+
/// @notice The default attestation delegate for new token holders.
|
|
79
|
+
/// @return The default delegate address.
|
|
80
|
+
function defaultAttestationDelegate() external view returns (address);
|
|
80
81
|
|
|
81
|
-
/// @notice The
|
|
82
|
-
/// @return The
|
|
83
|
-
function
|
|
82
|
+
/// @notice The Defifa project token used for token allocations.
|
|
83
|
+
/// @return The Defifa ERC-20 token.
|
|
84
|
+
function DEFIFA_TOKEN() external view returns (IERC20);
|
|
85
|
+
|
|
86
|
+
/// @notice The first owner of a given token ID.
|
|
87
|
+
/// @param tokenId The token ID.
|
|
88
|
+
/// @return The address of the first owner.
|
|
89
|
+
function firstOwnerOf(uint256 tokenId) external view returns (address);
|
|
84
90
|
|
|
85
91
|
/// @notice The game phase reporter for this hook.
|
|
86
92
|
/// @return The game phase reporter contract.
|
|
@@ -90,57 +96,6 @@ interface IDefifaHook is IJB721Hook {
|
|
|
90
96
|
/// @return The game pot reporter contract.
|
|
91
97
|
function gamePotReporter() external view returns (IDefifaGamePotReporter);
|
|
92
98
|
|
|
93
|
-
/// @notice The total amount redeemed from this game (refunds not counted).
|
|
94
|
-
/// @return The total redeemed amount.
|
|
95
|
-
function amountRedeemed() external view returns (uint256);
|
|
96
|
-
|
|
97
|
-
/// @notice The token allocations (Defifa token amount, base protocol token amount).
|
|
98
|
-
/// @return The Defifa token allocation and the base protocol token allocation.
|
|
99
|
-
function tokenAllocations() external view returns (uint256, uint256);
|
|
100
|
-
|
|
101
|
-
/// @notice The name of a specific tier.
|
|
102
|
-
/// @param tierId The ID of the tier.
|
|
103
|
-
/// @return The tier name.
|
|
104
|
-
function tierNameOf(uint256 tierId) external view returns (string memory);
|
|
105
|
-
|
|
106
|
-
/// @notice The number of tokens redeemed from a specific tier.
|
|
107
|
-
/// @param tierId The tier ID.
|
|
108
|
-
/// @return The number of tokens redeemed.
|
|
109
|
-
function tokensRedeemedFrom(uint256 tierId) external view returns (uint256);
|
|
110
|
-
|
|
111
|
-
/// @notice The pricing currency used by this hook.
|
|
112
|
-
/// @return The currency identifier.
|
|
113
|
-
function pricingCurrency() external view returns (uint256);
|
|
114
|
-
|
|
115
|
-
/// @notice The first owner of a given token ID.
|
|
116
|
-
/// @param tokenId The token ID.
|
|
117
|
-
/// @return The address of the first owner.
|
|
118
|
-
function firstOwnerOf(uint256 tokenId) external view returns (address);
|
|
119
|
-
|
|
120
|
-
/// @notice The base URI for token metadata.
|
|
121
|
-
/// @return The base URI string.
|
|
122
|
-
function baseURI() external view returns (string memory);
|
|
123
|
-
|
|
124
|
-
/// @notice The contract-level metadata URI.
|
|
125
|
-
/// @return The contract URI string.
|
|
126
|
-
function contractURI() external view returns (string memory);
|
|
127
|
-
|
|
128
|
-
/// @notice The default attestation delegate for new token holders.
|
|
129
|
-
/// @return The default delegate address.
|
|
130
|
-
function defaultAttestationDelegate() external view returns (address);
|
|
131
|
-
|
|
132
|
-
/// @notice Get the delegate for a specific account and tier.
|
|
133
|
-
/// @param account The account to look up.
|
|
134
|
-
/// @param tier The tier ID.
|
|
135
|
-
/// @return The delegate address.
|
|
136
|
-
function getTierDelegateOf(address account, uint256 tier) external view returns (address);
|
|
137
|
-
|
|
138
|
-
/// @notice Get the attestation units for a specific account and tier.
|
|
139
|
-
/// @param account The account to look up.
|
|
140
|
-
/// @param tier The tier ID.
|
|
141
|
-
/// @return The number of attestation units.
|
|
142
|
-
function getTierAttestationUnitsOf(address account, uint256 tier) external view returns (uint256);
|
|
143
|
-
|
|
144
99
|
/// @notice Get the attestation units for a specific account and tier at a past timestamp.
|
|
145
100
|
/// @param account The account to look up.
|
|
146
101
|
/// @param tier The tier ID.
|
|
@@ -155,43 +110,67 @@ interface IDefifaHook is IJB721Hook {
|
|
|
155
110
|
view
|
|
156
111
|
returns (uint256);
|
|
157
112
|
|
|
158
|
-
/// @notice Get the total attestation units for a specific tier.
|
|
159
|
-
/// @param tier The tier ID.
|
|
160
|
-
/// @return The total attestation units.
|
|
161
|
-
function getTierTotalAttestationUnitsOf(uint256 tier) external view returns (uint256);
|
|
162
|
-
|
|
163
113
|
/// @notice Get the total attestation units for a tier at a past timestamp.
|
|
164
114
|
/// @param tier The tier ID.
|
|
165
115
|
/// @param timestamp The historical timestamp.
|
|
166
116
|
/// @return The total attestation units at that time.
|
|
167
117
|
function getPastTierTotalAttestationUnitsOf(uint256 tier, uint48 timestamp) external view returns (uint256);
|
|
168
118
|
|
|
119
|
+
/// @notice Get the attestation units for a specific account and tier.
|
|
120
|
+
/// @param account The account to look up.
|
|
121
|
+
/// @param tier The tier ID.
|
|
122
|
+
/// @return The number of attestation units.
|
|
123
|
+
function getTierAttestationUnitsOf(address account, uint256 tier) external view returns (uint256);
|
|
124
|
+
|
|
125
|
+
/// @notice Get the delegate for a specific account and tier.
|
|
126
|
+
/// @param account The account to look up.
|
|
127
|
+
/// @param tier The tier ID.
|
|
128
|
+
/// @return The delegate address.
|
|
129
|
+
function getTierDelegateOf(address account, uint256 tier) external view returns (address);
|
|
130
|
+
|
|
131
|
+
/// @notice Get the total attestation units for a specific tier.
|
|
132
|
+
/// @param tier The tier ID.
|
|
133
|
+
/// @return The total attestation units.
|
|
134
|
+
function getTierTotalAttestationUnitsOf(uint256 tier) external view returns (uint256);
|
|
135
|
+
|
|
136
|
+
/// @notice The pricing currency used by this hook.
|
|
137
|
+
/// @return The currency identifier.
|
|
138
|
+
function pricingCurrency() external view returns (uint256);
|
|
139
|
+
|
|
140
|
+
/// @notice The rulesets contract used by this hook.
|
|
141
|
+
/// @return The rulesets contract.
|
|
142
|
+
function rulesets() external view returns (IJBRulesets);
|
|
143
|
+
|
|
144
|
+
/// @notice The 721 tiers hook store used by this hook.
|
|
145
|
+
/// @return The store contract.
|
|
146
|
+
function store() external view returns (IJB721TiersHookStore);
|
|
147
|
+
|
|
148
|
+
/// @notice The cash out weights for all tiers (up to 128).
|
|
149
|
+
/// @return The array of tier cash out weights.
|
|
150
|
+
function tierCashOutWeights() external view returns (uint256[128] memory);
|
|
151
|
+
|
|
152
|
+
/// @notice The name of a specific tier.
|
|
153
|
+
/// @param tierId The ID of the tier.
|
|
154
|
+
/// @return The tier name.
|
|
155
|
+
function tierNameOf(uint256 tierId) external view returns (string memory);
|
|
156
|
+
|
|
157
|
+
/// @notice The token allocations (Defifa token amount, base protocol token amount).
|
|
158
|
+
/// @return The Defifa token allocation and the base protocol token allocation.
|
|
159
|
+
function tokenAllocations() external view returns (uint256, uint256);
|
|
160
|
+
|
|
169
161
|
/// @notice Get the claimable Defifa and base protocol tokens for a set of token IDs.
|
|
170
162
|
/// @param tokenIds The token IDs to check.
|
|
171
163
|
/// @return The claimable Defifa token amount and base protocol token amount.
|
|
172
164
|
function tokensClaimableFor(uint256[] memory tokenIds) external view returns (uint256, uint256);
|
|
173
165
|
|
|
174
|
-
/// @notice
|
|
175
|
-
/// @param delegatee The address to delegate to.
|
|
166
|
+
/// @notice The number of tokens redeemed from a specific tier.
|
|
176
167
|
/// @param tierId The tier ID.
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
/// @notice Set attestation delegates for multiple tiers at once.
|
|
180
|
-
/// @param delegations The delegation assignments.
|
|
181
|
-
function setTierDelegatesTo(DefifaDelegation[] memory delegations) external;
|
|
182
|
-
|
|
183
|
-
/// @notice Set the cash out weights for tiers. Only callable by the game's governor (owner).
|
|
184
|
-
/// @param tierWeights The tier cash out weights to set.
|
|
185
|
-
function setTierCashOutWeightsTo(DefifaTierCashOutWeight[] memory tierWeights) external;
|
|
186
|
-
|
|
187
|
-
/// @notice Mint reserved tokens for multiple tiers.
|
|
188
|
-
/// @param mintReservesForTiersData The configuration for which tiers to mint reserves for.
|
|
189
|
-
function mintReservesFor(JB721TiersMintReservesConfig[] memory mintReservesForTiersData) external;
|
|
168
|
+
/// @return The number of tokens redeemed.
|
|
169
|
+
function tokensRedeemedFrom(uint256 tierId) external view returns (uint256);
|
|
190
170
|
|
|
191
|
-
/// @notice
|
|
192
|
-
/// @
|
|
193
|
-
|
|
194
|
-
function mintReservesFor(uint256 tierId, uint256 count) external;
|
|
171
|
+
/// @notice The total cash out weight used to normalize tier cash out weights.
|
|
172
|
+
/// @return The total cash out weight.
|
|
173
|
+
function TOTAL_CASHOUT_WEIGHT() external view returns (uint256);
|
|
195
174
|
|
|
196
175
|
/// @notice Initialize the hook with game-specific configuration.
|
|
197
176
|
/// @param gameId The ID of the game.
|
|
@@ -225,4 +204,26 @@ interface IDefifaHook is IJB721Hook {
|
|
|
225
204
|
string[] memory tierNames
|
|
226
205
|
)
|
|
227
206
|
external;
|
|
207
|
+
|
|
208
|
+
/// @notice Mint reserved tokens for multiple tiers.
|
|
209
|
+
/// @param mintReservesForTiersData The configuration for which tiers to mint reserves for.
|
|
210
|
+
function mintReservesFor(JB721TiersMintReservesConfig[] memory mintReservesForTiersData) external;
|
|
211
|
+
|
|
212
|
+
/// @notice Mint reserved tokens for a specific tier.
|
|
213
|
+
/// @param tierId The tier ID to mint reserves for.
|
|
214
|
+
/// @param count The number of reserved tokens to mint.
|
|
215
|
+
function mintReservesFor(uint256 tierId, uint256 count) external;
|
|
216
|
+
|
|
217
|
+
/// @notice Set the cash out weights for tiers. Only callable by the game's governor (owner).
|
|
218
|
+
/// @param tierWeights The tier cash out weights to set.
|
|
219
|
+
function setTierCashOutWeightsTo(DefifaTierCashOutWeight[] memory tierWeights) external;
|
|
220
|
+
|
|
221
|
+
/// @notice Set the attestation delegate for a specific tier.
|
|
222
|
+
/// @param delegatee The address to delegate to.
|
|
223
|
+
/// @param tierId The tier ID.
|
|
224
|
+
function setTierDelegateTo(address delegatee, uint256 tierId) external;
|
|
225
|
+
|
|
226
|
+
/// @notice Set attestation delegates for multiple tiers at once.
|
|
227
|
+
/// @param delegations The delegation assignments.
|
|
228
|
+
function setTierDelegatesTo(DefifaDelegation[] memory delegations) external;
|
|
228
229
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity 0.8.
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
3
|
|
|
4
4
|
import {ITypeface} from "lib/typeface/contracts/interfaces/ITypeface.sol";
|
|
5
5
|
|
|
6
6
|
interface IDefifaTokenUriResolver {
|
|
7
|
-
function
|
|
7
|
+
function TYPEFACE() external view returns (ITypeface);
|
|
8
8
|
}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity 0.8.
|
|
2
|
+
pragma solidity ^0.8.17;
|
|
3
3
|
|
|
4
4
|
import {ITypeface, Font} from "lib/typeface/contracts/interfaces/ITypeface.sol";
|
|
5
5
|
|
|
6
6
|
/// @notice Summon fonts.
|
|
7
7
|
library DefifaFontImporter {
|
|
8
|
-
|
|
9
|
-
/// @
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
/// @notice Gets the Base64 encoded Capsules-500.otf typeface.
|
|
9
|
+
/// @param typeface The typeface contract to query.
|
|
10
|
+
/// @return The Base64 encoded font file.
|
|
11
|
+
function getSkinnyFontSource(ITypeface typeface) internal view returns (bytes memory) {
|
|
12
|
+
return typeface.sourceOf(Font({weight: 500, style: "normal"})); // Capsules font source
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
/// @
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
/// @notice Gets the Base64 encoded Capsules-700.otf typeface.
|
|
16
|
+
/// @param typeface The typeface contract to query.
|
|
17
|
+
/// @return The Base64 encoded font file.
|
|
18
|
+
function getBeefyFontSource(ITypeface typeface) internal view returns (bytes memory) {
|
|
19
|
+
return typeface.sourceOf(Font({weight: 700, style: "normal"})); // Capsules font source
|
|
18
20
|
}
|
|
19
21
|
}
|