@black-market/sdk 0.15.0 → 0.15.1

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 (93) hide show
  1. package/README.md +9 -8
  2. package/dist/lifecycle/auto-compound.d.ts +21 -0
  3. package/dist/lifecycle/auto-compound.d.ts.map +1 -0
  4. package/dist/lifecycle/auto-compound.js +34 -0
  5. package/dist/lifecycle/auto-compound.js.map +1 -0
  6. package/dist/lifecycle/calibration.d.ts +2 -4
  7. package/dist/lifecycle/calibration.d.ts.map +1 -1
  8. package/dist/lifecycle/calibration.js +1 -26
  9. package/dist/lifecycle/calibration.js.map +1 -1
  10. package/dist/lifecycle/deployments/auto-compound-dynamic-pool-v1-20261028.d.ts +73 -0
  11. package/dist/lifecycle/deployments/auto-compound-dynamic-pool-v1-20261028.d.ts.map +1 -0
  12. package/dist/lifecycle/deployments/auto-compound-dynamic-pool-v1-20261028.js +75 -0
  13. package/dist/lifecycle/deployments/auto-compound-dynamic-pool-v1-20261028.js.map +1 -0
  14. package/dist/lifecycle/deployments/auto-compound-static-pool-v1-20261028.d.ts +73 -0
  15. package/dist/lifecycle/deployments/auto-compound-static-pool-v1-20261028.d.ts.map +1 -0
  16. package/dist/lifecycle/deployments/auto-compound-static-pool-v1-20261028.js +75 -0
  17. package/dist/lifecycle/deployments/auto-compound-static-pool-v1-20261028.js.map +1 -0
  18. package/dist/lifecycle/gas-profile.d.ts +17 -13
  19. package/dist/lifecycle/gas-profile.d.ts.map +1 -1
  20. package/dist/lifecycle/gas-profile.js +125 -115
  21. package/dist/lifecycle/gas-profile.js.map +1 -1
  22. package/dist/lifecycle/index.d.ts +4 -4
  23. package/dist/lifecycle/index.d.ts.map +1 -1
  24. package/dist/lifecycle/index.js +4 -4
  25. package/dist/lifecycle/index.js.map +1 -1
  26. package/dist/lifecycle/markets.d.ts +2 -0
  27. package/dist/lifecycle/markets.d.ts.map +1 -1
  28. package/dist/lifecycle/markets.js +30 -3
  29. package/dist/lifecycle/markets.js.map +1 -1
  30. package/dist/lifecycle/opening-buys.js +1 -1
  31. package/dist/lifecycle/opening-buys.js.map +1 -1
  32. package/dist/lifecycle/planner.d.ts +6 -9
  33. package/dist/lifecycle/planner.d.ts.map +1 -1
  34. package/dist/lifecycle/planner.js +102 -207
  35. package/dist/lifecycle/planner.js.map +1 -1
  36. package/dist/lifecycle/presets.d.ts +7 -3
  37. package/dist/lifecycle/presets.d.ts.map +1 -1
  38. package/dist/lifecycle/presets.js +10 -1
  39. package/dist/lifecycle/presets.js.map +1 -1
  40. package/dist/lifecycle/rpc.d.ts +3 -13
  41. package/dist/lifecycle/rpc.d.ts.map +1 -1
  42. package/dist/lifecycle/rpc.js +11 -37
  43. package/dist/lifecycle/rpc.js.map +1 -1
  44. package/dist/lifecycle/snapshot.d.ts.map +1 -1
  45. package/dist/lifecycle/snapshot.js +1 -2
  46. package/dist/lifecycle/snapshot.js.map +1 -1
  47. package/dist/lifecycle/transactions.d.ts +10 -3
  48. package/dist/lifecycle/transactions.d.ts.map +1 -1
  49. package/dist/lifecycle/transactions.js +40 -10
  50. package/dist/lifecycle/transactions.js.map +1 -1
  51. package/dist/lifecycle/types.d.ts +32 -107
  52. package/dist/lifecycle/types.d.ts.map +1 -1
  53. package/dist/lifecycle/types.js +3 -3
  54. package/dist/lifecycle/types.js.map +1 -1
  55. package/dist/lifecycle/ufg.d.ts +1 -1
  56. package/dist/lifecycle/ufg.d.ts.map +1 -1
  57. package/dist/lifecycle/ufg.js +1 -1
  58. package/dist/lifecycle/ufg.js.map +1 -1
  59. package/docs/launch-lifecycle.md +43 -0
  60. package/docs/lifecycle-gas-profiles.md +1 -1
  61. package/docs/reference.md +56 -2
  62. package/examples/.env.example +0 -3
  63. package/examples/README.md +10 -10
  64. package/examples/launch-example-support.ts +4 -9
  65. package/examples/launch-example.ts +12 -28
  66. package/examples/launch-lifecycle-smoke.ts +10 -22
  67. package/examples/launch.ts +8 -11
  68. package/package.json +1 -1
  69. package/src/lifecycle/auto-compound.ts +38 -0
  70. package/src/lifecycle/calibration.ts +3 -23
  71. package/src/lifecycle/deployments/auto-compound-dynamic-pool-v1-20261028.ts +77 -0
  72. package/src/lifecycle/deployments/auto-compound-static-pool-v1-20261028.ts +77 -0
  73. package/src/lifecycle/gas-profile.ts +117 -106
  74. package/src/lifecycle/index.ts +4 -4
  75. package/src/lifecycle/markets.ts +25 -3
  76. package/src/lifecycle/opening-buys.ts +1 -1
  77. package/src/lifecycle/planner.ts +98 -190
  78. package/src/lifecycle/presets.ts +10 -1
  79. package/src/lifecycle/rpc.ts +10 -32
  80. package/src/lifecycle/snapshot.ts +1 -2
  81. package/src/lifecycle/transactions.ts +39 -9
  82. package/src/lifecycle/types.ts +38 -87
  83. package/src/lifecycle/ufg.ts +1 -1
  84. package/dist/lifecycle/fork.d.ts +0 -15
  85. package/dist/lifecycle/fork.d.ts.map +0 -1
  86. package/dist/lifecycle/fork.js +0 -36
  87. package/dist/lifecycle/fork.js.map +0 -1
  88. package/dist/lifecycle/simulation.d.ts +0 -17
  89. package/dist/lifecycle/simulation.d.ts.map +0 -1
  90. package/dist/lifecycle/simulation.js +0 -605
  91. package/dist/lifecycle/simulation.js.map +0 -1
  92. package/src/lifecycle/fork.ts +0 -36
  93. package/src/lifecycle/simulation.ts +0 -543
