@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.
Files changed (46) hide show
  1. package/ADMINISTRATION.md +3 -3
  2. package/AUDIT_INSTRUCTIONS.md +422 -0
  3. package/CRYPTO_ECON.md +5 -5
  4. package/RISKS.md +38 -335
  5. package/SKILLS.md +1 -1
  6. package/USER_JOURNEYS.md +691 -0
  7. package/package.json +7 -7
  8. package/script/Deploy.s.sol +14 -3
  9. package/script/helpers/DefifaDeploymentLib.sol +13 -15
  10. package/src/DefifaDeployer.sol +221 -192
  11. package/src/DefifaGovernor.sol +286 -276
  12. package/src/DefifaHook.sol +65 -32
  13. package/src/DefifaProjectOwner.sol +27 -4
  14. package/src/DefifaTokenUriResolver.sol +136 -134
  15. package/src/enums/DefifaGamePhase.sol +1 -1
  16. package/src/enums/DefifaScorecardState.sol +1 -1
  17. package/src/interfaces/IDefifaDeployer.sol +52 -50
  18. package/src/interfaces/IDefifaGamePhaseReporter.sol +2 -2
  19. package/src/interfaces/IDefifaGamePotReporter.sol +1 -1
  20. package/src/interfaces/IDefifaGovernor.sol +53 -54
  21. package/src/interfaces/IDefifaHook.sol +104 -103
  22. package/src/interfaces/IDefifaTokenUriResolver.sol +2 -2
  23. package/src/libraries/DefifaFontImporter.sol +11 -9
  24. package/src/libraries/DefifaHookLib.sol +66 -53
  25. package/src/structs/DefifaAttestations.sol +1 -1
  26. package/src/structs/DefifaDelegation.sol +1 -1
  27. package/src/structs/DefifaLaunchProjectData.sol +4 -4
  28. package/src/structs/DefifaOpsData.sol +1 -1
  29. package/src/structs/DefifaScorecard.sol +1 -1
  30. package/src/structs/DefifaTierCashOutWeight.sol +1 -1
  31. package/src/structs/DefifaTierParams.sol +2 -1
  32. package/test/DefifaAdversarialQuorum.t.sol +602 -0
  33. package/test/DefifaAuditLowGuards.t.sol +304 -0
  34. package/test/DefifaFeeAccounting.t.sol +37 -16
  35. package/test/DefifaGovernor.t.sol +37 -11
  36. package/test/DefifaHookRegressions.t.sol +14 -12
  37. package/test/DefifaMintCostInvariant.t.sol +31 -12
  38. package/test/DefifaNoContest.t.sol +33 -13
  39. package/test/DefifaSecurity.t.sol +45 -25
  40. package/test/DefifaUSDC.t.sol +44 -34
  41. package/test/Fork.t.sol +42 -40
  42. package/test/SVG.t.sol +2 -2
  43. package/test/TestAuditGaps.sol +982 -0
  44. package/test/TestQALastMile.t.sol +511 -0
  45. package/test/regression/FulfillmentBlocksRatification.t.sol +36 -30
  46. 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.7",
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.16",
17
- "@bananapus/address-registry-v6": "^0.0.9",
18
- "@bananapus/core-v6": "^0.0.16",
19
- "@bananapus/permission-ids-v6": "^0.0.9",
20
- "@croptop/core-v6": "^0.0.15",
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.12",
23
+ "@rev-net/core-v6": "^0.0.13",
24
24
  "scripty.sol": "^2.1.1"
25
25
  },
26
26
  "devDependencies": {
@@ -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-v5";
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}({_controller: core.controller, _owner: safeAddress()});
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 vm = Vm(VM_ADDRESS);
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, network_name: networks[_i].name});
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 network_name
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, project_name: PROJECT_NAME, network_name: network_name, contractName: "DefifaHook"
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, project_name: PROJECT_NAME, network_name: network_name, contractName: "DefifaDeployer"
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, project_name: PROJECT_NAME, network_name: network_name, contractName: "DefifaGovernor"
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 project_name The name of the project.
84
- /// @param network_name The name of the network.
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 project_name,
90
- string memory network_name,
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
- vm.readFile(string.concat(path, project_name, "/", network_name, "/", contractName, ".json"));
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
  }