@enclave-e3/contracts 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -2
- package/artifacts/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol/ProxyAdmin.json +135 -0
- package/artifacts/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol/artifacts.d.ts +27 -0
- package/artifacts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/ITransparentUpgradeableProxy.json +77 -0
- package/artifacts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.json +126 -0
- package/artifacts/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/artifacts.d.ts +43 -0
- package/artifacts/build-info/solc-0_8_28-5150b9e6b6cf4df4986fccba97bea37a16fdfebc.json +311 -0
- package/artifacts/build-info/solc-0_8_28-5150b9e6b6cf4df4986fccba97bea37a16fdfebc.output.json +1 -0
- package/artifacts/contracts/Enclave.sol/Enclave.json +239 -147
- package/artifacts/contracts/Enclave.sol/artifacts.d.ts +6 -6
- package/artifacts/contracts/interfaces/IBondingRegistry.sol/IBondingRegistry.json +881 -0
- package/artifacts/contracts/interfaces/IBondingRegistry.sol/artifacts.d.ts +27 -0
- package/artifacts/contracts/interfaces/ICiphernodeRegistry.sol/ICiphernodeRegistry.json +326 -10
- package/artifacts/contracts/interfaces/ICiphernodeRegistry.sol/artifacts.d.ts +2 -2
- package/artifacts/contracts/interfaces/IComputeProvider.sol/IComputeProvider.json +1 -1
- package/artifacts/contracts/interfaces/IComputeProvider.sol/artifacts.d.ts +1 -1
- package/artifacts/contracts/interfaces/IDecryptionVerifier.sol/IDecryptionVerifier.json +1 -1
- package/artifacts/contracts/interfaces/IDecryptionVerifier.sol/artifacts.d.ts +1 -1
- package/artifacts/contracts/interfaces/IE3Program.sol/IE3Program.json +21 -3
- package/artifacts/contracts/interfaces/IE3Program.sol/artifacts.d.ts +2 -2
- package/artifacts/contracts/interfaces/IEnclave.sol/IEnclave.json +247 -27
- package/artifacts/contracts/interfaces/IEnclave.sol/artifacts.d.ts +2 -2
- package/artifacts/contracts/interfaces/{IRegistryFilter.sol/IRegistryFilter.json → ISlashVerifier.sol/ISlashVerifier.json} +10 -10
- package/artifacts/contracts/interfaces/ISlashVerifier.sol/artifacts.d.ts +27 -0
- package/artifacts/contracts/interfaces/ISlashingManager.sol/ISlashingManager.json +759 -0
- package/artifacts/contracts/interfaces/ISlashingManager.sol/artifacts.d.ts +27 -0
- package/artifacts/contracts/lib/ExitQueueLib.sol/ExitQueueLib.json +116 -0
- package/artifacts/contracts/lib/ExitQueueLib.sol/artifacts.d.ts +27 -0
- package/artifacts/contracts/registry/BondingRegistry.sol/BondingRegistry.json +1217 -0
- package/artifacts/contracts/registry/BondingRegistry.sol/artifacts.d.ts +27 -0
- package/artifacts/contracts/registry/CiphernodeRegistryOwnable.sol/CiphernodeRegistryOwnable.json +351 -57
- package/artifacts/contracts/registry/CiphernodeRegistryOwnable.sol/artifacts.d.ts +6 -6
- package/artifacts/contracts/slashing/SlashingManager.sol/SlashingManager.json +1107 -0
- package/artifacts/contracts/slashing/SlashingManager.sol/artifacts.d.ts +27 -0
- package/artifacts/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry.json +328 -12
- package/artifacts/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey.json +328 -12
- package/artifacts/contracts/test/MockCiphernodeRegistry.sol/artifacts.d.ts +8 -8
- package/artifacts/contracts/test/MockComputeProvider.sol/MockComputeProvider.json +4 -4
- package/artifacts/contracts/test/MockComputeProvider.sol/artifacts.d.ts +4 -4
- package/artifacts/contracts/test/MockDecryptionVerifier.sol/MockDecryptionVerifier.json +3 -3
- package/artifacts/contracts/test/MockDecryptionVerifier.sol/artifacts.d.ts +3 -3
- package/artifacts/contracts/test/MockE3Program.sol/MockE3Program.json +26 -32
- package/artifacts/contracts/test/MockE3Program.sol/artifacts.d.ts +4 -4
- package/artifacts/contracts/test/MockSlashingVerifier.sol/MockSlashingVerifier.json +38 -0
- package/artifacts/contracts/test/MockSlashingVerifier.sol/artifacts.d.ts +27 -0
- package/artifacts/contracts/test/MockStableToken.sol/MockUSDC.json +425 -0
- package/artifacts/contracts/test/MockStableToken.sol/artifacts.d.ts +27 -0
- package/artifacts/contracts/token/EnclaveTicketToken.sol/EnclaveTicketToken.json +1222 -0
- package/artifacts/contracts/token/EnclaveTicketToken.sol/artifacts.d.ts +27 -0
- package/artifacts/contracts/token/EnclaveToken.sol/EnclaveToken.json +1460 -0
- package/artifacts/contracts/token/EnclaveToken.sol/artifacts.d.ts +27 -0
- package/artifacts/poseidon-solidity/PoseidonT3.sol/PoseidonT3.json +3 -3
- package/artifacts/poseidon-solidity/PoseidonT3.sol/artifacts.d.ts +3 -3
- package/contracts/Enclave.sol +230 -81
- package/contracts/interfaces/IBondingRegistry.sol +446 -0
- package/contracts/interfaces/ICiphernodeRegistry.sol +153 -9
- package/contracts/interfaces/IComputeProvider.sol +12 -2
- package/contracts/interfaces/IDecryptionVerifier.sol +11 -6
- package/contracts/interfaces/IE3.sol +21 -17
- package/contracts/interfaces/IE3Program.sol +30 -17
- package/contracts/interfaces/IEnclave.sol +95 -21
- package/contracts/interfaces/ISlashVerifier.sol +23 -0
- package/contracts/interfaces/ISlashingManager.sol +426 -0
- package/contracts/lib/ExitQueueLib.sol +490 -0
- package/contracts/registry/BondingRegistry.sol +737 -0
- package/contracts/registry/CiphernodeRegistryOwnable.sol +393 -26
- package/contracts/slashing/SlashingManager.sol +367 -0
- package/contracts/test/MockCiphernodeRegistry.sol +118 -24
- package/contracts/test/MockComputeProvider.sol +2 -2
- package/contracts/test/MockE3Program.sol +17 -14
- package/contracts/test/MockSlashingVerifier.sol +19 -0
- package/contracts/test/MockStableToken.sol +28 -0
- package/contracts/token/EnclaveTicketToken.sol +243 -0
- package/contracts/token/EnclaveToken.sol +267 -0
- package/dist/hardhat.config.d.ts.map +1 -1
- package/dist/hardhat.config.js +35 -16
- package/dist/ignition/modules/{mockInputValidator.d.ts → bondingRegistry.d.ts} +1 -1
- package/dist/ignition/modules/bondingRegistry.d.ts.map +1 -0
- package/dist/ignition/modules/bondingRegistry.js +35 -0
- package/dist/ignition/modules/ciphernodeRegistry.d.ts.map +1 -1
- package/dist/ignition/modules/ciphernodeRegistry.js +12 -2
- package/dist/ignition/modules/enclave.d.ts.map +1 -1
- package/dist/ignition/modules/enclave.js +16 -7
- package/dist/ignition/modules/{naiveRegistryFilter.d.ts → enclaveTicketToken.d.ts} +1 -1
- package/dist/ignition/modules/enclaveTicketToken.d.ts.map +1 -0
- package/dist/ignition/modules/enclaveTicketToken.js +17 -0
- package/dist/ignition/modules/enclaveToken.d.ts +3 -0
- package/dist/ignition/modules/enclaveToken.d.ts.map +1 -0
- package/dist/ignition/modules/{mockInputValidator.js → enclaveToken.js} +4 -4
- package/dist/ignition/modules/mockCiphernodeRegistry.d.ts.map +1 -1
- package/dist/ignition/modules/mockCiphernodeRegistry.js +0 -1
- package/dist/ignition/modules/mockCiphernodeRegistryEmptyKey.d.ts.map +1 -1
- package/dist/ignition/modules/mockCiphernodeRegistryEmptyKey.js +0 -1
- package/dist/ignition/modules/mockComputeProvider.d.ts.map +1 -1
- package/dist/ignition/modules/mockComputeProvider.js +0 -1
- package/dist/ignition/modules/mockDecryptionVerifier.d.ts.map +1 -1
- package/dist/ignition/modules/mockDecryptionVerifier.js +0 -1
- package/dist/ignition/modules/mockE3Program.d.ts.map +1 -1
- package/dist/ignition/modules/mockE3Program.js +1 -3
- package/dist/ignition/modules/mockSlashingVerifier.d.ts +3 -0
- package/dist/ignition/modules/mockSlashingVerifier.d.ts.map +1 -0
- package/dist/ignition/modules/mockSlashingVerifier.js +10 -0
- package/dist/ignition/modules/mockStableToken.d.ts +3 -0
- package/dist/ignition/modules/mockStableToken.d.ts.map +1 -0
- package/dist/ignition/modules/mockStableToken.js +11 -0
- package/dist/ignition/modules/poseidonT3.d.ts.map +1 -1
- package/dist/ignition/modules/poseidonT3.js +0 -1
- package/dist/ignition/modules/slashingManager.d.ts +3 -0
- package/dist/ignition/modules/slashingManager.d.ts.map +1 -0
- package/dist/ignition/modules/slashingManager.js +16 -0
- package/dist/scripts/cleanIgnitionState.d.ts +12 -0
- package/dist/scripts/cleanIgnitionState.d.ts.map +1 -0
- package/dist/scripts/cleanIgnitionState.js +41 -0
- package/dist/scripts/deployAndSave/bondingRegistry.d.ts +38 -0
- package/dist/scripts/deployAndSave/bondingRegistry.d.ts.map +1 -0
- package/dist/scripts/deployAndSave/bondingRegistry.js +133 -0
- package/dist/scripts/deployAndSave/ciphernodeRegistryOwnable.d.ts +11 -1
- package/dist/scripts/deployAndSave/ciphernodeRegistryOwnable.d.ts.map +1 -1
- package/dist/scripts/deployAndSave/ciphernodeRegistryOwnable.js +76 -19
- package/dist/scripts/deployAndSave/enclave.d.ts +16 -2
- package/dist/scripts/deployAndSave/enclave.d.ts.map +1 -1
- package/dist/scripts/deployAndSave/enclave.js +89 -22
- package/dist/scripts/deployAndSave/enclaveTicketToken.d.ts +20 -0
- package/dist/scripts/deployAndSave/enclaveTicketToken.d.ts.map +1 -0
- package/dist/scripts/deployAndSave/enclaveTicketToken.js +41 -0
- package/dist/scripts/deployAndSave/enclaveToken.d.ts +18 -0
- package/dist/scripts/deployAndSave/enclaveToken.d.ts.map +1 -0
- package/dist/scripts/deployAndSave/enclaveToken.js +57 -0
- package/dist/scripts/deployAndSave/mockComputeProvider.d.ts.map +1 -1
- package/dist/scripts/deployAndSave/mockComputeProvider.js +5 -5
- package/dist/scripts/deployAndSave/mockDecryptionVerifier.d.ts.map +1 -1
- package/dist/scripts/deployAndSave/mockDecryptionVerifier.js +5 -5
- package/dist/scripts/deployAndSave/mockProgram.d.ts +1 -2
- package/dist/scripts/deployAndSave/mockProgram.d.ts.map +1 -1
- package/dist/scripts/deployAndSave/mockProgram.js +7 -19
- package/dist/scripts/deployAndSave/mockStableToken.d.ts +18 -0
- package/dist/scripts/deployAndSave/mockStableToken.d.ts.map +1 -0
- package/dist/scripts/deployAndSave/mockStableToken.js +36 -0
- package/dist/scripts/deployAndSave/poseidonT3.d.ts +11 -0
- package/dist/scripts/deployAndSave/poseidonT3.d.ts.map +1 -0
- package/dist/scripts/deployAndSave/poseidonT3.js +41 -0
- package/dist/scripts/deployAndSave/slashingManager.d.ts +19 -0
- package/dist/scripts/deployAndSave/slashingManager.d.ts.map +1 -0
- package/dist/scripts/deployAndSave/slashingManager.js +38 -0
- package/dist/scripts/deployEnclave.d.ts.map +1 -1
- package/dist/scripts/deployEnclave.js +109 -23
- package/dist/scripts/deployMocks.d.ts +0 -1
- package/dist/scripts/deployMocks.d.ts.map +1 -1
- package/dist/scripts/deployMocks.js +3 -6
- package/dist/scripts/index.d.ts +7 -2
- package/dist/scripts/index.d.ts.map +1 -1
- package/dist/scripts/index.js +7 -2
- package/dist/scripts/proxy.d.ts +22 -0
- package/dist/scripts/proxy.d.ts.map +1 -0
- package/dist/scripts/proxy.js +36 -0
- package/dist/scripts/runVerification.d.ts +2 -0
- package/dist/scripts/runVerification.d.ts.map +1 -0
- package/dist/scripts/runVerification.js +16 -0
- package/dist/scripts/upgrade/bondingRegistry.d.ts +6 -0
- package/dist/scripts/upgrade/bondingRegistry.d.ts.map +1 -0
- package/dist/scripts/upgrade/bondingRegistry.js +49 -0
- package/dist/scripts/upgrade/ciphernodeRegistryOwnable.d.ts +6 -0
- package/dist/scripts/upgrade/ciphernodeRegistryOwnable.d.ts.map +1 -0
- package/dist/scripts/upgrade/ciphernodeRegistryOwnable.js +52 -0
- package/dist/scripts/upgrade/enclave.d.ts +6 -0
- package/dist/scripts/upgrade/enclave.d.ts.map +1 -0
- package/dist/scripts/upgrade/enclave.js +49 -0
- package/dist/scripts/utils.d.ts +51 -2
- package/dist/scripts/utils.d.ts.map +1 -1
- package/dist/scripts/utils.js +67 -4
- package/dist/scripts/verify.d.ts +6 -0
- package/dist/scripts/verify.d.ts.map +1 -0
- package/dist/scripts/verify.js +142 -0
- package/dist/tasks/ciphernode.d.ts +2 -0
- package/dist/tasks/ciphernode.d.ts.map +1 -1
- package/dist/tasks/ciphernode.js +290 -19
- package/dist/tasks/enclave.d.ts.map +1 -1
- package/dist/tasks/enclave.js +76 -31
- package/dist/test/Enclave.spec.js +377 -370
- package/dist/test/Registry/BondingRegistry.spec.d.ts +2 -0
- package/dist/test/Registry/BondingRegistry.spec.d.ts.map +1 -0
- package/dist/test/Registry/BondingRegistry.spec.js +684 -0
- package/dist/test/Registry/CiphernodeRegistryOwnable.spec.d.ts.map +1 -0
- package/dist/test/Registry/CiphernodeRegistryOwnable.spec.js +374 -0
- package/dist/test/Slashing/SlashingManager.spec.d.ts +2 -0
- package/dist/test/Slashing/SlashingManager.spec.d.ts.map +1 -0
- package/dist/test/Slashing/SlashingManager.spec.js +672 -0
- package/dist/types/@openzeppelin/contracts/index.d.ts +3 -0
- package/dist/types/@openzeppelin/contracts/index.d.ts.map +1 -0
- package/dist/types/@openzeppelin/contracts/proxy/index.d.ts +3 -0
- package/dist/types/@openzeppelin/contracts/proxy/index.d.ts.map +1 -0
- package/dist/types/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.d.ts +97 -0
- package/dist/types/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.d.ts.map +1 -0
- package/dist/types/{contracts/registry/NaiveRegistryFilter.js → @openzeppelin/contracts/proxy/transparent/ProxyAdmin.js} +0 -4
- package/dist/types/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/ITransparentUpgradeableProxy.d.ts +81 -0
- package/dist/types/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/ITransparentUpgradeableProxy.d.ts.map +1 -0
- package/dist/types/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/ITransparentUpgradeableProxy.js +12 -0
- package/dist/types/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.d.ts +52 -0
- package/dist/types/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.d.ts.map +1 -0
- package/dist/types/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.js +8 -0
- package/dist/types/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/index.d.ts +3 -0
- package/dist/types/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/index.d.ts.map +1 -0
- package/dist/types/@openzeppelin/contracts/proxy/transparent/index.d.ts +4 -0
- package/dist/types/@openzeppelin/contracts/proxy/transparent/index.d.ts.map +1 -0
- package/dist/types/@openzeppelin/index.d.ts +3 -0
- package/dist/types/@openzeppelin/index.d.ts.map +1 -0
- package/dist/types/contracts/Enclave.d.ts +126 -53
- package/dist/types/contracts/Enclave.d.ts.map +1 -1
- package/dist/types/contracts/Enclave.js +12 -0
- package/dist/types/contracts/index.d.ts +6 -0
- package/dist/types/contracts/index.d.ts.map +1 -1
- package/dist/types/contracts/interfaces/IBondingRegistry.d.ts +622 -0
- package/dist/types/contracts/interfaces/IBondingRegistry.d.ts.map +1 -0
- package/dist/types/contracts/interfaces/IBondingRegistry.js +24 -0
- package/dist/types/contracts/interfaces/ICiphernodeRegistry.d.ts +245 -15
- package/dist/types/contracts/interfaces/ICiphernodeRegistry.d.ts.map +1 -1
- package/dist/types/contracts/interfaces/ICiphernodeRegistry.js +16 -0
- package/dist/types/contracts/interfaces/IE3Program.d.ts +20 -10
- package/dist/types/contracts/interfaces/IE3Program.d.ts.map +1 -1
- package/dist/types/contracts/interfaces/IEnclave.d.ts +149 -20
- package/dist/types/contracts/interfaces/IEnclave.d.ts.map +1 -1
- package/dist/types/contracts/interfaces/IEnclave.js +12 -0
- package/dist/types/contracts/interfaces/{IRegistryFilter.d.ts → ISlashVerifier.d.ts} +16 -16
- package/dist/types/contracts/interfaces/ISlashVerifier.d.ts.map +1 -0
- package/dist/types/contracts/interfaces/ISlashVerifier.js +1 -0
- package/dist/types/contracts/interfaces/ISlashingManager.d.ts +384 -0
- package/dist/types/contracts/interfaces/ISlashingManager.d.ts.map +1 -0
- package/dist/types/contracts/interfaces/ISlashingManager.js +24 -0
- package/dist/types/contracts/interfaces/index.d.ts +3 -2
- package/dist/types/contracts/interfaces/index.d.ts.map +1 -1
- package/dist/types/contracts/lib/ExitQueueLib.d.ts +73 -0
- package/dist/types/contracts/lib/ExitQueueLib.d.ts.map +1 -0
- package/dist/types/contracts/lib/ExitQueueLib.js +12 -0
- package/dist/types/contracts/lib/index.d.ts +2 -0
- package/dist/types/contracts/lib/index.d.ts.map +1 -0
- package/dist/types/contracts/lib/index.js +1 -0
- package/dist/types/contracts/registry/BondingRegistry.d.ts +821 -0
- package/dist/types/contracts/registry/BondingRegistry.d.ts.map +1 -0
- package/dist/types/contracts/registry/BondingRegistry.js +44 -0
- package/dist/types/contracts/registry/CiphernodeRegistryOwnable.d.ts +194 -34
- package/dist/types/contracts/registry/CiphernodeRegistryOwnable.d.ts.map +1 -1
- package/dist/types/contracts/registry/CiphernodeRegistryOwnable.js +20 -0
- package/dist/types/contracts/registry/index.d.ts +1 -1
- package/dist/types/contracts/registry/index.d.ts.map +1 -1
- package/dist/types/contracts/slashing/SlashingManager.d.ts +592 -0
- package/dist/types/contracts/slashing/SlashingManager.d.ts.map +1 -0
- package/dist/types/contracts/slashing/SlashingManager.js +36 -0
- package/dist/types/contracts/slashing/index.d.ts +2 -0
- package/dist/types/contracts/slashing/index.d.ts.map +1 -0
- package/dist/types/contracts/slashing/index.js +1 -0
- package/dist/types/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry.d.ts +247 -17
- package/dist/types/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry.d.ts.map +1 -1
- package/dist/types/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry.js +16 -0
- package/dist/types/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey.d.ts +247 -17
- package/dist/types/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey.d.ts.map +1 -1
- package/dist/types/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey.js +16 -0
- package/dist/types/contracts/test/MockE3Program.d.ts +20 -14
- package/dist/types/contracts/test/MockE3Program.d.ts.map +1 -1
- package/dist/types/contracts/test/{MockInputValidator.d.ts → MockSlashingVerifier.d.ts} +15 -15
- package/dist/types/contracts/test/MockSlashingVerifier.d.ts.map +1 -0
- package/dist/types/contracts/test/MockSlashingVerifier.js +1 -0
- package/dist/types/contracts/test/MockStableToken.sol/MockUSDC.d.ts +227 -0
- package/dist/types/contracts/test/MockStableToken.sol/MockUSDC.d.ts.map +1 -0
- package/dist/types/contracts/test/MockStableToken.sol/MockUSDC.js +12 -0
- package/dist/types/contracts/test/MockStableToken.sol/index.d.ts +2 -0
- package/dist/types/contracts/test/MockStableToken.sol/index.d.ts.map +1 -0
- package/dist/types/contracts/test/MockStableToken.sol/index.js +1 -0
- package/dist/types/contracts/test/index.d.ts +3 -3
- package/dist/types/contracts/test/index.d.ts.map +1 -1
- package/dist/types/contracts/token/EnclaveTicketToken.d.ts +574 -0
- package/dist/types/contracts/token/EnclaveTicketToken.d.ts.map +1 -0
- package/dist/types/contracts/token/EnclaveTicketToken.js +24 -0
- package/dist/types/contracts/token/EnclaveToken.d.ts +775 -0
- package/dist/types/contracts/token/EnclaveToken.d.ts.map +1 -0
- package/dist/types/contracts/token/EnclaveToken.js +48 -0
- package/dist/types/contracts/token/index.d.ts +3 -0
- package/dist/types/contracts/token/index.d.ts.map +1 -0
- package/dist/types/contracts/token/index.js +1 -0
- package/dist/types/factories/@openzeppelin/contracts/index.d.ts +2 -0
- package/dist/types/factories/@openzeppelin/contracts/index.d.ts.map +1 -0
- package/dist/types/factories/@openzeppelin/contracts/index.js +4 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/index.d.ts +2 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/index.d.ts.map +1 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/index.js +4 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/ProxyAdmin__factory.d.ts +118 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/ProxyAdmin__factory.d.ts.map +1 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/ProxyAdmin__factory.js +157 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/ITransparentUpgradeableProxy__factory.d.ts +57 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/ITransparentUpgradeableProxy__factory.d.ts.map +1 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/ITransparentUpgradeableProxy__factory.js +78 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy__factory.d.ts +105 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy__factory.d.ts.map +1 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy__factory.js +141 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/index.d.ts +3 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/index.d.ts.map +1 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/index.js +5 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/index.d.ts +3 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/index.d.ts.map +1 -0
- package/dist/types/factories/@openzeppelin/contracts/proxy/transparent/index.js +5 -0
- package/dist/types/factories/@openzeppelin/index.d.ts +2 -0
- package/dist/types/factories/@openzeppelin/index.d.ts.map +1 -0
- package/dist/types/factories/@openzeppelin/index.js +4 -0
- package/dist/types/factories/contracts/Enclave__factory.d.ts +190 -104
- package/dist/types/factories/contracts/Enclave__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/Enclave__factory.js +241 -134
- package/dist/types/factories/contracts/index.d.ts +3 -0
- package/dist/types/factories/contracts/index.d.ts.map +1 -1
- package/dist/types/factories/contracts/index.js +3 -0
- package/dist/types/factories/contracts/interfaces/IBondingRegistry__factory.d.ts +678 -0
- package/dist/types/factories/contracts/interfaces/IBondingRegistry__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/interfaces/IBondingRegistry__factory.js +882 -0
- package/dist/types/factories/contracts/interfaces/ICiphernodeRegistry__factory.d.ts +253 -9
- package/dist/types/factories/contracts/interfaces/ICiphernodeRegistry__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/interfaces/ICiphernodeRegistry__factory.js +325 -9
- package/dist/types/factories/contracts/interfaces/IE3Program__factory.d.ts +16 -2
- package/dist/types/factories/contracts/interfaces/IE3Program__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/interfaces/IE3Program__factory.js +20 -2
- package/dist/types/factories/contracts/interfaces/IEnclave__factory.d.ts +190 -24
- package/dist/types/factories/contracts/interfaces/IEnclave__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/interfaces/IEnclave__factory.js +246 -26
- package/dist/types/factories/contracts/interfaces/ISlashVerifier__factory.d.ts +26 -0
- package/dist/types/factories/contracts/interfaces/ISlashVerifier__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/interfaces/{IRegistryFilter__factory.js → ISlashVerifier__factory.js} +7 -7
- package/dist/types/factories/contracts/interfaces/ISlashingManager__factory.d.ts +594 -0
- package/dist/types/factories/contracts/interfaces/ISlashingManager__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/interfaces/ISlashingManager__factory.js +760 -0
- package/dist/types/factories/contracts/interfaces/index.d.ts +3 -2
- package/dist/types/factories/contracts/interfaces/index.d.ts.map +1 -1
- package/dist/types/factories/contracts/interfaces/index.js +3 -2
- package/dist/types/factories/contracts/lib/ExitQueueLib__factory.d.ts +107 -0
- package/dist/types/factories/contracts/lib/ExitQueueLib__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/lib/ExitQueueLib__factory.js +138 -0
- package/dist/types/factories/contracts/lib/index.d.ts +2 -0
- package/dist/types/factories/contracts/lib/index.d.ts.map +1 -0
- package/dist/types/factories/contracts/lib/index.js +4 -0
- package/dist/types/factories/contracts/registry/BondingRegistry__factory.d.ts +958 -0
- package/dist/types/factories/contracts/registry/BondingRegistry__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/registry/BondingRegistry__factory.js +1239 -0
- package/dist/types/factories/contracts/registry/CiphernodeRegistryOwnable__factory.d.ts +272 -40
- package/dist/types/factories/contracts/registry/CiphernodeRegistryOwnable__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/registry/CiphernodeRegistryOwnable__factory.js +343 -49
- package/dist/types/factories/contracts/registry/index.d.ts +1 -1
- package/dist/types/factories/contracts/registry/index.d.ts.map +1 -1
- package/dist/types/factories/contracts/registry/index.js +1 -1
- package/dist/types/factories/contracts/slashing/SlashingManager__factory.d.ts +879 -0
- package/dist/types/factories/contracts/slashing/SlashingManager__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/slashing/SlashingManager__factory.js +1129 -0
- package/dist/types/factories/contracts/slashing/index.d.ts +2 -0
- package/dist/types/factories/contracts/slashing/index.d.ts.map +1 -0
- package/dist/types/factories/contracts/slashing/index.js +4 -0
- package/dist/types/factories/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey__factory.d.ts +254 -10
- package/dist/types/factories/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistryEmptyKey__factory.js +326 -10
- package/dist/types/factories/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry__factory.d.ts +254 -10
- package/dist/types/factories/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/test/MockCiphernodeRegistry.sol/MockCiphernodeRegistry__factory.js +326 -10
- package/dist/types/factories/contracts/test/MockComputeProvider__factory.d.ts +2 -2
- package/dist/types/factories/contracts/test/MockComputeProvider__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/test/MockComputeProvider__factory.js +2 -2
- package/dist/types/factories/contracts/test/MockDecryptionVerifier__factory.d.ts +1 -1
- package/dist/types/factories/contracts/test/MockDecryptionVerifier__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/test/MockDecryptionVerifier__factory.js +1 -1
- package/dist/types/factories/contracts/test/MockE3Program__factory.d.ts +23 -27
- package/dist/types/factories/contracts/test/MockE3Program__factory.d.ts.map +1 -1
- package/dist/types/factories/contracts/test/MockE3Program__factory.js +28 -34
- package/dist/types/factories/contracts/test/MockSlashingVerifier__factory.d.ts +43 -0
- package/dist/types/factories/contracts/test/MockSlashingVerifier__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/test/MockSlashingVerifier__factory.js +60 -0
- package/dist/types/factories/contracts/test/MockStableToken.sol/MockUSDC__factory.d.ts +338 -0
- package/dist/types/factories/contracts/test/MockStableToken.sol/MockUSDC__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/test/MockStableToken.sol/MockUSDC__factory.js +447 -0
- package/dist/types/factories/contracts/test/MockStableToken.sol/index.d.ts +2 -0
- package/dist/types/factories/contracts/test/MockStableToken.sol/index.d.ts.map +1 -0
- package/dist/types/factories/contracts/test/MockStableToken.sol/index.js +4 -0
- package/dist/types/factories/contracts/test/index.d.ts +2 -2
- package/dist/types/factories/contracts/test/index.d.ts.map +1 -1
- package/dist/types/factories/contracts/test/index.js +2 -2
- package/dist/types/factories/contracts/token/EnclaveTicketToken__factory.d.ts +894 -0
- package/dist/types/factories/contracts/token/EnclaveTicketToken__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/token/EnclaveTicketToken__factory.js +1175 -0
- package/dist/types/factories/contracts/token/EnclaveToken__factory.d.ts +1101 -0
- package/dist/types/factories/contracts/token/EnclaveToken__factory.d.ts.map +1 -0
- package/dist/types/factories/contracts/token/EnclaveToken__factory.js +1439 -0
- package/dist/types/factories/contracts/token/index.d.ts +3 -0
- package/dist/types/factories/contracts/token/index.d.ts.map +1 -0
- package/dist/types/factories/contracts/token/index.js +5 -0
- package/dist/types/factories/index.d.ts +1 -0
- package/dist/types/factories/index.d.ts.map +1 -1
- package/dist/types/factories/index.js +1 -0
- package/dist/types/factories/poseidon-solidity/PoseidonT3__factory.d.ts +1 -1
- package/dist/types/factories/poseidon-solidity/PoseidonT3__factory.d.ts.map +1 -1
- package/dist/types/factories/poseidon-solidity/PoseidonT3__factory.js +1 -1
- package/dist/types/index.d.ts +28 -12
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +13 -6
- package/package.json +30 -21
- package/LICENSE.md +0 -165
- package/artifacts/build-info/solc-0_8_27-9aea5e3f6e25811e781e96c22e8edaf1eb1a01c5.json +0 -130
- package/artifacts/build-info/solc-0_8_27-9aea5e3f6e25811e781e96c22e8edaf1eb1a01c5.output.json +0 -1
- package/artifacts/contracts/interfaces/IInputValidator.sol/IInputValidator.json +0 -38
- package/artifacts/contracts/interfaces/IInputValidator.sol/artifacts.d.ts +0 -27
- package/artifacts/contracts/interfaces/IRegistryFilter.sol/artifacts.d.ts +0 -27
- package/artifacts/contracts/registry/NaiveRegistryFilter.sol/NaiveRegistryFilter.json +0 -309
- package/artifacts/contracts/registry/NaiveRegistryFilter.sol/artifacts.d.ts +0 -27
- package/artifacts/contracts/test/MockInputValidator.sol/MockInputValidator.json +0 -43
- package/artifacts/contracts/test/MockInputValidator.sol/artifacts.d.ts +0 -27
- package/artifacts/contracts/test/MockRegistryFilter.sol/IRegistry.json +0 -37
- package/artifacts/contracts/test/MockRegistryFilter.sol/MockNaiveRegistryFilter.json +0 -262
- package/artifacts/contracts/test/MockRegistryFilter.sol/artifacts.d.ts +0 -43
- package/contracts/interfaces/IInputValidator.sol +0 -18
- package/contracts/interfaces/IRegistryFilter.sol +0 -13
- package/contracts/registry/NaiveRegistryFilter.sol +0 -124
- package/contracts/test/MockInputValidator.sol +0 -29
- package/contracts/test/MockRegistryFilter.sol +0 -117
- package/dist/ignition/modules/mockInputValidator.d.ts.map +0 -1
- package/dist/ignition/modules/naiveRegistryFilter.d.ts.map +0 -1
- package/dist/ignition/modules/naiveRegistryFilter.js +0 -16
- package/dist/scripts/deployAndSave/mockInputValidator.d.ts +0 -6
- package/dist/scripts/deployAndSave/mockInputValidator.d.ts.map +0 -1
- package/dist/scripts/deployAndSave/mockInputValidator.js +0 -18
- package/dist/scripts/deployAndSave/naiveRegistryFilter.d.ts +0 -11
- package/dist/scripts/deployAndSave/naiveRegistryFilter.d.ts.map +0 -1
- package/dist/scripts/deployAndSave/naiveRegistryFilter.js +0 -41
- package/dist/test/CiphernodeRegistry/CiphernodeRegistryOwnable.spec.d.ts.map +0 -1
- package/dist/test/CiphernodeRegistry/CiphernodeRegistryOwnable.spec.js +0 -279
- package/dist/test/CiphernodeRegistry/NaiveRegistryFilter.spec.d.ts +0 -2
- package/dist/test/CiphernodeRegistry/NaiveRegistryFilter.spec.d.ts.map +0 -1
- package/dist/test/CiphernodeRegistry/NaiveRegistryFilter.spec.js +0 -160
- package/dist/types/contracts/interfaces/IInputValidator.d.ts +0 -36
- package/dist/types/contracts/interfaces/IInputValidator.d.ts.map +0 -1
- package/dist/types/contracts/interfaces/IRegistryFilter.d.ts.map +0 -1
- package/dist/types/contracts/registry/NaiveRegistryFilter.d.ts +0 -187
- package/dist/types/contracts/registry/NaiveRegistryFilter.d.ts.map +0 -1
- package/dist/types/contracts/test/MockInputValidator.d.ts.map +0 -1
- package/dist/types/contracts/test/MockRegistryFilter.sol/IRegistry.d.ts +0 -38
- package/dist/types/contracts/test/MockRegistryFilter.sol/IRegistry.d.ts.map +0 -1
- package/dist/types/contracts/test/MockRegistryFilter.sol/MockNaiveRegistryFilter.d.ts +0 -163
- package/dist/types/contracts/test/MockRegistryFilter.sol/MockNaiveRegistryFilter.d.ts.map +0 -1
- package/dist/types/contracts/test/MockRegistryFilter.sol/MockNaiveRegistryFilter.js +0 -8
- package/dist/types/contracts/test/MockRegistryFilter.sol/index.d.ts +0 -3
- package/dist/types/contracts/test/MockRegistryFilter.sol/index.d.ts.map +0 -1
- package/dist/types/factories/contracts/interfaces/IInputValidator__factory.d.ts +0 -26
- package/dist/types/factories/contracts/interfaces/IInputValidator__factory.d.ts.map +0 -1
- package/dist/types/factories/contracts/interfaces/IInputValidator__factory.js +0 -39
- package/dist/types/factories/contracts/interfaces/IRegistryFilter__factory.d.ts +0 -26
- package/dist/types/factories/contracts/interfaces/IRegistryFilter__factory.d.ts.map +0 -1
- package/dist/types/factories/contracts/registry/NaiveRegistryFilter__factory.d.ts +0 -251
- package/dist/types/factories/contracts/registry/NaiveRegistryFilter__factory.d.ts.map +0 -1
- package/dist/types/factories/contracts/registry/NaiveRegistryFilter__factory.js +0 -331
- package/dist/types/factories/contracts/test/MockInputValidator__factory.d.ts +0 -47
- package/dist/types/factories/contracts/test/MockInputValidator__factory.d.ts.map +0 -1
- package/dist/types/factories/contracts/test/MockInputValidator__factory.js +0 -65
- package/dist/types/factories/contracts/test/MockRegistryFilter.sol/IRegistry__factory.d.ts +0 -26
- package/dist/types/factories/contracts/test/MockRegistryFilter.sol/IRegistry__factory.d.ts.map +0 -1
- package/dist/types/factories/contracts/test/MockRegistryFilter.sol/IRegistry__factory.js +0 -38
- package/dist/types/factories/contracts/test/MockRegistryFilter.sol/MockNaiveRegistryFilter__factory.d.ts +0 -216
- package/dist/types/factories/contracts/test/MockRegistryFilter.sol/MockNaiveRegistryFilter__factory.d.ts.map +0 -1
- package/dist/types/factories/contracts/test/MockRegistryFilter.sol/MockNaiveRegistryFilter__factory.js +0 -284
- package/dist/types/factories/contracts/test/MockRegistryFilter.sol/index.d.ts +0 -3
- package/dist/types/factories/contracts/test/MockRegistryFilter.sol/index.d.ts.map +0 -1
- package/dist/types/factories/contracts/test/MockRegistryFilter.sol/index.js +0 -5
- /package/dist/test/{CiphernodeRegistry → Registry}/CiphernodeRegistryOwnable.spec.d.ts +0 -0
- /package/dist/types/{contracts/test/MockRegistryFilter.sol → @openzeppelin/contracts}/index.js +0 -0
- /package/dist/types/{contracts/interfaces/IInputValidator.js → @openzeppelin/contracts/proxy/index.js} +0 -0
- /package/dist/types/{contracts/interfaces/IRegistryFilter.js → @openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol/index.js} +0 -0
- /package/dist/types/{contracts/test/MockInputValidator.js → @openzeppelin/contracts/proxy/transparent/index.js} +0 -0
- /package/dist/types/{contracts/test/MockRegistryFilter.sol/IRegistry.js → @openzeppelin/index.js} +0 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
|
+
//
|
|
3
|
+
// This file is provided WITHOUT ANY WARRANTY;
|
|
4
|
+
// without even the implied warranty of MERCHANTABILITY
|
|
5
|
+
// or FITNESS FOR A PARTICULAR PURPOSE.
|
|
6
|
+
pragma solidity ^0.8.27;
|
|
7
|
+
|
|
8
|
+
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
|
9
|
+
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
10
|
+
import {
|
|
11
|
+
SafeERC20
|
|
12
|
+
} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
13
|
+
import {
|
|
14
|
+
ERC20Wrapper
|
|
15
|
+
} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Wrapper.sol";
|
|
16
|
+
import {
|
|
17
|
+
ERC20Permit
|
|
18
|
+
} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";
|
|
19
|
+
import {
|
|
20
|
+
ERC20Votes
|
|
21
|
+
} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
|
|
22
|
+
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
|
|
23
|
+
import { Nonces } from "@openzeppelin/contracts/utils/Nonces.sol";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @title EnclaveTicketToken (ETK)
|
|
27
|
+
* @notice Non-transferable, non-delegatable ERC20Votes wrapper over a stablecoin for operator staking
|
|
28
|
+
* @dev ERC20 wrapper token that represents staked stablecoins (e.g., USDC, DAI) used for operator
|
|
29
|
+
* bonding in the Enclave protocol. Implements voting power tracking through ERC20Votes but
|
|
30
|
+
* prevents transfers between users and manual delegation. Deposits automatically delegate to
|
|
31
|
+
* self to enable voting power tracking. Only the designated registry contract can mint
|
|
32
|
+
* (deposit) and burn (withdraw) tokens.
|
|
33
|
+
*/
|
|
34
|
+
contract EnclaveTicketToken is
|
|
35
|
+
ERC20,
|
|
36
|
+
ERC20Permit,
|
|
37
|
+
ERC20Votes,
|
|
38
|
+
Ownable,
|
|
39
|
+
ERC20Wrapper
|
|
40
|
+
{
|
|
41
|
+
using SafeERC20 for IERC20;
|
|
42
|
+
// Custom errors
|
|
43
|
+
|
|
44
|
+
/// @notice Thrown when a function is called by an address other than the registry
|
|
45
|
+
error NotRegistry();
|
|
46
|
+
|
|
47
|
+
/// @notice Thrown when attempting to transfer tokens between non-zero addresses
|
|
48
|
+
error TransferNotAllowed();
|
|
49
|
+
|
|
50
|
+
/// @notice Thrown when a zero address is provided where a valid address is required
|
|
51
|
+
error ZeroAddress();
|
|
52
|
+
|
|
53
|
+
/// @notice Thrown when attempting to manually delegate voting power
|
|
54
|
+
error DelegationLocked();
|
|
55
|
+
|
|
56
|
+
/// @notice Address of the registry contract authorized to mint, burn, and manage ticket tokens
|
|
57
|
+
/// @dev Only this contract can call restricted functions like depositFor, withdrawTo, burnTickets, and payout
|
|
58
|
+
address public registry;
|
|
59
|
+
|
|
60
|
+
/// @notice Restricts function access to only the registry contract
|
|
61
|
+
/// @dev Reverts with NotRegistry if caller is not the registry address
|
|
62
|
+
modifier onlyRegistry() {
|
|
63
|
+
if (msg.sender != registry) revert NotRegistry();
|
|
64
|
+
_;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @notice Initializes the Enclave Ticket Token with name "Enclave Ticket Token" and symbol "ETK"
|
|
69
|
+
* @dev Sets up the token as an ERC20 wrapper around the provided base token (stablecoin).
|
|
70
|
+
* Initializes voting and permit functionality. The decimals will match the base token.
|
|
71
|
+
* @param baseToken The underlying ERC20 stablecoin to wrap (e.g., USDC, DAI)
|
|
72
|
+
* @param registry_ Address of the registry contract that will manage deposits and withdrawals
|
|
73
|
+
* @param initialOwner_ Address that will own the contract and can update the registry
|
|
74
|
+
*/
|
|
75
|
+
constructor(
|
|
76
|
+
IERC20 baseToken,
|
|
77
|
+
address registry_,
|
|
78
|
+
address initialOwner_
|
|
79
|
+
)
|
|
80
|
+
ERC20("Enclave Ticket Token", "ETK")
|
|
81
|
+
ERC20Permit("Enclave Ticket Token")
|
|
82
|
+
ERC20Wrapper(baseToken)
|
|
83
|
+
Ownable(initialOwner_)
|
|
84
|
+
{
|
|
85
|
+
setRegistry(registry_);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @notice Updates the registry contract address
|
|
90
|
+
* @dev Only callable by the contract owner. The new registry address cannot be zero.
|
|
91
|
+
* This function grants the new registry exclusive rights to mint, burn, and manage tokens.
|
|
92
|
+
* @param newRegistry Address of the new registry contract (must not be zero address)
|
|
93
|
+
*/
|
|
94
|
+
function setRegistry(address newRegistry) public onlyOwner {
|
|
95
|
+
require(newRegistry != address(0), ZeroAddress());
|
|
96
|
+
registry = newRegistry;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @notice Deposits underlying tokens from the registry and mints ticket tokens to an operator
|
|
101
|
+
* @dev Only callable by the registry contract. Transfers underlying tokens from the registry to
|
|
102
|
+
* this contract and mints an equivalent amount of ticket tokens. Automatically delegates
|
|
103
|
+
* voting power to the operator on their first deposit to enable voting power tracking.
|
|
104
|
+
* @param operator Address to receive the minted ticket tokens
|
|
105
|
+
* @param amount Number of underlying tokens to deposit and ticket tokens to mint
|
|
106
|
+
* @return success True if the deposit and minting succeeded
|
|
107
|
+
*/
|
|
108
|
+
function depositFor(
|
|
109
|
+
address operator,
|
|
110
|
+
uint256 amount
|
|
111
|
+
) public override onlyRegistry returns (bool success) {
|
|
112
|
+
success = super.depositFor(operator, amount);
|
|
113
|
+
|
|
114
|
+
// Auto-delegate on first deposit to track voting power
|
|
115
|
+
if (delegates(operator) == address(0)) {
|
|
116
|
+
_delegate(operator, operator);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @notice Deposits underlying tokens from a specified account and mints ticket tokens to another account
|
|
122
|
+
* @dev Only callable by the registry contract. Transfers underlying tokens from the 'from' address
|
|
123
|
+
* to this contract and mints ticket tokens to the 'to' address. Useful for scenarios where
|
|
124
|
+
* the source and destination differ. Automatically delegates voting power to recipient on
|
|
125
|
+
* their first deposit.
|
|
126
|
+
* @param from Address to transfer underlying tokens from (must have approved this contract)
|
|
127
|
+
* @param to Address to receive the minted ticket tokens
|
|
128
|
+
* @param amount Number of underlying tokens to deposit and ticket tokens to mint
|
|
129
|
+
* @return bool True if the deposit and minting succeeded
|
|
130
|
+
*/
|
|
131
|
+
function depositFrom(
|
|
132
|
+
address from,
|
|
133
|
+
address to,
|
|
134
|
+
uint256 amount
|
|
135
|
+
) external onlyRegistry returns (bool) {
|
|
136
|
+
SafeERC20.safeTransferFrom(
|
|
137
|
+
IERC20(address(underlying())),
|
|
138
|
+
from,
|
|
139
|
+
address(this),
|
|
140
|
+
amount
|
|
141
|
+
);
|
|
142
|
+
_mint(to, amount);
|
|
143
|
+
if (delegates(to) == address(0)) _delegate(to, to);
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @notice Burns ticket tokens from the registry and transfers underlying tokens to a receiver
|
|
149
|
+
* @dev Only callable by the registry contract. Burns ticket tokens from the registry's balance
|
|
150
|
+
* and transfers an equivalent amount of underlying tokens to the receiver address. Used
|
|
151
|
+
* when operators unstake their tokens.
|
|
152
|
+
* @param receiver Address to receive the underlying tokens
|
|
153
|
+
* @param amount Number of ticket tokens to burn and underlying tokens to transfer
|
|
154
|
+
* @return success True if the burn and transfer succeeded
|
|
155
|
+
*/
|
|
156
|
+
function withdrawTo(
|
|
157
|
+
address receiver,
|
|
158
|
+
uint256 amount
|
|
159
|
+
) public override onlyRegistry returns (bool success) {
|
|
160
|
+
return super.withdrawTo(receiver, amount);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* @notice Burns ticket tokens from an operator's balance without transferring underlying tokens
|
|
165
|
+
* @dev Only callable by the registry contract. Used for slashing or penalizing operators where
|
|
166
|
+
* the underlying tokens should remain in the contract or be handled separately. Does not
|
|
167
|
+
* return underlying tokens to the operator.
|
|
168
|
+
* @param operator Address whose ticket tokens will be burned
|
|
169
|
+
* @param amount Number of ticket tokens to burn from the operator's balance
|
|
170
|
+
*/
|
|
171
|
+
function burnTickets(
|
|
172
|
+
address operator,
|
|
173
|
+
uint256 amount
|
|
174
|
+
) external onlyRegistry {
|
|
175
|
+
_burn(operator, amount);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* @notice Transfer underlying tokens to an address without burning ticket tokens.
|
|
180
|
+
* @dev Only callable by the registry contract.
|
|
181
|
+
* @param to Address to payout to.
|
|
182
|
+
* @param amount Amount of ticket tokens to payout.
|
|
183
|
+
*/
|
|
184
|
+
function payout(address to, uint256 amount) external onlyRegistry {
|
|
185
|
+
SafeERC20.safeTransfer(IERC20(address(underlying())), to, amount);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* @dev Override ERC20Votes update hook to prevent transfers between users.
|
|
190
|
+
*/
|
|
191
|
+
function _update(
|
|
192
|
+
address from,
|
|
193
|
+
address to,
|
|
194
|
+
uint256 value
|
|
195
|
+
) internal override(ERC20, ERC20Votes) {
|
|
196
|
+
if (from != address(0) && to != address(0)) {
|
|
197
|
+
revert TransferNotAllowed();
|
|
198
|
+
}
|
|
199
|
+
super._update(from, to, value);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* @dev Prevent delegation of voting power.
|
|
204
|
+
*/
|
|
205
|
+
function delegate(address) public pure override {
|
|
206
|
+
revert DelegationLocked();
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* @dev Prevent delegation of voting power via signature.
|
|
211
|
+
*/
|
|
212
|
+
function delegateBySig(
|
|
213
|
+
address,
|
|
214
|
+
uint256,
|
|
215
|
+
uint256,
|
|
216
|
+
uint8,
|
|
217
|
+
bytes32,
|
|
218
|
+
bytes32
|
|
219
|
+
) public pure override {
|
|
220
|
+
revert DelegationLocked();
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* @dev Expose decimals from the underlying token.
|
|
225
|
+
*/
|
|
226
|
+
function decimals()
|
|
227
|
+
public
|
|
228
|
+
view
|
|
229
|
+
override(ERC20, ERC20Wrapper)
|
|
230
|
+
returns (uint8)
|
|
231
|
+
{
|
|
232
|
+
return super.decimals();
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* @dev Expose permit nonces via both ERC20Permit and OpenZeppelin Nonces.
|
|
237
|
+
*/
|
|
238
|
+
function nonces(
|
|
239
|
+
address owner
|
|
240
|
+
) public view override(ERC20Permit, Nonces) returns (uint256) {
|
|
241
|
+
return super.nonces(owner);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
|
+
//
|
|
3
|
+
// This file is provided WITHOUT ANY WARRANTY;
|
|
4
|
+
// without even the implied warranty of MERCHANTABILITY
|
|
5
|
+
// or FITNESS FOR A PARTICULAR PURPOSE.
|
|
6
|
+
|
|
7
|
+
pragma solidity >=0.8.27;
|
|
8
|
+
|
|
9
|
+
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
|
10
|
+
import {
|
|
11
|
+
ERC20Permit,
|
|
12
|
+
Nonces
|
|
13
|
+
} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";
|
|
14
|
+
import {
|
|
15
|
+
ERC20Votes
|
|
16
|
+
} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
|
|
17
|
+
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
|
|
18
|
+
import {
|
|
19
|
+
AccessControl
|
|
20
|
+
} from "@openzeppelin/contracts/access/AccessControl.sol";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @title EnclaveToken
|
|
24
|
+
* @notice The governance and utility token for the Enclave protocol
|
|
25
|
+
* @dev ERC20 token with voting capabilities, permit functionality, and controlled minting.
|
|
26
|
+
* Implements transfer restrictions that can be toggled by the owner to control token
|
|
27
|
+
* transferability during early phases. Supports a maximum supply cap and role-based
|
|
28
|
+
* minting through the MINTER_ROLE.
|
|
29
|
+
*/
|
|
30
|
+
contract EnclaveToken is
|
|
31
|
+
ERC20,
|
|
32
|
+
ERC20Permit,
|
|
33
|
+
ERC20Votes,
|
|
34
|
+
Ownable,
|
|
35
|
+
AccessControl
|
|
36
|
+
{
|
|
37
|
+
// Custom errors
|
|
38
|
+
|
|
39
|
+
/// @notice Thrown when a zero address is provided where a valid address is required
|
|
40
|
+
error ZeroAddress();
|
|
41
|
+
|
|
42
|
+
/// @notice Thrown when attempting to mint zero tokens
|
|
43
|
+
error ZeroAmount();
|
|
44
|
+
|
|
45
|
+
/// @notice Thrown when minting would exceed the maximum token supply
|
|
46
|
+
error ExceedsTotalSupply();
|
|
47
|
+
|
|
48
|
+
/// @notice Thrown when array parameters have mismatched lengths
|
|
49
|
+
error ArrayLengthMismatch();
|
|
50
|
+
|
|
51
|
+
/// @notice Thrown when a transfer is attempted while restrictions are active and neither party is whitelisted
|
|
52
|
+
error TransferNotAllowed();
|
|
53
|
+
|
|
54
|
+
/// @notice Maximum supply of the token: 1.2 billion tokens with 18 decimals
|
|
55
|
+
/// @dev Hard cap on total token supply that cannot be exceeded through minting
|
|
56
|
+
uint256 public constant MAX_SUPPLY = 1_200_000_000e18;
|
|
57
|
+
|
|
58
|
+
/// @notice Role identifier for accounts authorized to mint new tokens
|
|
59
|
+
/// @dev Keccak256 hash of "MINTER_ROLE" used in AccessControl
|
|
60
|
+
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
|
|
61
|
+
|
|
62
|
+
/// @notice Tracks the cumulative amount of tokens minted since deployment
|
|
63
|
+
/// @dev Incremented with each mint operation to enforce MAX_SUPPLY cap
|
|
64
|
+
uint256 public totalMinted;
|
|
65
|
+
|
|
66
|
+
/// @notice Mapping of addresses permitted to transfer tokens when restrictions are active
|
|
67
|
+
/// @dev When transfersRestricted is true, only whitelisted addresses can send or receive tokens
|
|
68
|
+
mapping(address account => bool allowed) public transferWhitelisted;
|
|
69
|
+
|
|
70
|
+
/// @notice Indicates whether token transfers are currently restricted
|
|
71
|
+
/// @dev When true, only whitelisted addresses can transfer tokens
|
|
72
|
+
bool public transfersRestricted;
|
|
73
|
+
|
|
74
|
+
/// @notice Emitted when tokens are minted as part of a named allocation
|
|
75
|
+
/// @param recipient Address receiving the minted tokens
|
|
76
|
+
/// @param amount Number of tokens minted (18 decimals)
|
|
77
|
+
/// @param allocation Description of the allocation for tracking purposes
|
|
78
|
+
event AllocationMinted(
|
|
79
|
+
address indexed recipient,
|
|
80
|
+
uint256 amount,
|
|
81
|
+
string allocation
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
/// @notice Emitted when the transfer restriction setting is changed
|
|
85
|
+
/// @param restricted New state of transfer restrictions (true = restricted, false = unrestricted)
|
|
86
|
+
event TransferRestrictionUpdated(bool restricted);
|
|
87
|
+
|
|
88
|
+
/// @notice Emitted when an address is added to or removed from the transfer whitelist
|
|
89
|
+
/// @param account Address whose whitelist status changed
|
|
90
|
+
/// @param whitelisted New whitelist status (true = whitelisted, false = not whitelisted)
|
|
91
|
+
event TransferWhitelistUpdated(address indexed account, bool whitelisted);
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @notice Initializes the Enclave token with name "Enclave" and symbol "ENCL"
|
|
95
|
+
* @dev Sets up the token with voting and permit functionality. Grants admin and minter
|
|
96
|
+
* roles to the owner, enables transfer restrictions, and whitelists the owner.
|
|
97
|
+
* @param _owner Address that will own the contract and receive DEFAULT_ADMIN_ROLE and MINTER_ROLE
|
|
98
|
+
*/
|
|
99
|
+
constructor(
|
|
100
|
+
address _owner
|
|
101
|
+
) ERC20("Enclave", "ENCL") ERC20Permit("Enclave") Ownable(_owner) {
|
|
102
|
+
// Grant the deployer all admin roles.
|
|
103
|
+
_grantRole(DEFAULT_ADMIN_ROLE, _owner);
|
|
104
|
+
_grantRole(MINTER_ROLE, _owner);
|
|
105
|
+
|
|
106
|
+
// Initialise state variables.
|
|
107
|
+
transfersRestricted = true;
|
|
108
|
+
transferWhitelisted[_owner] = true;
|
|
109
|
+
|
|
110
|
+
emit TransferRestrictionUpdated(true);
|
|
111
|
+
emit TransferWhitelistUpdated(_owner, true);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @notice Mints a named allocation of tokens to a specified recipient
|
|
116
|
+
* @dev Only callable by accounts with MINTER_ROLE. Reverts if recipient is zero address,
|
|
117
|
+
* amount is zero, or minting would exceed MAX_SUPPLY. Updates totalMinted tracker.
|
|
118
|
+
* @param recipient Address to receive the minted tokens (cannot be zero address)
|
|
119
|
+
* @param amount Number of tokens to mint in wei (18 decimals, must be greater than zero)
|
|
120
|
+
* @param allocation Human-readable description of this allocation for tracking and auditing purposes
|
|
121
|
+
*/
|
|
122
|
+
function mintAllocation(
|
|
123
|
+
address recipient,
|
|
124
|
+
uint256 amount,
|
|
125
|
+
string memory allocation
|
|
126
|
+
) external onlyRole(MINTER_ROLE) {
|
|
127
|
+
if (recipient == address(0)) revert ZeroAddress();
|
|
128
|
+
if (amount == 0) revert ZeroAmount();
|
|
129
|
+
// Ensure we do not exceed the total supply.
|
|
130
|
+
if (totalMinted + amount > MAX_SUPPLY) revert ExceedsTotalSupply();
|
|
131
|
+
|
|
132
|
+
_mint(recipient, amount);
|
|
133
|
+
totalMinted += amount;
|
|
134
|
+
emit AllocationMinted(recipient, amount, allocation);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @notice Mints multiple named allocations to different recipients in a single transaction
|
|
139
|
+
* @dev Only callable by accounts with MINTER_ROLE. All arrays must have the same length.
|
|
140
|
+
* Reverts if any amount is zero or if the cumulative minting would exceed MAX_SUPPLY.
|
|
141
|
+
* Gas-efficient for distributing tokens to multiple addresses.
|
|
142
|
+
* @param recipients Array of addresses to receive minted tokens
|
|
143
|
+
* @param amounts Array of token amounts to mint (18 decimals, must match recipients length)
|
|
144
|
+
* @param allocations Array of allocation descriptions (must match recipients length)
|
|
145
|
+
*/
|
|
146
|
+
function batchMintAllocations(
|
|
147
|
+
address[] calldata recipients,
|
|
148
|
+
uint256[] calldata amounts,
|
|
149
|
+
string[] calldata allocations
|
|
150
|
+
) external onlyRole(MINTER_ROLE) {
|
|
151
|
+
uint256 len = recipients.length;
|
|
152
|
+
if (amounts.length != len || allocations.length != len) {
|
|
153
|
+
revert ArrayLengthMismatch();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
uint256 minted = totalMinted;
|
|
157
|
+
|
|
158
|
+
for (uint256 i = 0; i < len; i++) {
|
|
159
|
+
address recipient = recipients[i];
|
|
160
|
+
uint256 amount = amounts[i];
|
|
161
|
+
if (amount == 0) revert ZeroAmount();
|
|
162
|
+
|
|
163
|
+
if (amount > MAX_SUPPLY - minted) revert ExceedsTotalSupply();
|
|
164
|
+
minted += amount;
|
|
165
|
+
|
|
166
|
+
_mint(recipient, amount);
|
|
167
|
+
emit AllocationMinted(recipient, amount, allocations[i]);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
totalMinted = minted;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* @notice Enables or disables transfer restrictions for the token
|
|
175
|
+
* @dev Only callable by the contract owner. When restrictions are enabled, only whitelisted
|
|
176
|
+
* addresses can send or receive tokens. Useful for controlling token circulation during
|
|
177
|
+
* early phases before public trading.
|
|
178
|
+
* @param restricted True to enable restrictions, false to allow unrestricted transfers
|
|
179
|
+
*/
|
|
180
|
+
function setTransferRestriction(bool restricted) external onlyOwner {
|
|
181
|
+
transfersRestricted = restricted;
|
|
182
|
+
emit TransferRestrictionUpdated(restricted);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* @notice Toggles an account's transfer whitelist status between enabled and disabled
|
|
187
|
+
* @dev Only callable by the contract owner. Flips the current whitelist state for the given
|
|
188
|
+
* account. Whitelisted accounts can send and receive tokens even when transfer restrictions
|
|
189
|
+
* are active.
|
|
190
|
+
* @param account Address whose whitelist status will be toggled
|
|
191
|
+
*/
|
|
192
|
+
function toggleTransferWhitelist(address account) external onlyOwner {
|
|
193
|
+
bool newStatus = !transferWhitelisted[account];
|
|
194
|
+
transferWhitelisted[account] = newStatus;
|
|
195
|
+
emit TransferWhitelistUpdated(account, newStatus);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* @notice Whitelists key protocol contracts to allow them to transfer tokens during restricted periods
|
|
200
|
+
* @dev Only callable by the contract owner. Convenience function for whitelisting multiple protocol
|
|
201
|
+
* contracts in a single transaction. Zero addresses are safely ignored. Typically used to whitelist
|
|
202
|
+
* contracts like bonding managers and vesting escrows that need to handle tokens on behalf of users.
|
|
203
|
+
* @param bondingManager Address of the BondingManager contract (zero address skipped)
|
|
204
|
+
* @param vestingEscrow Address of the VestingEscrow contract (zero address skipped)
|
|
205
|
+
*/
|
|
206
|
+
function whitelistContracts(
|
|
207
|
+
address bondingManager,
|
|
208
|
+
address vestingEscrow
|
|
209
|
+
) external onlyOwner {
|
|
210
|
+
if (bondingManager != address(0)) {
|
|
211
|
+
transferWhitelisted[bondingManager] = true;
|
|
212
|
+
emit TransferWhitelistUpdated(bondingManager, true);
|
|
213
|
+
}
|
|
214
|
+
if (vestingEscrow != address(0)) {
|
|
215
|
+
transferWhitelisted[vestingEscrow] = true;
|
|
216
|
+
emit TransferWhitelistUpdated(vestingEscrow, true);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* @notice Internal hook that enforces transfer restrictions and updates voting power
|
|
222
|
+
* @dev Overrides ERC20 and ERC20Votes to add transfer restriction logic. Reverts if transfers
|
|
223
|
+
* are restricted and neither sender nor receiver is whitelisted. Minting (from == 0) and
|
|
224
|
+
* burning (to == 0) are always allowed regardless of restrictions.
|
|
225
|
+
* @param from Address sending tokens (zero address for minting)
|
|
226
|
+
* @param to Address receiving tokens (zero address for burning)
|
|
227
|
+
* @param value Amount of tokens being transferred
|
|
228
|
+
*/
|
|
229
|
+
function _update(
|
|
230
|
+
address from,
|
|
231
|
+
address to,
|
|
232
|
+
uint256 value
|
|
233
|
+
) internal override(ERC20, ERC20Votes) {
|
|
234
|
+
// When transfers are restricted, only whitelisted addresses can send or receive.
|
|
235
|
+
if (from != address(0) && to != address(0) && transfersRestricted) {
|
|
236
|
+
if (!transferWhitelisted[from] && !transferWhitelisted[to]) {
|
|
237
|
+
revert TransferNotAllowed();
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
super._update(from, to, value);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* @notice Checks if this contract implements a given interface
|
|
245
|
+
* @dev Implements ERC165 interface detection via AccessControl
|
|
246
|
+
* @param interfaceId The interface identifier to check, as specified in ERC-165
|
|
247
|
+
* @return bool True if the contract implements the interface, false otherwise
|
|
248
|
+
*/
|
|
249
|
+
function supportsInterface(
|
|
250
|
+
bytes4 interfaceId
|
|
251
|
+
) public view override(AccessControl) returns (bool) {
|
|
252
|
+
return super.supportsInterface(interfaceId);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* @notice Returns the current nonce for an address, used for permit signatures
|
|
257
|
+
* @dev Resolves the override conflict between ERC20Permit and Nonces by calling the parent
|
|
258
|
+
* implementation. Nonces are incremented with each permit to prevent replay attacks.
|
|
259
|
+
* @param owner Address to query the nonce for
|
|
260
|
+
* @return uint256 The current nonce value for the given address
|
|
261
|
+
*/
|
|
262
|
+
function nonces(
|
|
263
|
+
address owner
|
|
264
|
+
) public view override(ERC20Permit, Nonces) returns (uint256) {
|
|
265
|
+
return super.nonces(owner);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hardhat.config.d.ts","sourceRoot":"","sources":["../hardhat.config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hardhat.config.d.ts","sourceRoot":"","sources":["../hardhat.config.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAoExD,QAAA,MAAM,MAAM,EAAE,iBA8Gb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/hardhat.config.js
CHANGED
|
@@ -8,15 +8,16 @@ import hardhatIgnitionEthers from "@nomicfoundation/hardhat-ignition-ethers";
|
|
|
8
8
|
import hardhatNetworkHelpers from "@nomicfoundation/hardhat-network-helpers";
|
|
9
9
|
import hardhatToolboxMochaEthersPlugin from "@nomicfoundation/hardhat-toolbox-mocha-ethers";
|
|
10
10
|
import hardhatTypechainPlugin from "@nomicfoundation/hardhat-typechain";
|
|
11
|
+
import hardhatVerify from "@nomicfoundation/hardhat-verify";
|
|
11
12
|
import dotenv from "dotenv";
|
|
12
|
-
import { ciphernodeAdd, ciphernodeRemove, ciphernodeSiblings, } from "./tasks/ciphernode";
|
|
13
|
+
import { ciphernodeAdd, ciphernodeAdminAdd, ciphernodeMintTokens, ciphernodeRemove, ciphernodeSiblings, } from "./tasks/ciphernode";
|
|
13
14
|
import { activateE3, enableE3, publishCiphertext, publishCommittee, publishInput, publishPlaintext, requestCommittee, } from "./tasks/enclave";
|
|
14
15
|
import { cleanDeploymentsTask } from "./tasks/utils";
|
|
15
16
|
dotenv.config();
|
|
16
17
|
const mnemonic = process.env.MNEMONIC ??
|
|
17
18
|
"test test test test test test test test test test test junk";
|
|
18
19
|
const privateKey = process.env.PRIVATE_KEY;
|
|
19
|
-
const
|
|
20
|
+
const rpcUrl = process.env.RPC_URL ?? "http://localhost:8545";
|
|
20
21
|
const chainIds = {
|
|
21
22
|
"arbitrum-mainnet": 42161,
|
|
22
23
|
avalanche: 43114,
|
|
@@ -31,17 +32,6 @@ const chainIds = {
|
|
|
31
32
|
goerli: 5,
|
|
32
33
|
};
|
|
33
34
|
function getChainConfig(chain, apiUrl) {
|
|
34
|
-
let jsonRpcUrl;
|
|
35
|
-
switch (chain) {
|
|
36
|
-
case "avalanche":
|
|
37
|
-
jsonRpcUrl = "https://api.avax.network/ext/bc/C/rpc";
|
|
38
|
-
break;
|
|
39
|
-
case "bsc":
|
|
40
|
-
jsonRpcUrl = "https://bsc-dataseed1.binance.org";
|
|
41
|
-
break;
|
|
42
|
-
default:
|
|
43
|
-
jsonRpcUrl = "https://" + chain + ".infura.io/v3/" + infuraApiKey;
|
|
44
|
-
}
|
|
45
35
|
let accounts;
|
|
46
36
|
if (privateKey) {
|
|
47
37
|
accounts = [privateKey];
|
|
@@ -56,7 +46,7 @@ function getChainConfig(chain, apiUrl) {
|
|
|
56
46
|
return {
|
|
57
47
|
accounts,
|
|
58
48
|
chainId: chainIds[chain],
|
|
59
|
-
url:
|
|
49
|
+
url: rpcUrl,
|
|
60
50
|
type: "http",
|
|
61
51
|
chainType: "l1",
|
|
62
52
|
blockExplorers: {
|
|
@@ -73,9 +63,12 @@ const config = {
|
|
|
73
63
|
hardhatNetworkHelpers,
|
|
74
64
|
hardhatIgnitionEthers,
|
|
75
65
|
hardhatEthersChaiMatchers,
|
|
66
|
+
hardhatVerify,
|
|
76
67
|
],
|
|
77
68
|
tasks: [
|
|
78
69
|
ciphernodeAdd,
|
|
70
|
+
ciphernodeAdminAdd,
|
|
71
|
+
ciphernodeMintTokens,
|
|
79
72
|
ciphernodeRemove,
|
|
80
73
|
ciphernodeSiblings,
|
|
81
74
|
requestCommittee,
|
|
@@ -93,6 +86,16 @@ const config = {
|
|
|
93
86
|
type: "edr-simulated",
|
|
94
87
|
chainType: "l1",
|
|
95
88
|
},
|
|
89
|
+
localhost: {
|
|
90
|
+
accounts: {
|
|
91
|
+
mnemonic,
|
|
92
|
+
},
|
|
93
|
+
chainId: chainIds.hardhat,
|
|
94
|
+
url: "http://localhost:8545",
|
|
95
|
+
type: "http",
|
|
96
|
+
chainType: "l1",
|
|
97
|
+
timeout: 60000,
|
|
98
|
+
},
|
|
96
99
|
ganache: {
|
|
97
100
|
accounts: {
|
|
98
101
|
mnemonic,
|
|
@@ -100,6 +103,7 @@ const config = {
|
|
|
100
103
|
chainId: chainIds.ganache,
|
|
101
104
|
url: "http://localhost:8545",
|
|
102
105
|
type: "http",
|
|
106
|
+
timeout: 60000,
|
|
103
107
|
},
|
|
104
108
|
arbitrum: getChainConfig("arbitrum-mainnet", process.env.ARBISCAN_API_KEY || ""),
|
|
105
109
|
avalanche: getChainConfig("avalanche", process.env.SNOWTRACE_API_KEY || ""),
|
|
@@ -111,6 +115,14 @@ const config = {
|
|
|
111
115
|
sepolia: getChainConfig("sepolia", process.env.ETHERSCAN_API_KEY || ""),
|
|
112
116
|
goerli: getChainConfig("goerli", process.env.ETHERSCAN_API_KEY || ""),
|
|
113
117
|
},
|
|
118
|
+
verify: {
|
|
119
|
+
etherscan: {
|
|
120
|
+
apiKey: process.env.ETHERSCAN_API_KEY || "",
|
|
121
|
+
},
|
|
122
|
+
blockscout: {
|
|
123
|
+
enabled: false,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
114
126
|
paths: {
|
|
115
127
|
artifacts: "./artifacts",
|
|
116
128
|
cache: "./cache",
|
|
@@ -122,15 +134,22 @@ const config = {
|
|
|
122
134
|
tsNocheck: false,
|
|
123
135
|
},
|
|
124
136
|
solidity: {
|
|
125
|
-
npmFilesToBuild: [
|
|
137
|
+
npmFilesToBuild: [
|
|
138
|
+
"poseidon-solidity/PoseidonT3.sol",
|
|
139
|
+
"@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol",
|
|
140
|
+
"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol",
|
|
141
|
+
],
|
|
126
142
|
compilers: [
|
|
127
143
|
{
|
|
128
|
-
version: "0.8.
|
|
144
|
+
version: "0.8.28",
|
|
129
145
|
settings: {
|
|
130
146
|
optimizer: {
|
|
131
147
|
enabled: true,
|
|
132
148
|
runs: 800,
|
|
133
149
|
},
|
|
150
|
+
metadata: {
|
|
151
|
+
bytecodeHash: "none",
|
|
152
|
+
},
|
|
134
153
|
},
|
|
135
154
|
},
|
|
136
155
|
],
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bondingRegistry.d.ts","sourceRoot":"","sources":["../../../ignition/modules/bondingRegistry.ts"],"names":[],"mappings":"wBAuCM,GAAG;AAhCT,wBAgCU"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// SPDX-License-Identifier: LGPL-3.0-only
|
|
2
|
+
//
|
|
3
|
+
// This file is provided WITHOUT ANY WARRANTY;
|
|
4
|
+
// without even the implied warranty of MERCHANTABILITY
|
|
5
|
+
// or FITNESS FOR A PARTICULAR PURPOSE.
|
|
6
|
+
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";
|
|
7
|
+
export default buildModule("BondingRegistry", (m) => {
|
|
8
|
+
const ticketToken = m.getParameter("ticketToken");
|
|
9
|
+
const licenseToken = m.getParameter("licenseToken");
|
|
10
|
+
const registry = m.getParameter("registry");
|
|
11
|
+
const slashedFundsTreasury = m.getParameter("slashedFundsTreasury");
|
|
12
|
+
const ticketPrice = m.getParameter("ticketPrice");
|
|
13
|
+
const licenseRequiredBond = m.getParameter("licenseRequiredBond");
|
|
14
|
+
const minTicketBalance = m.getParameter("minTicketBalance");
|
|
15
|
+
const exitDelay = m.getParameter("exitDelay");
|
|
16
|
+
const owner = m.getParameter("owner");
|
|
17
|
+
const bondingRegistryImpl = m.contract("BondingRegistry", []);
|
|
18
|
+
const initData = m.encodeFunctionCall(bondingRegistryImpl, "initialize", [
|
|
19
|
+
owner,
|
|
20
|
+
ticketToken,
|
|
21
|
+
licenseToken,
|
|
22
|
+
registry,
|
|
23
|
+
slashedFundsTreasury,
|
|
24
|
+
ticketPrice,
|
|
25
|
+
licenseRequiredBond,
|
|
26
|
+
minTicketBalance,
|
|
27
|
+
exitDelay,
|
|
28
|
+
]);
|
|
29
|
+
const bondingRegistry = m.contract("TransparentUpgradeableProxy", [
|
|
30
|
+
bondingRegistryImpl,
|
|
31
|
+
owner,
|
|
32
|
+
initData,
|
|
33
|
+
]);
|
|
34
|
+
return { bondingRegistry };
|
|
35
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ciphernodeRegistry.d.ts","sourceRoot":"","sources":["../../../ignition/modules/ciphernodeRegistry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ciphernodeRegistry.d.ts","sourceRoot":"","sources":["../../../ignition/modules/ciphernodeRegistry.ts"],"names":[],"mappings":"wBAiCM,GAAG;AA1BT,wBA0BU"}
|