@@ -0,0 +1,77 @@
1
+ import type { Hex } from "viem";
2
+ import type { LaunchEnvelopeV2, AdapterRegistrationV1, ProfileRegistrationV1, ProfileTopologyV1 } from "../schema.js";
3
+
4
+ // Generated by scripts/generate-auto-compound-presets.mjs from admission and registry readback.
5
+ // Robinhood block 100486085, 0xa41849e3e83fb977ed2fbfc7ff71c639bdf1fc34489dc46878128c021fdb6c44; admission 0x4f5c6614a186c05645d94e1a660390e9536b3c1a5624fa1f0a97762e2e451601.
6
+ export const autoCompoundStaticEnvelope = Object.freeze({
7
+ artifactDigest: "0x2c7bd199217fedf96a5b83d3ae3d630589eee86756c3a33bcc9a8d5e35efdc52",
8
+ reviewManifestDigest: "0x1474f959f6068b1cfcb90aa8106612d62476a271eb04c25df8debd442d03a07b",
9
+ configBoundsDigest: "0x72e0b2d542556d472a47f9c38b2c91079c72793af847dee77933f0eca203129d",
10
+ termsDigest: "0x4188f7e1087ad7963ffc94062345b27a7f3e497cb67c3e163d0b36973db993da",
11
+ topology: 2,
12
+ configVersion: 6,
13
+ economicVersion: 3,
14
+ capabilities: 123n,
15
+ flags: 0n,
16
+ callbackFlags: 6908,
17
+ callbackMask: 16383,
18
+ protocolTreasury: "0x961981916AB6575C3af3eeCecbf6A3b7Fad7C9e1",
19
+ protocolFeeDenominator: 6,
20
+ beneficiary: "0x7cb44b8693b3C350A2BcD4b681aF85365aa27783",
21
+ maximumDeveloperFeeBps: 0,
22
+ bounds: Object.freeze({
23
+ minimumTickSpacing: 1,
24
+ maximumTickSpacing: 32767,
25
+ maximumPositions: 32,
26
+ maximumOracleCardinality: 4096,
27
+ feeModeFlags: 3,
28
+ }),
29
+ graph: Object.freeze({
30
+ manager: "0x8366a39CC670B4001A1121B8F6A443A643e40951",
31
+ hookRoot: "0x0000000000000000000000000000000000000000",
32
+ oracleFactory: "0xe7feF2BC860B25bbdEB6F6AB96d88bAAa77ddad7",
33
+ locker: "0x0EB419d291ABc5f643ACb5B6035236DF231e479D",
34
+ collectorFactory: "0x1D93705968DD03A27d86cb1590889882153ac0aF",
35
+ collectorDeployer: "0x1B256029541eE5beF2dB363211A7a05f9C36C18C",
36
+ hookDeployer: "0x78811B0b1Bb0F0f896e65C539c5bc62C4d33FbE2",
37
+ coreCodeHash: "0x9fb8f46c3b980b9db25dfdb487a69a308a86be145860269b4036a4e74480787b",
38
+ managerCodeHash: "0xbd3881180b547f5fe817545743cfb4343e96b1bc6640dcd70c106b0066e95626",
39
+ hookRuntimeCodeHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
40
+ oracleFactoryCodeHash: "0x974fb5c72d91ccb99f1eb4679a5d4432c82bbaa0906b1c2917ec4da3499b7b98",
41
+ lockerCodeHash: "0x5b11a5a42678c8da4c075ed9eb336113ac6d70e9adf43346bd586d6754dd0a63",
42
+ collectorFactoryCodeHash: "0xc1164680edec0a76d45b78d5d4e6ac11ccf1bb4e3e52999080beda989c987023",
43
+ collectorDeployerCodeHash: "0x5260583f372e6e60c6f2c9bab628f499c5d17551c714f85fc4555ba12cf11f5d",
44
+ hookDeployerCodeHash: "0xdd59bd8dae0acd396e0e276e50681278c5cb4f766d2e342fefaf001c75d4bbc5",
45
+ hookCreationCodeHash: "0x2c7bd199217fedf96a5b83d3ae3d630589eee86756c3a33bcc9a8d5e35efdc52",
46
+ codeChunk0: "0x0Ba427F55DcC0F2af6605c7095b8C2E6FE7C99bd",
47
+ codeChunk0Hash: "0x03b5f35b8e44b4f3fedd729a277e935de3b69edd4d23ad39726a0bab7aa1b39d",
48
+ codeChunk1: "0x86431579Fb52d1BE1f96Fb721daF853dB49cdAC2",
49
+ codeChunk1Hash: "0x2d752704dc0fdc33b6b820d4d8466615e8f1076363b700dc0b78f729bd2bc7b0",
50
+ sharedHookSalt: "0x0000000000000000000000000000000000000000000000000000000000000000",
51
+ }),
52
+ }) satisfies LaunchEnvelopeV2;
53
+ export const autoCompoundStaticAdapter = Object.freeze({
54
+ implementation: "0xAE70e5acB118eade1ddF97A86a8eF681d5b71686",
55
+ codeHash: "0xd67ee6b00dea01568d1da2dd805af85da34c92c0ba5bd1b2b2c2913fa8015f3b",
56
+ capabilities: 123n,
57
+ configVersion: 6,
58
+ enabled: true,
59
+ }) satisfies AdapterRegistrationV1;
60
+ export const autoCompoundStaticRegistration = Object.freeze({
61
+ adapterId: "0x47f9efabc7c0427db5166ecf11702e0e0d2ca307a475d015d400a1584e572bc5",
62
+ configSchema: "0x51c5ca14c40012f78425cd1afb1ea77980da3fed0490a00911a8a4ed34792045",
63
+ dependencyDigest: "0x0fe998eb31c2efc79c7e2f3d48ca1ff141a7b6fde408eb21b16639c359cf7d04",
64
+ venue: "0x8366a39CC670B4001A1121B8F6A443A643e40951",
65
+ factory: "0x0000000000000000000000000000000000000000",
66
+ hook: "0x0000000000000000000000000000000000000000",
67
+ capabilities: 123n,
68
+ enabled: true,
69
+ }) satisfies ProfileRegistrationV1;
70
+ export const autoCompoundStaticTopology = Object.freeze({
71
+ hookTopology: 2,
72
+ configVersion: 6,
73
+ hookDeployer: "0x78811B0b1Bb0F0f896e65C539c5bc62C4d33FbE2",
74
+ hookCreationCodeHash: "0x2c7bd199217fedf96a5b83d3ae3d630589eee86756c3a33bcc9a8d5e35efdc52",
75
+ }) satisfies ProfileTopologyV1;
76
+ // 28561 bytes; keccak256 0x2c7bd199217fedf96a5b83d3ae3d630589eee86756c3a33bcc9a8d5e35efdc52.
77
+ export const autoCompoundStaticCreationCode: Hex = "0x610240604052348015610010575f5ffd5b50604051616f91380380616f9183398101604081905261002f91610ddb565b80610039816105ad565b611afc613fff30161461005f57604051632a96f9e160e21b815260040160405180910390fd5b80516001600160a01b039081166080908152602080840151831660a0908152604080860151851660c0526060860151851660e0529285015184166101005284015190921661012052516100b491839101610f60565b60408051808303601f1901815291905280516020909101206101609081526102408201516101809081526101208301516001600160a01b039081166101a05261026084015163ffffffff166101c052908301519183015160189290921b66ffffffff0000001662ffffff909216919091176101e05260a082015160c08301519082169116105f81610149578260a0015161014f565b8260c001515b90505f82610161578360c00151610167565b8360a001515b6001600160a01b038084166102008190529082166102208190526040805160a081018252928352602083019190915260e087015162ffffff169082015261010086015160020b60608201523060808201529091505f6101c78260a0902090565b61014081905286517f3976becbb8e6ca85459092153a2186a0e92a4b441f5cb1fb7c8a782ec56ad97f8054600160281b600160c81b031916650100000000006001600160a01b039384160217905560a08801517f3976becbb8e6ca85459092153a2186a0e92a4b441f5cb1fb7c8a782ec56ad98080546001600160a01b031990811692841692909217905560c0890180517f3976becbb8e6ca85459092153a2186a0e92a4b441f5cb1fb7c8a782ec56ad981805484169185169190911790557f3976becbb8e6ca85459092153a2186a0e92a4b441f5cb1fb7c8a782ec56ad98284905585517f3976becbb8e6ca85459092153a2186a0e92a4b441f5cb1fb7c8a782ec56ad983805484169185169190911790556020808701517f3976becbb8e6ca85459092153a2186a0e92a4b441f5cb1fb7c8a782ec56ad98480546040808b01516060808d0151958a166001600160b81b031990941693909317600160a01b62ffffff928316021762ffffff60b81b1916600160b81b9190951602939093179091556080808a01517f3976becbb8e6ca85459092153a2186a0e92a4b441f5cb1fb7c8a782ec56ad9858054909716908816179095558151610120810183525f8152948d01518616928501929092529151909316908201526101a08901519293507f3976becbb8e6ca85459092153a2186a0e92a4b441f5cb1fb7c8a782ec56ad97b92909182019060ff1660018111156103e3576103e3611105565b60018111156103f4576103f4611105565b815261014089015162ffffff166020808301919091526101c08a015160ff166040808401919091526101e08b01516001600160a01b039081166060808601919091526102008d0151151560808601526102208d015160a09095019490945284515f80549183166001600160a01b031992831617815593860151600180549184169183169190911781559286015160028054919093169181168217835594860151939491926001600160a81b03199092161790600160a01b9084908111156104bd576104bd611105565b0217905550608082015160028201805460a085015160ff16600160c01b0260ff60c01b1962ffffff909416600160a81b029390931663ffffffff60a81b199091161791909117905560c082015160038201805460e08501511515600160a01b026001600160a81b03199091166001600160a01b0390931692909217919091179055610100909101516004909101556102208701515f90819061055e90610c5a565b601e909401805461ffff909516600160e01b0261ffff60e01b1962ffffff909316600160c81b029290921664ffffffffff60c81b19909516949094171790925550611176975050505050505050565b80516001600160a01b03163b15806105d1575060208101516001600160a01b03163b155b806105e8575060408101516001600160a01b03163b155b806105ff575060608101516001600160a01b03163b155b80610616575060808101516001600160a01b03163b155b8061062d575060c08101516001600160a01b03163b155b80610643575060a08101516001600160a01b0316155b8061066757508060c001516001600160a01b03168160a001516001600160a01b0316145b8061067e575060a08101516001600160a01b031630145b806106a2575080606001516001600160a01b031681602001516001600160a01b0316145b806106c55750805f01516001600160a01b031681602001516001600160a01b0316145b806106dc575060208101516001600160a01b031630145b806106f3575060608101516001600160a01b031630145b8061070a575060808101516001600160a01b031630145b8061072d5750805f01516001600160a01b031681608001516001600160a01b0316145b80610740575060e081015162ffffff1615155b806107565750600160020b81610100015160020b125b8061076d5750610100810151617fff60029190910b135b8061079357506401000276a36001600160a01b03168161012001516001600160a01b0316105b806107c9575073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b03168161012001516001600160a01b031610155b806107e55750620f424062ffffff1681610140015162ffffff16115b80610803575080610140015162ffffff1681610160015162ffffff16115b806108195750600160ff16816101a0015160ff16115b8061085057506101c081015160ff161580159061085057506004816101c0015160ff1610806108505750600a816101c0015160ff16115b8061087957506101c081015160ff161580159061087957506101e08101516001600160a01b0316155b8061089157506101e08101516001600160a01b031630145b806108b55750805f01516001600160a01b0316816101e001516001600160a01b0316145b806108da575080608001516001600160a01b0316816101e001516001600160a01b0316145b806108e85750610240810151155b806108fc575061026081015163ffffffff16155b806109125750602081610260015163ffffffff16115b156109305760405163c52a9bd360e01b815260040160405180910390fd5b5f816020015190505f8260800151905082606001516001600160a01b0316826001600160a01b031663f2f4eb266040518163ffffffff1660e01b8152600401602060405180830381865afa15801561098a573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109ae9190611119565b6001600160a01b0316141580610a385750825f01516001600160a01b0316826001600160a01b031663dc4c90d36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a08573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a2c9190611119565b6001600160a01b031614155b80610ab8575082604001516001600160a01b0316826001600160a01b031663c7f7fb906040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a88573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610aac9190611119565b6001600160a01b031614155b80610b38575082608001516001600160a01b0316826001600160a01b031663d7b96d4e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b08573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b2c9190611119565b6001600160a01b031614155b80610bb8575082602001516001600160a01b0316816001600160a01b03166316eebd1e6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b88573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bac9190611119565b6001600160a01b031614155b80610c375750825f01516001600160a01b0316816001600160a01b031663dc4c90d36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c07573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c2b9190611119565b6001600160a01b031614155b15610c555760405163c52a9bd360e01b815260040160405180910390fd5b505050565b5f5f60c0516001600160a01b031663deee4135846040518263ffffffff1660e01b8152600401610c8c91815260200190565b6040805180830381865afa158015610ca6573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cca919061113b565b909250905062ffffff82161580610ce85750620d89e862ffffff8316115b80610cf7575060028161ffff16105b80610d07575061100061ffff8216115b15610d255760405163c52a9bd360e01b815260040160405180910390fd5b915091565b60405161028081016001600160401b0381118282101715610d5957634e487b7160e01b5f52604160045260245ffd5b60405290565b6001600160a01b0381168114610d73575f5ffd5b50565b8051610d8181610d5f565b919050565b805162ffffff81168114610d81575f5ffd5b8051600281900b8114610d81575f5ffd5b805163ffffffff81168114610d81575f5ffd5b805160ff81168114610d81575f5ffd5b80518015158114610d81575f5ffd5b5f610280828403128015610ded575f5ffd5b50610df6610d2a565b610dff83610d76565b8152610e0d60208401610d76565b6020820152610e1e60408401610d76565b6040820152610e2f60608401610d76565b6060820152610e4060808401610d76565b6080820152610e5160a08401610d76565b60a0820152610e6260c08401610d76565b60c0820152610e7360e08401610d86565b60e0820152610e856101008401610d98565b610100820152610e986101208401610d76565b610120820152610eab6101408401610d86565b610140820152610ebe6101608401610d86565b610160820152610ed16101808401610da9565b610180820152610ee46101a08401610dbc565b6101a0820152610ef76101c08401610dbc565b6101c0820152610f0a6101e08401610d76565b6101e0820152610f1d6102008401610dcc565b61020082015261022083810151908201526102408084015190820152610f466102608401610da9565b6102608201529392505050565b6001600160a01b03169052565b5f61028082019050610f73828451610f53565b6020830151610f856020840182610f53565b506040830151610f986040840182610f53565b506060830151610fab6060840182610f53565b506080830151610fbe6080840182610f53565b5060a0830151610fd160a0840182610f53565b5060c0830151610fe460c0840182610f53565b5060e0830151610ffb60e084018262ffffff169052565b5061010083015161101261010084018260020b9052565b50610120830151611027610120840182610f53565b5061014083015161104061014084018262ffffff169052565b5061016083015161105961016084018262ffffff169052565b5061018083015161107361018084018263ffffffff169052565b506101a083015161108a6101a084018260ff169052565b506101c08301516110a16101c084018260ff169052565b506101e08301516110b66101e0840182610f53565b506102008301516110cc61020084018215159052565b506102208301516102208301526102408301516102408301526102608301516110fe61026084018263ffffffff169052565b5092915050565b634e487b7160e01b5f52602160045260245ffd5b5f60208284031215611129575f5ffd5b815161113481610d5f565b9392505050565b5f5f6040838503121561114c575f5ffd5b61115583610d86565b9150602083015161ffff8116811461116b575f5ffd5b809150509250929050565b60805160a05160c05160e05161010051610120516101405161016051610180516101a0516101c0516101e0516102005161022051615ba16113f05f395f8181612c7901528181612d5e01526132b201525f8181612c3701528181612d23015261327601525f81816105a2015281816106b9015261436601525f61067701525f81816105ee01526117be01525f61083701525f6104c801525f818161042d01528181610b2c01528181610fbd0152818161148f0152818161182e01528181611ba101528181611f08015281816127510152818161294501528181612b3a01528181612cf80152818161369e0152818161381f01528181613bf80152818161423a01526142c301525f81816109fa01526121ee01525f818161064801528181610f850152818161131f015281816114dc015281816129d801528181612a4301528181612aad01528181612da401528181612f46015281816131c2015281816136c40152818161376801526137fc01525f81816109a5015261323a01525f81816107aa015261156601525f818161039c01528181610aba01528181610ec30152818161178101526131fe01525f818161087a01528181610ce101528181610daf015281816111810152818161146e0152818161169a015281816118b801528181611adf01528181611dc6015281816123720152818161268e01528181612b5f01528181612bd401528181612cd701528181612fad0152818161318601528181613a2001528181613aaf01528181613b2c01528181614261015281816142fb01528181614635015281816146a801528181614737015281816147b401528181614ade01528181614b3101528181614b7c0152614be90152615ba15ff3fe608060405234801561000f575f5ffd5b50600436106102b2575f3560e01c80630268e293146102b65780630286c109146102cb5780630581555f146102eb5780630885f732146102f15780630cc97b021461031157806321d0ee7014610334578063251b25e614610354578063259982e5146103845780632b20e39714610397578063359b4f30146103cb5780633b5b6540146103ec5780633e451d6a1461040257806342ea83e01461041557806347f8496c1461042857806350fb3a3a1461044f5780635524d54814610462578063575e24b4146104855780635955d09a146104c35780635da3eaff146104ea57806360f89f2e14610515578063654f631c146105285780636bdbeb36146105595780636fe7e6eb1461057a578063747a68cd1461058d5780637dbeb94e146105a0578063847211a6146105d65780638bc801c1146105e957806391dd734614610610578063921b0bed146106305780639759164a146106435780639b19293e1461066a5780639e5fe06214610672578063a3f4bac7146106ae578063a8691114146106b7578063aae49d70146106e0578063ac4e4054146106ea578063ac5555aa146106f3578063b439824414610706578063b47b2fb114610726578063b6a8b0fa1461075c578063c5c51dca1461076f578063c5fbb29814610784578063c67046af14610797578063c7f7fb90146107a5578063ca266dfe146107cc578063ce1b8e4f14610832578063d186230c14610859578063d2be66251461086c578063dc4c90d314610875578063dd71cea81461089c578063e1b4af69146108e9578063e2e65ec1146108fc578063e4967b0b1461090f578063f11457c714610936578063f2f4eb26146109a0578063f399150c146109c7578063f69e2046146109da578063f9bc70e7146109e2578063fc0c546a146109f5578063fd5b6d5b14610a1c575b5f5ffd5b6102c96102c4366004614d36565b610a2f565b005b6102d3610b80565b60405161ffff90911681526020015b60405180910390f35b5f6102d3565b6103046102ff366004614d50565b610b96565b6040516102e29190614db1565b610319610cad565b604080519384526020840192909252908201526060016102e2565b610347610342366004614eb3565b610cd5565b6040516102e29190614f33565b61035c610d6a565b604080519586526020860194909452928401919091526060830152608082015260a0016102e2565b610347610392366004614eb3565b610da3565b6103be7f000000000000000000000000000000000000000000000000000000000000000081565b6040516102e29190614f48565b6103de6103d9366004614f5c565b610e40565b6040519081526020016102e2565b6103f4610e5d565b6040516102e2929190614f8a565b6103de610410366004614f98565b610e7d565b6102c9610423366004614fb3565b610e8e565b6103de7f000000000000000000000000000000000000000000000000000000000000000081565b6102c961045d366004615001565b611018565b610475610470366004614d50565b61115e565b60405190151581526020016102e2565b610498610493366004615034565b611173565b604080516001600160e01b03199094168452602084019290925262ffffff16908201526060016102e2565b6103de7f000000000000000000000000000000000000000000000000000000000000000081565b6104f2611404565b60408051600294850b81529290930b6020830152918101919091526060016102e2565b6102c961052336600461508d565b61145f565b61053b610536366004614d50565b611544565b6040805162ffffff909316835261ffff9091166020830152016102e2565b61056c6105673660046150d4565b61162e565b6040516102e292919061514c565b6103476105883660046151e9565b61168e565b6103de61059b366004614f98565b611885565b7f00000000000000000000000000000000000000000000000000000000000000005b60405162ffffff90911681526020016102e2565b6103de6105e4366004614d50565b611899565b6103be7f000000000000000000000000000000000000000000000000000000000000000081565b61062361061e366004615240565b6118ab565b6040516102e2919061527e565b61056c61063e3660046150d4565b6119d0565b6103be7f000000000000000000000000000000000000000000000000000000000000000081565b6103be611a85565b6106997f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff90911681526020016102e2565b6103be613fff81565b7f000000000000000000000000000000000000000000000000000000000000000060181c610699565b6105c2620f424081565b6103be611afc81565b610475610701366004614d50565b611a9d565b61070e611ab7565b6040516001600160801b0390911681526020016102e2565b6107396107343660046152b3565b611ad2565b604080516001600160e01b03199093168352600f9190910b6020830152016102e2565b61034761076a366004615333565b611dba565b610777611e9e565b6040516102e2919061538c565b6103de610792366004614d50565b611f49565b5f6040516102e291906153ce565b6103be7f000000000000000000000000000000000000000000000000000000000000000081565b6107df6107da366004614d50565b611f75565b6040516102e2919081516001600160a01b03908116825260208084015182169083015260408084015162ffffff169083015260608084015160020b90830152608092830151169181019190915260a00190565b6103de7f000000000000000000000000000000000000000000000000000000000000000081565b6102c96108673660046153e1565b61200e565b6102d361100081565b6103be7f000000000000000000000000000000000000000000000000000000000000000081565b6108af6108aa3660046153fc565b6122ff565b6040805163ffffffff909516855260069390930b60208501526001600160a01b0390911691830191909152151560608201526080016102e2565b6103476108f7366004615333565b612366565b6103de61090a366004614f5c565b612452565b610917612470565b604080518251815260209283015161ffff1692810192909252016102e2565b610949610944366004614d50565b6124b0565b6040805161ffff998a168152978916602089015295881695870195909552600293840b60608701526001600160401b039283166080870152911660a0850152900b60c083015290911660e0820152610100016102e2565b6103be7f000000000000000000000000000000000000000000000000000000000000000081565b6103f46109d5366004614d36565b612531565b6102c96127bb565b6105c26109f036600461541c565b612855565b6103be7f000000000000000000000000000000000000000000000000000000000000000081565b6103de610a2a366004614f5c565b6128c2565b3068929eee149b4bd212685403610a4d5763ab143c065f526004601cfd5b3068929eee149b4bd2126855600a5460ff1680610a9157506002610a6f6128e0565b60040154600160201b900460ff166003811115610a8e57610a8e614d74565b10155b15610aaf5760405163558a1e0360e11b815260040160405180910390fd5b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610af7576040516282b42960e81b815260040160405180910390fd5b610b0081612904565b60085415610b21576040516304c7cf6760e51b815260040160405180910390fd5b4260088190556040517f0000000000000000000000000000000000000000000000000000000000000000907ff1bac50d2c6f6c83cb8ff6fac488b03adc5fb0cc9fae30db2077588d5d9e5fbd905f90a33868929eee149b4bd212685550565b5f610b896128e0565b6004015461ffff16919050565b60408051610120810182525f80825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810191909152610be782612943565b60408051610120810182525f80546001600160a01b039081168352600180548216602085015260025491821694840194909452919290916060840191600160a01b90910460ff1690811115610c3e57610c3e614d74565b6001811115610c4f57610c4f614d74565b8152600282015462ffffff600160a81b820416602083015260ff600160c01b9091048116604083015260038301546001600160a01b0381166060840152600160a01b9004161515608082015260049091015460a09091015292915050565b5f5f5f5f610cb96128e0565b6013810154601482015460159092015490969195509350915050565b5f336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610d1e576040516282b42960e81b815260040160405180910390fd5b3068929eee149b4bd212685403610d3c5763ab143c065f526004601cfd5b610d4585612904565b610d4f8685612982565b610d5884612b00565b5063021d0ee760e41b95945050505050565b5f5f5f5f5f5f610d786128e0565b6019810154601a820154601b830154601c840154601d90940154929a91995097509195509350915050565b5f336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610dec576040516282b42960e81b815260040160405180910390fd5b3068929eee149b4bd212685403610e0a5763ab143c065f526004601cfd5b610e1385612904565b610e1d8685612982565b610e25612bfe565b610e2e84612b00565b5063259982e560e01b95945050505050565b5f610e4a83612943565b610e5382612c29565b5490505b92915050565b5f5f5f610e686128e0565b90508060160154816017015492509250509091565b5f610e8782612c29565b5492915050565b3068929eee149b4bd212685403610eac5763ab143c065f526004601cfd5b3068929eee149b4bd2126855336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610f00576040516282b42960e81b815260040160405180910390fd5b610f21610f1c610f153685900385018561548a565b60a0902090565b612943565b60075460ff1615610f4557604051630ea075bf60e21b815260040160405180910390fd5b610f4e81612cd1565b610f5b6020820182614f98565b5f80546001600160a01b0319166001600160a01b039283161790556007805460ff191660011790557f000000000000000000000000000000000000000000000000000000000000000016610fb26020830183614f98565b6001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000007ffafdbdd88ac30f0aa936e576be61816ea751908540523fa81b80c4a406ad7bec60405160405180910390a43868929eee149b4bd21268555050565b3068929eee149b4bd2126854036110365763ab143c065f526004601cfd5b600a5460ff168061106e5750600261104c6128e0565b60040154600160201b900460ff16600381111561106b5761106b614d74565b10155b1561108c5760405163558a1e0360e11b815260040160405180910390fd5b61109582612943565b5f61109e6128e0565b601e81015490915061ffff600160e01b909104811690831611156110cf57601e810154600160e01b900461ffff1691505b601e810154600160201b900461ffff165f6110ee601f8401838661346d565b601e8401805461ffff808416600160201b810261ffff60201b199093169290921790925591925083161461115757847f04f592d3848fffa22f73de92a2fd8da837e6d597f468af77c6fc619b478362ae838360405161114e92919061551f565b60405180910390a25b5050505050565b5f61116882612943565b505060075460ff1690565b5f8080336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146111be576040516282b42960e81b815260040160405180910390fd5b3068929eee149b4bd2126854036111dc5763ab143c065f526004601cfd5b600a5460ff1680611214575060026111f26128e0565b60040154600160201b900460ff16600381111561121157611211614d74565b10155b156112325760405163558a1e0360e11b815260040160405180910390fd5b61123b87612904565b611243612bfe565b5f61124c6128e0565b90505f6004820154600160201b900460ff16600381111561126f5761126f614d74565b14611290576040516001620787ab60e51b0319815260040160405180910390fd5b60048101805464ffffff000019811661ffff909116620100000217600160201b1790555f6112be8a89613500565b90505f6112cb8a8a61355a565b90505f62ffffff8316158015906112e857506112e8828c8c613598565b15611306576113036112fd8b60200135613617565b84613652565b90505b6040516364b3357d60e11b81525f906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c9666afa90611358908f908f908790600401615600565b602060405180830381865afa158015611373573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611397919061562b565b90506113d38c6113aa60208e018e615642565b6113b4575f6113b6565b825b6113c360208f018f615642565b6113cd5783613690565b5f613690565b81156113e3576113e3838361387d565b506315d7892d60e21b965060801b94505f9350505050955095509592505050565b5f5f5f5f6114106128e0565b60090154600160b81b900460020b905061142981613cb4565b61143282613cd5565b7fc7f8e8a3674727689aaf995179f25e33d31f0a09bac35877b0e81b130abd088a93509350935050909192565b61146883612904565b5f6114b37f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000613ced565b50505f54919250506001600160a01b0384811691161415806115075750816001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614155b8061151957506001600160a01b038116155b156115365760405162820f3560e61b815260040160405180910390fd5b61153e613d9f565b50505050565b60405163deee413560e01b8152600481018290525f9081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063deee4135906024016040805180830381865afa1580156115aa573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115ce919061565b565b909250905062ffffff821615806115ec5750620d89e862ffffff8316115b806115fb575060028161ffff16105b8061160b575061100061ffff8216115b156116295760405163c52a9bd360e01b815260040160405180910390fd5b915091565b606080333014611650576040516282b42960e81b815260040160405180910390fd5b5f611659613e5e565b604051633f03b12360e21b80825291925060031936016004808301375f5f3683865af43d5f833e80611689573d82fd5b503d81f35b5f336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146116d7576040516282b42960e81b815260040160405180910390fd5b3068929eee149b4bd2126854036116f55763ab143c065f526004601cfd5b600a5460ff168061172d5750600261170b6128e0565b60040154600160201b900460ff16600381111561172a5761172a614d74565b10155b1561174b5760405163558a1e0360e11b815260040160405180910390fd5b611760610f1c610f153687900387018761548a565b60075460ff1615806117795750600754610100900460ff165b806117b657507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316856001600160a01b031614155b806117f357507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031614155b156118105760405162820f3560e61b815260040160405180910390fd5b61181a825f613eb4565b6007805461ff0019166101001790556040517f0000000000000000000000000000000000000000000000000000000000000000907febcc9ffea17e08841d7588f2ecd87720e1cfb444bb3b5e662c4a5005c3c94ab2905f90a250636fe7e6eb60e01b5b949350505050565b5f61188f82612c29565b6003015492915050565b5f6118a382612943565b505060085490565b6060336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146118f5576040516282b42960e81b815260040160405180910390fd5b600954158061191d57506009548383604051611912929190615688565b604051809103902014155b1561193b5760405163f7a632f560e01b815260040160405180910390fd5b5f600981905561194d8385018561548a565b905061195d610f1c8260a0902090565b600754610100900460ff166119845760405162820f3560e61b815260040160405180910390fd5b5f611991825f0151613efb565b90505f6119a18360200151613efb565b905081816040516020016119b6929190614f8a565b604051602081830303815290604052935050505092915050565b6060806119dc85612943565b6119e46128e0565b601e015462010000900461ffff165f03611a11576040516329d9e10560e01b815260040160405180910390fd5b6040516335edf59b60e11b81523090636bdbeb3690611a3890889088908890600401615697565b5f60405180830381865afa158015611a52573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052611a799190810190615781565b91509150935093915050565b5f611a8e6128e0565b546001600160a01b0316919050565b5f611aa782612943565b5050600754610100900460ff1690565b5f611ac06128e0565b601801546001600160801b0316919050565b5f80336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611b1c576040516282b42960e81b815260040160405180910390fd5b3068929eee149b4bd212685403611b3a5763ab143c065f526004601cfd5b600a5460ff1680611b7257506002611b506128e0565b60040154600160201b900460ff166003811115611b6f57611b6f614d74565b10155b15611b905760405163558a1e0360e11b815260040160405180910390fd5b611b9987612904565b5f611bc760057f00000000000000000000000000000000000000000000000000000000000000008b8a613f93565b9050611bd4885f5f613690565b5f611bdf898961355a565b90505f611bef60208b018b614f98565b6001600160a01b0316826001600160a01b031614611c1957611c1460208b018b614f98565b611c29565b611c2960408b0160208c01614f98565b905062ffffff831615801590611c455750611c45828b8b613598565b15611cde575f611c61611c5b8b60200135613617565b85613652565b90508015611cdc575f611c7760208d018d614f98565b6001600160a01b0316846001600160a01b031614611c9e57611c998a600f0b90565b611ca8565b611ca88a60801d90565b9050611cb88260208d013561585f565b81600f0b14611cda5760405163161b48a960e21b815260040160405180910390fd5b505b505b5f62ffffff841615801590611cf95750611cf9828c8c613598565b15611d68575f611d0c60208d018d614f98565b6001600160a01b0316836001600160a01b031614611d3357611d2e8a600f0b90565b611d3d565b611d3d8a60801d90565b9050611d54611d4e82600f0b613617565b86613652565b91508115611d6657611d66838361387d565b505b611d70614001565b5f611d796128e0565b600401805460ff60201b1916600160201b836003811115611d9c57611d9c614d74565b021790555063b47b2fb160e01b9c909b509950505050505050505050565b5f336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611e03576040516282b42960e81b815260040160405180910390fd5b3068929eee149b4bd212685403611e215763ab143c065f526004601cfd5b600a5460ff1680611e5957506002611e376128e0565b60040154600160201b900460ff166003811115611e5657611e56614d74565b10155b15611e775760405163558a1e0360e11b815260040160405180910390fd5b611e8086612904565b611e8b868686613690565b50635b54587d60e11b9695505050505050565b60075460609060ff16611eb1575f611eb4565b60015b60ff166001600160401b03811115611ece57611ece615436565b604051908082528060200260200182016040528015611ef7578160200160208202803683370190505b5060075490915060ff1615611f46577f0000000000000000000000000000000000000000000000000000000000000000815f81518110611f3957611f39615886565b6020026020010181815250505b90565b5f611f5382612943565b611f5b6128e0565b601e0154600160881b90046001600160401b031692915050565b6040805160a0810182525f80825260208201819052918101829052606081018290526080810191909152611fa882612943565b611fb06128e0565b6040805160a08101825260088301546001600160a01b0390811682526009840154808216602084015262ffffff600160a01b82041693830193909352600160b81b90920460020b6060820152600a9092015416608082015292915050565b3068929eee149b4bd21268540361202c5763ab143c065f526004601cfd5b3068929eee149b4bd2126855600a5460ff16806120705750600261204e6128e0565b60040154600160201b900460ff16600381111561206d5761206d614d74565b10155b1561208e5760405163558a1e0360e11b815260040160405180910390fd5b5f6120976128e0565b60075490915060ff1615806120cb57505f6004820154600160201b900460ff1660038111156120c8576120c8614d74565b14155b156120e95760405163558a1e0360e11b815260040160405180910390fd5b6127108261ffff1611156121105760405163c52a9bd360e01b815260040160405180910390fd5b5f805460408051630d96a1bf60e21b815290516001600160a01b039092169163365a86fc916004808201926020929091908290030181865afa158015612158573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061217c919061589a565b9050806001600160a01b031663122a43a16040518163ffffffff1660e01b8152600401602060405180830381865afa1580156121ba573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121de919061589a565b6001600160a01b0316639c44d63b7f00000000000000000000000000000000000000000000000000000000000000006040518263ffffffff1660e01b81526004016122299190614f48565b602060405180830381865afa158015612244573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612268919061589a565b6001600160a01b0316336001600160a01b031614612298576040516282b42960e81b815260040160405180910390fd5b60048201805461ffff85811661ffff1983161790925560405191169033907fb684611c9f6689ae8240c74c5af96bf6c09896aaecc561466be02df4a330a530906122e5908490889061551f565b60405180910390a25050503868929eee149b4bd212685550565b5f5f5f5f61230c86612943565b5f6123156128e0565b601f018661ffff811061232a5761232a615886565b015463ffffffff811698600160201b820460060b9850600160581b82046001600160a01b03169750600160f81b90910460ff1695509350505050565b5f336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146123af576040516282b42960e81b815260040160405180910390fd5b3068929eee149b4bd2126854036123cd5763ab143c065f526004601cfd5b600a5460ff1680612405575060026123e36128e0565b60040154600160201b900460ff16600381111561240257612402614d74565b10155b156124235760405163558a1e0360e11b815260040160405180910390fd5b61242c86612904565b612437865f5f613690565b61243f6141b5565b5063e1b4af6960e01b9695505050505050565b5f61245c83612943565b61246582612c29565b600101549392505050565b604080518082019091525f808252602082015261248b6128e0565b604080518082019091526002820154815260039091015461ffff166020820152919050565b5f5f5f5f5f5f5f5f6124c189612943565b5f6124ca6128e0565b601e015461ffff8082169c62010000830482169c50600160201b830482169b50600160301b8304600290810b9b506001600160401b03600160481b850481169b50600160881b8504169950600160c81b8404900b9750600160e01b90920416945092505050565b5f5f3068929eee149b4bd2126854036125515763ab143c065f526004601cfd5b3068929eee149b4bd2126855600a5460ff1680612595575060026125736128e0565b60040154600160201b900460ff16600381111561259257612592614d74565b10155b156125b35760405163558a1e0360e11b815260040160405180910390fd5b6125bc83612904565b5f546001600160a01b031633146125e5576040516282b42960e81b815260040160405180910390fd5b5f6125ee6128e0565b90505f6004820154600160201b900460ff16600381111561261157612611614d74565b1461262f5760405163558a1e0360e11b815260040160405180910390fd5b600b8101541515806126445750600f81015415155b15612745575f8460405160200161265b91906158b5565b60408051601f1981840301815290829052805160208201206009556348c8949160e01b825291505f906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906348c89491906126c390859060040161527e565b5f604051808303815f875af11580156126de573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261270591908101906158c3565b600954909150156127295760405163f7a632f560e01b815260040160405180910390fd5b8080602001905181019061273d9190615955565b909550935050505b336001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000007f4a93be8d0a356d70b54fdf016f78a2ed8b8a3c420952848eb4f4b2c4546405b685856040516127a1929190614f8a565b60405180910390a3503868929eee149b4bd2126855915091565b5f6127c46128e0565b905033301415806127f5575060026004820154600160201b900460ff1660038111156127f2576127f2614d74565b14155b15612812576040516282b42960e81b815260040160405180910390fd5b60048101805460ff60201b1916600360201b1790555f612830613e5e565b604051631851865560e21b8082529192505f80600483865af461153e573d5f823e3d81fd5b5f3068929eee149b4bd2126854036128745763ab143c065f526004601cfd5b600754610100900460ff1661289b5760405162820f3560e61b815260040160405180910390fd5b6128a3613d9f565b5f6128ad836141eb565b5090506128b9816143ca565b9150505b919050565b5f6128cc83612943565b6128d582612c29565b600201549392505050565b7f3976becbb8e6ca85459092153a2186a0e92a4b441f5cb1fb7c8a782ec56ad97b90565b612919610f1c610f153684900384018461548a565b600754610100900460ff166129405760405162820f3560e61b815260040160405180910390fd5b50565b7f000000000000000000000000000000000000000000000000000000000000000081146129405760405162820f3560e61b815260040160405180910390fd5b600261298c6128e0565b60040154600160201b900460ff1660038111156129ab576129ab614d74565b106129c95760405163558a1e0360e11b815260040160405180910390fd5b600a5460ff168015612a1a57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b0316141580612a1a5750604081013515155b15612a385760405163558a1e0360e11b815260040160405180910390fd5b6008545f03612a97577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b031614612a9357604051637cd5a0ad60e01b815260040160405180910390fd5b5050565b600354600160a01b900460ff168015612ae257507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b031614155b15612a9357604051630af9fb3360e21b815260040160405180910390fd5b5f612b096128e0565b905060408201351580612b2f5750601e810154600160481b90046001600160401b031643145b15612b38575050565b7f00000000000000000000000000000000000000000000000000000000000000005f612b847f000000000000000000000000000000000000000000000000000000000000000083613ced565b50909250612b989150506020850185615977565b60020b8160020b1280612bc05750612bb66040850160208601615977565b60020b8160020b12155b15612bcb5750505050565b61153e81612bf97f000000000000000000000000000000000000000000000000000000000000000085614432565b613eb4565b600a54610100900460ff1615612c1057565b612c18613d9f565b600a805461ff001916610100179055565b5f5f612c336128e0565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031603612c7757600b0192915050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031603612cb957600f0192915050565b60405162820f3560e61b815260040160405180910390fd5b5f612d1c7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000613ced565b50505090507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163b5f1480612d8157506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000163b155b80612d9457506001600160a01b03811615155b80612de057506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016612dd46040840160208501614f98565b6001600160a01b031614155b80612e0e57506002546001600160a01b0316612e026060840160408501614f98565b6001600160a01b031614155b80612e565750600254600160a01b900460ff166001811115612e3257612e32614d74565b612e426080840160608501615990565b6001811115612e5357612e53614d74565b14155b80612e835750600254600160a81b900462ffffff16612e7b60a08401608085016159ae565b62ffffff1614155b80612eac5750600254600160c01b900460ff16612ea660c0840160a085016159c9565b60ff1614155b80612eda57506003546001600160a01b0316612ece60e0840160c08501614f98565b6001600160a01b031614155b80612f055750600354600160a01b900460ff161515612f00610100840160e08501615642565b151514155b80612f17575060045461010083013514155b80612f365750612f2a6020830183614f98565b6001600160a01b03163b155b80612f7e57506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016612f736020840184614f98565b6001600160a01b0316145b80612f9d575030612f926020840184614f98565b6001600160a01b0316145b80612fe557506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016612fda6020840184614f98565b6001600160a01b0316145b156130035760405163c52a9bd360e01b815260040160405180910390fd5b5f61300c6128e0565b90505f5f61301e856101000135611544565b601e8501549193509150600283810b600160c81b909204900b1415806130565750601e83015461ffff828116600160e01b9092041614155b156130745760405163c52a9bd360e01b815260040160405180910390fd5b5f6130826020870187614f98565b90505f816001600160a01b0316639b19293e6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156130c1573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906130e5919061589a565b90505f826001600160a01b031663192134426040518163ffffffff1660e01b8152600401602060405180830381865afa158015613124573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613148919061562b565b90506001600160a01b0382163b158061316b575080826001600160a01b03163f14155b8061317e57506001600160a01b03821630145b806131ba57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b0316145b806131f657507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b0316145b8061323257507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b0316145b8061326e57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b0316145b806132aa57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b0316145b806132e657507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b0316145b8061330e57506132f96020890189614f98565b6001600160a01b0316826001600160a01b0316145b1561332c5760405163c52a9bd360e01b815260040160405180910390fd5b5f836001600160a01b031663e4967b0b6040518163ffffffff1660e01b81526004016040805180830381865afa158015613368573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061338c91906159e9565b9050613397816144be565b6001600160a01b038316632714f4d8306133b460208d018d614f98565b6040518363ffffffff1660e01b81526004016133d1929190615a3e565b602060405180830381865afa1580156133ec573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613410919061589a565b5086546001600160a01b0319166001600160a01b03939093169290921786556001860155805160028601556020015160038501805461ffff1990811661ffff90931692831790915560049095018054909516179093555050505050565b5f8261ffff165f03613492576040516329d9e10560e01b815260040160405180910390fd5b8261ffff168261ffff16116134a85750816134f9565b825b8261ffff168161ffff1610156134f4576001858261ffff1661ffff81106134d3576134d3615886565b01805463ffffffff191663ffffffff929092169190911790556001016134aa565b508190505b9392505050565b5f5f5f61350c846141eb565b604082015191935091506135236005848888614515565b935061352d6128e0565b601e0154600160481b90046001600160401b03164314613551576135518282613eb4565b50505092915050565b5f6135686020830183615642565b15155f6020840135121461358b576135866040840160208501614f98565b6134f9565b6134f96020840184614f98565b5f806001600254600160a01b900460ff1660018111156135ba576135ba614d74565b146135f2576135cc6020840184615642565b6135e5576135e06040850160208601614f98565b6135ff565b6135e06020850185614f98565b6002546001600160a01b03165b6001600160a01b038681169116149150509392505050565b5f600160ff1b820361363c57604051637e2df70960e11b815260040160405180910390fd5b5f82126136495781610e57565b610e5782615a58565b5f613666838362ffffff16620f4240614593565b905060016001607f1b03811115610e5757604051637e2df70960e11b815260040160405180910390fd5b60405162e568cf60e71b81527f000000000000000000000000000000000000000000000000000000000000000060048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906372b4678090602401602060405180830381865afa158015613711573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613735919061562b565b5f0361374057505050565b600a805460ff191660011790556040516381f8a9d160e01b81525f9081906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906381f8a9d1906137a190889088908890600401615a72565b60408051808303815f875af11580156137bc573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906137e09190615955565b600a805460ff1916905560405191935091506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016907f0000000000000000000000000000000000000000000000000000000000000000907fa30ca6140dfb2cac1c1021c5303d8dc7de0cd4db47221fb3ad068fac7ef8185e9061386e9086908690614f8a565b60405180910390a35050505050565b3068929eee149b4bd21268540361389b5763ab143c065f526004601cfd5b3068929eee149b4bd2126855815f6138b16128e0565b90505f6138bd83612c29565b600254909150600160c01b900460ff165f81156138fd5760646138e360ff841688615aa5565b6138ee90607d615ac4565b6138f89190615aa5565b6138ff565b5f5b90505f61392661390f8389615adb565b600487015462010000900461ffff16612710614593565b90505f6139338289615adb565b90505f8560020154865f01546139499190615adb565b905061395c8160016001607f1b03615adb565b82111561396e5761396e8a8783614621565b81865f015f8282546139809190615aee565b9250508190555083866001015f82825461399a9190615aee565b9250508190555081866003015f8282546139b49190615aee565b909155505060068701546001600160a01b03908116908916036139ef5782876013015f8282546139e49190615aee565b90915550613a089050565b82876014015f828254613a029190615aee565b90915550505b604051627eeac760e11b81525f906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169062fdd58e90613a569030908d90600401615a3e565b602060405180830381865afa158015613a71573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613a95919061562b565b604051630ab714fb60e11b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063156e29f690613ae89030908d908f90600401615b01565b5f604051808303815f87803b158015613aff575f5ffd5b505af1158015613b11573d5f5f3e3d5ffd5b5050604051627eeac760e11b81525f92506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016915062fdd58e90613b639030908e90600401615a3e565b602060405180830381865afa158015613b7e573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613ba2919061562b565b905081811080613bbb57508a613bb88383615adb565b14155b80613bce5750613bcb898b6148a6565b81105b15613bec5760405163104eed1d60e31b815260040160405180910390fd5b896001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000007f2616e25de5abcc9e6a698b140fb6c92f55ace21b7a57f76172f195dbbf693af68d89604051613c48929190614f8a565b60405180910390a38415613c9a57896001600160a01b03167fe04ea7e7ad1b5991b027bff5aecce3a2120139e6b38c482f5a1b97cfdad3a90586604051613c9191815260200190565b60405180910390a25b505050505050505050503868929eee149b4bd21268555050565b5f81600281900b620d89e71981613ccd57613ccd615a91565b050292915050565b5f81600281900b620d89e881613ccd57613ccd615a91565b5f5f5f5f5f613cfb86614996565b604051631e2eaeaf60e01b8152600481018290529091505f906001600160a01b03891690631e2eaeaf90602401602060405180830381865afa158015613d43573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190613d67919061562b565b90506001600160a01b03811695508060a01c60020b945062ffffff8160b81c16935062ffffff8160d01c169250505092959194509250565b600a54610100900460ff1615613db157565b5f613dba6128e0565b80549091506001600160a01b03161580613de35750600181015481546001600160a01b03163f14155b15613e015760405163c52a9bd360e01b815260040160405180910390fd5b80545f546040516344dd3d9960e01b81526001600160a01b03928316926344dd3d9992613e3692309290911690600401615a3e565b5f6040518083038186803b158015613e4c575f5ffd5b505afa158015611157573d5f5f3e3d5ffd5b5f5f613e686128e0565b80546001600160a01b031692509050811580613e9257508060010154826001600160a01b03163f14155b15613eb05760405163c52a9bd360e01b815260040160405180910390fd5b5090565b5f613ebd613e5e565b60405163059f233d60e41b808252600286900b60048301526001600160801b03851660248301529192505f80604483865af4611157573d5f823e3d81fd5b5f8181613f0782612c29565b80549091505f819003613f1e57505f949350505050565b613f388583846002015484613f339190615adb565b614621565b6001820180545f808555918290556002840191909155613f588183615adb565b600354909550613f739085906001600160a01b0316836149d2565b5f54613f8a9085906001600160a01b0316876149d2565b50505050919050565b60018401545f9063ffffffff16801580613fb85750613fb3858585614a79565b865414155b15613fd9576040516001620787ab60e51b0319815260040160405180910390fd5b613fe4600182615b25565b5f87556001909601805463ffffffff191690555093949350505050565b5f61400a6128e0565b905080601301545f14801561402157506014810154155b801561402f57506015810154155b156140375750565b6008545f03614068575f516020615b815f395f51905f525f5b60405160ff909116815260200160405180910390a150565b60ff5f5c1615614087575f516020615b815f395f51905f526005614050565b614094619c406002615ac4565b5a10156140b45760405163460c751360e11b815260040160405180910390fd5b60048101805460ff60201b1916600160211b179055637b4f102360e11b5f619c405a6140e09190615adb565b90505f5f6040518481525f5f6004835f3089f1925060033d118315161561410b5760045f823e805191505b5060048501805460ff60201b1916600160201b1790558161115757614131600884615aa5565b61413d90619c40615aee565b5a101561417757622dc6c08310156141685760405163460c751360e11b815260040160405180910390fd5b60015f805c60ff19168217905d505b7f8367b40cbd89b8d6964eed84ae26ab78afff41d04572e37d5e6aaf7ad3a055eb816040516141a69190614f33565b60405180910390a15050505050565b5f6141be613e5e565b6040516001623fd76560e11b03198082529192505f80600483865af46141e6573d5f823e3d81fd5b505050565b61423760408051610120810182525f80825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e081018290529061010082015290565b5f7f00000000000000000000000000000000000000000000000000000000000000008180806142867f000000000000000000000000000000000000000000000000000000000000000085613ced565b509250925092508062ffffff165f146142b25760405163c52a9bd360e01b815260040160405180910390fd5b8194506040518061012001604052807f00000000000000000000000000000000000000000000000000000000000000008152602001846001600160a01b031681526020016143207f000000000000000000000000000000000000000000000000000000000000000087614432565b6001600160801b0316815260200188602001358152602001885f01602081019061434a9190615642565b15158152600254600160a81b810462ffffff90811660208401527f0000000000000000000000000000000000000000000000000000000000000000908116604084015260181c63ffffffff166060830152608090910190600160a01b900460ff1660018111156143bc576143bc614d74565b815250955050505050915091565b5f600160ff1b8260600151036143f357604051637e2df70960e11b815260040160405180910390fd5b5060a081015160c082015181908062ffffff168362ffffff16101561442b576040516302cce67760e31b815260040160405180910390fd5b5050919050565b5f5f61443d83614996565b90505f61444b600383615aee565b604051631e2eaeaf60e01b8152600481018290529091506001600160a01b03861690631e2eaeaf90602401602060405180830381865afa158015614491573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906144b5919061562b565b95945050505050565b80517f31fb6a2d116ef519550e8d3bce0e446b722f788b7f9cb5b5bdc78c8160fbda9c1415806144f75750612710816020015161ffff16115b1561294057604051634674941d60e11b815260040160405180910390fd5b60018401545f9063ffffffff1615614543576040516001620787ab60e51b0319815260040160405180910390fd5b835161454e856143ca565b915061455b818585614a79565b865561456d62ffffff83166001615b41565b600196909601805463ffffffff191663ffffffff90971696909617909555949350505050565b8282028183858304148515170261461a575f198385098181108201900382848609835f0384168285116145cd5763ae47f7025f526004601cfd5b93849004938382119092035f8390038390046001010292030417600260038302811880840282030280840282030280840282030280840282030280840282030280840290910302026134f9565b0492915050565b805f0361462d57505050565b8281614659827f0000000000000000000000000000000000000000000000000000000000000000614aae565b1015614678576040516365169c1d60e01b815260040160405180910390fd5b81836003015f82825461468b9190615adb565b9091555050604051627eeac760e11b81525f906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169062fdd58e906146de9030908690600401615a3e565b602060405180830381865afa1580156146f9573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061471d919061562b565b604051637a94c56560e11b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f5298aca9061477090309086908890600401615b01565b5f604051808303815f87803b158015614787575f5ffd5b505af1158015614799573d5f5f3e3d5ffd5b5050604051627eeac760e11b81525f92506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016915062fdd58e906147eb9030908790600401615a3e565b602060405180830381865afa158015614806573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061482a919061562b565b9050818111806148435750836148408284615adb565b14155b8061485e575061485b836148556128e0565b906148a6565b81105b1561487c5760405163104eed1d60e31b815260040160405180910390fd5b6148868685614ad8565b83856002015f8282546148999190615aee565b9091555050505050505050565b60068201545f9081906001600160a01b038481169116146148f157600684015460058501546001600160a01b039182169116106148e757601284015461491d565b600e84015461491d565b600584015460068501546001600160a01b0391821691161061491757601284015461491d565b600e8401545b60088501549091505f906001600160a01b03858116911614614943578460170154614949565b84601601545b60068601549091506001600160a01b0385811691161461497c57846015015485601401546149779190615aee565b614982565b84601301545b61498c8284615aee565b6144b59190615aee565b6040515f906149b5908390600690602001918252602082015260400190565b604051602081830303815290604052805190602001209050919050565b805f036149de57505050565b5f6149e98430614aae565b90505f6149f68585614aae565b9050614a03858585614c4e565b5f614a0e8630614aae565b90505f614a1b8787614aae565b905083821180614a34575084614a318386615adb565b14155b80614a3e57508281105b80614a52575084614a4f8483615adb565b14155b15614a7057604051631dc418c360e31b815260040160405180910390fd5b50505050505050565b5f838383604051602001614a8f93929190615b5d565b6040516020818303038152906040528051906020012090509392505050565b5f816014526370a0823160601b5f5260208060246010865afa601f3d111660205102905092915050565b5f614b027f0000000000000000000000000000000000000000000000000000000000000000614c98565b6001600160a01b031614614b29576040516365169c1d60e01b815260040160405180910390fd5b815f614b55827f0000000000000000000000000000000000000000000000000000000000000000614aae565b90505f614b628330614aae565b604051630b0d9c0960e01b81529091506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630b0d9c0990614bb590889030908990600401615b01565b5f604051808303815f87803b158015614bcc575f5ffd5b505af1158015614bde573d5f5f3e3d5ffd5b505050505f614c0d847f0000000000000000000000000000000000000000000000000000000000000000614aae565b90505f614c1a8530614aae565b905083821180614c33575085614c308386615adb565b14155b80614c3d57508281105b80614a52575085614a4f8483615adb565b816014528060345263a9059cbb60601b5f5260205f604460105f875af18060015f511416614c8e57803d853b151710614c8e576390b8ec185f526004601cfd5b505f603452505050565b60405163789add5560e11b81527f27e098c505d44ec3574004bca052aabf76bd35004c182099d8c575fb238593b960048201525f906001600160a01b0383169063f135baaa90602401602060405180830381865afa158015614cfc573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e57919061562b565b5f60a08284031215614d30575f5ffd5b50919050565b5f60a08284031215614d46575f5ffd5b6134f98383614d20565b5f60208284031215614d60575f5ffd5b5035919050565b6001600160a01b03169052565b634e487b7160e01b5f52602160045260245ffd5b6002811061294057634e487b7160e01b5f52602160045260245ffd5b614dad81614d88565b9052565b81516001600160a01b03908116825260208084015190911690820152604080830151610120830191614de590840182614d67565b506060830151614df86060840182614da4565b506080830151614e0f608084018262ffffff169052565b5060a0830151614e2460a084018260ff169052565b5060c0830151614e3760c0840182614d67565b5060e0830151614e4b60e084018215159052565b5061010092830151919092015290565b6001600160a01b0381168114612940575f5ffd5b5f5f83601f840112614e7f575f5ffd5b5081356001600160401b03811115614e95575f5ffd5b602083019150836020828501011115614eac575f5ffd5b9250929050565b5f5f5f5f5f858703610160811215614ec9575f5ffd5b8635614ed481614e5b565b9550614ee38860208901614d20565b9450608060bf1982011215614ef6575f5ffd5b5060c0860192506101408601356001600160401b03811115614f16575f5ffd5b614f2288828901614e6f565b969995985093965092949392505050565b6001600160e01b031991909116815260200190565b6001600160a01b0391909116815260200190565b5f5f60408385031215614f6d575f5ffd5b823591506020830135614f7f81614e5b565b809150509250929050565b918252602082015260400190565b5f60208284031215614fa8575f5ffd5b81356134f981614e5b565b5f5f8284036101c0811215614fc6575f5ffd5b614fd08585614d20565b9250610120609f1982011215614fe4575f5ffd5b5060a0830190509250929050565b61ffff81168114612940575f5ffd5b5f5f60408385031215615012575f5ffd5b823591506020830135614f7f81614ff2565b5f60608284031215614d30575f5ffd5b5f5f5f5f5f6101408688031215615049575f5ffd5b853561505481614e5b565b94506150638760208801614d20565b93506150728760c08801615024565b92506101208601356001600160401b03811115614f16575f5ffd5b5f5f5f60e0848603121561509f575f5ffd5b6150a98585614d20565b925060a08401356150b981614e5b565b915060c08401356150c981614e5b565b809150509250925092565b5f5f5f604084860312156150e6575f5ffd5b8335925060208401356001600160401b03811115615102575f5ffd5b8401601f81018613615112575f5ffd5b80356001600160401b03811115615127575f5ffd5b8660208260051b840101111561513b575f5ffd5b939660209190910195509293505050565b604080825283519082018190525f9060208501906060840190835b8181101561518857835160060b835260209384019390920191600101615167565b5050838103602080860191909152855180835291810192508501905f5b818110156151cc5782516001600160a01b03168452602093840193909201916001016151a5565b50919695505050505050565b8035600281900b81146128bd575f5ffd5b5f5f5f5f61010085870312156151fd575f5ffd5b843561520881614e5b565b93506152178660208701614d20565b925060c085013561522781614e5b565b915061523560e086016151d8565b905092959194509250565b5f5f60208385031215615251575f5ffd5b82356001600160401b03811115615266575f5ffd5b61527285828601614e6f565b90969095509350505050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b5f5f5f5f5f5f61016087890312156152c9575f5ffd5b86356152d481614e5b565b95506152e38860208901614d20565b94506152f28860c08901615024565b935061012087013592506101408701356001600160401b03811115615315575f5ffd5b61532189828a01614e6f565b979a9699509497509295939492505050565b5f5f5f5f5f5f6101208789031215615349575f5ffd5b863561535481614e5b565b95506153638860208901614d20565b945060c0870135935060e087013592506101008701356001600160401b03811115615315575f5ffd5b602080825282518282018190525f918401906040840190835b818110156153c35783518352602093840193909201916001016153a5565b509095945050505050565b602081016153db83614d88565b91905290565b5f602082840312156153f1575f5ffd5b81356134f981614ff2565b5f5f6040838503121561540d575f5ffd5b50508035926020909101359150565b5f6060828403121561542c575f5ffd5b6134f98383615024565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b038111828210171561547257615472615436565b604052919050565b62ffffff81168114612940575f5ffd5b5f60a082840312801561549b575f5ffd5b5060405160a081016001600160401b03811182821017156154be576154be615436565b60405282356154cc81614e5b565b815260208301356154dc81614e5b565b602082015260408301356154ef8161547a565b6040820152615500606084016151d8565b6060820152608083013561551381614e5b565b60808201529392505050565b61ffff92831681529116602082015260400190565b803561553f81614e5b565b6001600160a01b03168252602081013561555881614e5b565b6001600160a01b0316602083015260408101356155748161547a565b62ffffff16604083015261558a606082016151d8565b60020b606083015260808101356155a081614e5b565b6001600160a01b03166080929092019190915250565b803580151581146128bd575f5ffd5b6155ce816155b6565b151582526020818101359083015260408101356155ea81614e5b565b6001600160a01b03166040929092019190915250565b610120810161560f8286615534565b61561c60a08301856155c5565b82610100830152949350505050565b5f6020828403121561563b575f5ffd5b5051919050565b5f60208284031215615652575f5ffd5b6134f9826155b6565b5f5f6040838503121561566c575f5ffd5b82516156778161547a565b6020840151909250614f7f81614ff2565b818382375f9101908152919050565b83815260406020820181905281018290525f8360608301825b858110156156e157823563ffffffff81168082146156cc575f5ffd5b835250602092830192909101906001016156b0565b509695505050505050565b5f6001600160401b0382111561570457615704615436565b5060051b60200190565b5f82601f83011261571d575f5ffd5b815161573061572b826156ec565b61544a565b8082825260208201915060208360051b860101925085831115615751575f5ffd5b602085015b8381101561577757805161576981614e5b565b835260209283019201615756565b5095945050505050565b5f5f60408385031215615792575f5ffd5b82516001600160401b038111156157a7575f5ffd5b8301601f810185136157b7575f5ffd5b80516157c561572b826156ec565b8082825260208201915060208360051b8501019250878311156157e6575f5ffd5b6020840193505b828410156158165783518060060b8114615805575f5ffd5b8252602093840193909101906157ed565b6020870151909550925050506001600160401b03811115615835575f5ffd5b6158418582860161570e565b9150509250929050565b634e487b7160e01b5f52601160045260245ffd5b8082018281125f83128015821682158216171561587e5761587e61584b565b505092915050565b634e487b7160e01b5f52603260045260245ffd5b5f602082840312156158aa575f5ffd5b81516134f981614e5b565b60a08101610e578284615534565b5f602082840312156158d3575f5ffd5b81516001600160401b038111156158e8575f5ffd5b8201601f810184136158f8575f5ffd5b80516001600160401b0381111561591157615911615436565b615924601f8201601f191660200161544a565b818152856020838501011115615938575f5ffd5b8160208401602083015e5f91810160200191909152949350505050565b5f5f60408385031215615966575f5ffd5b505080516020909101519092909150565b5f60208284031215615987575f5ffd5b6134f9826151d8565b5f602082840312156159a0575f5ffd5b8135600281106134f9575f5ffd5b5f602082840312156159be575f5ffd5b81356134f98161547a565b5f602082840312156159d9575f5ffd5b813560ff811681146134f9575f5ffd5b5f60408284031280156159fa575f5ffd5b50604080519081016001600160401b0381118282101715615a1d57615a1d615436565b604052825181526020830151615a3281614ff2565b60208201529392505050565b6001600160a01b0392831681529116602082015260400190565b5f600160ff1b8201615a6c57615a6c61584b565b505f0390565b60e08101615a808286615534565b60a082019390935260c00152919050565b634e487b7160e01b5f52601260045260245ffd5b5f82615abf57634e487b7160e01b5f52601260045260245ffd5b500490565b8082028115828204841417610e5757610e5761584b565b81810381811115610e5757610e5761584b565b80820180821115610e5757610e5761584b565b6001600160a01b039384168152919092166020820152604081019190915260600190565b63ffffffff8281168282160390811115610e5757610e5761584b565b63ffffffff8181168382160190811115610e5757610e5761584b565b8381526001600160a01b038316602082015260a0810161187d60408301846155c556febbaa14b89d897968cceb6d38217c5b6714f6be272da6dd1d0b07aa443da1995f";
@@ -1,42 +1,26 @@
1
- import { toHex, zeroAddress, type Address } from "viem";
2
- import { AUCTION_QUOTE_OPTIONS } from "../auction.js";
3
- import { getTickAtSqrtRatio } from "../launch.js";
1
+ import { toHex, type Address } from "viem";
4
2
  import { decodeAbyssLifecycleMarketConfig, decodePoolBoundV4LifecycleMarketConfig } from "./markets.js";
