@coti-io/coti-contracts 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (360) hide show
  1. package/contracts/access/DataPrivacyFramework/DataPrivacyFramework.sol +1 -1
  2. package/contracts/access/DataPrivacyFramework/extensions/DataPrivacyFrameworkMpc.sol +1 -1
  3. package/contracts/disperse/coinByRatio/FixedRatioCoinDisperserUnlimitedWindow.sol +2 -4
  4. package/contracts/disperse/disperseToken/MintDisperser.sol +1 -3
  5. package/contracts/disperse/disperseToken/TokenDisperser.sol +1 -1
  6. package/contracts/messaging/PrivateMessaging.sol +1 -1
  7. package/contracts/mocks/access/DataPrivacyFramework/DataPrivacyFrameworkMock.sol +1 -1
  8. package/contracts/mocks/messaging/PrivateMessagingHarness.sol +1 -1
  9. package/contracts/mocks/oracle/CotiPriceConsumerMock.sol +1 -1
  10. package/contracts/mocks/token/ERC20DecimalsMock.sol +1 -1
  11. package/contracts/mocks/token/ERC20Mock.sol +1 -1
  12. package/contracts/mocks/token/PrivateERC20/EncryptedTokenReceiverMock.sol +1 -1
  13. package/contracts/mocks/token/PrivateERC20/PrivacyBridgeERC20Mock.sol +1 -1
  14. package/contracts/mocks/token/PrivateERC20/PrivateERC20AuditorSupplyMock.sol +1 -1
  15. package/contracts/mocks/token/PrivateERC20/PrivateERC20CappedMock.sol +1 -1
  16. package/contracts/mocks/token/PrivateERC20/PrivateERC20GtCallerMock.sol +1 -1
  17. package/contracts/mocks/token/PrivateERC20/PrivateERC20Mock.sol +1 -1
  18. package/contracts/mocks/token/PrivateERC20/PrivateERC20ReentrantReceiverMock.sol +1 -1
  19. package/contracts/mocks/token/PrivateERC20/PublicReentrantTokenReceiverMock.sol +1 -1
  20. package/contracts/mocks/token/PrivateERC20/PublicTokenReceiverBoolMock.sol +1 -1
  21. package/contracts/mocks/token/PrivateERC20/PublicTokenReceiverMock.sol +1 -1
  22. package/contracts/mocks/token/PrivateERC721/PrivateERC721URIStorageMock.sol +1 -1
  23. package/contracts/mocks/utils/mpc/Arithmetic128TestsContract.sol +1 -1
  24. package/contracts/mocks/utils/mpc/Arithmetic256TestsContract.sol +1 -1
  25. package/contracts/mocks/utils/mpc/ArithmeticAddTestsContract.sol +196 -0
  26. package/contracts/mocks/utils/mpc/ArithmeticMulTestsContract.sol +194 -0
  27. package/contracts/mocks/utils/mpc/ArithmeticSigned128TestsContract.sol +63 -0
  28. package/contracts/mocks/utils/mpc/ArithmeticSigned256TestsContract.sol +107 -0
  29. package/contracts/mocks/utils/mpc/ArithmeticSignedNarrowTestsContract.sol +123 -0
  30. package/contracts/mocks/utils/mpc/ArithmeticSubTestsContract.sol +196 -0
  31. package/contracts/mocks/utils/mpc/Bitwise128TestsContract.sol +1 -1
  32. package/contracts/mocks/utils/mpc/Bitwise256TestsContract.sol +1 -1
  33. package/contracts/mocks/utils/mpc/BitwiseTestsContract.sol +1 -1
  34. package/contracts/mocks/utils/mpc/CheckedArithmetic128WithOverflowBitTestsContract.sol +1 -1
  35. package/contracts/mocks/utils/mpc/CheckedArithmetic256WithOverflowBitTestsContract.sol +1 -1
  36. package/contracts/mocks/utils/mpc/CheckedArithmeticWIthOverflowBitTestsContract.sol +1 -1
  37. package/contracts/mocks/utils/mpc/Comparison128TestsContract.sol +1 -1
  38. package/contracts/mocks/utils/mpc/Comparison1TestsContract.sol +1 -1
  39. package/contracts/mocks/utils/mpc/Comparison256TestsContract.sol +1 -1
  40. package/contracts/mocks/utils/mpc/Comparison2TestsContract.sol +1 -1
  41. package/contracts/mocks/utils/mpc/MinMax128TestsContract.sol +1 -1
  42. package/contracts/mocks/utils/mpc/MinMax256TestsContract.sol +1 -1
  43. package/contracts/mocks/utils/mpc/MinMaxTestsContract.sol +1 -1
  44. package/contracts/mocks/utils/mpc/MinimalImplementation.sol +1 -1
  45. package/contracts/mocks/utils/mpc/MinimalProxy.sol +1 -1
  46. package/contracts/mocks/utils/mpc/Miscellaneous1TestsContract.sol +1 -1
  47. package/contracts/mocks/utils/mpc/MiscellaneousTestsContract.sol +1 -1
  48. package/contracts/mocks/utils/mpc/MpcOperations128TestContract.sol +1 -1
  49. package/contracts/mocks/utils/mpc/MpcOperationsTestContract.sol +4 -4
  50. package/contracts/mocks/utils/mpc/Mux128TestsContract.sol +1 -1
  51. package/contracts/mocks/utils/mpc/Mux256TestsContract.sol +1 -1
  52. package/contracts/mocks/utils/mpc/OffboardToUserKeyTestContract.sol +1 -1
  53. package/contracts/mocks/utils/mpc/OnBoard128TestsContract.sol +1 -1
  54. package/contracts/mocks/utils/mpc/OnBoard256TestsContract.sol +1 -1
  55. package/contracts/mocks/utils/mpc/PrivacyImplementationV1.sol +1 -1
  56. package/contracts/mocks/utils/mpc/PrivacyImplementationV2.sol +1 -1
  57. package/contracts/mocks/utils/mpc/PrivacyProxy.sol +1 -1
  58. package/contracts/mocks/utils/mpc/Random128TestsContract.sol +1 -1
  59. package/contracts/mocks/utils/mpc/Random256TestsContract.sol +1 -1
  60. package/contracts/mocks/utils/mpc/Shift128TestsContract.sol +1 -1
  61. package/contracts/mocks/utils/mpc/Shift256TestsContract.sol +1 -1
  62. package/contracts/mocks/utils/mpc/ShiftTestsContract.sol +1 -1
  63. package/contracts/mocks/utils/mpc/StringTestsContract.sol +1 -1
  64. package/contracts/mocks/utils/mpc/Transfer128TestsContract.sol +1 -1
  65. package/contracts/mocks/utils/mpc/Transfer256TestsContract.sol +1 -1
  66. package/contracts/mocks/utils/mpc/TransferScalarTestsContract.sol +1 -1
  67. package/contracts/mocks/utils/mpc/TransferTestsContract.sol +1 -1
  68. package/contracts/mocks/utils/mpc/TransferWithAllowance128TestsContract.sol +1 -1
  69. package/contracts/mocks/utils/mpc/TransferWithAllowance256TestsContract.sol +1 -1
  70. package/contracts/mocks/utils/mpc/TransferWithAllowance64_16TestsContract.sol +1 -1
  71. package/contracts/mocks/utils/mpc/TransferWithAllowance64_32TestsContract.sol +1 -1
  72. package/contracts/mocks/utils/mpc/TransferWithAllowance64_64TestsContract.sol +1 -1
  73. package/contracts/mocks/utils/mpc/TransferWithAllowance64_8TestsContract.sol +1 -1
  74. package/contracts/mocks/utils/mpc/TransferWithAllowanceScalarTestsContract.sol +1 -1
  75. package/contracts/mocks/utils/mpc/TransferWithAllowanceTestsContract.sol +1 -1
  76. package/contracts/mocks/utils/mpc/ValidateCiphertext128TestsContract.sol +1 -1
  77. package/contracts/mocks/utils/mpc/ValidateCiphertext256TestsContract.sol +2 -2
  78. package/contracts/mocks/utils/mpc/ValidateCiphertextTestsContract.sol +1 -1
  79. package/contracts/mocks/wallet/PrivateERC20Wallet/PrivateERC20WalletMock.sol +1 -1
  80. package/contracts/node/CotiNodeRewards.sol +3 -3
  81. package/contracts/node/SoulboundNodeNFT.sol +1 -2
  82. package/contracts/onboard/AccountOnboard.sol +1 -1
  83. package/contracts/oracle/ICotiPriceConsumer.sol +1 -1
  84. package/contracts/pod/IInbox.sol +231 -0
  85. package/contracts/pod/IInboxMiner.sol +53 -0
  86. package/contracts/pod/InboxUser.sol +29 -0
  87. package/contracts/pod/InboxUserCotiTestnet.sol +13 -0
  88. package/contracts/pod/PodNetworkConstants.sol +30 -0
  89. package/contracts/pod/examples/MpcAdder.sol +57 -0
  90. package/contracts/pod/examples/MpcAdderPausable.sol +25 -0
  91. package/contracts/pod/examples/MpcAdderPausable.sol.bak +25 -0
  92. package/contracts/pod/examples/it128/PodAdder128.sol +48 -0
  93. package/contracts/pod/examples/it256/PodAdder256.sol +48 -0
  94. package/contracts/pod/fee/IInboxFeeManager.sol +40 -0
  95. package/contracts/pod/manifest.json +52 -0
  96. package/contracts/pod/mpc/PodLib.sol +10 -0
  97. package/contracts/pod/mpc/PodLib128.sol +361 -0
  98. package/contracts/pod/mpc/PodLib256.sol +361 -0
  99. package/contracts/pod/mpc/PodLib64.sol +385 -0
  100. package/contracts/pod/mpc/PodLibBase.sol +72 -0
  101. package/contracts/pod/mpc/PodUser.sol +58 -0
  102. package/contracts/pod/mpc/PodUserFuji.sol +14 -0
  103. package/contracts/pod/mpc/PodUserSepolia.sol +13 -0
  104. package/contracts/pod/mpc/coti-side/IPodExecutorOps.sol +99 -0
  105. package/contracts/pod/mpccodec/MpcAbiCodec.sol +482 -0
  106. package/contracts/pod/privacy/IPodPriceOracle.sol +20 -0
  107. package/contracts/pod/privacy/IPrivacyPortal.sol +248 -0
  108. package/contracts/pod/privacy/IPrivacyPortalFactory.sol +88 -0
  109. package/contracts/pod/privacy/PortalFeeOracle.sol +51 -0
  110. package/contracts/pod/privacy/PrivacyPortal.sol +871 -0
  111. package/contracts/pod/privacy/PrivacyPortalFactory.sol +492 -0
  112. package/contracts/pod/privacy/PrivacyPortalFeeLib.sol +98 -0
  113. package/contracts/pod/privacy/mocks/CloneHelper.sol +14 -0
  114. package/contracts/pod/privacy/mocks/MockERC20.sol +26 -0
  115. package/contracts/pod/privacy/mocks/MockPodERC20ForPortal.sol +160 -0
  116. package/contracts/pod/privacy/mocks/MockPrivacyPortalFactory.sol +125 -0
  117. package/contracts/pod/privacy/mocks/MockWrappedNative.sol +24 -0
  118. package/contracts/pod/token/erc7984/Erc7984Constants.sol +9 -0
  119. package/contracts/pod/token/erc7984/Erc7984Pointers.sol +29 -0
  120. package/contracts/pod/token/erc7984/IERC7984.sol +69 -0
  121. package/contracts/pod/token/erc7984/IERC7984PortalWrapper.sol +31 -0
  122. package/contracts/pod/token/erc7984/PodErc7984Mixin.sol +125 -0
  123. package/contracts/pod/token/erc7984/README.md +60 -0
  124. package/contracts/pod/token/perc20/IPodERC20.sol +298 -0
  125. package/contracts/pod/token/perc20/PodERC20.sol +1021 -0
  126. package/contracts/pod/token/perc20/PodErc20Mintable.sol +88 -0
  127. package/contracts/pod/token/perc20/PodErc20MintableInitializable.sol +42 -0
  128. package/contracts/pod/token/perc20/cotiside/IPodErc20CotiSide.sol +88 -0
  129. package/contracts/pod/token/perc20/cotiside/PodErc20CotiMother.sol +529 -0
  130. package/contracts/pod/utils/IWrappedNative.sol +11 -0
  131. package/contracts/privacyBridge/PrivacyBridge.sol +5 -5
  132. package/contracts/privacyBridge/PrivacyBridgeCotiNative.sol +1 -1
  133. package/contracts/privacyBridge/PrivacyBridgeERC20.sol +1 -1
  134. package/contracts/privacyBridge/PrivacyBridgeUSDCe.sol +1 -1
  135. package/contracts/privacyBridge/PrivacyBridgeUSDT.sol +1 -1
  136. package/contracts/privacyBridge/PrivacyBridgeWADA.sol +1 -1
  137. package/contracts/privacyBridge/PrivacyBridgeWBTC.sol +1 -1
  138. package/contracts/privacyBridge/PrivacyBridgeWETH.sol +1 -1
  139. package/contracts/privacyBridge/PrivacyBridgegCoti.sol +1 -1
  140. package/contracts/token/PrivateERC20/IPrivateERC20.sol +1 -1
  141. package/contracts/token/PrivateERC20/ITokenReceiver.sol +1 -1
  142. package/contracts/token/PrivateERC20/ITokenReceiverEncrypted.sol +1 -1
  143. package/contracts/token/PrivateERC20/PrivateERC20.sol +5 -5
  144. package/contracts/token/PrivateERC20/tokens/PrivateBridgedUSDC.sol +1 -1
  145. package/contracts/token/PrivateERC20/tokens/PrivateCOTI.sol +1 -1
  146. package/contracts/token/PrivateERC20/tokens/PrivateCOTITreasuryGovernanceToken.sol +1 -1
  147. package/contracts/token/PrivateERC20/tokens/PrivateTetherUSD.sol +1 -1
  148. package/contracts/token/PrivateERC20/tokens/PrivateWrappedADA.sol +1 -1
  149. package/contracts/token/PrivateERC20/tokens/PrivateWrappedBTC.sol +1 -1
  150. package/contracts/token/PrivateERC20/tokens/PrivateWrappedEther.sol +1 -1
  151. package/contracts/token/PrivateERC721/IERC721Errors.sol +1 -1
  152. package/contracts/token/PrivateERC721/PrivateERC721.sol +1 -1
  153. package/contracts/token/PrivateERC721/extensions/IPrivateERC721URIStorage.sol +1 -1
  154. package/contracts/token/PrivateERC721/extensions/PrivateERC721URIStorage.sol +1 -1
  155. package/contracts/token/points/CotiTokenPoints004.sol +43 -0
  156. package/contracts/utils/mpc/MpcCore.sol +610 -1
  157. package/contracts/utils/mpc/MpcInterface.sol +1 -1
  158. package/hardhat.config.ts +5 -14
  159. package/package.json +4 -4
  160. package/scripts/deployCotiTokenPoints004.ts +61 -0
  161. package/scripts/deployFixedRatioCoinDisperserUnlimitedWindow.ts +68 -0
  162. package/scripts/verifyCotiTokenPoints004.ts +123 -0
  163. package/scripts/verifyFixedRatioCoinDisperserUnlimitedWindow.ts +112 -0
  164. package/test/messaging/PrivateMessaging.test.ts +5 -5
  165. package/test/pod/privacy/PrivacyPortal.access.test.ts +756 -0
  166. package/test/pod/privacy/PrivacyPortal.recovery.test.ts +263 -0
  167. package/test/privacyBridge/UnifiedPrivacyBridges.test.cjs +5 -3
  168. package/test/utils/mpc/CheckedSignedArithmetic256.test.ts +163 -0
  169. package/test/utils/mpc/NegativeCases.test.ts +3 -3
  170. package/test/utils/mpc/Precompile.test.ts +6 -6
  171. package/typechain-types/@openzeppelin/contracts/access/AccessControl.ts +2 -2
  172. package/typechain-types/@openzeppelin/contracts/access/IAccessControl.ts +2 -2
  173. package/typechain-types/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.ts +375 -0
  174. package/typechain-types/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.ts +329 -0
  175. package/typechain-types/@openzeppelin/contracts/access/extensions/index.ts +5 -0
  176. package/typechain-types/@openzeppelin/contracts/access/index.ts +2 -0
  177. package/typechain-types/@openzeppelin/contracts/interfaces/IERC1363.ts +412 -0
  178. package/typechain-types/@openzeppelin/contracts/interfaces/IERC5267.ts +151 -0
  179. package/typechain-types/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC1155Errors.ts +69 -0
  180. package/typechain-types/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC20Errors.ts +69 -0
  181. package/typechain-types/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC721Errors.ts +69 -0
  182. package/typechain-types/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/index.ts +6 -0
  183. package/typechain-types/@openzeppelin/contracts/interfaces/index.ts +4 -0
  184. package/typechain-types/@openzeppelin/contracts/token/ERC20/ERC20.ts +6 -50
  185. package/typechain-types/@openzeppelin/contracts/token/ERC20/IERC20.ts +6 -6
  186. package/typechain-types/@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.ts +313 -0
  187. package/typechain-types/@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.ts +356 -0
  188. package/typechain-types/@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.ts +423 -0
  189. package/typechain-types/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.ts +6 -6
  190. package/typechain-types/@openzeppelin/contracts/token/ERC20/extensions/index.ts +3 -0
  191. package/typechain-types/@openzeppelin/contracts/token/ERC20/index.ts +2 -0
  192. package/typechain-types/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.ts +69 -0
  193. package/typechain-types/@openzeppelin/contracts/token/ERC20/utils/index.ts +4 -0
  194. package/typechain-types/@openzeppelin/contracts/utils/Nonces.ts +85 -0
  195. package/typechain-types/@openzeppelin/contracts/utils/Pausable.ts +150 -0
  196. package/typechain-types/@openzeppelin/contracts/utils/ReentrancyGuard.ts +69 -0
  197. package/typechain-types/@openzeppelin/contracts/utils/ShortStrings.ts +69 -0
  198. package/typechain-types/@openzeppelin/contracts/utils/Strings.ts +69 -0
  199. package/typechain-types/@openzeppelin/contracts/utils/cryptography/ECDSA.ts +69 -0
  200. package/typechain-types/@openzeppelin/contracts/utils/cryptography/EIP712.ts +151 -0
  201. package/typechain-types/@openzeppelin/contracts/utils/cryptography/index.ts +5 -0
  202. package/typechain-types/@openzeppelin/contracts/utils/index.ts +9 -0
  203. package/typechain-types/@openzeppelin/contracts/utils/math/SafeCast.ts +69 -0
  204. package/typechain-types/@openzeppelin/contracts/utils/math/index.ts +4 -0
  205. package/typechain-types/contracts/mocks/token/ERC20DecimalsMock.ts +6 -50
  206. package/typechain-types/contracts/mocks/token/ERC20Mock.ts +6 -50
  207. package/typechain-types/contracts/mocks/token/PrivateERC20/PrivacyBridgeERC20Mock.ts +16 -2
  208. package/typechain-types/contracts/mocks/token/PrivateERC20/PrivateERC20AuditorSupplyMock.ts +2 -2
  209. package/typechain-types/contracts/mocks/token/PrivateERC20/PrivateERC20CappedMock.ts +2 -2
  210. package/typechain-types/contracts/mocks/token/PrivateERC20/PrivateERC20Mock.ts +2 -2
  211. package/typechain-types/contracts/privacyBridge/PrivacyBridge.ts +16 -2
  212. package/typechain-types/contracts/privacyBridge/PrivacyBridgeCotiNative.ts +16 -2
  213. package/typechain-types/contracts/privacyBridge/PrivacyBridgeERC20.sol/PrivacyBridgeERC20.ts +16 -2
  214. package/typechain-types/contracts/privacyBridge/PrivacyBridgeUSDCe.ts +16 -2
  215. package/typechain-types/contracts/privacyBridge/PrivacyBridgeUSDT.ts +16 -2
  216. package/typechain-types/contracts/privacyBridge/PrivacyBridgeWADA.ts +16 -2
  217. package/typechain-types/contracts/privacyBridge/PrivacyBridgeWBTC.ts +16 -2
  218. package/typechain-types/contracts/privacyBridge/PrivacyBridgeWETH.ts +16 -2
  219. package/typechain-types/contracts/privacyBridge/PrivacyBridgegCoti.ts +16 -2
  220. package/typechain-types/contracts/token/PrivateERC20/PrivateERC20.ts +2 -2
  221. package/typechain-types/contracts/token/PrivateERC20/tokens/PrivateBridgedUSDC.ts +2 -2
  222. package/typechain-types/contracts/token/PrivateERC20/tokens/PrivateCOTI.ts +2 -2
  223. package/typechain-types/contracts/token/PrivateERC20/tokens/PrivateCOTITreasuryGovernanceToken.ts +2 -2
  224. package/typechain-types/contracts/token/PrivateERC20/tokens/PrivateTetherUSD.ts +2 -2
  225. package/typechain-types/contracts/token/PrivateERC20/tokens/PrivateWrappedADA.ts +2 -2
  226. package/typechain-types/contracts/token/PrivateERC20/tokens/PrivateWrappedBTC.ts +2 -2
  227. package/typechain-types/contracts/token/PrivateERC20/tokens/PrivateWrappedEther.ts +2 -2
  228. package/typechain-types/contracts/token/index.ts +2 -0
  229. package/typechain-types/contracts/token/points/CotiTokenPoints004.sol/COTITokenPoints004.ts +826 -0
  230. package/typechain-types/contracts/token/points/CotiTokenPoints004.ts +826 -0
  231. package/typechain-types/contracts/token/points/index.ts +4 -0
  232. package/typechain-types/factories/@openzeppelin/contracts/access/AccessControl__factory.ts +22 -1
  233. package/typechain-types/factories/@openzeppelin/contracts/access/IAccessControl__factory.ts +22 -1
  234. package/typechain-types/factories/@openzeppelin/contracts/access/Ownable__factory.ts +22 -0
  235. package/typechain-types/factories/@openzeppelin/contracts/access/extensions/AccessControlEnumerable__factory.ts +316 -0
  236. package/typechain-types/factories/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable__factory.ts +265 -0
  237. package/typechain-types/factories/@openzeppelin/contracts/access/extensions/index.ts +5 -0
  238. package/typechain-types/factories/@openzeppelin/contracts/access/index.ts +1 -0
  239. package/typechain-types/factories/@openzeppelin/contracts/interfaces/IERC1363__factory.ts +393 -0
  240. package/typechain-types/factories/@openzeppelin/contracts/interfaces/IERC5267__factory.ts +71 -0
  241. package/typechain-types/factories/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC1155Errors__factory.ts +127 -0
  242. package/typechain-types/factories/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC20Errors__factory.ts +111 -0
  243. package/typechain-types/factories/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC721Errors__factory.ts +128 -0
  244. package/typechain-types/factories/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/index.ts +6 -0
  245. package/typechain-types/factories/@openzeppelin/contracts/interfaces/index.ts +3 -0
  246. package/typechain-types/factories/@openzeppelin/contracts/token/ERC20/ERC20__factory.ts +84 -110
  247. package/typechain-types/factories/@openzeppelin/contracts/token/ERC20/IERC20__factory.ts +3 -3
  248. package/typechain-types/factories/@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable__factory.ts +364 -0
  249. package/typechain-types/factories/@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable__factory.ts +382 -0
  250. package/typechain-types/factories/@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit__factory.ts +540 -0
  251. package/typechain-types/factories/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata__factory.ts +3 -3
  252. package/typechain-types/factories/@openzeppelin/contracts/token/ERC20/extensions/index.ts +3 -0
  253. package/typechain-types/factories/@openzeppelin/contracts/token/ERC20/index.ts +1 -0
  254. package/typechain-types/factories/@openzeppelin/contracts/token/ERC20/utils/SafeERC20__factory.ts +96 -0
  255. package/typechain-types/factories/@openzeppelin/contracts/token/ERC20/utils/index.ts +4 -0
  256. package/typechain-types/factories/@openzeppelin/contracts/token/ERC721/ERC721__factory.ts +98 -59
  257. package/typechain-types/factories/@openzeppelin/contracts/utils/Nonces__factory.ts +57 -0
  258. package/typechain-types/factories/@openzeppelin/contracts/utils/Pausable__factory.ts +71 -0
  259. package/typechain-types/factories/@openzeppelin/contracts/utils/ReentrancyGuard__factory.ts +30 -0
  260. package/typechain-types/factories/@openzeppelin/contracts/utils/ShortStrings__factory.ts +83 -0
  261. package/typechain-types/factories/@openzeppelin/contracts/utils/Strings__factory.ts +90 -0
  262. package/typechain-types/factories/@openzeppelin/contracts/utils/cryptography/ECDSA__factory.ts +91 -0
  263. package/typechain-types/factories/@openzeppelin/contracts/utils/cryptography/EIP712__factory.ts +87 -0
  264. package/typechain-types/factories/@openzeppelin/contracts/utils/cryptography/index.ts +5 -0
  265. package/typechain-types/factories/@openzeppelin/contracts/utils/index.ts +7 -0
  266. package/typechain-types/factories/@openzeppelin/contracts/utils/math/SafeCast__factory.ts +118 -0
  267. package/typechain-types/factories/@openzeppelin/contracts/utils/math/index.ts +4 -0
  268. package/typechain-types/factories/contracts/disperse/coinByRatio/FixedRatioCoinDisperserLeftoverS1__factory.ts +12 -1
  269. package/typechain-types/factories/contracts/disperse/coinByRatio/FixedRatioCoinDisperserUnlimitedWindow__factory.ts +39 -1
  270. package/typechain-types/factories/contracts/disperse/coinByRatio/FixedRatioCoinDisperser__factory.ts +12 -1
  271. package/typechain-types/factories/contracts/disperse/disperseToken/MintDisperser.sol/MintDisperser__factory.ts +23 -1
  272. package/typechain-types/factories/contracts/disperse/disperseToken/TokenDisperser__factory.ts +12 -1
  273. package/typechain-types/factories/contracts/messaging/PrivateMessaging__factory.ts +1 -1
  274. package/typechain-types/factories/contracts/mocks/messaging/PrivateMessagingHarness__factory.ts +1 -1
  275. package/typechain-types/factories/contracts/mocks/token/ERC20DecimalsMock__factory.ts +90 -52
  276. package/typechain-types/factories/contracts/mocks/token/ERC20Mock__factory.ts +90 -52
  277. package/typechain-types/factories/contracts/mocks/token/PrivateERC20/PrivacyBridgeERC20Mock__factory.ts +90 -2
  278. package/typechain-types/factories/contracts/mocks/token/PrivateERC20/PrivateERC20AuditorSupplyMock__factory.ts +28 -2
  279. package/typechain-types/factories/contracts/mocks/token/PrivateERC20/PrivateERC20CappedMock__factory.ts +28 -2
  280. package/typechain-types/factories/contracts/mocks/token/PrivateERC20/PrivateERC20GtCallerMock__factory.ts +1 -1
  281. package/typechain-types/factories/contracts/mocks/token/PrivateERC20/PrivateERC20Mock__factory.ts +28 -2
  282. package/typechain-types/factories/contracts/mocks/token/PrivateERC721/PrivateERC721URIStorageMock__factory.ts +1 -1
  283. package/typechain-types/factories/contracts/mocks/utils/mpc/Arithmetic128TestsContract__factory.ts +1 -1
  284. package/typechain-types/factories/contracts/mocks/utils/mpc/Arithmetic256TestsContract__factory.ts +1 -1
  285. package/typechain-types/factories/contracts/mocks/utils/mpc/ArithmeticTestsContract__factory.ts +1 -1
  286. package/typechain-types/factories/contracts/mocks/utils/mpc/Bitwise128TestsContract__factory.ts +1 -1
  287. package/typechain-types/factories/contracts/mocks/utils/mpc/Bitwise256TestsContract__factory.ts +1 -1
  288. package/typechain-types/factories/contracts/mocks/utils/mpc/BitwiseTestsContract__factory.ts +1 -1
  289. package/typechain-types/factories/contracts/mocks/utils/mpc/CheckedArithmetic128WithOverflowBitTestsContract__factory.ts +1 -1
  290. package/typechain-types/factories/contracts/mocks/utils/mpc/CheckedArithmetic256WithOverflowBitTestsContract__factory.ts +1 -1
  291. package/typechain-types/factories/contracts/mocks/utils/mpc/CheckedArithmeticWIthOverflowBitTestsContract.sol/CheckedArithmeticWithOverflowBitTestsContract__factory.ts +1 -1
  292. package/typechain-types/factories/contracts/mocks/utils/mpc/Comparison128TestsContract__factory.ts +1 -1
  293. package/typechain-types/factories/contracts/mocks/utils/mpc/Comparison1TestsContract__factory.ts +1 -1
  294. package/typechain-types/factories/contracts/mocks/utils/mpc/Comparison256TestsContract__factory.ts +1 -1
  295. package/typechain-types/factories/contracts/mocks/utils/mpc/Comparison2TestsContract__factory.ts +1 -1
  296. package/typechain-types/factories/contracts/mocks/utils/mpc/MinMax128TestsContract__factory.ts +1 -1
  297. package/typechain-types/factories/contracts/mocks/utils/mpc/MinMax256TestsContract__factory.ts +1 -1
  298. package/typechain-types/factories/contracts/mocks/utils/mpc/MinMaxTestsContract__factory.ts +1 -1
  299. package/typechain-types/factories/contracts/mocks/utils/mpc/MinimalImplementation__factory.ts +1 -1
  300. package/typechain-types/factories/contracts/mocks/utils/mpc/Miscellaneous1TestsContract__factory.ts +1 -1
  301. package/typechain-types/factories/contracts/mocks/utils/mpc/MiscellaneousTestsContract__factory.ts +1 -1
  302. package/typechain-types/factories/contracts/mocks/utils/mpc/MpcOperations128TestContract__factory.ts +1 -1
  303. package/typechain-types/factories/contracts/mocks/utils/mpc/MpcOperationsTestContract__factory.ts +1 -1
  304. package/typechain-types/factories/contracts/mocks/utils/mpc/Mux128TestsContract__factory.ts +1 -1
  305. package/typechain-types/factories/contracts/mocks/utils/mpc/Mux256TestsContract__factory.ts +1 -1
  306. package/typechain-types/factories/contracts/mocks/utils/mpc/OffboardToUserKeyTestContract__factory.ts +1 -1
  307. package/typechain-types/factories/contracts/mocks/utils/mpc/OnBoard128TestsContract__factory.ts +1 -1
  308. package/typechain-types/factories/contracts/mocks/utils/mpc/OnBoard256TestsContract__factory.ts +1 -1
  309. package/typechain-types/factories/contracts/mocks/utils/mpc/PrivacyImplementationV1__factory.ts +1 -1
  310. package/typechain-types/factories/contracts/mocks/utils/mpc/PrivacyImplementationV2__factory.ts +1 -1
  311. package/typechain-types/factories/contracts/mocks/utils/mpc/Random128TestsContract__factory.ts +1 -1
  312. package/typechain-types/factories/contracts/mocks/utils/mpc/Random256TestsContract__factory.ts +1 -1
  313. package/typechain-types/factories/contracts/mocks/utils/mpc/Shift128TestsContract__factory.ts +1 -1
  314. package/typechain-types/factories/contracts/mocks/utils/mpc/Shift256TestsContract__factory.ts +1 -1
  315. package/typechain-types/factories/contracts/mocks/utils/mpc/ShiftTestsContract__factory.ts +1 -1
  316. package/typechain-types/factories/contracts/mocks/utils/mpc/StringTestsContract__factory.ts +1 -1
  317. package/typechain-types/factories/contracts/mocks/utils/mpc/Transfer128TestsContract__factory.ts +1 -1
  318. package/typechain-types/factories/contracts/mocks/utils/mpc/Transfer256TestsContract__factory.ts +1 -1
  319. package/typechain-types/factories/contracts/mocks/utils/mpc/TransferScalarTestsContract__factory.ts +1 -1
  320. package/typechain-types/factories/contracts/mocks/utils/mpc/TransferTestsContract__factory.ts +1 -1
  321. package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance128TestsContract__factory.ts +1 -1
  322. package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance256TestsContract__factory.ts +1 -1
  323. package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance64_16TestsContract__factory.ts +1 -1
  324. package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance64_32TestsContract__factory.ts +1 -1
  325. package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance64_64TestsContract__factory.ts +1 -1
  326. package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance64_8TestsContract__factory.ts +1 -1
  327. package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowanceScalarTestsContract__factory.ts +1 -1
  328. package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowanceTestsContract__factory.ts +1 -1
  329. package/typechain-types/factories/contracts/mocks/utils/mpc/ValidateCiphertext128TestsContract__factory.ts +1 -1
  330. package/typechain-types/factories/contracts/mocks/utils/mpc/ValidateCiphertext256TestsContract__factory.ts +1 -1
  331. package/typechain-types/factories/contracts/mocks/utils/mpc/ValidateCiphertextTestsContract__factory.ts +1 -1
  332. package/typechain-types/factories/contracts/mocks/wallet/PrivateERC20Wallet/PrivateERC20WalletMock__factory.ts +1 -1
  333. package/typechain-types/factories/contracts/node/CotiNodeRewards__factory.ts +28 -1
  334. package/typechain-types/factories/contracts/node/SoulboundNodeNFT.sol/SoulboundNodeNFT__factory.ts +126 -1
  335. package/typechain-types/factories/contracts/onboard/AccountOnboard__factory.ts +1 -1
  336. package/typechain-types/factories/contracts/privacyBridge/PrivacyBridgeCotiNative__factory.ts +79 -2
  337. package/typechain-types/factories/contracts/privacyBridge/PrivacyBridgeERC20.sol/PrivacyBridgeERC20__factory.ts +89 -1
  338. package/typechain-types/factories/contracts/privacyBridge/PrivacyBridgeUSDCe__factory.ts +90 -2
  339. package/typechain-types/factories/contracts/privacyBridge/PrivacyBridgeUSDT__factory.ts +90 -2
  340. package/typechain-types/factories/contracts/privacyBridge/PrivacyBridgeWADA__factory.ts +90 -2
  341. package/typechain-types/factories/contracts/privacyBridge/PrivacyBridgeWBTC__factory.ts +90 -2
  342. package/typechain-types/factories/contracts/privacyBridge/PrivacyBridgeWETH__factory.ts +90 -2
  343. package/typechain-types/factories/contracts/privacyBridge/PrivacyBridge__factory.ts +78 -1
  344. package/typechain-types/factories/contracts/privacyBridge/PrivacyBridgegCoti__factory.ts +90 -2
  345. package/typechain-types/factories/contracts/token/PrivateERC20/PrivateERC20__factory.ts +27 -1
  346. package/typechain-types/factories/contracts/token/PrivateERC20/tokens/PrivateBridgedUSDC__factory.ts +28 -2
  347. package/typechain-types/factories/contracts/token/PrivateERC20/tokens/PrivateCOTITreasuryGovernanceToken__factory.ts +28 -2
  348. package/typechain-types/factories/contracts/token/PrivateERC20/tokens/PrivateCOTI__factory.ts +28 -2
  349. package/typechain-types/factories/contracts/token/PrivateERC20/tokens/PrivateTetherUSD__factory.ts +28 -2
  350. package/typechain-types/factories/contracts/token/PrivateERC20/tokens/PrivateWrappedADA__factory.ts +28 -2
  351. package/typechain-types/factories/contracts/token/PrivateERC20/tokens/PrivateWrappedBTC__factory.ts +28 -2
  352. package/typechain-types/factories/contracts/token/PrivateERC20/tokens/PrivateWrappedEther__factory.ts +28 -2
  353. package/typechain-types/factories/contracts/token/index.ts +1 -0
  354. package/typechain-types/factories/contracts/token/points/CotiTokenPoints004.sol/COTITokenPoints004__factory.ts +992 -0
  355. package/typechain-types/factories/contracts/token/points/CotiTokenPoints004__factory.ts +992 -0
  356. package/typechain-types/factories/contracts/token/points/index.ts +4 -0
  357. package/typechain-types/factories/contracts/utils/mpc/MpcCore__factory.ts +1 -1
  358. package/typechain-types/hardhat.d.ts +360 -0
  359. package/typechain-types/index.ts +36 -4
  360. package/contracts/mocks/utils/mpc/ArithmeticTestsContract.sol +0 -408
