Spaces:
Running
Running
GitHub Actions commited on
Commit Β·
eae31d8
1
Parent(s): 595baf5
π Automated sync from GitHub
Browse files- config.py +23 -449
- recover_chain.py +6 -6
- requirements.txt +1 -0
- src/PureVersation_compiled.json +535 -0
- src/dynamic_compiler.py +83 -0
- src/trust_agent.py +33 -9
config.py
CHANGED
|
@@ -49,452 +49,26 @@ class AppConfig:
|
|
| 49 |
print(f" - {cls.DATASET_DIR}")
|
| 50 |
print(f" - {cls.PROFILES_DIR}")
|
| 51 |
|
| 52 |
-
# --- ABI
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
{
|
| 76 |
-
"indexed": false,
|
| 77 |
-
"internalType": "uint256",
|
| 78 |
-
"name": "timestamp",
|
| 79 |
-
"type": "uint256"
|
| 80 |
-
}
|
| 81 |
-
],
|
| 82 |
-
"name": "BackupCreated",
|
| 83 |
-
"type": "event"
|
| 84 |
-
},
|
| 85 |
-
{
|
| 86 |
-
"anonymous": false,
|
| 87 |
-
"inputs": [
|
| 88 |
-
{
|
| 89 |
-
"indexed": true,
|
| 90 |
-
"internalType": "uint256",
|
| 91 |
-
"name": "id",
|
| 92 |
-
"type": "uint256"
|
| 93 |
-
},
|
| 94 |
-
{
|
| 95 |
-
"indexed": false,
|
| 96 |
-
"internalType": "string",
|
| 97 |
-
"name": "phrase",
|
| 98 |
-
"type": "string"
|
| 99 |
-
},
|
| 100 |
-
{
|
| 101 |
-
"indexed": true,
|
| 102 |
-
"internalType": "address",
|
| 103 |
-
"name": "proposer",
|
| 104 |
-
"type": "address"
|
| 105 |
-
}
|
| 106 |
-
],
|
| 107 |
-
"name": "EntryProposed",
|
| 108 |
-
"type": "event"
|
| 109 |
-
},
|
| 110 |
-
{
|
| 111 |
-
"anonymous": false,
|
| 112 |
-
"inputs": [
|
| 113 |
-
{
|
| 114 |
-
"indexed": true,
|
| 115 |
-
"internalType": "uint256",
|
| 116 |
-
"name": "id",
|
| 117 |
-
"type": "uint256"
|
| 118 |
-
},
|
| 119 |
-
{
|
| 120 |
-
"indexed": true,
|
| 121 |
-
"internalType": "address",
|
| 122 |
-
"name": "verifier",
|
| 123 |
-
"type": "address"
|
| 124 |
-
}
|
| 125 |
-
],
|
| 126 |
-
"name": "EntryVerified",
|
| 127 |
-
"type": "event"
|
| 128 |
-
},
|
| 129 |
-
{
|
| 130 |
-
"anonymous": false,
|
| 131 |
-
"inputs": [
|
| 132 |
-
{
|
| 133 |
-
"indexed": true,
|
| 134 |
-
"internalType": "address",
|
| 135 |
-
"name": "researcher",
|
| 136 |
-
"type": "address"
|
| 137 |
-
},
|
| 138 |
-
{
|
| 139 |
-
"indexed": false,
|
| 140 |
-
"internalType": "string",
|
| 141 |
-
"name": "newRole",
|
| 142 |
-
"type": "string"
|
| 143 |
-
}
|
| 144 |
-
],
|
| 145 |
-
"name": "RankUpgraded",
|
| 146 |
-
"type": "event"
|
| 147 |
-
},
|
| 148 |
-
{
|
| 149 |
-
"anonymous": false,
|
| 150 |
-
"inputs": [
|
| 151 |
-
{
|
| 152 |
-
"indexed": true,
|
| 153 |
-
"internalType": "address",
|
| 154 |
-
"name": "researcher",
|
| 155 |
-
"type": "address"
|
| 156 |
-
},
|
| 157 |
-
{
|
| 158 |
-
"indexed": false,
|
| 159 |
-
"internalType": "uint256",
|
| 160 |
-
"name": "amount",
|
| 161 |
-
"type": "uint256"
|
| 162 |
-
}
|
| 163 |
-
],
|
| 164 |
-
"name": "ReputationMinted",
|
| 165 |
-
"type": "event"
|
| 166 |
-
},
|
| 167 |
-
{
|
| 168 |
-
"inputs": [
|
| 169 |
-
{
|
| 170 |
-
"internalType": "string",
|
| 171 |
-
"name": "",
|
| 172 |
-
"type": "string"
|
| 173 |
-
},
|
| 174 |
-
{
|
| 175 |
-
"internalType": "uint256",
|
| 176 |
-
"name": "",
|
| 177 |
-
"type": "uint256"
|
| 178 |
-
}
|
| 179 |
-
],
|
| 180 |
-
"name": "backups",
|
| 181 |
-
"outputs": [
|
| 182 |
-
{
|
| 183 |
-
"internalType": "uint256",
|
| 184 |
-
"name": "timestamp",
|
| 185 |
-
"type": "uint256"
|
| 186 |
-
},
|
| 187 |
-
{
|
| 188 |
-
"internalType": "string",
|
| 189 |
-
"name": "dataType",
|
| 190 |
-
"type": "string"
|
| 191 |
-
},
|
| 192 |
-
{
|
| 193 |
-
"internalType": "string",
|
| 194 |
-
"name": "ipfsCid",
|
| 195 |
-
"type": "string"
|
| 196 |
-
},
|
| 197 |
-
{
|
| 198 |
-
"internalType": "string",
|
| 199 |
-
"name": "description",
|
| 200 |
-
"type": "string"
|
| 201 |
-
},
|
| 202 |
-
{
|
| 203 |
-
"internalType": "address",
|
| 204 |
-
"name": "uploader",
|
| 205 |
-
"type": "address"
|
| 206 |
-
}
|
| 207 |
-
],
|
| 208 |
-
"stateMutability": "view",
|
| 209 |
-
"type": "function"
|
| 210 |
-
},
|
| 211 |
-
{
|
| 212 |
-
"inputs": [
|
| 213 |
-
{
|
| 214 |
-
"internalType": "string",
|
| 215 |
-
"name": "_dataKey",
|
| 216 |
-
"type": "string"
|
| 217 |
-
},
|
| 218 |
-
{
|
| 219 |
-
"internalType": "string",
|
| 220 |
-
"name": "_dataType",
|
| 221 |
-
"type": "string"
|
| 222 |
-
},
|
| 223 |
-
{
|
| 224 |
-
"internalType": "string",
|
| 225 |
-
"name": "_ipfsCid",
|
| 226 |
-
"type": "string"
|
| 227 |
-
},
|
| 228 |
-
{
|
| 229 |
-
"internalType": "string",
|
| 230 |
-
"name": "_description",
|
| 231 |
-
"type": "string"
|
| 232 |
-
}
|
| 233 |
-
],
|
| 234 |
-
"name": "createBackup",
|
| 235 |
-
"outputs": [],
|
| 236 |
-
"stateMutability": "nonpayable",
|
| 237 |
-
"type": "function"
|
| 238 |
-
},
|
| 239 |
-
{
|
| 240 |
-
"inputs": [
|
| 241 |
-
{
|
| 242 |
-
"internalType": "uint256",
|
| 243 |
-
"name": "",
|
| 244 |
-
"type": "uint256"
|
| 245 |
-
}
|
| 246 |
-
],
|
| 247 |
-
"name": "entries",
|
| 248 |
-
"outputs": [
|
| 249 |
-
{
|
| 250 |
-
"internalType": "uint256",
|
| 251 |
-
"name": "id",
|
| 252 |
-
"type": "uint256"
|
| 253 |
-
},
|
| 254 |
-
{
|
| 255 |
-
"internalType": "string",
|
| 256 |
-
"name": "phrase",
|
| 257 |
-
"type": "string"
|
| 258 |
-
},
|
| 259 |
-
{
|
| 260 |
-
"internalType": "string",
|
| 261 |
-
"name": "dialect",
|
| 262 |
-
"type": "string"
|
| 263 |
-
},
|
| 264 |
-
{
|
| 265 |
-
"internalType": "string",
|
| 266 |
-
"name": "ipfsCid",
|
| 267 |
-
"type": "string"
|
| 268 |
-
},
|
| 269 |
-
{
|
| 270 |
-
"internalType": "address",
|
| 271 |
-
"name": "contributor",
|
| 272 |
-
"type": "address"
|
| 273 |
-
},
|
| 274 |
-
{
|
| 275 |
-
"internalType": "string",
|
| 276 |
-
"name": "licenseType",
|
| 277 |
-
"type": "string"
|
| 278 |
-
},
|
| 279 |
-
{
|
| 280 |
-
"internalType": "uint256",
|
| 281 |
-
"name": "verificationCount",
|
| 282 |
-
"type": "uint256"
|
| 283 |
-
},
|
| 284 |
-
{
|
| 285 |
-
"internalType": "bool",
|
| 286 |
-
"name": "isVerified",
|
| 287 |
-
"type": "bool"
|
| 288 |
-
}
|
| 289 |
-
],
|
| 290 |
-
"stateMutability": "view",
|
| 291 |
-
"type": "function"
|
| 292 |
-
},
|
| 293 |
-
{
|
| 294 |
-
"inputs": [],
|
| 295 |
-
"name": "entryCounter",
|
| 296 |
-
"outputs": [
|
| 297 |
-
{
|
| 298 |
-
"internalType": "uint256",
|
| 299 |
-
"name": "",
|
| 300 |
-
"type": "uint256"
|
| 301 |
-
}
|
| 302 |
-
],
|
| 303 |
-
"stateMutability": "view",
|
| 304 |
-
"type": "function"
|
| 305 |
-
},
|
| 306 |
-
{
|
| 307 |
-
"inputs": [
|
| 308 |
-
{
|
| 309 |
-
"internalType": "string",
|
| 310 |
-
"name": "_dataKey",
|
| 311 |
-
"type": "string"
|
| 312 |
-
}
|
| 313 |
-
],
|
| 314 |
-
"name": "getLatestBackup",
|
| 315 |
-
"outputs": [
|
| 316 |
-
{
|
| 317 |
-
"internalType": "string",
|
| 318 |
-
"name": "ipfsCid",
|
| 319 |
-
"type": "string"
|
| 320 |
-
},
|
| 321 |
-
{
|
| 322 |
-
"internalType": "uint256",
|
| 323 |
-
"name": "timestamp",
|
| 324 |
-
"type": "uint256"
|
| 325 |
-
}
|
| 326 |
-
],
|
| 327 |
-
"stateMutability": "view",
|
| 328 |
-
"type": "function"
|
| 329 |
-
},
|
| 330 |
-
{
|
| 331 |
-
"inputs": [
|
| 332 |
-
{
|
| 333 |
-
"internalType": "uint256",
|
| 334 |
-
"name": "_id",
|
| 335 |
-
"type": "uint256"
|
| 336 |
-
}
|
| 337 |
-
],
|
| 338 |
-
"name": "getLicenseInfo",
|
| 339 |
-
"outputs": [
|
| 340 |
-
{
|
| 341 |
-
"internalType": "string",
|
| 342 |
-
"name": "license",
|
| 343 |
-
"type": "string"
|
| 344 |
-
},
|
| 345 |
-
{
|
| 346 |
-
"internalType": "address",
|
| 347 |
-
"name": "contributor",
|
| 348 |
-
"type": "address"
|
| 349 |
-
}
|
| 350 |
-
],
|
| 351 |
-
"stateMutability": "view",
|
| 352 |
-
"type": "function"
|
| 353 |
-
},
|
| 354 |
-
{
|
| 355 |
-
"inputs": [],
|
| 356 |
-
"name": "labAdmin",
|
| 357 |
-
"outputs": [
|
| 358 |
-
{
|
| 359 |
-
"internalType": "address",
|
| 360 |
-
"name": "",
|
| 361 |
-
"type": "address"
|
| 362 |
-
}
|
| 363 |
-
],
|
| 364 |
-
"stateMutability": "view",
|
| 365 |
-
"type": "function"
|
| 366 |
-
},
|
| 367 |
-
{
|
| 368 |
-
"inputs": [],
|
| 369 |
-
"name": "name",
|
| 370 |
-
"outputs": [
|
| 371 |
-
{
|
| 372 |
-
"internalType": "string",
|
| 373 |
-
"name": "",
|
| 374 |
-
"type": "string"
|
| 375 |
-
}
|
| 376 |
-
],
|
| 377 |
-
"stateMutability": "view",
|
| 378 |
-
"type": "function"
|
| 379 |
-
},
|
| 380 |
-
{
|
| 381 |
-
"inputs": [
|
| 382 |
-
{
|
| 383 |
-
"internalType": "string",
|
| 384 |
-
"name": "_phrase",
|
| 385 |
-
"type": "string"
|
| 386 |
-
},
|
| 387 |
-
{
|
| 388 |
-
"internalType": "string",
|
| 389 |
-
"name": "_dialect",
|
| 390 |
-
"type": "string"
|
| 391 |
-
},
|
| 392 |
-
{
|
| 393 |
-
"internalType": "string",
|
| 394 |
-
"name": "_ipfsCid",
|
| 395 |
-
"type": "string"
|
| 396 |
-
},
|
| 397 |
-
{
|
| 398 |
-
"internalType": "string",
|
| 399 |
-
"name": "_license",
|
| 400 |
-
"type": "string"
|
| 401 |
-
},
|
| 402 |
-
{
|
| 403 |
-
"internalType": "address",
|
| 404 |
-
"name": "_contributor",
|
| 405 |
-
"type": "address"
|
| 406 |
-
}
|
| 407 |
-
],
|
| 408 |
-
"name": "proposeEntry",
|
| 409 |
-
"outputs": [],
|
| 410 |
-
"stateMutability": "nonpayable",
|
| 411 |
-
"type": "function"
|
| 412 |
-
},
|
| 413 |
-
{
|
| 414 |
-
"inputs": [
|
| 415 |
-
{
|
| 416 |
-
"internalType": "address",
|
| 417 |
-
"name": "_user",
|
| 418 |
-
"type": "address"
|
| 419 |
-
},
|
| 420 |
-
{
|
| 421 |
-
"internalType": "string",
|
| 422 |
-
"name": "_initialRole",
|
| 423 |
-
"type": "string"
|
| 424 |
-
}
|
| 425 |
-
],
|
| 426 |
-
"name": "registerResearcher",
|
| 427 |
-
"outputs": [],
|
| 428 |
-
"stateMutability": "nonpayable",
|
| 429 |
-
"type": "function"
|
| 430 |
-
},
|
| 431 |
-
{
|
| 432 |
-
"inputs": [
|
| 433 |
-
{
|
| 434 |
-
"internalType": "uint256",
|
| 435 |
-
"name": "_id",
|
| 436 |
-
"type": "uint256"
|
| 437 |
-
}
|
| 438 |
-
],
|
| 439 |
-
"name": "rejectEntry",
|
| 440 |
-
"outputs": [],
|
| 441 |
-
"stateMutability": "nonpayable",
|
| 442 |
-
"type": "function"
|
| 443 |
-
},
|
| 444 |
-
{
|
| 445 |
-
"inputs": [
|
| 446 |
-
{
|
| 447 |
-
"internalType": "address",
|
| 448 |
-
"name": "",
|
| 449 |
-
"type": "address"
|
| 450 |
-
}
|
| 451 |
-
],
|
| 452 |
-
"name": "researchers",
|
| 453 |
-
"outputs": [
|
| 454 |
-
{
|
| 455 |
-
"internalType": "bool",
|
| 456 |
-
"name": "isRegistered",
|
| 457 |
-
"type": "bool"
|
| 458 |
-
},
|
| 459 |
-
{
|
| 460 |
-
"internalType": "uint256",
|
| 461 |
-
"name": "reputationScore",
|
| 462 |
-
"type": "uint256"
|
| 463 |
-
},
|
| 464 |
-
{
|
| 465 |
-
"internalType": "string",
|
| 466 |
-
"name": "role",
|
| 467 |
-
"type": "string"
|
| 468 |
-
}
|
| 469 |
-
],
|
| 470 |
-
"stateMutability": "view",
|
| 471 |
-
"type": "function"
|
| 472 |
-
},
|
| 473 |
-
{
|
| 474 |
-
"inputs": [],
|
| 475 |
-
"name": "symbol",
|
| 476 |
-
"outputs": [
|
| 477 |
-
{
|
| 478 |
-
"internalType": "string",
|
| 479 |
-
"name": "",
|
| 480 |
-
"type": "string"
|
| 481 |
-
}
|
| 482 |
-
],
|
| 483 |
-
"stateMutability": "view",
|
| 484 |
-
"type": "function"
|
| 485 |
-
},
|
| 486 |
-
{
|
| 487 |
-
"inputs": [
|
| 488 |
-
{
|
| 489 |
-
"internalType": "uint256",
|
| 490 |
-
"name": "_id",
|
| 491 |
-
"type": "uint256"
|
| 492 |
-
}
|
| 493 |
-
],
|
| 494 |
-
"name": "verifyEntry",
|
| 495 |
-
"outputs": [],
|
| 496 |
-
"stateMutability": "nonpayable",
|
| 497 |
-
"type": "function"
|
| 498 |
-
}
|
| 499 |
-
]
|
| 500 |
-
""")
|
|
|
|
| 49 |
print(f" - {cls.DATASET_DIR}")
|
| 50 |
print(f" - {cls.PROFILES_DIR}")
|
| 51 |
|
| 52 |
+
# --- DYNAMIC ABI LOAD ---
|
| 53 |
+
@property
|
| 54 |
+
def CONTRACT_ABI(self):
|
| 55 |
+
return AppConfig.get_dynamic_abi()
|
| 56 |
+
|
| 57 |
+
@classmethod
|
| 58 |
+
def get_dynamic_abi(cls):
|
| 59 |
+
try:
|
| 60 |
+
from src.dynamic_compiler import get_contract_interface
|
| 61 |
+
abi, _ = get_contract_interface()
|
| 62 |
+
return abi
|
| 63 |
+
except Exception as e:
|
| 64 |
+
print(f"β οΈ Dynamic ABI load failed: {e}")
|
| 65 |
+
return []
|
| 66 |
+
|
| 67 |
+
# For backward compatibility where code uses AppConfig.CONTRACT_ABI directly
|
| 68 |
+
# we can initialize it here:
|
| 69 |
+
try:
|
| 70 |
+
from src.dynamic_compiler import get_contract_interface
|
| 71 |
+
AppConfig.CONTRACT_ABI, _ = get_contract_interface()
|
| 72 |
+
except Exception as e:
|
| 73 |
+
print(f"β οΈ Startup compilation failed: {e}")
|
| 74 |
+
AppConfig.CONTRACT_ABI = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
recover_chain.py
CHANGED
|
@@ -7,12 +7,12 @@ except ImportError:
|
|
| 7 |
from web3.middleware import geth_poa_middleware
|
| 8 |
from huggingface_hub import hf_hub_download
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
]
|
| 16 |
|
| 17 |
def main():
|
| 18 |
print("π Connecting to PureChain...")
|
|
|
|
| 7 |
from web3.middleware import geth_poa_middleware
|
| 8 |
from huggingface_hub import hf_hub_download
|
| 9 |
|
| 10 |
+
try:
|
| 11 |
+
from src.dynamic_compiler import get_contract_interface
|
| 12 |
+
CONTRACT_ABI, _ = get_contract_interface()
|
| 13 |
+
except Exception as e:
|
| 14 |
+
print(f"Failed to load dynamic ABI: {e}")
|
| 15 |
+
CONTRACT_ABI = []
|
| 16 |
|
| 17 |
def main():
|
| 18 |
print("π Connecting to PureChain...")
|
requirements.txt
CHANGED
|
@@ -28,6 +28,7 @@ soundfile
|
|
| 28 |
|
| 29 |
# --- TRUST / BLOCKCHAIN & TRAINER ---
|
| 30 |
web3>=6.0.0
|
|
|
|
| 31 |
autotrain-advanced
|
| 32 |
|
| 33 |
# --- RAG PIPELINE (LOCAL EMBEDDINGS) ---
|
|
|
|
| 28 |
|
| 29 |
# --- TRUST / BLOCKCHAIN & TRAINER ---
|
| 30 |
web3>=6.0.0
|
| 31 |
+
py-solc-x>=1.1.1
|
| 32 |
autotrain-advanced
|
| 33 |
|
| 34 |
# --- R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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"abi": [
|
| 3 |
+
{
|
| 4 |
+
"inputs": [],
|
| 5 |
+
"stateMutability": "nonpayable",
|
| 6 |
+
"type": "constructor"
|
| 7 |
+
},
|
| 8 |
+
{
|
| 9 |
+
"anonymous": false,
|
| 10 |
+
"inputs": [
|
| 11 |
+
{
|
| 12 |
+
"indexed": true,
|
| 13 |
+
"internalType": "string",
|
| 14 |
+
"name": "dataKey",
|
| 15 |
+
"type": "string"
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"indexed": false,
|
| 19 |
+
"internalType": "string",
|
| 20 |
+
"name": "ipfsCid",
|
| 21 |
+
"type": "string"
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"indexed": false,
|
| 25 |
+
"internalType": "uint256",
|
| 26 |
+
"name": "timestamp",
|
| 27 |
+
"type": "uint256"
|
| 28 |
+
}
|
| 29 |
+
],
|
| 30 |
+
"name": "BackupCreated",
|
| 31 |
+
"type": "event"
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"anonymous": false,
|
| 35 |
+
"inputs": [
|
| 36 |
+
{
|
| 37 |
+
"indexed": true,
|
| 38 |
+
"internalType": "uint256",
|
| 39 |
+
"name": "id",
|
| 40 |
+
"type": "uint256"
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"indexed": false,
|
| 44 |
+
"internalType": "string",
|
| 45 |
+
"name": "phrase",
|
| 46 |
+
"type": "string"
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"indexed": true,
|
| 50 |
+
"internalType": "address",
|
| 51 |
+
"name": "proposer",
|
| 52 |
+
"type": "address"
|
| 53 |
+
}
|
| 54 |
+
],
|
| 55 |
+
"name": "EntryProposed",
|
| 56 |
+
"type": "event"
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"anonymous": false,
|
| 60 |
+
"inputs": [
|
| 61 |
+
{
|
| 62 |
+
"indexed": true,
|
| 63 |
+
"internalType": "uint256",
|
| 64 |
+
"name": "id",
|
| 65 |
+
"type": "uint256"
|
| 66 |
+
},
|
| 67 |
+
{
|
| 68 |
+
"indexed": true,
|
| 69 |
+
"internalType": "address",
|
| 70 |
+
"name": "rejector",
|
| 71 |
+
"type": "address"
|
| 72 |
+
}
|
| 73 |
+
],
|
| 74 |
+
"name": "EntryRejected",
|
| 75 |
+
"type": "event"
|
| 76 |
+
},
|
| 77 |
+
{
|
| 78 |
+
"anonymous": false,
|
| 79 |
+
"inputs": [
|
| 80 |
+
{
|
| 81 |
+
"indexed": true,
|
| 82 |
+
"internalType": "uint256",
|
| 83 |
+
"name": "id",
|
| 84 |
+
"type": "uint256"
|
| 85 |
+
},
|
| 86 |
+
{
|
| 87 |
+
"indexed": true,
|
| 88 |
+
"internalType": "address",
|
| 89 |
+
"name": "verifier",
|
| 90 |
+
"type": "address"
|
| 91 |
+
}
|
| 92 |
+
],
|
| 93 |
+
"name": "EntryVerified",
|
| 94 |
+
"type": "event"
|
| 95 |
+
},
|
| 96 |
+
{
|
| 97 |
+
"anonymous": false,
|
| 98 |
+
"inputs": [
|
| 99 |
+
{
|
| 100 |
+
"indexed": true,
|
| 101 |
+
"internalType": "address",
|
| 102 |
+
"name": "researcher",
|
| 103 |
+
"type": "address"
|
| 104 |
+
},
|
| 105 |
+
{
|
| 106 |
+
"indexed": false,
|
| 107 |
+
"internalType": "string",
|
| 108 |
+
"name": "newRole",
|
| 109 |
+
"type": "string"
|
| 110 |
+
}
|
| 111 |
+
],
|
| 112 |
+
"name": "RankUpgraded",
|
| 113 |
+
"type": "event"
|
| 114 |
+
},
|
| 115 |
+
{
|
| 116 |
+
"anonymous": false,
|
| 117 |
+
"inputs": [
|
| 118 |
+
{
|
| 119 |
+
"indexed": true,
|
| 120 |
+
"internalType": "address",
|
| 121 |
+
"name": "researcher",
|
| 122 |
+
"type": "address"
|
| 123 |
+
},
|
| 124 |
+
{
|
| 125 |
+
"indexed": false,
|
| 126 |
+
"internalType": "uint256",
|
| 127 |
+
"name": "amount",
|
| 128 |
+
"type": "uint256"
|
| 129 |
+
}
|
| 130 |
+
],
|
| 131 |
+
"name": "ReputationMinted",
|
| 132 |
+
"type": "event"
|
| 133 |
+
},
|
| 134 |
+
{
|
| 135 |
+
"inputs": [
|
| 136 |
+
{
|
| 137 |
+
"internalType": "string",
|
| 138 |
+
"name": "",
|
| 139 |
+
"type": "string"
|
| 140 |
+
},
|
| 141 |
+
{
|
| 142 |
+
"internalType": "uint256",
|
| 143 |
+
"name": "",
|
| 144 |
+
"type": "uint256"
|
| 145 |
+
}
|
| 146 |
+
],
|
| 147 |
+
"name": "backups",
|
| 148 |
+
"outputs": [
|
| 149 |
+
{
|
| 150 |
+
"internalType": "uint256",
|
| 151 |
+
"name": "timestamp",
|
| 152 |
+
"type": "uint256"
|
| 153 |
+
},
|
| 154 |
+
{
|
| 155 |
+
"internalType": "string",
|
| 156 |
+
"name": "dataType",
|
| 157 |
+
"type": "string"
|
| 158 |
+
},
|
| 159 |
+
{
|
| 160 |
+
"internalType": "string",
|
| 161 |
+
"name": "ipfsCid",
|
| 162 |
+
"type": "string"
|
| 163 |
+
},
|
| 164 |
+
{
|
| 165 |
+
"internalType": "string",
|
| 166 |
+
"name": "description",
|
| 167 |
+
"type": "string"
|
| 168 |
+
},
|
| 169 |
+
{
|
| 170 |
+
"internalType": "address",
|
| 171 |
+
"name": "uploader",
|
| 172 |
+
"type": "address"
|
| 173 |
+
}
|
| 174 |
+
],
|
| 175 |
+
"stateMutability": "view",
|
| 176 |
+
"type": "function"
|
| 177 |
+
},
|
| 178 |
+
{
|
| 179 |
+
"inputs": [
|
| 180 |
+
{
|
| 181 |
+
"internalType": "string",
|
| 182 |
+
"name": "_dataKey",
|
| 183 |
+
"type": "string"
|
| 184 |
+
},
|
| 185 |
+
{
|
| 186 |
+
"internalType": "string",
|
| 187 |
+
"name": "_dataType",
|
| 188 |
+
"type": "string"
|
| 189 |
+
},
|
| 190 |
+
{
|
| 191 |
+
"internalType": "string",
|
| 192 |
+
"name": "_ipfsCid",
|
| 193 |
+
"type": "string"
|
| 194 |
+
},
|
| 195 |
+
{
|
| 196 |
+
"internalType": "string",
|
| 197 |
+
"name": "_description",
|
| 198 |
+
"type": "string"
|
| 199 |
+
}
|
| 200 |
+
],
|
| 201 |
+
"name": "createBackup",
|
| 202 |
+
"outputs": [],
|
| 203 |
+
"stateMutability": "nonpayable",
|
| 204 |
+
"type": "function"
|
| 205 |
+
},
|
| 206 |
+
{
|
| 207 |
+
"inputs": [
|
| 208 |
+
{
|
| 209 |
+
"internalType": "uint256",
|
| 210 |
+
"name": "",
|
| 211 |
+
"type": "uint256"
|
| 212 |
+
}
|
| 213 |
+
],
|
| 214 |
+
"name": "entries",
|
| 215 |
+
"outputs": [
|
| 216 |
+
{
|
| 217 |
+
"internalType": "uint256",
|
| 218 |
+
"name": "id",
|
| 219 |
+
"type": "uint256"
|
| 220 |
+
},
|
| 221 |
+
{
|
| 222 |
+
"internalType": "string",
|
| 223 |
+
"name": "phrase",
|
| 224 |
+
"type": "string"
|
| 225 |
+
},
|
| 226 |
+
{
|
| 227 |
+
"internalType": "string",
|
| 228 |
+
"name": "dialect",
|
| 229 |
+
"type": "string"
|
| 230 |
+
},
|
| 231 |
+
{
|
| 232 |
+
"internalType": "string",
|
| 233 |
+
"name": "ipfsCid",
|
| 234 |
+
"type": "string"
|
| 235 |
+
},
|
| 236 |
+
{
|
| 237 |
+
"internalType": "address",
|
| 238 |
+
"name": "contributor",
|
| 239 |
+
"type": "address"
|
| 240 |
+
},
|
| 241 |
+
{
|
| 242 |
+
"internalType": "string",
|
| 243 |
+
"name": "licenseType",
|
| 244 |
+
"type": "string"
|
| 245 |
+
},
|
| 246 |
+
{
|
| 247 |
+
"internalType": "uint256",
|
| 248 |
+
"name": "verificationCount",
|
| 249 |
+
"type": "uint256"
|
| 250 |
+
},
|
| 251 |
+
{
|
| 252 |
+
"internalType": "bool",
|
| 253 |
+
"name": "isVerified",
|
| 254 |
+
"type": "bool"
|
| 255 |
+
}
|
| 256 |
+
],
|
| 257 |
+
"stateMutability": "view",
|
| 258 |
+
"type": "function"
|
| 259 |
+
},
|
| 260 |
+
{
|
| 261 |
+
"inputs": [],
|
| 262 |
+
"name": "entryCounter",
|
| 263 |
+
"outputs": [
|
| 264 |
+
{
|
| 265 |
+
"internalType": "uint256",
|
| 266 |
+
"name": "",
|
| 267 |
+
"type": "uint256"
|
| 268 |
+
}
|
| 269 |
+
],
|
| 270 |
+
"stateMutability": "view",
|
| 271 |
+
"type": "function"
|
| 272 |
+
},
|
| 273 |
+
{
|
| 274 |
+
"inputs": [
|
| 275 |
+
{
|
| 276 |
+
"internalType": "string",
|
| 277 |
+
"name": "_dataKey",
|
| 278 |
+
"type": "string"
|
| 279 |
+
}
|
| 280 |
+
],
|
| 281 |
+
"name": "getLatestBackup",
|
| 282 |
+
"outputs": [
|
| 283 |
+
{
|
| 284 |
+
"internalType": "string",
|
| 285 |
+
"name": "ipfsCid",
|
| 286 |
+
"type": "string"
|
| 287 |
+
},
|
| 288 |
+
{
|
| 289 |
+
"internalType": "uint256",
|
| 290 |
+
"name": "timestamp",
|
| 291 |
+
"type": "uint256"
|
| 292 |
+
}
|
| 293 |
+
],
|
| 294 |
+
"stateMutability": "view",
|
| 295 |
+
"type": "function"
|
| 296 |
+
},
|
| 297 |
+
{
|
| 298 |
+
"inputs": [
|
| 299 |
+
{
|
| 300 |
+
"internalType": "uint256",
|
| 301 |
+
"name": "_id",
|
| 302 |
+
"type": "uint256"
|
| 303 |
+
}
|
| 304 |
+
],
|
| 305 |
+
"name": "getLicenseInfo",
|
| 306 |
+
"outputs": [
|
| 307 |
+
{
|
| 308 |
+
"internalType": "string",
|
| 309 |
+
"name": "license",
|
| 310 |
+
"type": "string"
|
| 311 |
+
},
|
| 312 |
+
{
|
| 313 |
+
"internalType": "address",
|
| 314 |
+
"name": "contributor",
|
| 315 |
+
"type": "address"
|
| 316 |
+
}
|
| 317 |
+
],
|
| 318 |
+
"stateMutability": "view",
|
| 319 |
+
"type": "function"
|
| 320 |
+
},
|
| 321 |
+
{
|
| 322 |
+
"inputs": [
|
| 323 |
+
{
|
| 324 |
+
"internalType": "uint256",
|
| 325 |
+
"name": "",
|
| 326 |
+
"type": "uint256"
|
| 327 |
+
},
|
| 328 |
+
{
|
| 329 |
+
"internalType": "address",
|
| 330 |
+
"name": "",
|
| 331 |
+
"type": "address"
|
| 332 |
+
}
|
| 333 |
+
],
|
| 334 |
+
"name": "hasRejected",
|
| 335 |
+
"outputs": [
|
| 336 |
+
{
|
| 337 |
+
"internalType": "bool",
|
| 338 |
+
"name": "",
|
| 339 |
+
"type": "bool"
|
| 340 |
+
}
|
| 341 |
+
],
|
| 342 |
+
"stateMutability": "view",
|
| 343 |
+
"type": "function"
|
| 344 |
+
},
|
| 345 |
+
{
|
| 346 |
+
"inputs": [
|
| 347 |
+
{
|
| 348 |
+
"internalType": "uint256",
|
| 349 |
+
"name": "",
|
| 350 |
+
"type": "uint256"
|
| 351 |
+
},
|
| 352 |
+
{
|
| 353 |
+
"internalType": "address",
|
| 354 |
+
"name": "",
|
| 355 |
+
"type": "address"
|
| 356 |
+
}
|
| 357 |
+
],
|
| 358 |
+
"name": "hasVerified",
|
| 359 |
+
"outputs": [
|
| 360 |
+
{
|
| 361 |
+
"internalType": "bool",
|
| 362 |
+
"name": "",
|
| 363 |
+
"type": "bool"
|
| 364 |
+
}
|
| 365 |
+
],
|
| 366 |
+
"stateMutability": "view",
|
| 367 |
+
"type": "function"
|
| 368 |
+
},
|
| 369 |
+
{
|
| 370 |
+
"inputs": [],
|
| 371 |
+
"name": "labAdmin",
|
| 372 |
+
"outputs": [
|
| 373 |
+
{
|
| 374 |
+
"internalType": "address",
|
| 375 |
+
"name": "",
|
| 376 |
+
"type": "address"
|
| 377 |
+
}
|
| 378 |
+
],
|
| 379 |
+
"stateMutability": "view",
|
| 380 |
+
"type": "function"
|
| 381 |
+
},
|
| 382 |
+
{
|
| 383 |
+
"inputs": [],
|
| 384 |
+
"name": "name",
|
| 385 |
+
"outputs": [
|
| 386 |
+
{
|
| 387 |
+
"internalType": "string",
|
| 388 |
+
"name": "",
|
| 389 |
+
"type": "string"
|
| 390 |
+
}
|
| 391 |
+
],
|
| 392 |
+
"stateMutability": "view",
|
| 393 |
+
"type": "function"
|
| 394 |
+
},
|
| 395 |
+
{
|
| 396 |
+
"inputs": [
|
| 397 |
+
{
|
| 398 |
+
"internalType": "string",
|
| 399 |
+
"name": "_phrase",
|
| 400 |
+
"type": "string"
|
| 401 |
+
},
|
| 402 |
+
{
|
| 403 |
+
"internalType": "string",
|
| 404 |
+
"name": "_dialect",
|
| 405 |
+
"type": "string"
|
| 406 |
+
},
|
| 407 |
+
{
|
| 408 |
+
"internalType": "string",
|
| 409 |
+
"name": "_ipfsCid",
|
| 410 |
+
"type": "string"
|
| 411 |
+
},
|
| 412 |
+
{
|
| 413 |
+
"internalType": "string",
|
| 414 |
+
"name": "_license",
|
| 415 |
+
"type": "string"
|
| 416 |
+
},
|
| 417 |
+
{
|
| 418 |
+
"internalType": "address",
|
| 419 |
+
"name": "_contributor",
|
| 420 |
+
"type": "address"
|
| 421 |
+
}
|
| 422 |
+
],
|
| 423 |
+
"name": "proposeEntry",
|
| 424 |
+
"outputs": [],
|
| 425 |
+
"stateMutability": "nonpayable",
|
| 426 |
+
"type": "function"
|
| 427 |
+
},
|
| 428 |
+
{
|
| 429 |
+
"inputs": [
|
| 430 |
+
{
|
| 431 |
+
"internalType": "address",
|
| 432 |
+
"name": "_user",
|
| 433 |
+
"type": "address"
|
| 434 |
+
},
|
| 435 |
+
{
|
| 436 |
+
"internalType": "string",
|
| 437 |
+
"name": "_initialRole",
|
| 438 |
+
"type": "string"
|
| 439 |
+
}
|
| 440 |
+
],
|
| 441 |
+
"name": "registerResearcher",
|
| 442 |
+
"outputs": [],
|
| 443 |
+
"stateMutability": "nonpayable",
|
| 444 |
+
"type": "function"
|
| 445 |
+
},
|
| 446 |
+
{
|
| 447 |
+
"inputs": [
|
| 448 |
+
{
|
| 449 |
+
"internalType": "uint256",
|
| 450 |
+
"name": "_id",
|
| 451 |
+
"type": "uint256"
|
| 452 |
+
}
|
| 453 |
+
],
|
| 454 |
+
"name": "rejectEntry",
|
| 455 |
+
"outputs": [],
|
| 456 |
+
"stateMutability": "nonpayable",
|
| 457 |
+
"type": "function"
|
| 458 |
+
},
|
| 459 |
+
{
|
| 460 |
+
"inputs": [
|
| 461 |
+
{
|
| 462 |
+
"internalType": "uint256",
|
| 463 |
+
"name": "",
|
| 464 |
+
"type": "uint256"
|
| 465 |
+
}
|
| 466 |
+
],
|
| 467 |
+
"name": "rejectionCounts",
|
| 468 |
+
"outputs": [
|
| 469 |
+
{
|
| 470 |
+
"internalType": "uint256",
|
| 471 |
+
"name": "",
|
| 472 |
+
"type": "uint256"
|
| 473 |
+
}
|
| 474 |
+
],
|
| 475 |
+
"stateMutability": "view",
|
| 476 |
+
"type": "function"
|
| 477 |
+
},
|
| 478 |
+
{
|
| 479 |
+
"inputs": [
|
| 480 |
+
{
|
| 481 |
+
"internalType": "address",
|
| 482 |
+
"name": "",
|
| 483 |
+
"type": "address"
|
| 484 |
+
}
|
| 485 |
+
],
|
| 486 |
+
"name": "researchers",
|
| 487 |
+
"outputs": [
|
| 488 |
+
{
|
| 489 |
+
"internalType": "bool",
|
| 490 |
+
"name": "isRegistered",
|
| 491 |
+
"type": "bool"
|
| 492 |
+
},
|
| 493 |
+
{
|
| 494 |
+
"internalType": "uint256",
|
| 495 |
+
"name": "reputationScore",
|
| 496 |
+
"type": "uint256"
|
| 497 |
+
},
|
| 498 |
+
{
|
| 499 |
+
"internalType": "string",
|
| 500 |
+
"name": "role",
|
| 501 |
+
"type": "string"
|
| 502 |
+
}
|
| 503 |
+
],
|
| 504 |
+
"stateMutability": "view",
|
| 505 |
+
"type": "function"
|
| 506 |
+
},
|
| 507 |
+
{
|
| 508 |
+
"inputs": [],
|
| 509 |
+
"name": "symbol",
|
| 510 |
+
"outputs": [
|
| 511 |
+
{
|
| 512 |
+
"internalType": "string",
|
| 513 |
+
"name": "",
|
| 514 |
+
"type": "string"
|
| 515 |
+
}
|
| 516 |
+
],
|
| 517 |
+
"stateMutability": "view",
|
| 518 |
+
"type": "function"
|
| 519 |
+
},
|
| 520 |
+
{
|
| 521 |
+
"inputs": [
|
| 522 |
+
{
|
| 523 |
+
"internalType": "uint256",
|
| 524 |
+
"name": "_id",
|
| 525 |
+
"type": "uint256"
|
| 526 |
+
}
|
| 527 |
+
],
|
| 528 |
+
"name": "verifyEntry",
|
| 529 |
+
"outputs": [],
|
| 530 |
+
"stateMutability": "nonpayable",
|
| 531 |
+
"type": "function"
|
| 532 |
+
}
|
| 533 |
+
],
|
| 534 |
+
"bytecode": "60806040523480156200001157600080fd5b5033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040518060600160405280600115158152602001606481526020016040518060400160405280600581526020017f41646d696e0000000000000000000000000000000000000000000000000000008152508152506000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff0219169083151502179055506020820151816001015560408201518160020190805190602001906200012d92919062000137565b509050506200024c565b8280546200014590620001e7565b90600052602060002090601f016020900481019282620001695760008555620001b5565b82601f106200018457805160ff1916838001178555620001b5565b82800160010185558215620001b5579182015b82811115620001b457825182559160200191906001019062000197565b5b509050620001c49190620001c8565b5090565b5b80821115620001e3576000816000905550600101620001c9565b5090565b600060028204905060018216806200020057607f821691505b602082108114156200021757620002166200021d565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b612f35806200025c6000396000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c80638c06062c116100a2578063d17007b511610071578063d17007b5146102d6578063d40f299a14610306578063e8a3c5a714610322578063efebb04414610356578063f3c2cf65146103725761010b565b80638c06062c1461024957806395d89b4114610265578063b30906d414610283578063b6602c3a146102ba5761010b565b806356563e4a116100de57806356563e4a146101ac57806362da8313146101dc57806379a0f97b146101fa57806386c8ce7f1461022b5761010b565b806301bc237d1461011057806306fdde031461014257806308a0e3131461016057806320fb56291461017c575b600080fd5b61012a60048036038101906101259190612224565b6103a3565b6040516101399392919061292a565b60405180910390f35b61014a610462565b6040516101579190612968565b60405180910390f35b61017a600480360381019061017591906123a5565b61049b565b005b610196600480360381019061019191906124f9565b610826565b6040516101a3919061290f565b60405180910390f35b6101c660048036038101906101c191906124f9565b610855565b6040516101d3919061290f565b60405180910390f35b6101e4610884565b6040516101f19190612aea565b60405180910390f35b610214600480360381019061020f91906122a1565b61088a565b6040516102229291906129ba565b60405180910390f35b610233610bbb565b60405161024091906128f4565b60405180910390f35b610263600480360381019061025e91906124d0565b610be1565b005b61026d610e90565b60405161027a9190612968565b60405180910390f35b61029d600480360381019061029891906124d0565b610ec9565b6040516102b1989796959493929190612b6d565b60405180910390f35b6102d460048036038101906102cf91906122e2565b61115e565b005b6102f060048036038101906102eb91906124d0565b611375565b6040516102fd9190612aea565b60405180910390f35b610320600480360381019061031b919061224d565b61138d565b005b61033c6004803603810190610337919061247c565b6114d1565b60405161034d959493929190612b05565b60405180910390f35b610370600480360381019061036b91906124d0565b6116f2565b005b61038c600480360381019061038791906124d0565b611a57565b60405161039a92919061298a565b60405180910390f35b60006020528060005260406000206000915090508060000160009054906101000a900460ff16908060010154908060020180546103df90612db8565b80601f016020809104026020016040519081016040528092919081815260200182805461040b90612db8565b80156104585780601f1061042d57610100808354040283529160200191610458565b820191906000526020600020905b81548152906001019060200180831161043b57829003601f168201915b5050505050905083565b6040518060400160405280601f81526020017f50757265566572736174696f6e2052657365617263682052656769737472790081525081565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff16610529576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161052090612a6a565b60405180910390fd5b6002600081548092919061053c90612dea565b919050555060405180610100016040528060025481526020018681526020018581526020018481526020018273ffffffffffffffffffffffffffffffffffffffff16815260200183815260200160008152602001600015158152506003600060025481526020019081526020016000206000820151816000015560208201518160010190805190602001906105d29291906120ef565b5060408201518160020190805190602001906105ef9291906120ef565b50606082015181600301908051906020019061060c9291906120ef565b5060808201518160040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060a08201518160050190805190602001906106709291906120ef565b5060c0820151816006015560e08201518160070160006101000a81548160ff0219169083151502179055509050508073ffffffffffffffffffffffffffffffffffffffff166002547f41bbb82aa0096a4ef6e73d180bcf005a06dae558a2bd374fefd8e9d3d116d693876040516106e79190612968565b60405180910390a36000808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff1661081f576040518060600160405280600115158152602001600081526020016040518060400160405280600881526020017f496e6974696174650000000000000000000000000000000000000000000000008152508152506000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160010155604082015181600201908051906020019061081a9291906120ef565b509050505b5050505050565b60066020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60056020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60025481565b606060008060048460405161089f91906128b1565b908152602001604051809103902080549050116108f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e890612a8a565b60405180910390fd5b600060048460405161090391906128b1565b9081526020016040518091039020600160048660405161092391906128b1565b90815260200160405180910390208054905061093f9190612cfa565b81548110610976577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002090600502016040518060a0016040529081600082015481526020016001820180546109a990612db8565b80601f01602080910402602001604051908101604052809291908181526020018280546109d590612db8565b8015610a225780601f106109f757610100808354040283529160200191610a22565b820191906000526020600020905b815481529060010190602001808311610a0557829003601f168201915b50505050508152602001600282018054610a3b90612db8565b80601f0160208091040260200160405190810160405280929190818152602001828054610a6790612db8565b8015610ab45780601f10610a8957610100808354040283529160200191610ab4565b820191906000526020600020905b815481529060010190602001808311610a9757829003601f168201915b50505050508152602001600382018054610acd90612db8565b80601f0160208091040260200160405190810160405280929190818152602001828054610af990612db8565b8015610b465780601f10610b1b57610100808354040283529160200191610b46565b820191906000526020600020905b815481529060010190602001808311610b2957829003601f168201915b505050505081526020016004820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815250509050806040015181600001519250925050915091565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff16610c6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6690612a6a565b60405180910390fd5b6003600082815260200190815260200160002060070160009054906101000a900460ff1615610cd3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cca906129ea565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610d3757610d3281611b3d565b610e8d565b6006600082815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610dd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dcc90612aaa565b60405180910390fd5b60016006600083815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600760008281526020019081526020016000206000815480929190610e6290612dea565b91905055506003600760008381526020019081526020016000205410610e8c57610e8b81611b3d565b5b5b50565b6040518060400160405280600981526020017f564552534154494f4e000000000000000000000000000000000000000000000081525081565b6003602052806000526040600020600091509050806000015490806001018054610ef290612db8565b80601f0160208091040260200160405190810160405280929190818152602001828054610f1e90612db8565b8015610f6b5780601f10610f4057610100808354040283529160200191610f6b565b820191906000526020600020905b815481529060010190602001808311610f4e57829003601f168201915b505050505090806002018054610f8090612db8565b80601f0160208091040260200160405190810160405280929190818152602001828054610fac90612db8565b8015610ff95780601f10610fce57610100808354040283529160200191610ff9565b820191906000526020600020905b815481529060010190602001808311610fdc57829003601f168201915b50505050509080600301805461100e90612db8565b80601f016020809104026020016040519081016040528092919081815260200182805461103a90612db8565b80156110875780601f1061105c57610100808354040283529160200191611087565b820191906000526020600020905b81548152906001019060200180831161106a57829003601f168201915b5050505050908060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060050180546110c290612db8565b80601f01602080910402602001604051908101604052809291908181526020018280546110ee90612db8565b801561113b5780601f106111105761010080835404028352916020019161113b565b820191906000526020600020905b81548152906001019060200180831161111e57829003601f168201915b5050505050908060060154908060070160009054906101000a900460ff16905088565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff166111ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111e390612a6a565b60405180910390fd5b60006040518060a001604052804281526020018581526020018481526020018381526020013373ffffffffffffffffffffffffffffffffffffffff16815250905060048560405161123d91906128b1565b908152602001604051809103902081908060018154018082558091505060019003906000526020600020906005020160009091909190915060008201518160000155602082015181600101908051906020019061129b9291906120ef565b5060408201518160020190805190602001906112b89291906120ef565b5060608201518160030190805190602001906112d59291906120ef565b5060808201518160040160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050508460405161132d91906128b1565b60405180910390207f55e378dbc81cbf3764f2fdc9915435a0de49effbb859d048f04415a779e4055184426040516113669291906129ba565b60405180910390a25050505050565b60076020528060005260406000206000915090505481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461141d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161141490612a2a565b60405180910390fd5b6040518060600160405280600115158152602001600a8152602001828152506000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548160ff0219169083151502179055506020820151816001015560408201518160020190805190602001906114c09291906120ef565b509050506114cd82611bcb565b5050565b600482805160208101820180518482526020830160208501208183528095505050505050818154811061150357600080fd5b90600052602060002090600502016000915091505080600001549080600101805461152d90612db8565b80601f016020809104026020016040519081016040528092919081815260200182805461155990612db8565b80156115a65780601f1061157b576101008083540402835291602001916115a6565b820191906000526020600020905b81548152906001019060200180831161158957829003601f168201915b5050505050908060020180546115bb90612db8565b80601f01602080910402602001604051908101604052809291908181526020018280546115e790612db8565b80156116345780601f1061160957610100808354040283529160200191611634565b820191906000526020600020905b81548152906001019060200180831161161757829003601f168201915b50505050509080600301805461164990612db8565b80601f016020809104026020016040519081016040528092919081815260200182805461167590612db8565b80156116c25780601f10611697576101008083540402835291602001916116c2565b820191906000526020600020905b8154815290600101906020018083116116a557829003601f168201915b5050505050908060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905085565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff16611780576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161177790612a6a565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166003600083815260200190815260200160002060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611825576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181c90612aca565b60405180910390fd5b6003600082815260200190815260200160002060070160009054906101000a900460ff1615611889576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188090612a0a565b60405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156118ed576118e881611e8b565b611a49565b6005600082815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561198b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161198290612a4a565b60405180910390fd5b60016005600083815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600360008281526020019081526020016000206006016000815480929190611a1b90612dea565b91905055506002600360008381526020019081526020016000206006015410611a4857611a4781611e8b565b5b5b611a5433600a611f42565b50565b60606000600360008481526020019081526020016000206005016003600085815260200190815260200160002060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16818054611ab490612db8565b80601f0160208091040260200160405190810160405280929190818152602001828054611ae090612db8565b8015611b2d5780601f10611b0257610100808354040283529160200191611b2d565b820191906000526020600020905b815481529060010190602001808311611b1057829003601f168201915b5050505050915091509150915091565b60006003600083815260200190815260200160002060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050611b8381600a611ff5565b3373ffffffffffffffffffffffffffffffffffffffff16827f3eacba1ffefb355646272b609f3eba7aa492e7f0eae1d9a94d019a2bbcca4b8160405160405180910390a35050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050604051602001611c1c906128df565b6040516020818303038152906040528051906020012081600201604051602001611c4691906128c8565b604051602081830303815290604052805190602001201415611c685750611e88565b60008160010154905060606105dc8210611cb9576040518060400160405280600681526020017f4f7261636c6500000000000000000000000000000000000000000000000000008152509050611dc6565b6103208210611cff576040518060400160405280600981526020017f41726368697669737400000000000000000000000000000000000000000000008152509050611dc5565b61012c8210611d45576040518060400160405280600881526020017f4c696e67756973740000000000000000000000000000000000000000000000008152509050611dc4565b60648210611d8a576040518060400160405280600581526020017f53636f75740000000000000000000000000000000000000000000000000000008152509050611dc3565b6040518060400160405280600881526020017f496e69746961746500000000000000000000000000000000000000000000000081525090505b5b5b5b80604051602001611dd791906128b1565b6040516020818303038152906040528051906020012083600201604051602001611e0191906128c8565b6040516020818303038152906040528051906020012014611e845780836002019080519060200190611e349291906120ef565b508373ffffffffffffffffffffffffffffffffffffffff167f38b44ef000ae19b1706917d3ee6c5625716848370f1af5a83e5e6e40484696a482604051611e7b9190612968565b60405180910390a25b5050505b50565b60016003600083815260200190815260200160002060070160006101000a81548160ff021916908315150217905550611efb6003600083815260200190815260200160002060040160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166032611f42565b3373ffffffffffffffffffffffffffffffffffffffff16817f82a82ea54aa0cfb8695810af1805d7f37f71a2683a57dc52567342b0a001f85260405160405180910390a350565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001016000828254611f939190612ca4565b925050819055508173ffffffffffffffffffffffffffffffffffffffff167f42bcf4689d0211adce4e556ee455319d34e671e8b8a762034e146461fb1be82d82604051611fe09190612aea565b60405180910390a2611ff182611bcb565b5050565b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101541061209a57806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101600082825461208e9190612cfa565b925050819055506120e2565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b6120eb82611bcb565b5050565b8280546120fb90612db8565b90600052602060002090601f01602090048101928261211d5760008555612164565b82601f1061213657805160ff1916838001178555612164565b82800160010185558215612164579182015b82811115612163578251825591602001919060010190612148565b5b5090506121719190612175565b5090565b5b8082111561218e576000816000905550600101612176565b5090565b60006121a56121a084612c38565b612c07565b9050828152602081018484840111156121bd57600080fd5b6121c8848285612d76565b509392505050565b6000813590506121df81612ed1565b92915050565b600082601f8301126121f657600080fd5b8135612206848260208601612192565b91505092915050565b60008135905061221e81612ee8565b92915050565b60006020828403121561223657600080fd5b6000612244848285016121d0565b91505092915050565b6000806040838503121561226057600080fd5b600061226e858286016121d0565b925050602083013567ffffffffffffffff81111561228b57600080fd5b612297858286016121e5565b9150509250929050565b6000602082840312156122b357600080fd5b600082013567ffffffffffffffff8111156122cd57600080fd5b6122d9848285016121e5565b91505092915050565b600080600080608085870312156122f857600080fd5b600085013567ffffffffffffffff81111561231257600080fd5b61231e878288016121e5565b945050602085013567ffffffffffffffff81111561233b57600080fd5b612347878288016121e5565b935050604085013567ffffffffffffffff81111561236457600080fd5b612370878288016121e5565b925050606085013567ffffffffffffffff81111561238d57600080fd5b612399878288016121e5565b91505092959194509250565b600080600080600060a086880312156123bd57600080fd5b600086013567ffffffffffffffff8111156123d757600080fd5b6123e3888289016121e5565b955050602086013567ffffffffffffffff81111561240057600080fd5b61240c888289016121e5565b945050604086013567ffffffffffffffff81111561242957600080fd5b612435888289016121e5565b935050606086013567ffffffffffffffff81111561245257600080fd5b61245e888289016121e5565b925050608061246f888289016121d0565b9150509295509295909350565b6000806040838503121561248f57600080fd5b600083013567ffffffffffffffff8111156124a957600080fd5b6124b5858286016121e5565b92505060206124c68582860161220f565b9150509250929050565b6000602082840312156124e257600080fd5b60006124f08482850161220f565b91505092915050565b6000806040838503121561250c57600080fd5b600061251a8582860161220f565b925050602061252b858286016121d0565b9150509250929050565b61253e81612d2e565b82525050565b61254d81612d40565b82525050565b600061255e82612c7d565b6125688185612c88565b9350612578818560208601612d85565b61258181612ec0565b840191505092915050565b600061259782612c7d565b6125a18185612c99565b93506125b1818560208601612d85565b80840191505092915050565b600081546125ca81612db8565b6125d48186612c99565b945060018216600081146125ef576001811461260057612633565b60ff19831686528186019350612633565b61260985612c68565b60005b8381101561262b5781548189015260018201915060208101905061260c565b838801955050505b50505092915050565b6000612649602783612c88565b91507f43616e6e6f742072656a65637420616e20616c7265616479207665726966696560008301527f6420656e747279000000000000000000000000000000000000000000000000006020830152604082019050919050565b60006126af601083612c88565b91507f416c7265616479207665726966696564000000000000000000000000000000006000830152602082019050919050565b60006126ef601a83612c88565b91507f4f6e6c79204c61622041646d696e2063616e20646f20746869730000000000006000830152602082019050919050565b600061272f600583612c99565b91507f41646d696e0000000000000000000000000000000000000000000000000000006000830152600582019050919050565b600061276f601783612c88565b91507f416c726561647920766572696669656420627920796f750000000000000000006000830152602082019050919050565b60006127af601d83612c88565b91507f4d757374206265207265676973746572656420726573656172636865720000006000830152602082019050919050565b60006127ef601083612c88565b91507f4e6f206261636b75707320666f756e64000000000000000000000000000000006000830152602082019050919050565b600061282f601783612c88565b91507f416c72656164792072656a656374656420627920796f750000000000000000006000830152602082019050919050565b600061286f601783612c88565b91507f43616e6e6f7420766572696679206f776e20656e7472790000000000000000006000830152602082019050919050565b6128ab81612d6c565b82525050565b60006128bd828461258c565b915081905092915050565b60006128d482846125bd565b915081905092915050565b60006128ea82612722565b9150819050919050565b60006020820190506129096000830184612535565b92915050565b60006020820190506129246000830184612544565b92915050565b600060608201905061293f6000830186612544565b61294c60208301856128a2565b818103604083015261295e8184612553565b9050949350505050565b600060208201905081810360008301526129828184612553565b905092915050565b600060408201905081810360008301526129a48185612553565b90506129b36020830184612535565b9392505050565b600060408201905081810360008301526129d48185612553565b90506129e360208301846128a2565b9392505050565b60006020820190508181036000830152612a038161263c565b9050919050565b60006020820190508181036000830152612a23816126a2565b9050919050565b60006020820190508181036000830152612a43816126e2565b9050919050565b60006020820190508181036000830152612a6381612762565b9050919050565b60006020820190508181036000830152612a83816127a2565b9050919050565b60006020820190508181036000830152612aa3816127e2565b9050919050565b60006020820190508181036000830152612ac381612822565b9050919050565b60006020820190508181036000830152612ae381612862565b9050919050565b6000602082019050612aff60008301846128a2565b92915050565b600060a082019050612b1a60008301886128a2565b8181036020830152612b2c8187612553565b90508181036040830152612b408186612553565b90508181036060830152612b548185612553565b9050612b636080830184612535565b9695505050505050565b600061010082019050612b83600083018b6128a2565b8181036020830152612b95818a612553565b90508181036040830152612ba98189612553565b90508181036060830152612bbd8188612553565b9050612bcc6080830187612535565b81810360a0830152612bde8186612553565b9050612bed60c08301856128a2565b612bfa60e0830184612544565b9998505050505050505050565b6000604051905081810181811067ffffffffffffffff82111715612c2e57612c2d612e91565b5b8060405250919050565b600067ffffffffffffffff821115612c5357612c52612e91565b5b601f19601f8301169050602081019050919050565b60008190508160005260206000209050919050565b600081519050919050565b600082825260208201905092915050565b600081905092915050565b6000612caf82612d6c565b9150612cba83612d6c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612cef57612cee612e33565b5b828201905092915050565b6000612d0582612d6c565b9150612d1083612d6c565b925082821015612d2357612d22612e33565b5b828203905092915050565b6000612d3982612d4c565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b82818337600083830152505050565b60005b83811015612da3578082015181840152602081019050612d88565b83811115612db2576000848401525b50505050565b60006002820490506001821680612dd057607f821691505b60208210811415612de457612de3612e62565b5b50919050565b6000612df582612d6c565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612e2857612e27612e33565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b612eda81612d2e565b8114612ee557600080fd5b50565b612ef181612d6c565b8114612efc57600080fd5b5056fea26469706673582212207aabd3bff3ed7bcf5b68e253bb08c3fc682d85f50187aa15729a5fa85b5a096364736f6c63430008000033"
|
| 535 |
+
}
|
src/dynamic_compiler.py
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import json
|
| 3 |
+
import solcx
|
| 4 |
+
|
| 5 |
+
def compile_contract(sol_file_path, contract_name="PureVersation"):
|
| 6 |
+
"""
|
| 7 |
+
Compiles a Solidity smart contract using py-solc-x.
|
| 8 |
+
Returns the ABI and Bytecode.
|
| 9 |
+
Caches the result to a JSON file to speed up subsequent loads.
|
| 10 |
+
"""
|
| 11 |
+
# Define cache file next to the sol file
|
| 12 |
+
cache_file = sol_file_path.replace('.sol', '_compiled.json')
|
| 13 |
+
|
| 14 |
+
# Optional: If you want to force recompile on every run, remove the cache check
|
| 15 |
+
if os.path.exists(cache_file):
|
| 16 |
+
try:
|
| 17 |
+
with open(cache_file, 'r', encoding='utf-8') as f:
|
| 18 |
+
data = json.load(f)
|
| 19 |
+
print(f"Loaded compiled contract from cache: {cache_file}")
|
| 20 |
+
return data["abi"], data["bytecode"]
|
| 21 |
+
except Exception as e:
|
| 22 |
+
print(f"Failed to load cached compiled contract: {e}. Recompiling...")
|
| 23 |
+
|
| 24 |
+
print(f"Dynamically compiling {sol_file_path} ...")
|
| 25 |
+
|
| 26 |
+
# 1. Install or load solc version 0.8.0
|
| 27 |
+
solc_version = "0.8.0"
|
| 28 |
+
try:
|
| 29 |
+
solcx.install_solc(solc_version)
|
| 30 |
+
solcx.set_solc_version(solc_version)
|
| 31 |
+
except Exception as e:
|
| 32 |
+
print(f"Failed to install/set solc compiler: {e}")
|
| 33 |
+
# If running in a restricted environment where binary download fails,
|
| 34 |
+
# it will throw an exception here.
|
| 35 |
+
raise e
|
| 36 |
+
|
| 37 |
+
# 2. Compile the .sol file
|
| 38 |
+
try:
|
| 39 |
+
compiled_sol = solcx.compile_files(
|
| 40 |
+
[sol_file_path],
|
| 41 |
+
output_values=["abi", "bin"],
|
| 42 |
+
solc_version=solc_version
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
# 3. Extract ABI and Bytecode
|
| 46 |
+
# The key in compiled_sol looks like: '<absolute_path>:<ContractName>'
|
| 47 |
+
contract_key = f"{sol_file_path}:{contract_name}"
|
| 48 |
+
if contract_key not in compiled_sol:
|
| 49 |
+
# Fallback if path separators cause mismatch
|
| 50 |
+
for key in compiled_sol.keys():
|
| 51 |
+
if key.endswith(f":{contract_name}"):
|
| 52 |
+
contract_key = key
|
| 53 |
+
break
|
| 54 |
+
|
| 55 |
+
contract_interface = compiled_sol[contract_key]
|
| 56 |
+
abi = contract_interface['abi']
|
| 57 |
+
bytecode = contract_interface['bin']
|
| 58 |
+
|
| 59 |
+
# 4. Save to cache
|
| 60 |
+
with open(cache_file, 'w', encoding='utf-8') as f:
|
| 61 |
+
json.dump({"abi": abi, "bytecode": bytecode}, f, indent=4)
|
| 62 |
+
|
| 63 |
+
print(f"Compilation successful! Saved to {cache_file}")
|
| 64 |
+
return abi, bytecode
|
| 65 |
+
|
| 66 |
+
except Exception as e:
|
| 67 |
+
print(f"Compilation failed: {e}")
|
| 68 |
+
raise e
|
| 69 |
+
|
| 70 |
+
# Provide a quick fetcher that integrates with config
|
| 71 |
+
def get_contract_interface():
|
| 72 |
+
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
| 73 |
+
sol_path = os.path.join(base_dir, "src", "PureVersation.sol")
|
| 74 |
+
return compile_contract(sol_path, "PureVersation")
|
| 75 |
+
|
| 76 |
+
if __name__ == "__main__":
|
| 77 |
+
# Test the compiler when run standalone
|
| 78 |
+
print("Testing Dynamic Compiler...")
|
| 79 |
+
try:
|
| 80 |
+
abi, bin_code = get_contract_interface()
|
| 81 |
+
print(f"Success! ABI length: {len(abi)} methods, Bytecode length: {len(bin_code)} chars")
|
| 82 |
+
except Exception as e:
|
| 83 |
+
print(e)
|
src/trust_agent.py
CHANGED
|
@@ -14,14 +14,7 @@ try:
|
|
| 14 |
except ImportError:
|
| 15 |
from web3.middleware import geth_poa_middleware
|
| 16 |
|
| 17 |
-
#
|
| 18 |
-
CONTRACT_ABI = '''[
|
| 19 |
-
{"inputs":[{"internalType":"string","name":"_phrase","type":"string"},{"internalType":"string","name":"_dialect","type":"string"},{"internalType":"string","name":"_ipfsCid","type":"string"},{"internalType":"string","name":"_license","type":"string"}],"name":"proposeEntry","outputs":[],"stateMutability":"nonpayable","type":"function"},
|
| 20 |
-
{"inputs":[{"internalType":"string","name":"_key","type":"string"},{"internalType":"string","name":"_type","type":"string"},{"internalType":"string","name":"_cid","type":"string"},{"internalType":"string","name":"_desc","type":"string"}],"name":"createBackup","outputs":[],"stateMutability":"nonpayable","type":"function"},
|
| 21 |
-
{"anonymous": false, "inputs": [{"indexed": true, "internalType": "uint256", "name": "id", "type": "uint256"}, {"indexed": false, "internalType": "string", "name": "phrase", "type": "string"}, {"indexed": true, "internalType": "address", "name": "proposer", "type": "address"}], "name": "EntryProposed", "type": "event"},
|
| 22 |
-
{"inputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], "name": "entries", "outputs": [{"internalType": "uint256", "name": "id", "type": "uint256"}, {"internalType": "string", "name": "phrase", "type": "string"}, {"internalType": "string", "name": "dialect", "type": "string"}, {"internalType": "string", "name": "ipfsCid", "type": "string"}, {"internalType": "address", "name": "contributor", "type": "address"}, {"internalType": "string", "name": "licenseType", "type": "string"}, {"internalType": "uint256", "name": "verificationCount", "type": "uint256"}, {"internalType": "bool", "name": "isVerified", "type": "bool"}], "stateMutability": "view", "type": "function"}
|
| 23 |
-
]'''
|
| 24 |
-
|
| 25 |
class AgentTrust:
|
| 26 |
def __init__(self, config):
|
| 27 |
self.config = config
|
|
@@ -63,6 +56,37 @@ class AgentTrust:
|
|
| 63 |
if self.w3.is_connected():
|
| 64 |
self.account = self.w3.eth.account.from_key(self.config.PRIVATE_KEY)
|
| 65 |
print(f"π Web3 Connected! Wallet: {self.account.address}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
else:
|
| 67 |
print(f"β οΈ Failed to connect to node at {self.config.PURECHAIN_RPC_URL}")
|
| 68 |
except Exception as e:
|
|
@@ -577,7 +601,7 @@ class AgentTrust:
|
|
| 577 |
if not cid: return "β Failed to pin file to IPFS."
|
| 578 |
|
| 579 |
# 2. Mint Backup to PureChain
|
| 580 |
-
contract = self.w3.eth.contract(address=self.config.PURECHAIN_CONTRACT_ADDRESS, abi=CONTRACT_ABI)
|
| 581 |
nonce = self.w3.eth.get_transaction_count(self.account.address, 'pending')
|
| 582 |
|
| 583 |
# Using your contract's createBackup(string _key, string _type, string _cid, string _desc)
|
|
|
|
| 14 |
except ImportError:
|
| 15 |
from web3.middleware import geth_poa_middleware
|
| 16 |
|
| 17 |
+
# Hardcoded ABI removed! Loaded dynamically via config.py / dynamic_compiler.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
class AgentTrust:
|
| 19 |
def __init__(self, config):
|
| 20 |
self.config = config
|
|
|
|
| 56 |
if self.w3.is_connected():
|
| 57 |
self.account = self.w3.eth.account.from_key(self.config.PRIVATE_KEY)
|
| 58 |
print(f"π Web3 Connected! Wallet: {self.account.address}")
|
| 59 |
+
|
| 60 |
+
# π’ DYNAMIC AUTO-DEPLOY LOGIC
|
| 61 |
+
if not self.config.PURECHAIN_CONTRACT_ADDRESS or self.config.PURECHAIN_CONTRACT_ADDRESS == "YOUR_CONTRACT_ADDRESS_HERE":
|
| 62 |
+
print("β οΈ No valid contract address found in config/env. Auto-deploying a new instance...")
|
| 63 |
+
try:
|
| 64 |
+
from src.dynamic_compiler import get_contract_interface
|
| 65 |
+
abi, bytecode = get_contract_interface()
|
| 66 |
+
|
| 67 |
+
Contract = self.w3.eth.contract(abi=abi, bytecode=bytecode)
|
| 68 |
+
tx = Contract.constructor().build_transaction({
|
| 69 |
+
'from': self.account.address,
|
| 70 |
+
'nonce': self.w3.eth.get_transaction_count(self.account.address),
|
| 71 |
+
'gas': 3000000,
|
| 72 |
+
'gasPrice': self.w3.eth.gas_price,
|
| 73 |
+
'chainId': getattr(self.config, 'PURECHAIN_ID', 900520900520)
|
| 74 |
+
})
|
| 75 |
+
signed_tx = self.w3.eth.account.sign_transaction(tx, self.config.PRIVATE_KEY)
|
| 76 |
+
tx_hash = self.w3.eth.send_raw_transaction(signed_tx.rawTransaction)
|
| 77 |
+
print("β³ Deploying contract... waiting for receipt.")
|
| 78 |
+
tx_receipt = self.w3.eth.wait_for_transaction_receipt(tx_hash)
|
| 79 |
+
|
| 80 |
+
new_address = tx_receipt.contractAddress
|
| 81 |
+
print(f"π CONTRACT DEPLOYED DYNAMICALLY AT: {new_address}")
|
| 82 |
+
|
| 83 |
+
# Set it in memory for this session
|
| 84 |
+
self.config.PURECHAIN_CONTRACT_ADDRESS = new_address
|
| 85 |
+
os.environ["PURECHAIN_CONTRACT_ADDRESS"] = new_address
|
| 86 |
+
# Also inject into config object dynamically
|
| 87 |
+
self.config.CONTRACT_ABI = abi
|
| 88 |
+
except Exception as de:
|
| 89 |
+
print(f"β Auto-deploy failed: {de}")
|
| 90 |
else:
|
| 91 |
print(f"β οΈ Failed to connect to node at {self.config.PURECHAIN_RPC_URL}")
|
| 92 |
except Exception as e:
|
|
|
|
| 601 |
if not cid: return "β Failed to pin file to IPFS."
|
| 602 |
|
| 603 |
# 2. Mint Backup to PureChain
|
| 604 |
+
contract = self.w3.eth.contract(address=self.config.PURECHAIN_CONTRACT_ADDRESS, abi=self.config.CONTRACT_ABI)
|
| 605 |
nonce = self.w3.eth.get_transaction_count(self.account.address, 'pending')
|
| 606 |
|
| 607 |
# Using your contract's createBackup(string _key, string _type, string _cid, string _desc)
|