5
3
  import { computeLifecycleOpeningBuys, hasProfiledOpeningMath } from "./opening-buys.js";
6
- import { getKnownLifecycleProfile, hmmV2ForwardingReserve } from "./presets.js";
7
- import { lifecyclePinnedRpc, lifecycleSessionRead, nitroPosterGasBound, readNitroPrices, registerLifecycleFinalCheck, resolveLifecycleLimits, rpcHex, rpcQuantity } from "./rpc.js";
4
+ import { hmmV2ForwardingReserve } from "./presets.js";
5
+ import { lifecyclePinnedRpc, lifecycleSourceClient, nitroPosterGasBound, readLifecycleGasPrice, readNitroPrices, registerLifecycleFinalCheck, resolveLifecycleLimits, rpcQuantity } from "./rpc.js";
8
6
  import { LifecycleFundingKind, LifecycleRewardMode, LifecycleTokenKind, type LaunchPlanV1 } from "./schema.js";
9
- import { buildLifecycleCommand } from "./transactions.js";
10
- import { UFG_LAUNCH_PROXY_ADDRESS, ufgPlanPrincipal, type UfgLaunchConfig } from "./ufg-config.js";
11
- import type { NextTransactionEnvelope } from "./simulation.js";
12
- import { LifecyclePlanningError, type LifecycleBlock, type LifecycleLaunchGasBounds, type LifecycleOpeningBuyQuote, type LifecycleSimulation, type LifecycleTransaction, type SimulateLaunchPlanOptions } from "./types.js";
7
+ import { isAutoCompoundProfile } from "./auto-compound.js";
8
+ import { buildLifecycleCommand, LIFECYCLE_CAPACITY_PADDING_BPS, preparationCalldataGas, preparationGasEstimate } from "./transactions.js";
9
+ import { UFG_LAUNCH_PROXY_ADDRESS, isUfgProfile, ufgPlanPrincipal, type UfgLaunchConfig } from "./ufg-config.js";
10
+ import { LifecyclePlanningError, type LifecycleBlock, type LifecycleLaunchGasBounds, type LifecycleLimitSource, type LifecycleOpeningBuyQuote, type LifecyclePlanningAssessment, type LifecycleRpcClient, type LifecycleTransaction, type PlannedLaunch } from "./types.js";
11
+ import { isHmmProfile } from "./hmm.js";
13
12
 