@@ -1,408 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- pragma solidity ^0.8.19;
3
-
4
- import "../../../utils/mpc/MpcCore.sol";
5
-
6
- contract ArithmeticTestsContract {
7
-
8
- struct AllGTCastingValues {
9
- gtUint8 a8_s;
10
- gtUint8 b8_s;
11
- gtUint16 a16_s;
12
- gtUint16 b16_s;
13
- gtUint32 a32_s;
14
- gtUint32 b32_s;
15
- gtUint64 a64_s;
16
- gtUint64 b64_s;
17
- }
18
-
19
- struct Check16 {
20
- gtUint16 res16_16;
21
- gtUint16 res8_16;
22
- gtUint16 res16_8;
23
- }
24
-
25
- struct Check32 {
26
- gtUint32 res32_32;
27
- gtUint32 res8_32;
28
- gtUint32 res32_8;
29
- gtUint32 res16_32;
30
- gtUint32 res32_16;
31
- }
32
-
33
- struct Check64 {
34
- gtUint64 res64_64;
35
- gtUint64 res8_64;
36
- gtUint64 res64_8;
37
- gtUint64 res16_64;
38
- gtUint64 res64_16;
39
- gtUint64 res32_64;
40
- gtUint64 res64_32;
41
- }
42
-
43
- uint8 addResult;
44
- uint8 subResult;
45
- uint8 mulResult;
46
-
47
- function getAddResult() public view returns (uint8) {
48
- return addResult;
49
- }
50
-
51
- function getSubResult() public view returns (uint8) {
52
- return subResult;
53
- }
54
-
55
- function getMulResult() public view returns (uint8) {
56
- return mulResult;
57
- }
58
-
59
- function setPublicValues(AllGTCastingValues memory castingValues, uint8 a, uint8 b) public{
60
- castingValues.a8_s = MpcCore.setPublic8(a);
61
- castingValues.b8_s = MpcCore.setPublic8(b);
62
- castingValues.a16_s = MpcCore.setPublic16(a);
63
- castingValues.b16_s = MpcCore.setPublic16(b);
64
- castingValues.a32_s = MpcCore.setPublic32(a);
65
- castingValues.b32_s = MpcCore.setPublic32(b);
66
- castingValues.a64_s = MpcCore.setPublic64(a);
67
- castingValues.b64_s = MpcCore.setPublic64(b);
68
- }
69
-
70
- function decryptAndCompareResults16(Check16 memory check16) public returns (uint16){
71
-
72
- // Calculate the result
73
- uint16 result = MpcCore.decrypt(check16.res16_16);
74
-
75
- require(result == MpcCore.decrypt(check16.res8_16) && result == MpcCore.decrypt(check16.res16_8),
76
- "decryptAndCompareAllResults: Failed to decrypt and compare all results");
77
- return result;
78
- }
79
-
80
- function decryptAndCompareResults32(Check32 memory check32) public returns (uint32){
81
-
82
- // Calculate the result
83
- uint32 result = MpcCore.decrypt(check32.res32_32);
84
-
85
- require(result == MpcCore.decrypt(check32.res8_32) && result == MpcCore.decrypt(check32.res32_8)
86
- && result == MpcCore.decrypt(check32.res32_16) && result == MpcCore.decrypt(check32.res16_32),
87
- "decryptAndCompareAllResults: Failed to decrypt and compare all results");
88
-
89
- return result;
90
- }
91
-
92
- function decryptAndCompareResults64(Check64 memory check64) public returns (uint64){
93
-
94
- // Calculate the result
95
- uint64 result = MpcCore.decrypt(check64.res64_64);
96
-
97
- require(result == MpcCore.decrypt(check64.res8_64) && result == MpcCore.decrypt(check64.res64_8)
98
- && result == MpcCore.decrypt(check64.res64_16) && result == MpcCore.decrypt(check64.res16_64)
99
- && result == MpcCore.decrypt(check64.res64_32) && result == MpcCore.decrypt(check64.res32_64),
100
- "decryptAndCompareAllResults: Failed to decrypt and compare all results");
101
-
102
- return result;
103
- }
104
-
105
- function addTest(uint8 a, uint8 b) public returns (uint8) {
106
- AllGTCastingValues memory castingValues;
107
- Check16 memory check16;
108
- Check32 memory check32;
109
- Check64 memory check64;
110
- setPublicValues(castingValues, a, b);
111
-
112
- // Calculate the expected result
113
- uint8 result = MpcCore.decrypt(MpcCore.add(castingValues.a8_s, castingValues.b8_s));
114
- addResult = result;
115
-
116
- // Calculate the results with casting to 16
117
- check16.res16_16 = MpcCore.add(castingValues.a16_s, castingValues.b16_s);
118
- check16.res8_16 = MpcCore.add(castingValues.a8_s, castingValues.b16_s);
119
- check16.res16_8 = MpcCore.add(castingValues.a16_s, castingValues.b8_s);
120
- uint16 res16 = decryptAndCompareResults16(check16);
121
- require(res16 == result, "addTest: cast 16 failed");
122
-
123
- // Calculate the result with casting to 32
124
- check32.res32_32 = MpcCore.add(castingValues.a32_s, castingValues.b32_s);
125
- check32.res8_32 = MpcCore.add(castingValues.a8_s, castingValues.b32_s);
126
- check32.res32_8 = MpcCore.add(castingValues.a32_s, castingValues.b8_s);
127
- check32.res16_32 = MpcCore.add(castingValues.a16_s, castingValues.b32_s);
128
- check32.res32_16 = MpcCore.add(castingValues.a32_s, castingValues.b16_s);
129
- uint32 res32 = decryptAndCompareResults32(check32);
130
- require(result == res32, "addTest: cast 32 failed");
131
-
132
- // Calculate the result with casting to 64
133
- check64.res64_64 = MpcCore.add(castingValues.a64_s, castingValues.b64_s);
134
- check64.res8_64 = MpcCore.add(castingValues.a8_s, castingValues.b64_s);
135
- check64.res64_8 = MpcCore.add(castingValues.a64_s, castingValues.b8_s);
136
- check64.res16_64 = MpcCore.add(castingValues.a16_s, castingValues.b64_s);
137
- check64.res64_16 = MpcCore.add(castingValues.a64_s, castingValues.b16_s);
138
- check64.res32_64 = MpcCore.add(castingValues.a32_s, castingValues.b64_s);
139
- check64.res64_32 = MpcCore.add(castingValues.a64_s, castingValues.b32_s);
140
- uint64 res64 = decryptAndCompareResults64(check64);
141
- require(result == res64, "addTest: cast 64 failed");
142
-
143
- // Check the result with scalar
144
- require(result == MpcCore.decrypt(MpcCore.add(a, castingValues.b8_s)) && result == MpcCore.decrypt(MpcCore.add(castingValues.a8_s, b)),
145
- "addTest: test 8 bits with scalar failed");
146
- require(result == MpcCore.decrypt(MpcCore.add(a, castingValues.b16_s)) && result == MpcCore.decrypt(MpcCore.add(castingValues.a16_s, b)),
147
- "addTest: test 16 bits with scalar failed");
148
- require(result == MpcCore.decrypt(MpcCore.add(a, castingValues.b32_s)) && result == MpcCore.decrypt(MpcCore.add(castingValues.a32_s, b)),
149
- "addTest: test 32 bits with scalar failed");
150
- require(result == MpcCore.decrypt(MpcCore.add(a, castingValues.b64_s)) && result == MpcCore.decrypt(MpcCore.add(castingValues.a64_s, b)),
151
- "addTest: test 64 bits with scalar failed");
152
-
153
- return result;
154
- }
155
-
156
- function checkedAddTest(uint8 a, uint8 b) public returns (uint8) {
157
- AllGTCastingValues memory castingValues;
158
- Check16 memory check16;
159
- Check32 memory check32;
160
- Check64 memory check64;
161
- setPublicValues(castingValues, a, b);
162
-
163
- // Calculate the expected result
164
- uint8 result = MpcCore.decrypt(MpcCore.checkedAdd(castingValues.a8_s, castingValues.b8_s));
165
- addResult = result;
166
-
167
- // Calculate the results with casting to 16
168
- check16.res16_16 = MpcCore.checkedAdd(castingValues.a16_s, castingValues.b16_s);
169
- check16.res8_16 = MpcCore.checkedAdd(castingValues.a8_s, castingValues.b16_s);
170
- check16.res16_8 = MpcCore.checkedAdd(castingValues.a16_s, castingValues.b8_s);
171
- uint16 res16 = decryptAndCompareResults16(check16);
172
- require(res16 == result, "addTest: cast 16 failed");
173
-
174
- // Calculate the result with casting to 32
175
- check32.res32_32 = MpcCore.checkedAdd(castingValues.a32_s, castingValues.b32_s);
176
- check32.res8_32 = MpcCore.checkedAdd(castingValues.a8_s, castingValues.b32_s);
177
- check32.res32_8 = MpcCore.checkedAdd(castingValues.a32_s, castingValues.b8_s);
178
- check32.res16_32 = MpcCore.checkedAdd(castingValues.a16_s, castingValues.b32_s);
179
- check32.res32_16 = MpcCore.checkedAdd(castingValues.a32_s, castingValues.b16_s);
180
- uint32 res32 = decryptAndCompareResults32(check32);
181
- require(result == res32, "addTest: cast 32 failed");
182
-
183
- // Calculate the result with casting to 64
184
- check64.res64_64 = MpcCore.checkedAdd(castingValues.a64_s, castingValues.b64_s);
185
- check64.res8_64 = MpcCore.checkedAdd(castingValues.a8_s, castingValues.b64_s);
186
- check64.res64_8 = MpcCore.checkedAdd(castingValues.a64_s, castingValues.b8_s);
187
- check64.res16_64 = MpcCore.checkedAdd(castingValues.a16_s, castingValues.b64_s);
188
- check64.res64_16 = MpcCore.checkedAdd(castingValues.a64_s, castingValues.b16_s);
189
- check64.res32_64 = MpcCore.checkedAdd(castingValues.a32_s, castingValues.b64_s);
190
- check64.res64_32 = MpcCore.checkedAdd(castingValues.a64_s, castingValues.b32_s);
191
- uint64 res64 = decryptAndCompareResults64(check64);
192
- require(result == res64, "addTest: cast 64 failed");
193
-
194
- // Check the result with scalar
195
- require(result == MpcCore.decrypt(MpcCore.checkedAdd(a, castingValues.b8_s)) && result == MpcCore.decrypt(MpcCore.checkedAdd(castingValues.a8_s, b)),
196
- "addTest: test 8 bits with scalar failed");
197
- require(result == MpcCore.decrypt(MpcCore.checkedAdd(a, castingValues.b16_s)) && result == MpcCore.decrypt(MpcCore.checkedAdd(castingValues.a16_s, b)),
198
- "addTest: test 16 bits with scalar failed");
199
- require(result == MpcCore.decrypt(MpcCore.checkedAdd(a, castingValues.b32_s)) && result == MpcCore.decrypt(MpcCore.checkedAdd(castingValues.a32_s, b)),
200
- "addTest: test 32 bits with scalar failed");
201
- require(result == MpcCore.decrypt(MpcCore.checkedAdd(a, castingValues.b64_s)) && result == MpcCore.decrypt(MpcCore.checkedAdd(castingValues.a64_s, b)),
202
- "addTest: test 64 bits with scalar failed");
203
-
204
- return result;
205
- }
206
-
207
- function subTest(uint8 a, uint8 b) public returns (uint8) {
208
- AllGTCastingValues memory castingValues;
209
- Check16 memory check16;
210
- Check32 memory check32;
211
- Check64 memory check64;
212
- setPublicValues(castingValues, a, b);
213
-
214
- // Calculate the expected result
215
- uint8 result = MpcCore.decrypt(MpcCore.sub(castingValues.a8_s, castingValues.b8_s));
216
- subResult = result;
217
-
218
- // Calculate the results with casting to 16
219
- check16.res16_16 = MpcCore.sub(castingValues.a16_s, castingValues.b16_s);
220
- check16.res8_16 = MpcCore.sub(castingValues.a8_s, castingValues.b16_s);
221
- check16.res16_8 = MpcCore.sub(castingValues.a16_s, castingValues.b8_s);
222
- uint16 res16 = decryptAndCompareResults16(check16);
223
- require(res16 == result, "subTest: cast 16 failed");
224
-
225
- // Calculate the result with casting to 32
226
- check32.res32_32 = MpcCore.sub(castingValues.a32_s, castingValues.b32_s);
227
- check32.res8_32 = MpcCore.sub(castingValues.a8_s, castingValues.b32_s);
228
- check32.res32_8 = MpcCore.sub(castingValues.a32_s, castingValues.b8_s);
229
- check32.res16_32 = MpcCore.sub(castingValues.a16_s, castingValues.b32_s);
230
- check32.res32_16 = MpcCore.sub(castingValues.a32_s, castingValues.b16_s);
231
- uint32 res32 = decryptAndCompareResults32(check32);
232
- require(result == res32, "subTest: cast 32 failed");
233
-
234
- // Calculate the result with casting to 64
235
- check64.res64_64 = MpcCore.sub(castingValues.a64_s, castingValues.b64_s);
236
- check64.res8_64 = MpcCore.sub(castingValues.a8_s, castingValues.b64_s);
237
- check64.res64_8 = MpcCore.sub(castingValues.a64_s, castingValues.b8_s);
238
- check64.res16_64 = MpcCore.sub(castingValues.a16_s, castingValues.b64_s);
239
- check64.res64_16 = MpcCore.sub(castingValues.a64_s, castingValues.b16_s);
240
- check64.res32_64 = MpcCore.sub(castingValues.a32_s, castingValues.b64_s);
241
- check64.res64_32 = MpcCore.sub(castingValues.a64_s, castingValues.b32_s);
242
- uint64 res64 = decryptAndCompareResults64(check64);
243
- require(result == res64, "subTest: cast 64 failed");
244
-
245
- // Check the result with scalar
246
- require(result == MpcCore.decrypt(MpcCore.sub(a, castingValues.b8_s)) && result == MpcCore.decrypt(MpcCore.sub(castingValues.a8_s, b)),
247
- "subTest: test 8 bits with scalar failed");
248
- require(result == MpcCore.decrypt(MpcCore.sub(a, castingValues.b16_s)) && result == MpcCore.decrypt(MpcCore.sub(castingValues.a16_s, b)),
249
- "subTest: test 16 bits with scalar failed");
250
- require(result == MpcCore.decrypt(MpcCore.sub(a, castingValues.b32_s)) && result == MpcCore.decrypt(MpcCore.sub(castingValues.a32_s, b)),
251
- "subTest: test 32 bits with scalar failed");
252
- require(result == MpcCore.decrypt(MpcCore.sub(a, castingValues.b64_s)) && result == MpcCore.decrypt(MpcCore.sub(castingValues.a64_s, b)),
253
- "subTest: test 64 bits with scalar failed");
254
-
255
- return result;
256
- }
257
-
258
- function checkedSubTest(uint8 a, uint8 b) public returns (uint8) {
259
- AllGTCastingValues memory castingValues;
260
- Check16 memory check16;
261
- Check32 memory check32;
262
- Check64 memory check64;
263
- setPublicValues(castingValues, a, b);
264
-
265
- // Calculate the expected result
266
- uint8 result = MpcCore.decrypt(MpcCore.checkedSub(castingValues.a8_s, castingValues.b8_s));
267
- subResult = result;
268
-
269
- // Calculate the results with casting to 16
270
- check16.res16_16 = MpcCore.checkedSub(castingValues.a16_s, castingValues.b16_s);
271
- check16.res8_16 = MpcCore.checkedSub(castingValues.a8_s, castingValues.b16_s);
272
- check16.res16_8 = MpcCore.checkedSub(castingValues.a16_s, castingValues.b8_s);
273
- uint16 res16 = decryptAndCompareResults16(check16);
274
- require(res16 == result, "subTest: cast 16 failed");
275
-
276
- // Calculate the result with casting to 32
277
- check32.res32_32 = MpcCore.checkedSub(castingValues.a32_s, castingValues.b32_s);
278
- check32.res8_32 = MpcCore.checkedSub(castingValues.a8_s, castingValues.b32_s);
279
- check32.res32_8 = MpcCore.checkedSub(castingValues.a32_s, castingValues.b8_s);
280
- check32.res16_32 = MpcCore.checkedSub(castingValues.a16_s, castingValues.b32_s);
281
- check32.res32_16 = MpcCore.checkedSub(castingValues.a32_s, castingValues.b16_s);
282
- uint32 res32 = decryptAndCompareResults32(check32);
283
- require(result == res32, "subTest: cast 32 failed");
284
-
285
- // Calculate the result with casting to 64
286
- check64.res64_64 = MpcCore.checkedSub(castingValues.a64_s, castingValues.b64_s);
287
- check64.res8_64 = MpcCore.checkedSub(castingValues.a8_s, castingValues.b64_s);
288
- check64.res64_8 = MpcCore.checkedSub(castingValues.a64_s, castingValues.b8_s);
289
- check64.res16_64 = MpcCore.checkedSub(castingValues.a16_s, castingValues.b64_s);
290
- check64.res64_16 = MpcCore.checkedSub(castingValues.a64_s, castingValues.b16_s);
291
- check64.res32_64 = MpcCore.checkedSub(castingValues.a32_s, castingValues.b64_s);
292
- check64.res64_32 = MpcCore.checkedSub(castingValues.a64_s, castingValues.b32_s);
293
- uint64 res64 = decryptAndCompareResults64(check64);
294
- require(result == res64, "subTest: cast 64 failed");
295
-
296
- // Check the result with scalar
297
- require(result == MpcCore.decrypt(MpcCore.checkedSub(a, castingValues.b8_s)) && result == MpcCore.decrypt(MpcCore.checkedSub(castingValues.a8_s, b)),
298
- "subTest: test 8 bits with scalar failed");
299
- require(result == MpcCore.decrypt(MpcCore.checkedSub(a, castingValues.b16_s)) && result == MpcCore.decrypt(MpcCore.checkedSub(castingValues.a16_s, b)),
300
- "subTest: test 16 bits with scalar failed");
301
- require(result == MpcCore.decrypt(MpcCore.checkedSub(a, castingValues.b32_s)) && result == MpcCore.decrypt(MpcCore.checkedSub(castingValues.a32_s, b)),
302
- "subTest: test 32 bits with scalar failed");
303
- require(result == MpcCore.decrypt(MpcCore.checkedSub(a, castingValues.b64_s)) && result == MpcCore.decrypt(MpcCore.checkedSub(castingValues.a64_s, b)),
304
- "subTest: test 64 bits with scalar failed");
305
-
306
- return result;
307
- }
308
-
309
- function mulTest(uint8 a, uint8 b) public returns (uint8) {
310
- AllGTCastingValues memory castingValues;
311
- Check16 memory check16;
312
- Check32 memory check32;
313
- Check64 memory check64;
314
- setPublicValues(castingValues, a, b);
315
-
316
- // Calculate the expected result
317
- mulResult = MpcCore.decrypt(MpcCore.mul(castingValues.a8_s, castingValues.b8_s));
318
-
319
- // Calculate the result with casting to 16
320
- check16.res16_16 = MpcCore.mul(castingValues.a16_s, castingValues.b16_s);
321
- check16.res8_16 = MpcCore.mul(castingValues.a8_s, castingValues.b16_s);
322
- check16.res16_8 = MpcCore.mul(castingValues.a16_s, castingValues.b8_s);
323
- uint16 res16 = decryptAndCompareResults16(check16);
324
- require(mulResult == res16, "mulTest: cast 16 failed");
325
-
326
- // Calculate the result with casting to 32
327
- check32.res32_32 = MpcCore.mul(castingValues.a32_s, castingValues.b32_s);
328
- check32.res8_32 = MpcCore.mul(castingValues.a8_s, castingValues.b32_s);
329
- check32.res32_8 = MpcCore.mul(castingValues.a32_s, castingValues.b8_s);
330
- check32.res16_32 = MpcCore.mul(castingValues.a16_s, castingValues.b32_s);
331
- check32.res32_16 = MpcCore.mul(castingValues.a32_s, castingValues.b16_s);
332
- uint32 res32 = decryptAndCompareResults32(check32);
333
- require(mulResult == res32, "mulTest: cast 32 failed");
334
-
335
- // Calculate the result with casting to 64
336
- check64.res64_64 = MpcCore.mul(castingValues.a64_s, castingValues.b64_s);
337
- check64.res8_64 = MpcCore.mul(castingValues.a8_s, castingValues.b64_s);
338
- check64.res64_8 = MpcCore.mul(castingValues.a64_s, castingValues.b8_s);
339
- check64.res16_64 = MpcCore.mul(castingValues.a16_s, castingValues.b64_s);
340
- check64.res64_16 = MpcCore.mul(castingValues.a64_s, castingValues.b16_s);
341
- check64.res32_64 = MpcCore.mul(castingValues.a32_s, castingValues.b64_s);
342
- check64.res64_32 = MpcCore.mul(castingValues.a64_s, castingValues.b32_s);
343
- uint64 res64 = decryptAndCompareResults64(check64);
344
- require(mulResult == res64, "mulTest: cast 64 failed");
345
-
346
- // Check the result with scalar
347
- require(mulResult == MpcCore.decrypt(MpcCore.mul(a, castingValues.b8_s)) && mulResult == MpcCore.decrypt(MpcCore.mul(castingValues.a8_s, b)),
348
- "mulTest: test 8 bits with scalar failed");
349
- require(mulResult == MpcCore.decrypt(MpcCore.mul(a, castingValues.b16_s)) && mulResult == MpcCore.decrypt(MpcCore.mul(castingValues.a16_s, b)),
350
- "mulTest: test 16 bits with scalar failed");
351
- require(mulResult == MpcCore.decrypt(MpcCore.mul(a, castingValues.b32_s)) && mulResult == MpcCore.decrypt(MpcCore.mul(castingValues.a32_s, b)),
352
- "mulTest: test 32 bits with scalar failed");
353
- require(mulResult == MpcCore.decrypt(MpcCore.mul(a, castingValues.b64_s)) && mulResult == MpcCore.decrypt(MpcCore.mul(castingValues.a64_s, b)),
354
- "mulTest: test 64 bits with scalar failed");
355
-
356
- return mulResult;
357
- }
358
-
359
- function checkedMulTest(uint8 a, uint8 b) public returns (uint8) {
360
- AllGTCastingValues memory castingValues;
361
- Check16 memory check16;
362
- Check32 memory check32;
363
- Check64 memory check64;
364
- setPublicValues(castingValues, a, b);
365
-
366
- // Calculate the expected result
367
- mulResult = MpcCore.decrypt(MpcCore.checkedMul(castingValues.a8_s, castingValues.b8_s));
368
-
369
- // Calculate the result with casting to 16
370
- check16.res16_16 = MpcCore.checkedMul(castingValues.a16_s, castingValues.b16_s);
371
- check16.res8_16 = MpcCore.checkedMul(castingValues.a8_s, castingValues.b16_s);
372
- check16.res16_8 = MpcCore.checkedMul(castingValues.a16_s, castingValues.b8_s);
373
- uint16 res16 = decryptAndCompareResults16(check16);
374
- require(mulResult == res16, "mulTest: cast 16 failed");
375
-
376
- // Calculate the result with casting to 32
377
- check32.res32_32 = MpcCore.checkedMul(castingValues.a32_s, castingValues.b32_s);
378
- check32.res8_32 = MpcCore.checkedMul(castingValues.a8_s, castingValues.b32_s);
379
- check32.res32_8 = MpcCore.checkedMul(castingValues.a32_s, castingValues.b8_s);
380
- check32.res16_32 = MpcCore.checkedMul(castingValues.a16_s, castingValues.b32_s);
381
- check32.res32_16 = MpcCore.checkedMul(castingValues.a32_s, castingValues.b16_s);
382
- uint32 res32 = decryptAndCompareResults32(check32);
383
- require(mulResult == res32, "mulTest: cast 32 failed");
384
-
385
- // Calculate the result with casting to 64
386
- check64.res64_64 = MpcCore.checkedMul(castingValues.a64_s, castingValues.b64_s);
387
- check64.res8_64 = MpcCore.checkedMul(castingValues.a8_s, castingValues.b64_s);
388
- check64.res64_8 = MpcCore.checkedMul(castingValues.a64_s, castingValues.b8_s);
389
- check64.res16_64 = MpcCore.checkedMul(castingValues.a16_s, castingValues.b64_s);
390
- check64.res64_16 = MpcCore.checkedMul(castingValues.a64_s, castingValues.b16_s);
391
- check64.res32_64 = MpcCore.checkedMul(castingValues.a32_s, castingValues.b64_s);
392
- check64.res64_32 = MpcCore.checkedMul(castingValues.a64_s, castingValues.b32_s);
393
- uint64 res64 = decryptAndCompareResults64(check64);
394
- require(mulResult == res64, "mulTest: cast 64 failed");
395
-
396
- // Check the result with scalar
397
- require(mulResult == MpcCore.decrypt(MpcCore.checkedMul(a, castingValues.b8_s)) && mulResult == MpcCore.decrypt(MpcCore.checkedMul(castingValues.a8_s, b)),
398
- "mulTest: test 8 bits with scalar failed");
399
- require(mulResult == MpcCore.decrypt(MpcCore.checkedMul(a, castingValues.b16_s)) && mulResult == MpcCore.decrypt(MpcCore.checkedMul(castingValues.a16_s, b)),
400
- "mulTest: test 16 bits with scalar failed");
401
- require(mulResult == MpcCore.decrypt(MpcCore.checkedMul(a, castingValues.b32_s)) && mulResult == MpcCore.decrypt(MpcCore.checkedMul(castingValues.a32_s, b)),
402
- "mulTest: test 32 bits with scalar failed");
403
- require(mulResult == MpcCore.decrypt(MpcCore.checkedMul(a, castingValues.b64_s)) && mulResult == MpcCore.decrypt(MpcCore.checkedMul(castingValues.a64_s, b)),
404
- "mulTest: test 64 bits with scalar failed");
405
-
406
- return mulResult;
407
- }
408
- }