@ballkidz/defifa 0.0.7 → 0.0.8
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/AUDIT_INSTRUCTIONS.md +422 -0
- package/CRYPTO_ECON.md +5 -5
- 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 +65 -32
- 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 +37 -11
- package/test/DefifaHookRegressions.t.sol +14 -12
- package/test/DefifaMintCostInvariant.t.sol +31 -12
- package/test/DefifaNoContest.t.sol +33 -13
- package/test/DefifaSecurity.t.sol +45 -25
- package/test/DefifaUSDC.t.sol +44 -34
- package/test/Fork.t.sol +42 -40
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ballkidz/defifa",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
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.
|
|
19
|
-
"@bananapus/permission-ids-v6": "^0.0.
|
|
20
|
-
"@croptop/core-v6": "^0.0.
|
|
16
|
+
"@bananapus/721-hook-v6": "^0.0.17",
|
|
17
|
+
"@bananapus/address-registry-v6": "^0.0.10",
|
|
18
|
+
"@bananapus/core-v6": "^0.0.17",
|
|
19
|
+
"@bananapus/permission-ids-v6": "^0.0.10",
|
|
20
|
+
"@croptop/core-v6": "^0.0.18",
|
|
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.13",
|
|
24
24
|
"scripty.sol": "^2.1.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
package/script/Deploy.s.sol
CHANGED
|
@@ -7,7 +7,6 @@ import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
|
7
7
|
import {DefifaHook} from "../src/DefifaHook.sol";
|
|
8
8
|
import {DefifaDeployer} from "../src/DefifaDeployer.sol";
|
|
9
9
|
import {DefifaGovernor} from "../src/DefifaGovernor.sol";
|
|
10
|
-
import {DefifaProjectOwner} from "../src/DefifaProjectOwner.sol";
|
|
11
10
|
import {DefifaTokenUriResolver} from "../src/DefifaTokenUriResolver.sol";
|
|
12
11
|
import {Sphinx} from "@sphinx-labs/contracts/contracts/foundry/SphinxPlugin.sol";
|
|
13
12
|
|
|
@@ -35,7 +34,7 @@ contract DeployMainnet is Script, Sphinx {
|
|
|
35
34
|
IERC20 baseProtocolToken;
|
|
36
35
|
|
|
37
36
|
function configureSphinx() public override {
|
|
38
|
-
sphinxConfig.projectName = "defifa-
|
|
37
|
+
sphinxConfig.projectName = "defifa-v6";
|
|
39
38
|
sphinxConfig.mainnets = ["ethereum", "optimism", "base", "arbitrum"];
|
|
40
39
|
sphinxConfig.testnets = ["ethereum_sepolia", "optimism_sepolia", "base_sepolia", "arbitrum_sepolia"];
|
|
41
40
|
}
|
|
@@ -69,14 +68,26 @@ contract DeployMainnet is Script, Sphinx {
|
|
|
69
68
|
if (block.chainid == 11_155_111) {
|
|
70
69
|
_typeface = ITypeface(0x8C420d3388C882F40d263714d7A6e2c8DB93905F);
|
|
71
70
|
|
|
71
|
+
// Optimism.
|
|
72
|
+
} else if (block.chainid == 10) {
|
|
73
|
+
_typeface = ITypeface(0xe160e47928907894F97a0DC025c61D64E862fEAa);
|
|
74
|
+
|
|
72
75
|
// Optimism sepolia.
|
|
73
76
|
} else if (block.chainid == 11_155_420) {
|
|
74
77
|
_typeface = ITypeface(0xe160e47928907894F97a0DC025c61D64E862fEAa);
|
|
75
78
|
|
|
79
|
+
// Base.
|
|
80
|
+
} else if (block.chainid == 8453) {
|
|
81
|
+
_typeface = ITypeface(0x3DE45A14ea0fe24037D6363Ae71Ef18F336D1C27);
|
|
82
|
+
|
|
76
83
|
// Base sepolia.
|
|
77
84
|
} else if (block.chainid == 84_532) {
|
|
78
85
|
_typeface = ITypeface(0xEb269d9F0850CEf5e3aB0F9718fb79c466720784);
|
|
79
86
|
|
|
87
|
+
// Arbitrum.
|
|
88
|
+
} else if (block.chainid == 42_161) {
|
|
89
|
+
_typeface = ITypeface(0x431C35e9fA5152A906A38390910d0Cfcba0Fb43b);
|
|
90
|
+
|
|
80
91
|
// Arb sepolia.
|
|
81
92
|
} else if (block.chainid == 421_614) {
|
|
82
93
|
_typeface = ITypeface(0x431C35e9fA5152A906A38390910d0Cfcba0Fb43b);
|
|
@@ -95,7 +106,7 @@ contract DeployMainnet is Script, Sphinx {
|
|
|
95
106
|
_directory: core.directory, _defifaToken: defifaToken, _baseProtocolToken: baseProtocolToken
|
|
96
107
|
});
|
|
97
108
|
DefifaTokenUriResolver tokenUriResolver = new DefifaTokenUriResolver{salt: _salt}(_typeface);
|
|
98
|
-
DefifaGovernor governor = new DefifaGovernor{salt: _salt}({
|
|
109
|
+
DefifaGovernor governor = new DefifaGovernor{salt: _salt}({controller: core.controller, owner: safeAddress()});
|
|
99
110
|
DefifaDeployer deployer = new DefifaDeployer{salt: _salt}({
|
|
100
111
|
_hookCodeOrigin: address(hook),
|
|
101
112
|
_tokenUriResolver: tokenUriResolver,
|
|
@@ -21,7 +21,7 @@ struct DefifaDeployment {
|
|
|
21
21
|
library DefifaDeploymentLib {
|
|
22
22
|
// Cheat code address, 0x7109709ECfa91a80626fF3989D68f67F5b1DD12D.
|
|
23
23
|
address internal constant VM_ADDRESS = address(uint160(uint256(keccak256("hevm cheat code"))));
|
|
24
|
-
Vm internal constant
|
|
24
|
+
Vm internal constant VM = Vm(VM_ADDRESS);
|
|
25
25
|
string constant PROJECT_NAME = "defifa-v5";
|
|
26
26
|
|
|
27
27
|
function getDeployment(string memory path) internal returns (DefifaDeployment memory deployment) {
|
|
@@ -34,7 +34,7 @@ library DefifaDeploymentLib {
|
|
|
34
34
|
|
|
35
35
|
for (uint256 _i; _i < networks.length; _i++) {
|
|
36
36
|
if (networks[_i].chainId == chainId) {
|
|
37
|
-
return getDeployment({path: path,
|
|
37
|
+
return getDeployment({path: path, networkName: networks[_i].name});
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -43,7 +43,7 @@ library DefifaDeploymentLib {
|
|
|
43
43
|
|
|
44
44
|
function getDeployment(
|
|
45
45
|
string memory path,
|
|
46
|
-
string memory
|
|
46
|
+
string memory networkName
|
|
47
47
|
)
|
|
48
48
|
internal
|
|
49
49
|
view
|
|
@@ -51,28 +51,25 @@ library DefifaDeploymentLib {
|
|
|
51
51
|
{
|
|
52
52
|
deployment.hook = DefifaHook(
|
|
53
53
|
_getDeploymentAddress({
|
|
54
|
-
path: path,
|
|
54
|
+
path: path, projectName: PROJECT_NAME, networkName: networkName, contractName: "DefifaHook"
|
|
55
55
|
})
|
|
56
56
|
);
|
|
57
57
|
|
|
58
58
|
deployment.deployer = DefifaDeployer(
|
|
59
59
|
_getDeploymentAddress({
|
|
60
|
-
path: path,
|
|
60
|
+
path: path, projectName: PROJECT_NAME, networkName: networkName, contractName: "DefifaDeployer"
|
|
61
61
|
})
|
|
62
62
|
);
|
|
63
63
|
|
|
64
64
|
deployment.governor = DefifaGovernor(
|
|
65
65
|
_getDeploymentAddress({
|
|
66
|
-
path: path,
|
|
66
|
+
path: path, projectName: PROJECT_NAME, networkName: networkName, contractName: "DefifaGovernor"
|
|
67
67
|
})
|
|
68
68
|
);
|
|
69
69
|
|
|
70
70
|
deployment.tokenUriResolver = DefifaTokenUriResolver(
|
|
71
71
|
_getDeploymentAddress({
|
|
72
|
-
path: path,
|
|
73
|
-
project_name: PROJECT_NAME,
|
|
74
|
-
network_name: network_name,
|
|
75
|
-
contractName: "DefifaTokenUriResolver"
|
|
72
|
+
path: path, projectName: PROJECT_NAME, networkName: networkName, contractName: "DefifaTokenUriResolver"
|
|
76
73
|
})
|
|
77
74
|
);
|
|
78
75
|
}
|
|
@@ -80,14 +77,14 @@ library DefifaDeploymentLib {
|
|
|
80
77
|
/// @notice Get the address of a contract that was deployed by the Deploy script.
|
|
81
78
|
/// @dev Reverts if the contract was not found.
|
|
82
79
|
/// @param path The path to the deployment file.
|
|
83
|
-
/// @param
|
|
84
|
-
/// @param
|
|
80
|
+
/// @param projectName The name of the project.
|
|
81
|
+
/// @param networkName The name of the network.
|
|
85
82
|
/// @param contractName The name of the contract to get the address of.
|
|
86
83
|
/// @return The address of the contract.
|
|
87
84
|
function _getDeploymentAddress(
|
|
88
85
|
string memory path,
|
|
89
|
-
string memory
|
|
90
|
-
string memory
|
|
86
|
+
string memory projectName,
|
|
87
|
+
string memory networkName,
|
|
91
88
|
string memory contractName
|
|
92
89
|
)
|
|
93
90
|
internal
|
|
@@ -95,7 +92,8 @@ library DefifaDeploymentLib {
|
|
|
95
92
|
returns (address)
|
|
96
93
|
{
|
|
97
94
|
string memory deploymentJson =
|
|
98
|
-
|
|
95
|
+
// forge-lint: disable-next-line(unsafe-cheatcode)
|
|
96
|
+
VM.readFile(string.concat(path, projectName, "/", networkName, "/", contractName, ".json"));
|
|
99
97
|
return stdJson.readAddress({json: deploymentJson, key: ".address"});
|
|
100
98
|
}
|
|
101
99
|
}
|