14
- export const LIFECYCLE_GAS_PROFILE_VERSION = "robinhood-4663-arbos61-v1";
15
-
16
- // Coverage, not token admission: unlisted currencies still use exact execution.
17
- const profiledQuotes = new Set<string>();
18
- for (const quote of AUCTION_QUOTE_OPTIONS) if (quote.address !== zeroAddress) profiledQuotes.add(quote.address.toLowerCase());
13
+ export const LIFECYCLE_GAS_PROFILE_VERSION = "robinhood-4663-capacity-v3";
14
+ export type NextTransactionEnvelope = Readonly<{ gas: bigint; gasPrice: bigint }>;
19
15
  const ceil = (value: bigint, divisor: bigint) => (value + divisor - 1n) / divisor;
20
16
  const approval = (transaction: LifecycleTransaction) => transaction.kind === "approve" || transaction.kind === "approve-reset";
21
- type MarketGas = { abyss: boolean; hmm: boolean; ufgHook: boolean; positions: number; spacing: number; openingTick: number; ticks: number[] };
22
-
23
- function covered(plan: LaunchPlanV1): boolean {
24
- return plan.chainId === 4663n && hasProfiledOpeningMath(plan) &&
25
- plan.markets.every((market) => profiledQuotes.has(market.quoteAsset.toLowerCase())) &&
26
- plan.funding.every((funding) => funding.kind !== LifecycleFundingKind.ERC20 || profiledQuotes.has(funding.inputAsset.toLowerCase()));
27
- }
17
+ type MarketGas = { abyss: boolean; hmm: boolean; ufgHook: boolean; positions: number };
28
18
 
