@ballkidz/defifa 0.0.8 → 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/ARCHITECTURE.md +2 -0
- package/README.md +1 -1
- package/package.json +6 -6
- package/src/DefifaHook.sol +3 -2
- package/test/DefifaGovernor.t.sol +6 -8
- package/test/DefifaNoContest.t.sol +1 -3
- package/test/DefifaSecurity.t.sol +1 -3
- package/test/DefifaUSDC.t.sol +1 -2
- package/test/Fork.t.sol +1 -3
package/ARCHITECTURE.md
CHANGED
|
@@ -75,6 +75,8 @@ Attestor → DefifaGovernor.attestToScorecard(proposalId)
|
|
|
75
75
|
- `@bananapus/721-hook-v6` — NFT tier system
|
|
76
76
|
- `@bananapus/address-registry-v6` — Deterministic deploys
|
|
77
77
|
- `@bananapus/permission-ids-v6` — Permission constants
|
|
78
|
+
- `@croptop/core-v6` — Croptop integration
|
|
79
|
+
- `@rev-net/core-v6` — Revnet integration
|
|
78
80
|
- `@openzeppelin/contracts` — Checkpoints, Ownable, Clones
|
|
79
81
|
- `@prb/math` — mulDiv
|
|
80
82
|
- `scripty.sol` — On-chain scripting for SVG
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ballkidz/defifa",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.0.0"
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
"url": "https://github.com/BallKidz/defifa-collection-deployer"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@bananapus/721-hook-v6": "^0.0.
|
|
17
|
-
"@bananapus/address-registry-v6": "^0.0.
|
|
18
|
-
"@bananapus/core-v6": "^0.0.
|
|
16
|
+
"@bananapus/721-hook-v6": "^0.0.19",
|
|
17
|
+
"@bananapus/address-registry-v6": "^0.0.11",
|
|
18
|
+
"@bananapus/core-v6": "^0.0.24",
|
|
19
19
|
"@bananapus/permission-ids-v6": "^0.0.10",
|
|
20
|
-
"@croptop/core-v6": "^0.0.
|
|
20
|
+
"@croptop/core-v6": "^0.0.20",
|
|
21
21
|
"@openzeppelin/contracts": "^5.6.1",
|
|
22
22
|
"@prb/math": "^4.1.1",
|
|
23
|
-
"@rev-net/core-v6": "^0.0.
|
|
23
|
+
"@rev-net/core-v6": "^0.0.15",
|
|
24
24
|
"scripty.sol": "^2.1.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
package/src/DefifaHook.sol
CHANGED
|
@@ -284,8 +284,9 @@ contract DefifaHook is JB721Hook, Ownable, IDefifaHook {
|
|
|
284
284
|
|
|
285
285
|
// Use this contract as the only cash out hook.
|
|
286
286
|
hookSpecifications = new JBCashOutHookSpecification[](1);
|
|
287
|
-
hookSpecifications[0] =
|
|
288
|
-
|
|
287
|
+
hookSpecifications[0] = JBCashOutHookSpecification({
|
|
288
|
+
hook: this, noop: false, amount: 0, metadata: abi.encode(_cumulativeMintPrice)
|
|
289
|
+
});
|
|
289
290
|
|
|
290
291
|
// Compute the cash out count based on the game phase.
|
|
291
292
|
cashOutCount = DefifaHookLib.computeCashOutCount({
|
|
@@ -558,8 +558,7 @@ contract DefifaGovernorTest is JBTest, TestBaseWorkflow {
|
|
|
558
558
|
)
|
|
559
559
|
internal
|
|
560
560
|
{
|
|
561
|
-
uint256 _pot = jbMultiTerminal()
|
|
562
|
-
.currentSurplusOf(_projectId, jbMultiTerminal().accountingContextsOf(_projectId), 18, JBCurrencyIds.ETH);
|
|
561
|
+
uint256 _pot = jbMultiTerminal().currentSurplusOf(_projectId, new address[](0), 18, JBCurrencyIds.ETH);
|
|
563
562
|
// Assert that the deployer did *NOT* receive any fee tokens.
|
|
564
563
|
assertEq(IERC20(_protocolFeeProjectTokenAccount).balanceOf(address(deployer)), 0);
|
|
565
564
|
assertEq(IERC20(_defifaProjectTokenAccount).balanceOf(address(deployer)), 0);
|
|
@@ -569,8 +568,8 @@ contract DefifaGovernorTest is JBTest, TestBaseWorkflow {
|
|
|
569
568
|
_verifySingleCashOut(_projectId, _nft, scorecards[i], _users[i], _pot, _sumDistribution, distribution, i);
|
|
570
569
|
}
|
|
571
570
|
// All NFTs should have been redeemed, only some dust should be left
|
|
572
|
-
uint256 remainingSurplus =
|
|
573
|
-
.currentSurplusOf(_projectId,
|
|
571
|
+
uint256 remainingSurplus =
|
|
572
|
+
jbMultiTerminal().currentSurplusOf(_projectId, new address[](0), 18, JBCurrencyIds.ETH);
|
|
574
573
|
uint256 _expected = _pot * (_nft.TOTAL_CASHOUT_WEIGHT() - assignedCashOutWeight) / _nft.TOTAL_CASHOUT_WEIGHT();
|
|
575
574
|
assertApproxEqAbs(remainingSurplus, _expected, 10 ** 14);
|
|
576
575
|
|
|
@@ -884,8 +883,7 @@ contract DefifaGovernorTest is JBTest, TestBaseWorkflow {
|
|
|
884
883
|
_governor.ratifyScorecardFrom(_gameId, scorecards);
|
|
885
884
|
vm.warp(block.timestamp + 1);
|
|
886
885
|
|
|
887
|
-
uint256 _pot = jbMultiTerminal()
|
|
888
|
-
.currentSurplusOf(_projectId, jbMultiTerminal().accountingContextsOf(_projectId), 18, JBCurrencyIds.ETH);
|
|
886
|
+
uint256 _pot = jbMultiTerminal().currentSurplusOf(_projectId, new address[](0), 18, JBCurrencyIds.ETH);
|
|
889
887
|
|
|
890
888
|
// Verify that the cashOutWeights actually changed
|
|
891
889
|
for (uint256 i = 0; i < _users.length; i++) {
|
|
@@ -932,8 +930,8 @@ contract DefifaGovernorTest is JBTest, TestBaseWorkflow {
|
|
|
932
930
|
}
|
|
933
931
|
// All NFTs should have been redeemed, only some dust should be left
|
|
934
932
|
// Max allowed dust is 0.0001
|
|
935
|
-
uint256 remainingSurplus =
|
|
936
|
-
.currentSurplusOf(_projectId,
|
|
933
|
+
uint256 remainingSurplus =
|
|
934
|
+
jbMultiTerminal().currentSurplusOf(_projectId, new address[](0), 18, JBCurrencyIds.ETH);
|
|
937
935
|
assertApproxEqAbs(
|
|
938
936
|
remainingSurplus, _pot * (totalCashOutWeight - assignedCashOutWeight) / totalCashOutWeight, 10 ** 14
|
|
939
937
|
);
|
|
@@ -892,9 +892,7 @@ contract DefifaNoContestTest is JBTest, TestBaseWorkflow {
|
|
|
892
892
|
}
|
|
893
893
|
|
|
894
894
|
function _surplus() internal view returns (uint256) {
|
|
895
|
-
return
|
|
896
|
-
jbMultiTerminal()
|
|
897
|
-
.currentSurplusOf(_pid, jbMultiTerminal().accountingContextsOf(_pid), 18, JBCurrencyIds.ETH);
|
|
895
|
+
return jbMultiTerminal().currentSurplusOf(_pid, new address[](0), 18, JBCurrencyIds.ETH);
|
|
898
896
|
}
|
|
899
897
|
|
|
900
898
|
function _cashOut(address user, uint256 tid, uint256 tnum) internal {
|
|
@@ -678,9 +678,7 @@ contract DefifaSecurityTest is JBTest, TestBaseWorkflow {
|
|
|
678
678
|
}
|
|
679
679
|
|
|
680
680
|
function _surplus() internal view returns (uint256) {
|
|
681
|
-
return
|
|
682
|
-
jbMultiTerminal()
|
|
683
|
-
.currentSurplusOf(_pid, jbMultiTerminal().accountingContextsOf(_pid), 18, JBCurrencyIds.ETH);
|
|
681
|
+
return jbMultiTerminal().currentSurplusOf(_pid, new address[](0), 18, JBCurrencyIds.ETH);
|
|
684
682
|
}
|
|
685
683
|
|
|
686
684
|
function _cashOut(address user, uint256 tid, uint256 tnum) internal {
|
package/test/DefifaUSDC.t.sol
CHANGED
|
@@ -306,8 +306,7 @@ contract DefifaUSDCTest is JBTest, TestBaseWorkflow {
|
|
|
306
306
|
}
|
|
307
307
|
|
|
308
308
|
function _surplus() internal view returns (uint256) {
|
|
309
|
-
return jbMultiTerminal()
|
|
310
|
-
.currentSurplusOf(_pid, jbMultiTerminal().accountingContextsOf(_pid), 6, uint32(uint160(address(usdc))));
|
|
309
|
+
return jbMultiTerminal().currentSurplusOf(_pid, new address[](0), 6, uint32(uint160(address(usdc))));
|
|
311
310
|
}
|
|
312
311
|
|
|
313
312
|
function _generateTokenId(uint256 tierId, uint256 tokenNumber) internal pure returns (uint256) {
|
package/test/Fork.t.sol
CHANGED
|
@@ -2325,9 +2325,7 @@ contract DefifaForkTest is JBTest, TestBaseWorkflow {
|
|
|
2325
2325
|
}
|
|
2326
2326
|
|
|
2327
2327
|
function _surplus() internal view returns (uint256) {
|
|
2328
|
-
return
|
|
2329
|
-
jbMultiTerminal()
|
|
2330
|
-
.currentSurplusOf(_pid, jbMultiTerminal().accountingContextsOf(_pid), 18, JBCurrencyIds.ETH);
|
|
2328
|
+
return jbMultiTerminal().currentSurplusOf(_pid, new address[](0), 18, JBCurrencyIds.ETH);
|
|
2331
2329
|
}
|
|
2332
2330
|
|
|
2333
2331
|
function _balance() internal view returns (uint256) {
|