|
| 1 | +import { parseAbiItem, type Address } from "viem"; |
| 2 | + |
| 3 | +import type { ProtocolConfig } from "../utils/types.js"; |
| 4 | + |
| 5 | +/** |
| 6 | + * FHERC20 Confidential Ether eETH: |
| 7 | + */ |
| 8 | +const CONFIDENTIAL_ETHER_PROXY: Address = "0xC132c8a82A24Fe1e491082932e3db4F70Ce95c93"; |
| 9 | + |
| 10 | +/** |
| 11 | + * ConfidentialETH.shieldNative function (inherited from FHERC20NativeWrapperUpgradeable.sol): |
| 12 | + * |
| 13 | + * Emits: |
| 14 | + * TaskCreated() - Assigned task to encrypt (emitted by Task Manager of Fhenix coprocessor) |
| 15 | + * TaskCreated() - Assigned task to encrypt (emitted by Task Manager of Fhenix coprocessor) |
| 16 | + * TaskCreated() - Assigned task to encrypt (emitted by Task Manager of Fhenix coprocessor) |
| 17 | + * TaskCreated() - Assigned task to encrypt (emitted by Task Manager of Fhenix coprocessor) |
| 18 | + * TaskCreated() - Assigned task to encrypt (emitted by Task Manager of Fhenix coprocessor) |
| 19 | + * TaskCreated() - Assigned task to encrypt (emitted by Task Manager of Fhenix coprocessor) |
| 20 | + * TaskCreated() - Assigned task to encrypt (emitted by Task Manager of Fhenix coprocessor) |
| 21 | + * Transfer() - Transfer to simulate a ERC20 transfer with dummy values (emitted by the confidential Eth contract) |
| 22 | + * ConfidentialTransfer() - Encrypted token transfer announcement (emitted by the confidential Eth contract) |
| 23 | + * ShieldedNative() - Shielded native ETH action (emitted by the confidential Eth contract) |
| 24 | + */ |
| 25 | +const ENCRYPT_ETH_EVENTS = [ |
| 26 | + parseAbiItem( |
| 27 | + "event TaskCreated(uint256 indexed taskId, string descriptionHash, uint256 maxBudget, uint256 commitDeadline, uint256 revealDeadline)", |
| 28 | + ), |
| 29 | + parseAbiItem( |
| 30 | + "event TaskCreated(uint256 indexed taskId, string descriptionHash, uint256 maxBudget, uint256 commitDeadline, uint256 revealDeadline)", |
| 31 | + ), |
| 32 | + parseAbiItem( |
| 33 | + "event TaskCreated(uint256 indexed taskId, string descriptionHash, uint256 maxBudget, uint256 commitDeadline, uint256 revealDeadline)", |
| 34 | + ), |
| 35 | + parseAbiItem( |
| 36 | + "event TaskCreated(uint256 indexed taskId, string descriptionHash, uint256 maxBudget, uint256 commitDeadline, uint256 revealDeadline)", |
| 37 | + ), |
| 38 | + parseAbiItem( |
| 39 | + "event TaskCreated(uint256 indexed taskId, string descriptionHash, uint256 maxBudget, uint256 commitDeadline, uint256 revealDeadline)", |
| 40 | + ), |
| 41 | + parseAbiItem( |
| 42 | + "event TaskCreated(uint256 indexed taskId, string descriptionHash, uint256 maxBudget, uint256 commitDeadline, uint256 revealDeadline)", |
| 43 | + ), |
| 44 | + parseAbiItem( |
| 45 | + "event TaskCreated(uint256 indexed taskId, string descriptionHash, uint256 maxBudget, uint256 commitDeadline, uint256 revealDeadline)", |
| 46 | + ), |
| 47 | + parseAbiItem("event Transfer(address indexed from, address indexed to, uint256 value)"), |
| 48 | + parseAbiItem("event ConfidentialTransfer(address indexed from, address indexed to, bytes32 indexed amount)"), |
| 49 | + parseAbiItem("event ShieldedNative(address indexed from, address indexed to, uint256 value)"), |
| 50 | +] as const; |
| 51 | + |
| 52 | +/** |
| 53 | + * ConfidentialETH.decrypt function: |
| 54 | + * |
| 55 | + * Emits: |
| 56 | + * TaskCreated() - Assigned task to decrypt (emitted by Task Manager of Fhenix coprocessor) |
| 57 | + * TaskCreated() - Assigned task to decrypt (emitted by Task Manager of Fhenix coprocessor) |
| 58 | + * TaskCreated() - Assigned task to decrypt (emitted by Task Manager of Fhenix coprocessor) |
| 59 | + * TaskCreated() - Assigned task to decrypt (emitted by Task Manager of Fhenix coprocessor) |
| 60 | + * TaskCreated() - Assigned task to decrypt (emitted by Task Manager of Fhenix coprocessor) |
| 61 | + * TaskCreated() - Assigned task to decrypt (emitted by Task Manager of Fhenix coprocessor) |
| 62 | + * TaskCreated() - Assigned task to decrypt (emitted by Task Manager of Fhenix coprocessor) |
| 63 | + * Transfer() - Transfer to simulate a ERC20 transfer with dummy values (emitted by the confidential Eth contract) |
| 64 | + * ConfidentialTransfer() - Encrypted token transfer announcement (emitted by the confidential Eth contract) |
| 65 | + * Unshielded() - Unshielded native ETH action (emitted by the confidential Eth contract) |
| 66 | + */ |
| 67 | +const DECRYPT_ETH_EVENTS = [ |
| 68 | + parseAbiItem( |
| 69 | + "event TaskCreated(uint256 indexed taskId, string descriptionHash, uint256 maxBudget, uint256 commitDeadline, uint256 revealDeadline)", |
| 70 | + ), |
| 71 | + parseAbiItem( |
| 72 | + "event TaskCreated(uint256 indexed taskId, string descriptionHash, uint256 maxBudget, uint256 commitDeadline, uint256 revealDeadline)", |
| 73 | + ), |
| 74 | + parseAbiItem( |
| 75 | + "event TaskCreated(uint256 indexed taskId, string descriptionHash, uint256 maxBudget, uint256 commitDeadline, uint256 revealDeadline)", |
| 76 | + ), |
| 77 | + parseAbiItem( |
| 78 | + "event TaskCreated(uint256 indexed taskId, string descriptionHash, uint256 maxBudget, uint256 commitDeadline, uint256 revealDeadline)", |
| 79 | + ), |
| 80 | + parseAbiItem( |
| 81 | + "event TaskCreated(uint256 indexed taskId, string descriptionHash, uint256 maxBudget, uint256 commitDeadline, uint256 revealDeadline)", |
| 82 | + ), |
| 83 | + parseAbiItem( |
| 84 | + "event TaskCreated(uint256 indexed taskId, string descriptionHash, uint256 maxBudget, uint256 commitDeadline, uint256 revealDeadline)", |
| 85 | + ), |
| 86 | + parseAbiItem( |
| 87 | + "event TaskCreated(uint256 indexed taskId, string descriptionHash, uint256 maxBudget, uint256 commitDeadline, uint256 revealDeadline)", |
| 88 | + ), |
| 89 | + parseAbiItem("event Transfer(address indexed from, address indexed to, uint256 value)"), |
| 90 | + parseAbiItem("event ConfidentialTransfer(address indexed from, address indexed to, bytes32 indexed amount)"), |
| 91 | + parseAbiItem("event Unshielded(address indexed to, bytes32 indexed amount)"), |
| 92 | +] as const; |
| 93 | + |
| 94 | +/** |
| 95 | + * ConfidentialETH.claimAllDecrypted function: |
| 96 | + * |
| 97 | + * Emits: |
| 98 | + * ClaimedUnshielded() - Claimed unshielded ETH transfer notification (emitted by the confidential wrapper contract) |
| 99 | + * |
| 100 | + */ |
| 101 | +const CLAIM_DECRYPTED_ETH_EVENTS = [ |
| 102 | + parseAbiItem( |
| 103 | + "event ClaimedUnshielded(address indexed to, bytes32 indexed unshieldRequestId, bytes32 indexed unshieldAmount, uint64 unshieldAmountCleartext)", |
| 104 | + ), |
| 105 | +] as const; |
| 106 | + |
| 107 | +/** |
| 108 | + * ConfidentialETH -> FHERC20NativeWrapperUpgradeable -> FHERC20Upgradeable.confidentialTransfer function: |
| 109 | + * |
| 110 | + * Emits: |
| 111 | + * TaskCreated() - Assigned task to decrypt (emitted by Task Manager of Fhenix coprocessor) |
| 112 | + * TaskCreated() - Assigned task to decrypt (emitted by Task Manager of Fhenix coprocessor) |
| 113 | + * TaskCreated() - Assigned task to decrypt (emitted by Task Manager of Fhenix coprocessor) |
| 114 | + * TaskCreated() - Assigned task to decrypt (emitted by Task Manager of Fhenix coprocessor) |
| 115 | + * TaskCreated() - Assigned task to decrypt (emitted by Task Manager of Fhenix coprocessor) |
| 116 | + * TaskCreated() - Assigned task to decrypt (emitted by Task Manager of Fhenix coprocessor) |
| 117 | + * Transfer() - Transfer to simulate a ERC20 transfer with dummy values (emitted by the confidential Eth contract) |
| 118 | + * ConfidentialTransfer() - Encrypted token transfer announcement (emitted by the confidential Eth contract) |
| 119 | + * |
| 120 | + * It can be used by confidential ETH or confidential ERC20 tokens because both are FHERC20 confidential tokens. |
| 121 | + */ |
| 122 | +const ENCRYPTED_TOKEN_TRANSFER_EVENTS = [ |
| 123 | + parseAbiItem( |
| 124 | + "event TaskCreated(uint256 indexed taskId, string descriptionHash, uint256 maxBudget, uint256 commitDeadline, uint256 revealDeadline)", |
| 125 | + ), |
| 126 | + parseAbiItem( |
| 127 | + "event TaskCreated(uint256 indexed taskId, string descriptionHash, uint256 maxBudget, uint256 commitDeadline, uint256 revealDeadline)", |
| 128 | + ), |
| 129 | + parseAbiItem( |
| 130 | + "event TaskCreated(uint256 indexed taskId, string descriptionHash, uint256 maxBudget, uint256 commitDeadline, uint256 revealDeadline)", |
| 131 | + ), |
| 132 | + parseAbiItem( |
| 133 | + "event TaskCreated(uint256 indexed taskId, string descriptionHash, uint256 maxBudget, uint256 commitDeadline, uint256 revealDeadline)", |
| 134 | + ), |
| 135 | + parseAbiItem( |
| 136 | + "event TaskCreated(uint256 indexed taskId, string descriptionHash, uint256 maxBudget, uint256 commitDeadline, uint256 revealDeadline)", |
| 137 | + ), |
| 138 | + parseAbiItem( |
| 139 | + "event TaskCreated(uint256 indexed taskId, string descriptionHash, uint256 maxBudget, uint256 commitDeadline, uint256 revealDeadline)", |
| 140 | + ), |
| 141 | + parseAbiItem("event Transfer(address indexed from, address indexed to, uint256 value)"), |
| 142 | + parseAbiItem("event ConfidentialTransfer(address indexed from, address indexed to, bytes32 indexed amount)"), |
| 143 | +] as const; |
| 144 | + |
| 145 | +/** Redact configuration */ |
| 146 | +const REDACT_CONFIG = { |
| 147 | + name: "redact", |
| 148 | + version: "1.0.0", |
| 149 | + contracts: [ |
| 150 | + { |
| 151 | + address: CONFIDENTIAL_ETHER_PROXY, |
| 152 | + sourceUrl: |
| 153 | + "https://github.com/FhenixProtocol/redact/blob/new-version-deployment/packages/hardhat/contracts/ConfidentialETH.sol", |
| 154 | + }, |
| 155 | + ], |
| 156 | + operations: [ |
| 157 | + { |
| 158 | + functionSourceUrl: |
| 159 | + "https://github.com/FhenixProtocol/fhenix-confidential-contracts/blob/0823e57e320c1c72e0caee7faeebc4d3a0710373/contracts/FHERC20/extensions/FHERC20NativeWrapperUpgradeable.sol#L91", |
| 160 | + exampleTxUrl: |
| 161 | + "https://sepolia.etherscan.io/tx/0xf1758a8d42ef208d4e20b00445a9c6b75aa8ae21c7fa6c5dcbdde78b1efa1ac1", |
| 162 | + events: ENCRYPT_ETH_EVENTS, |
| 163 | + }, |
| 164 | + { |
| 165 | + functionSourceUrl: |
| 166 | + "https://github.com/FhenixProtocol/fhenix-confidential-contracts/blob/0823e57e320c1c72e0caee7faeebc4d3a0710373/contracts/FHERC20/extensions/FHERC20NativeWrapperUpgradeable.sol#L112", |
| 167 | + exampleTxUrl: |
| 168 | + "https://sepolia.etherscan.io/tx/0xd0ce16c80d911ac3d5a9262f79372cff3b87291253e0163ced5c582a3b87e0cf", |
| 169 | + events: DECRYPT_ETH_EVENTS, |
| 170 | + }, |
| 171 | + { |
| 172 | + functionSourceUrl: |
| 173 | + "https://github.com/FhenixProtocol/fhenix-confidential-contracts/blob/0823e57e320c1c72e0caee7faeebc4d3a0710373/contracts/FHERC20/extensions/FHERC20NativeWrapperUpgradeable.sol#L135", |
| 174 | + exampleTxUrl: |
| 175 | + "https://sepolia.etherscan.io/tx/0x94b0cd3b3e8c7f53d7b9db497973ffd1b14b2dea3a6ef89f6b5561d775c4b649", |
| 176 | + events: CLAIM_DECRYPTED_ETH_EVENTS, |
| 177 | + }, |
| 178 | + { |
| 179 | + functionSourceUrl: |
| 180 | + "https://github.com/FhenixProtocol/fhenix-confidential-contracts/blob/0823e57e320c1c72e0caee7faeebc4d3a0710373/contracts/FHERC20/FHERC20Upgradeable.sol#L216", |
| 181 | + exampleTxUrl: |
| 182 | + "https://sepolia.etherscan.io/tx/0x9e2cc152f3c63cca0c02fcda4e2636776d00a304410b62ffcd110a9f4a664bcb", |
| 183 | + events: ENCRYPTED_TOKEN_TRANSFER_EVENTS, |
| 184 | + }, |
| 185 | + ], |
| 186 | +} satisfies ProtocolConfig; |
| 187 | + |
| 188 | +export { |
| 189 | + CONFIDENTIAL_ETHER_PROXY, |
| 190 | + ENCRYPT_ETH_EVENTS, |
| 191 | + DECRYPT_ETH_EVENTS, |
| 192 | + CLAIM_DECRYPTED_ETH_EVENTS, |
| 193 | + ENCRYPTED_TOKEN_TRANSFER_EVENTS, |
| 194 | + REDACT_CONFIG, |
| 195 | +}; |
0 commit comments