29
19
  function marketGas(plan: LaunchPlanV1): MarketGas[] {
30
20
  return plan.markets.map((market) => {
31
- const preset = getKnownLifecycleProfile({ chainId: plan.chainId, orchestrator: plan.orchestrator, profileId: market.profileId })!;
32
21
  const abyss = market.configVersion === 1;
33
22
  const config = abyss ? decodeAbyssLifecycleMarketConfig(market.config) : decodePoolBoundV4LifecycleMarketConfig(market.config, 6);
34
- const price = "openingSqrtPriceX96" in config ? config.openingSqrtPriceX96 : config.sqrtPriceX96;
35
- const spacing = "tickSpacing" in config ? config.tickSpacing : config.fee === 100 ? 1 : config.fee === 500 ? 10 : config.fee === 3000 ? 60 : 200;
36
- const ticks = new Set<number>();
37
- for (const position of config.positions) { ticks.add(position.tickLower); ticks.add(position.tickUpper); }
38
- return { abyss, hmm: preset.key.includes("hmm"), ufgHook: preset.key.includes("ufg"), positions: config.positions.length,
39
- spacing, openingTick: getTickAtSqrtRatio(price), ticks: [...ticks] };
23
+ return { abyss, hmm: isHmmProfile(market.profileId), ufgHook: isUfgProfile(market.profileId), positions: config.positions.length };
40
24
  });
41
25
  }
42
26
 
@@ -55,121 +39,148 @@ function utf8Bytes(value: string): number {
55
39
  function tokenCreationGas(token: LaunchPlanV1["token"]): bigint {
56
40
  return (token.kind === LifecycleTokenKind.ERC404 ? 2_500_000n : 0n) +
57
41
  (token.rewardMode === LifecycleRewardMode.Staking ? 2_500_000n : token.rewardMode === LifecycleRewardMode.Dividends ? 500_000n : 0n) +
58
- 22_000n * BigInt(Math.ceil(utf8Bytes(token.name) / 32) + Math.ceil(utf8Bytes(token.symbol) / 32) + Math.ceil(utf8Bytes(token.metadataURI) / 32));
42
+ 25_000n * BigInt(Math.ceil(utf8Bytes(token.name) / 32) + Math.ceil(utf8Bytes(token.symbol) / 32) + Math.ceil(utf8Bytes(token.metadataURI) / 32));
59
43
  }
60
44
 
61
- /** Capacity classification only. No value returned here ever sets a transaction gas limit. */
45
+ // Max observed compute: native Abyss atomic21,584,262; V4 fixed20,833,003;
46
+ // HMM26,395,772; UFG27,941,420 (historical-receipts.json,195 transactions).
47
+ // fork-matrix.json: Abyss activation8 positions11.08M/32 positions39.72M;
48
+ // fork-v4-matrix.json: dynamic V4 eight positions5,906,285.
49
+ // Native mixed HMM8/Abyss8/HMM8 activation23,883,893 (0xf05e…fe98).
50
+ const activationCosts = {
51
+ call: 1_500_000n,
52
+ abyss: { market: 500_000n, position: 1_250_000n },
53
+ v4: { market: 250_000n, position: 500_000n },
54
+ hmm: 1_000_000n,
55
+ ufg: 250_000n,
56
+ // Fork Abyss32: 64 buys78.44M minimum versus one buy47.49M;
57
+ // max observed marginal is below0.5M/buy. ERC404 pairs add below0.1M/NFT.
58
+ buy: 500_000n,
59
+ nft: 100_000n,
60
+ } as const;
61
+
62
+ /** Measured-max template budgets, never gas-limit sizing or execution evidence. */
62
63
  function capacityBasis(plan: LaunchPlanV1, transaction: LifecycleTransaction, markets: readonly MarketGas[], quotes: readonly LifecycleOpeningBuyQuote[], ufgRoute: boolean): bigint {
63
64
  const atomic = transaction.kind === "atomic";
64
- let gas = atomic ? 19_500_000n + tokenCreationGas(plan.token) + (ufgRoute ? 6_500_000n : 0n) : 1_000_000n;
65
- for (const [index, market] of markets.entries()) {
66
- if (!atomic) gas += market.abyss ? 2_500_000n + 1_600_000n * BigInt(market.positions) : 2_000_000n + 600_000n * BigInt(market.positions);
67
- else gas += (index === 0 ? market.hmm ? 7_000_000n : market.ufgHook ? 1_000_000n : market.abyss ? 500_000n : 0n
68
- : market.hmm ? 15_000_000n : market.ufgHook ? 9_000_000n : 8_000_000n) +
65
+ let gas = atomic ? 22_000_000n + tokenCreationGas(plan.token) + (ufgRoute ? 6_500_000n : 0n)
66
+ : activationCosts.call + (ufgRoute ? activationCosts.ufg : 0n);
67
+ for (const market of markets) {
68
+ if (atomic) gas += (market.hmm ? 7_000_000n : market.ufgHook ? 1_000_000n : market.abyss ? 500_000n : 0n) +
69
69
  (market.abyss ? 1_500_000n : 600_000n) * BigInt(market.positions - 1);
70
- if (!atomic && market.hmm) gas += 6_000_000n;
71
- }
72
- const ticks = markets.map((market) => market.openingTick);
73
- for (const quote of quotes) {
74
- const market = markets[quote.marketIndex]!, before = ticks[quote.marketIndex]!, after = getTickAtSqrtRatio(quote.sqrtPriceAfterX96);
75
- const low = Math.min(before, after), high = Math.max(before, after);
76
- const words = Math.abs(Math.floor(after / (market.spacing * 256)) - Math.floor(before / (market.spacing * 256))) + 2;
77
- let crossings = 0;
78
- for (const tick of market.ticks) if (tick >= low && tick <= high) crossings += 1;
79
- gas += 300_000n + 8_000n * BigInt(words) + 80_000n * BigInt(crossings);
80
- if (plan.token.kind === LifecycleTokenKind.ERC404) gas += 70_000n * ceil(quote.tokenOut, plan.token.nftUnit);
81
- ticks[quote.marketIndex] = after;
70
+ else {
71
+ const cost = market.abyss ? activationCosts.abyss : activationCosts.v4;
72
+ gas += cost.market + cost.position * BigInt(market.positions) + (market.hmm ? activationCosts.hmm : market.ufgHook ? activationCosts.ufg : 0n);
73
+ }
82
74
  }
75
+ gas += activationCosts.buy * BigInt(quotes.length);
76
+ if (plan.token.kind === LifecycleTokenKind.ERC404) for (const quote of quotes) gas += activationCosts.nft * ceil(quote.tokenOut, plan.token.nftUnit);
83
77
  return gas + 24n * BigInt((transaction.data.length - 2) / 2) + 100_000n * BigInt(plan.feeAssets.length);
84
78
  }
85
79
 
86
80
  type CapacityOptions = { plan: LaunchPlanV1; predictedToken: Address; ufg?: { config: UfgLaunchConfig }; headroomBps?: number };
87
81
  export type ProfiledLaunchCapacity = {
88
82
  bounds: LifecycleLaunchGasBounds; initialBuys: readonly LifecycleOpeningBuyQuote[]; headroomBps: number;
89
- atomic: LifecycleTransaction; activation: LifecycleTransaction;
83
+ atomic?: LifecycleTransaction; activation: LifecycleTransaction;
90
84
  };
91
85
 
92
- /** Internal shared computation; callers reuse both compiled commands and ordered math. */
86
+ /** No quote-token allowlist: costs and exact curve math belong to the release template. */
93
87
  export function deriveLifecycleLaunchCapacity(options: CapacityOptions, openingBuys?: readonly LifecycleOpeningBuyQuote[]): ProfiledLaunchCapacity | undefined {
94
88
  const { plan, ufg } = options;
95
- if (!covered(plan) || plan.funding.some((funding) => funding.kind === LifecycleFundingKind.Swap) ||
96
- (plan.creator.toLowerCase() === UFG_LAUNCH_PROXY_ADDRESS.toLowerCase()) !== (ufg !== undefined)) return undefined;
89
+ if (!hasProfiledOpeningMath(plan) || (plan.creator.toLowerCase() === UFG_LAUNCH_PROXY_ADDRESS.toLowerCase()) !== (ufg !== undefined)) return undefined;
90
+ // Auto-compounding templates have no measured gas yet; never invent their budgets.
91
+ if (plan.markets.some((market) => isAutoCompoundProfile(market.profileId))) return undefined;
97
92
  const headroomBps = options.headroomBps ?? 1500;
98
- if (!Number.isSafeInteger(headroomBps) || headroomBps < 0 || headroomBps > 10000) throw new LifecyclePlanningError("INVALID_LIMITS", "Headroom must be between zero and10000 basis points");
93
+ if (!Number.isSafeInteger(headroomBps) || headroomBps < 0 || headroomBps > 10000) throw new LifecyclePlanningError("INVALID_LIMITS", "Headroom must be between zero and 10000 basis points");
99
94
  const initialBuys = openingBuys ?? computeLifecycleOpeningBuys(options);
100
95
  const route = ufg === undefined ? undefined : { account: ufgPlanPrincipal(plan), config: ufg.config };
101
- const atomic = buildLifecycleCommand(plan, { kind: "atomic" }, route), activation = buildLifecycleCommand(plan, { kind: "activate" }, route);
96
+ const atomic = plan.markets.length === 1 && !plan.funding.some((funding) => funding.kind === LifecycleFundingKind.Swap)
97
+ ? buildLifecycleCommand(plan, { kind: "atomic" }, route) : undefined;
98
+ const activation = buildLifecycleCommand(plan, { kind: "activate" }, route);
102
99
  const markets = marketGas(plan), reserve = hmmV2ForwardingReserve(plan);
103
100
  const bound = (transaction: LifecycleTransaction) => {
104
101
  const basis = capacityBasis(plan, transaction, markets, initialBuys, ufg !== undefined);
105
- const buffered = ceil(basis * BigInt(10000 + headroomBps), 10000n);
102
+ const buffered = ceil(basis * BigInt(10000 + Math.max(LIFECYCLE_CAPACITY_PADDING_BPS, headroomBps)), 10000n);
106
103
  return buffered > basis + reserve ? buffered : basis + reserve;
107
104
  };
108
- return { bounds: { atomicComputeGasUpperBound: bound(atomic), activationComputeGasUpperBound: bound(activation) }, initialBuys, headroomBps, atomic, activation };
105
+ return { bounds: { ...(atomic === undefined ? {} : { atomicComputeGasUpperBound: bound(atomic) }), activationComputeGasUpperBound: bound(activation) }, initialBuys, headroomBps, atomic, activation };
109
106
  }
110
107
 
111
- /** Pure, versioned conservative compute bounds for mode/builder capacity, excluding poster gas.
112
- * Undefined means unprofiled, not unavailable functionality. A large upper bound is uncertain. */
108
+ /** Pure release-template budgets with headroom, excluding poster allocation.
109
+ * Missing coverage refuses planning; there is no execution fallback. */
113
110
  export function computeLifecycleLaunchGasBounds(options: CapacityOptions): LifecycleLaunchGasBounds | undefined {
114
111
  return deriveLifecycleLaunchCapacity(options)?.bounds;
115
112
  }
116
113
 
117
- export type ProfiledLifecycleTransactions = { simulation: LifecycleSimulation; profileOnly: boolean };
114
+ export type LifecycleBudgetOptions = { client: LifecycleRpcClient; planned: PlannedLaunch; limits?: LifecycleLimitSource; signal?: AbortSignal };
118
115
 
119
- /** Native ceilings determine every launch envelope. Profiles decide capacity only;
120
- * conversions and uncertain activation shapes still require exact execution. */
121
- export async function profileLifecycleTransactions(options: SimulateLaunchPlanOptions, transactions: readonly LifecycleTransaction[], block: LifecycleBlock,
122
- reviewed?: NextTransactionEnvelope, openingBuys?: readonly LifecycleOpeningBuyQuote[], capacity?: ProfiledLaunchCapacity): Promise<ProfiledLifecycleTransactions | undefined> {
116
+ /** Checks pinned inputs and deterministic capacity only. Never executes launch calldata. */
117
+ export async function assessLifecycleTransactions(options: LifecycleBudgetOptions, transactions: readonly LifecycleTransaction[], block: LifecycleBlock,
118
+ reviewed?: NextTransactionEnvelope, openingBuys?: readonly LifecycleOpeningBuyQuote[], capacity?: ProfiledLaunchCapacity): Promise<LifecyclePlanningAssessment> {
123
119
  const { client, planned } = options, plan = planned.plan;
124
- const onlyApprovals = transactions.every(approval);
125
- if (planned.chainId !== 4663n || !onlyApprovals && !covered(plan)) return undefined;
126
120
  const context = { client, account: planned.account, orchestrator: plan.orchestrator, block, chainId: planned.chainId };
127
121
  const observed = await resolveLifecycleLimits(context, options.limits === undefined ? planned.limits : options.limits);
128
- if (!onlyApprovals && observed.limits.arbOSVersion !== 61n) return undefined;
129
- const [prices, balanceValue, accountCode] = await Promise.all([
130
- readNitroPrices(client, block),
122
+ const [recommendation, balanceValue, prices] = await Promise.all([
123
+ readLifecycleGasPrice(client, block, planned.chainId),
131
124
  lifecyclePinnedRpc(client, "eth_getBalance", [planned.account, toHex(block.number)], block),
132
- lifecycleSessionRead(client, `${planned.chainId}:account-code:${planned.account.toLowerCase()}`, () => lifecyclePinnedRpc(client, "eth_getCode", [planned.account, toHex(block.number)], block)),
125
+ observed.limits.protocol === "nitro" ? readNitroPrices(client, block) : undefined,
133
126
  ]);
134
- if (rpcHex(accountCode, "account code") !== "0x") return undefined;
135
127
  options.signal?.throwIfAborted(); observed.assertCurrent(); registerLifecycleFinalCheck(client, observed.assertCurrent);
136
- const { limits } = observed, baseFee = block.baseFeePerGas ?? 0n;
137
- const requiredGasPrice = prices[5] > baseFee ? prices[5] : baseFee;
138
- const gasPrice = reviewed?.gasPrice ?? (prices[5] > baseFee * 2n ? prices[5] : baseFee * 2n);
139
- if (reviewed !== undefined && !onlyApprovals && reviewed.gas !== limits.executionGasCeiling) throw new LifecyclePlanningError("STALE_REVIEWED_GAS", "Reviewed gas differs from the native transaction ceiling; review the launch again");
140
- const needsBuys = transactions.some((transaction) => transaction.kind === "atomic" || transaction.kind === "activate");
141
- const currentCapacity = needsBuys ? capacity?.headroomBps === limits.headroomBps ? capacity : deriveLifecycleLaunchCapacity({ plan, predictedToken: planned.predictedToken, ufg: planned.ufg, headroomBps: limits.headroomBps }, openingBuys) : undefined;
142
- if (needsBuys && currentCapacity === undefined) return undefined;
143
- const quotes = currentCapacity?.initialBuys ?? [], bounds = currentCapacity?.bounds;
144
- let profileOnly = !plan.funding.some((funding) => funding.kind === LifecycleFundingKind.Swap) ||
145
- !transactions.some((transaction) => transaction.kind === "begin" || transaction.kind === "atomic" || transaction.kind === "activate");
128
+ const { limits } = observed, baseFee = block.baseFeePerGas ?? 0n, gasLimit = limits.executionGasCeiling;
129
+ const requiredGasPrice = limits.protocol === "nitro" && recommendation > baseFee ? recommendation : baseFee;
130
+ const gasPrice = reviewed?.gasPrice ?? (recommendation > baseFee * 2n ? recommendation : baseFee * 2n);
131
+ if (reviewed !== undefined && reviewed.gas !== gasLimit) throw new LifecyclePlanningError("STALE_REVIEWED_GAS", "Reviewed gas differs from the native transaction ceiling. Refresh the review before continuing.");
132
+ const cancelOnly = transactions.every((transaction) => transaction.kind === "cancel");
133
+ const currentCapacity = cancelOnly ? undefined : capacity?.headroomBps === limits.headroomBps ? capacity
134
+ : deriveLifecycleLaunchCapacity({ plan, predictedToken: planned.predictedToken, ufg: planned.ufg, headroomBps: limits.headroomBps }, openingBuys);
135
+ const immediate = transactions[0], launch = transactions.find((transaction) => !approval(transaction));
136
+ const poster = (transaction: LifecycleTransaction) => prices === undefined ? 0n : nitroPosterGasBound(transaction, prices).posterGas;
137
+ const assessment: LifecyclePlanningAssessment = { ready: true, blockNumber: block.number, blockHash: block.hash,
138
+ account: planned.account, chainId: planned.chainId, limits,
139
+ ...(currentCapacity === undefined ? {} : { gasProfile: { version: LIFECYCLE_GAS_PROFILE_VERSION, bounds: currentCapacity.bounds, initialBuys: currentCapacity.initialBuys } }) };
140
+ const refuse = (code: string, reason: string, failureCategory: LifecyclePlanningAssessment["failureCategory"], capacityConstraint?: LifecyclePlanningAssessment["capacityConstraint"], failedTransactionId?: string): LifecyclePlanningAssessment =>
141
+ ({ ...assessment, ready: false, code, reason, failureCategory, capacityConstraint, failedTransactionId });
142
+ if (!cancelOnly && currentCapacity === undefined) return refuse("UNKNOWN_GAS_PROFILE", "Gas budgets are unavailable for this launch profile. Use a supported profile or update the SDK.", "capacity");
143
+ if (!cancelOnly && currentCapacity!.bounds.activationComputeGasUpperBound + poster(currentCapacity!.activation) > gasLimit) {
144
+ return refuse("ACTIVATION_GAS_LIMIT", "Too many positions or pools for one activation. Reduce them to fit the native transaction ceiling.", "capacity", "activation", "activate");
145
+ }
146
146
  for (const transaction of transactions) {
147
- if (transaction.kind !== "atomic" && transaction.kind !== "activate") continue;
148
- const compute = transaction.kind === "atomic" ? bounds!.atomicComputeGasUpperBound : bounds!.activationComputeGasUpperBound;
149
- if (compute + nitroPosterGasBound(transaction, prices).posterGas > limits.executionGasCeiling) profileOnly = false;
147
+ if (transaction.kind === "atomic" && (currentCapacity?.bounds.atomicComputeGasUpperBound === undefined || currentCapacity.bounds.atomicComputeGasUpperBound + poster(transaction) > gasLimit))
148
+ return refuse("STAGED_EXECUTION_REQUIRED", "This launch requires staged execution. Refresh the review before continuing.", "capacity", "gas-envelope", transaction.id);
149
+ if (transaction.kind === "prepare" && ceil((preparationGasEstimate(plan, transaction.marketStart!, transaction.marketCount!) + preparationCalldataGas(transaction.data)) * BigInt(10000 + Math.max(LIFECYCLE_CAPACITY_PADDING_BPS, limits.headroomBps)), 10000n) + poster(transaction) > gasLimit)
150
+ return refuse("PREPARATION_GAS_LIMIT", "This preparation batch exceeds the gas budget. Refresh the review to split it.", "capacity", "preparation", transaction.id);
151
+ if (limits.maxCalldataBytes !== undefined && (transaction.data.length - 2) / 2 > limits.maxCalldataBytes)
152
+ return refuse("CALLDATA_LIMIT", "The launch exceeds the transaction data limit. Reduce its positions or pools.", "capacity", "calldata", transaction.id);
150
153
  }
151
- const launch = transactions.find((transaction) => !approval(transaction));
152
- const immediate = transactions[0], gasLimit = limits.executionGasCeiling;
153
- const envelopeFailure = launch !== undefined && limits.transactionGasCeiling !== undefined && gasLimit > limits.transactionGasCeiling;
154
- const calldataFailure = transactions.find((transaction) => limits.maxCalldataBytes !== undefined && (transaction.data.length - 2) / 2 > limits.maxCalldataBytes);
155
- const feeFailure = reviewed !== undefined && gasPrice < requiredGasPrice;
156
- const affordabilityFailure = launch !== undefined && launch.value + gasLimit * gasPrice > rpcQuantity(balanceValue, "creator native balance");
157
- const semanticFailure = quotes.find((quote) => quote.tokenOut < plan.buys[quote.buyIndex]!.minTokenOut);
158
- const expired = block.timestamp > plan.deadline && transactions.some((transaction) => transaction.kind !== "cancel");
159
- const refused = envelopeFailure || calldataFailure !== undefined || feeFailure || affordabilityFailure || semanticFailure !== undefined || expired;
160
- const poster = immediate === undefined || approval(immediate) ? undefined : nitroPosterGasBound(immediate, prices).posterGas;
161
- const simulation: LifecycleSimulation = {
162
- backend: "profiled", confidence: "profiled", executionProof: "not-run", protocolFit: "profiled", admitted: profileOnly && !refused,
163
- blockNumber: block.number, blockHash: block.hash, account: planned.account, chainId: planned.chainId, limits, steps: [], deferredTransactionIds: [],
164
- ...(bounds === undefined ? {} : { gasProfile: { version: LIFECYCLE_GAS_PROFILE_VERSION, bounds, initialBuys: quotes } }),
165
- ...(immediate === undefined || approval(immediate) ? {} : { estimate: { gasLimit, gasPrice, executionFee: gasLimit * gasPrice, dataFee: 0n, totalFee: gasLimit * gasPrice,
166
- posterGas: poster, posterFee: poster! * gasPrice, dataFeeIncludedInGas: true, feeConfidence: "native-ceiling-and-data" as const } }),
167
- ...(envelopeFailure ? { failureCategory: "capacity" as const, capacityConstraint: "gas-envelope" as const, failedTransactionId: launch!.id, reason: "Native transaction ceiling exceeds the supplied complete gas policy" } : {}),
168
- ...(calldataFailure === undefined ? {} : { failureCategory: "capacity" as const, capacityConstraint: "calldata" as const, failedTransactionId: calldataFailure.id, reason: "Encoded command exceeds the caller's calldata byte policy" }),
169
- ...(affordabilityFailure ? { failureCategory: "affordability" as const, failedTransactionId: launch!.id, reason: "Creator native balance cannot reserve transaction value and the native gas ceiling" } : {}),
170
- ...(semanticFailure === undefined ? {} : { failureCategory: "semantic" as const, failedTransactionId: transactions.find((transaction) => transaction.kind === "atomic" || transaction.kind === "activate")?.id, reason: "Opening curve output is below the committed minimum" }),
171
- ...(expired ? { failureCategory: "semantic" as const, failedTransactionId: transactions.find((transaction) => transaction.kind !== "cancel")?.id, reason: "Launch deadline has expired at the pinned block" } : {}),
172
- ...(feeFailure ? { failedTransactionId: immediate?.id, reason: "Reviewed gas price is below the pinned required fee" } : {}),
173
- };
174
- return { simulation, profileOnly: profileOnly || refused };
154
+ if (launch !== undefined && limits.transactionGasCeiling !== undefined && gasLimit > limits.transactionGasCeiling)
155
+ return refuse("GAS_POLICY_LIMIT", "The configured gas limit is below the chain's native transaction ceiling.", "capacity", "gas-envelope", launch.id);
156
+ if (reviewed !== undefined && gasPrice < requiredGasPrice) return refuse("REVIEWED_FEE_TOO_LOW", "The reviewed gas price is below the current required fee. Refresh the review before continuing.", "semantic", undefined, immediate?.id);
157
+ const quotes = currentCapacity?.initialBuys ?? [];
158
+ if (quotes.some((quote) => quote.tokenOut < plan.buys[quote.buyIndex]!.minTokenOut))
159
+ return refuse("BUY_MINIMUM_NOT_MET", "An opening buy is below its minimum output. Refresh the review before continuing.", "semantic");
160
+ if (block.timestamp > plan.deadline && !cancelOnly) return refuse("PLAN_EXPIRED", "The launch deadline has passed. Cancel an unfinished launch to recover its funds.", "semantic");
161
+ const inputs = new Map<string, { required: bigint; balance: bigint }>();
162
+ for (const prerequisite of planned.prerequisites) {
163
+ if (prerequisite.allowance === undefined) continue;
164
+ const key = prerequisite.funding.inputAsset.toLowerCase(), total = inputs.get(key) ?? { required: 0n, balance: prerequisite.inputBalance };
165
+ total.required += prerequisite.requiredInput; inputs.set(key, total);
166
+ }
167
+ if ([...inputs.values()].some((input) => input.required > input.balance)) return refuse("INSUFFICIENT_FUNDING_BALANCE", "There are not enough tokens to fund this launch. Add funds or reduce the purchase.", "affordability");
168
+ const balance = rpcQuantity(balanceValue, "creator native balance");
169
+ if (gasPrice >= 1n << 256n || launch !== undefined && launch.value + gasLimit * gasPrice >= 1n << 256n) throw new LifecyclePlanningError("INVALID_GAS_ENVELOPE", "Transaction value and native-ceiling fee must fit uint256");
170
+ if (launch !== undefined && launch.value + gasLimit * gasPrice > balance) return refuse("INSUFFICIENT_NATIVE_BALANCE", "There is not enough native currency for the launch amount and gas budget. Add funds or reduce the purchase.", "affordability", undefined, launch.id);
171
+ if (immediate !== undefined && !approval(immediate)) {
172
+ const source = lifecycleSourceClient(client);
173
+ const dataFee = limits.protocol === "nitro" ? 0n : observed.configuration.estimateDataFee === undefined ? undefined
174
+ : await observed.configuration.estimateDataFee({ ...immediate, gas: gasLimit, gasPrice }, source === client ? context : { ...context, client: source });
175
+ if (dataFee !== undefined && (typeof dataFee !== "bigint" || dataFee < 0n || dataFee >= 1n << 256n)) throw new LifecyclePlanningError("INVALID_DATA_FEE", "Data-fee estimate must be a nonnegative uint256 amount");
176
+ const executionFee = gasLimit * gasPrice, required = immediate.value + executionFee + (dataFee ?? 0n);
177
+ if (required >= 1n << 256n) throw new LifecyclePlanningError("INVALID_GAS_ENVELOPE", "Transaction value and gas/data fee budget must fit uint256");
178
+ if (required > balance) return refuse("INSUFFICIENT_NATIVE_BALANCE", "There is not enough native currency for the launch amount and gas budget. Add funds or reduce the purchase.", "affordability", undefined, immediate.id);
179
+ const posterGas = prices === undefined ? undefined : poster(immediate);
180
+ assessment.estimate = { gasLimit, gasPrice, executionFee, dataFee, totalFee: dataFee === undefined ? undefined : executionFee + dataFee,
181
+ posterGas, posterFee: posterGas === undefined ? undefined : posterGas * gasPrice, dataFeeIncludedInGas: limits.protocol === "nitro",
182
+ feeConfidence: dataFee === undefined ? "native-ceiling-only" : "native-ceiling-and-data" };
183
+ }
184
+ options.signal?.throwIfAborted(); observed.assertCurrent();
185
+ return assessment;
175
186
  }
@@ -1,21 +1,21 @@
1
- /** Versioned construction metadata and live launch execution calibration. */
1
+ /** Versioned construction metadata, exact local curve math and launch budgets. */
2
2
  export * from "./schema.js";
3
3
  export * from "./types.js";
4
4
  export * from "./abi.js";
5
5
  export * from "./markets.js";
6
6
  export * from "./hmm.js";
7
7
  export * from "./ufg.js";
8
+ export * from "./auto-compound.js";
8
9
  export { ABYSS_LIFECYCLE_CONFIG_SCHEMA, readLifecycleTokenAtBlock, readLifecycleHeadProgress, predictLifecycleToken,
9
10
  validateV4LifecycleOracle, readLifecycleProfiles, readPoolBoundHookDeployment,
10
11
  buildPoolBoundHookDeploymentTransaction, validateLifecycleMarketIdentity, readLaunchProgress } from "./progress.js";
11
- export * from "./fork.js";
12
12
  export * from "./authors.js";
13
13
  export * from "./presets.js";
14
- export { preparationGasEstimate, packPreparationBatches, buildLaunchTransactions } from "./transactions.js";
14
+ export { preparationGasEstimate, packPreparationBatches, buildLaunchTransactions, LIFECYCLE_CAPACITY_PADDING_BPS } from "./transactions.js";
15
15
  export { createLifecycleSessionCache } from "./rpc.js";
16
16
  export { launchLensAbi } from "./lens.js";
17
17
  export { hookSaltMinerAbi } from "./mining.js";
18
- export { planLaunch, simulateLaunchPlan, buildNextTransaction, prepareAndPlanLifecycleLaunch } from "./planner.js";
18
+ export { planLaunch, buildNextTransaction, prepareAndPlanLifecycleLaunch } from "./planner.js";
19
19
  export { computeLifecycleOpeningBuys } from "./opening-buys.js";
20
20
  export { computeLifecycleLaunchGasBounds } from "./gas-profile.js";
21
21
  export { assertLaunchTopologyCoverage, getTickAtSqrtRatio, type LaunchTopologyCoverageInput, type LaunchTopologyPosition } from "../launch.js";