@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.
- package/contracts/access/DataPrivacyFramework/DataPrivacyFramework.sol +1 -1
- package/contracts/access/DataPrivacyFramework/extensions/DataPrivacyFrameworkMpc.sol +1 -1
- package/contracts/disperse/coinByRatio/FixedRatioCoinDisperserUnlimitedWindow.sol +2 -4
- package/contracts/disperse/disperseToken/MintDisperser.sol +1 -3
- package/contracts/disperse/disperseToken/TokenDisperser.sol +1 -1
- package/contracts/messaging/PrivateMessaging.sol +1 -1
- package/contracts/mocks/access/DataPrivacyFramework/DataPrivacyFrameworkMock.sol +1 -1
- package/contracts/mocks/messaging/PrivateMessagingHarness.sol +1 -1
- package/contracts/mocks/oracle/CotiPriceConsumerMock.sol +1 -1
- package/contracts/mocks/token/ERC20DecimalsMock.sol +1 -1
- package/contracts/mocks/token/ERC20Mock.sol +1 -1
- package/contracts/mocks/token/PrivateERC20/EncryptedTokenReceiverMock.sol +1 -1
- package/contracts/mocks/token/PrivateERC20/PrivacyBridgeERC20Mock.sol +1 -1
- package/contracts/mocks/token/PrivateERC20/PrivateERC20AuditorSupplyMock.sol +1 -1
- package/contracts/mocks/token/PrivateERC20/PrivateERC20CappedMock.sol +1 -1
- package/contracts/mocks/token/PrivateERC20/PrivateERC20GtCallerMock.sol +1 -1
- package/contracts/mocks/token/PrivateERC20/PrivateERC20Mock.sol +1 -1
- package/contracts/mocks/token/PrivateERC20/PrivateERC20ReentrantReceiverMock.sol +1 -1
- package/contracts/mocks/token/PrivateERC20/PublicReentrantTokenReceiverMock.sol +1 -1
- package/contracts/mocks/token/PrivateERC20/PublicTokenReceiverBoolMock.sol +1 -1
- package/contracts/mocks/token/PrivateERC20/PublicTokenReceiverMock.sol +1 -1
- package/contracts/mocks/token/PrivateERC721/PrivateERC721URIStorageMock.sol +1 -1
- package/contracts/mocks/utils/mpc/Arithmetic128TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/Arithmetic256TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/ArithmeticAddTestsContract.sol +196 -0
- package/contracts/mocks/utils/mpc/ArithmeticMulTestsContract.sol +194 -0
- package/contracts/mocks/utils/mpc/ArithmeticSigned128TestsContract.sol +63 -0
- package/contracts/mocks/utils/mpc/ArithmeticSigned256TestsContract.sol +107 -0
- package/contracts/mocks/utils/mpc/ArithmeticSignedNarrowTestsContract.sol +123 -0
- package/contracts/mocks/utils/mpc/ArithmeticSubTestsContract.sol +196 -0
- package/contracts/mocks/utils/mpc/Bitwise128TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/Bitwise256TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/BitwiseTestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/CheckedArithmetic128WithOverflowBitTestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/CheckedArithmetic256WithOverflowBitTestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/CheckedArithmeticWIthOverflowBitTestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/Comparison128TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/Comparison1TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/Comparison256TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/Comparison2TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/MinMax128TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/MinMax256TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/MinMaxTestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/MinimalImplementation.sol +1 -1
- package/contracts/mocks/utils/mpc/MinimalProxy.sol +1 -1
- package/contracts/mocks/utils/mpc/Miscellaneous1TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/MiscellaneousTestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/MpcOperations128TestContract.sol +1 -1
- package/contracts/mocks/utils/mpc/MpcOperationsTestContract.sol +4 -4
- package/contracts/mocks/utils/mpc/Mux128TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/Mux256TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/OffboardToUserKeyTestContract.sol +1 -1
- package/contracts/mocks/utils/mpc/OnBoard128TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/OnBoard256TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/PrivacyImplementationV1.sol +1 -1
- package/contracts/mocks/utils/mpc/PrivacyImplementationV2.sol +1 -1
- package/contracts/mocks/utils/mpc/PrivacyProxy.sol +1 -1
- package/contracts/mocks/utils/mpc/Random128TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/Random256TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/Shift128TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/Shift256TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/ShiftTestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/StringTestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/Transfer128TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/Transfer256TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/TransferScalarTestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/TransferTestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/TransferWithAllowance128TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/TransferWithAllowance256TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/TransferWithAllowance64_16TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/TransferWithAllowance64_32TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/TransferWithAllowance64_64TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/TransferWithAllowance64_8TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/TransferWithAllowanceScalarTestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/TransferWithAllowanceTestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/ValidateCiphertext128TestsContract.sol +1 -1
- package/contracts/mocks/utils/mpc/ValidateCiphertext256TestsContract.sol +2 -2
- package/contracts/mocks/utils/mpc/ValidateCiphertextTestsContract.sol +1 -1
- package/contracts/mocks/wallet/PrivateERC20Wallet/PrivateERC20WalletMock.sol +1 -1
- package/contracts/node/CotiNodeRewards.sol +3 -3
- package/contracts/node/SoulboundNodeNFT.sol +1 -2
- package/contracts/onboard/AccountOnboard.sol +1 -1
- package/contracts/oracle/ICotiPriceConsumer.sol +1 -1
- package/contracts/pod/IInbox.sol +231 -0
- package/contracts/pod/IInboxMiner.sol +53 -0
- package/contracts/pod/InboxUser.sol +29 -0
- package/contracts/pod/InboxUserCotiTestnet.sol +13 -0
- package/contracts/pod/PodNetworkConstants.sol +30 -0
- package/contracts/pod/examples/MpcAdder.sol +57 -0
- package/contracts/pod/examples/MpcAdderPausable.sol +25 -0
- package/contracts/pod/examples/MpcAdderPausable.sol.bak +25 -0
- package/contracts/pod/examples/it128/PodAdder128.sol +48 -0
- package/contracts/pod/examples/it256/PodAdder256.sol +48 -0
- package/contracts/pod/fee/IInboxFeeManager.sol +40 -0
- package/contracts/pod/manifest.json +52 -0
- package/contracts/pod/mpc/PodLib.sol +10 -0
- package/contracts/pod/mpc/PodLib128.sol +361 -0
- package/contracts/pod/mpc/PodLib256.sol +361 -0
- package/contracts/pod/mpc/PodLib64.sol +385 -0
- package/contracts/pod/mpc/PodLibBase.sol +72 -0
- package/contracts/pod/mpc/PodUser.sol +58 -0
- package/contracts/pod/mpc/PodUserFuji.sol +14 -0
- package/contracts/pod/mpc/PodUserSepolia.sol +13 -0
- package/contracts/pod/mpc/coti-side/IPodExecutorOps.sol +99 -0
- package/contracts/pod/mpccodec/MpcAbiCodec.sol +482 -0
- package/contracts/pod/privacy/IPodPriceOracle.sol +20 -0
- package/contracts/pod/privacy/IPrivacyPortal.sol +248 -0
- package/contracts/pod/privacy/IPrivacyPortalFactory.sol +88 -0
- package/contracts/pod/privacy/PortalFeeOracle.sol +51 -0
- package/contracts/pod/privacy/PrivacyPortal.sol +871 -0
- package/contracts/pod/privacy/PrivacyPortalFactory.sol +492 -0
- package/contracts/pod/privacy/PrivacyPortalFeeLib.sol +98 -0
- package/contracts/pod/privacy/mocks/CloneHelper.sol +14 -0
- package/contracts/pod/privacy/mocks/MockERC20.sol +26 -0
- package/contracts/pod/privacy/mocks/MockPodERC20ForPortal.sol +160 -0
- package/contracts/pod/privacy/mocks/MockPrivacyPortalFactory.sol +125 -0
- package/contracts/pod/privacy/mocks/MockWrappedNative.sol +24 -0
- package/contracts/pod/token/erc7984/Erc7984Constants.sol +9 -0
- package/contracts/pod/token/erc7984/Erc7984Pointers.sol +29 -0
- package/contracts/pod/token/erc7984/IERC7984.sol +69 -0
- package/contracts/pod/token/erc7984/IERC7984PortalWrapper.sol +31 -0
- package/contracts/pod/token/erc7984/PodErc7984Mixin.sol +125 -0
- package/contracts/pod/token/erc7984/README.md +60 -0
- package/contracts/pod/token/perc20/IPodERC20.sol +298 -0
- package/contracts/pod/token/perc20/PodERC20.sol +1021 -0
- package/contracts/pod/token/perc20/PodErc20Mintable.sol +88 -0
- package/contracts/pod/token/perc20/PodErc20MintableInitializable.sol +42 -0
- package/contracts/pod/token/perc20/cotiside/IPodErc20CotiSide.sol +88 -0
- package/contracts/pod/token/perc20/cotiside/PodErc20CotiMother.sol +529 -0
- package/contracts/pod/utils/IWrappedNative.sol +11 -0
- package/contracts/privacyBridge/PrivacyBridge.sol +5 -5
- package/contracts/privacyBridge/PrivacyBridgeCotiNative.sol +1 -1
- package/contracts/privacyBridge/PrivacyBridgeERC20.sol +1 -1
- package/contracts/privacyBridge/PrivacyBridgeUSDCe.sol +1 -1
- package/contracts/privacyBridge/PrivacyBridgeUSDT.sol +1 -1
- package/contracts/privacyBridge/PrivacyBridgeWADA.sol +1 -1
- package/contracts/privacyBridge/PrivacyBridgeWBTC.sol +1 -1
- package/contracts/privacyBridge/PrivacyBridgeWETH.sol +1 -1
- package/contracts/privacyBridge/PrivacyBridgegCoti.sol +1 -1
- package/contracts/token/PrivateERC20/IPrivateERC20.sol +1 -1
- package/contracts/token/PrivateERC20/ITokenReceiver.sol +1 -1
- package/contracts/token/PrivateERC20/ITokenReceiverEncrypted.sol +1 -1
- package/contracts/token/PrivateERC20/PrivateERC20.sol +5 -5
- package/contracts/token/PrivateERC20/tokens/PrivateBridgedUSDC.sol +1 -1
- package/contracts/token/PrivateERC20/tokens/PrivateCOTI.sol +1 -1
- package/contracts/token/PrivateERC20/tokens/PrivateCOTITreasuryGovernanceToken.sol +1 -1
- package/contracts/token/PrivateERC20/tokens/PrivateTetherUSD.sol +1 -1
- package/contracts/token/PrivateERC20/tokens/PrivateWrappedADA.sol +1 -1
- package/contracts/token/PrivateERC20/tokens/PrivateWrappedBTC.sol +1 -1
- package/contracts/token/PrivateERC20/tokens/PrivateWrappedEther.sol +1 -1
- package/contracts/token/PrivateERC721/IERC721Errors.sol +1 -1
- package/contracts/token/PrivateERC721/PrivateERC721.sol +1 -1
- package/contracts/token/PrivateERC721/extensions/IPrivateERC721URIStorage.sol +1 -1
- package/contracts/token/PrivateERC721/extensions/PrivateERC721URIStorage.sol +1 -1
- package/contracts/token/points/CotiTokenPoints004.sol +43 -0
- package/contracts/utils/mpc/MpcCore.sol +610 -1
- package/contracts/utils/mpc/MpcInterface.sol +1 -1
- package/hardhat.config.ts +5 -14
- package/package.json +4 -4
- package/scripts/deployCotiTokenPoints004.ts +61 -0
- package/scripts/deployFixedRatioCoinDisperserUnlimitedWindow.ts +68 -0
- package/scripts/verifyCotiTokenPoints004.ts +123 -0
- package/scripts/verifyFixedRatioCoinDisperserUnlimitedWindow.ts +112 -0
- package/test/messaging/PrivateMessaging.test.ts +5 -5
- package/test/pod/privacy/PrivacyPortal.access.test.ts +756 -0
- package/test/pod/privacy/PrivacyPortal.recovery.test.ts +263 -0
- package/test/privacyBridge/UnifiedPrivacyBridges.test.cjs +5 -3
- package/test/utils/mpc/CheckedSignedArithmetic256.test.ts +163 -0
- package/test/utils/mpc/NegativeCases.test.ts +3 -3
- package/test/utils/mpc/Precompile.test.ts +6 -6
- package/typechain-types/@openzeppelin/contracts/access/AccessControl.ts +2 -2
- package/typechain-types/@openzeppelin/contracts/access/IAccessControl.ts +2 -2
- package/typechain-types/@openzeppelin/contracts/access/extensions/AccessControlEnumerable.ts +375 -0
- package/typechain-types/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.ts +329 -0
- package/typechain-types/@openzeppelin/contracts/access/extensions/index.ts +5 -0
- package/typechain-types/@openzeppelin/contracts/access/index.ts +2 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/IERC1363.ts +412 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/IERC5267.ts +151 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC1155Errors.ts +69 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC20Errors.ts +69 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC721Errors.ts +69 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/index.ts +6 -0
- package/typechain-types/@openzeppelin/contracts/interfaces/index.ts +4 -0
- package/typechain-types/@openzeppelin/contracts/token/ERC20/ERC20.ts +6 -50
- package/typechain-types/@openzeppelin/contracts/token/ERC20/IERC20.ts +6 -6
- package/typechain-types/@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.ts +313 -0
- package/typechain-types/@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.ts +356 -0
- package/typechain-types/@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.ts +423 -0
- package/typechain-types/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.ts +6 -6
- package/typechain-types/@openzeppelin/contracts/token/ERC20/extensions/index.ts +3 -0
- package/typechain-types/@openzeppelin/contracts/token/ERC20/index.ts +2 -0
- package/typechain-types/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.ts +69 -0
- package/typechain-types/@openzeppelin/contracts/token/ERC20/utils/index.ts +4 -0
- package/typechain-types/@openzeppelin/contracts/utils/Nonces.ts +85 -0
- package/typechain-types/@openzeppelin/contracts/utils/Pausable.ts +150 -0
- package/typechain-types/@openzeppelin/contracts/utils/ReentrancyGuard.ts +69 -0
- package/typechain-types/@openzeppelin/contracts/utils/ShortStrings.ts +69 -0
- package/typechain-types/@openzeppelin/contracts/utils/Strings.ts +69 -0
- package/typechain-types/@openzeppelin/contracts/utils/cryptography/ECDSA.ts +69 -0
- package/typechain-types/@openzeppelin/contracts/utils/cryptography/EIP712.ts +151 -0
- package/typechain-types/@openzeppelin/contracts/utils/cryptography/index.ts +5 -0
- package/typechain-types/@openzeppelin/contracts/utils/index.ts +9 -0
- package/typechain-types/@openzeppelin/contracts/utils/math/SafeCast.ts +69 -0
- package/typechain-types/@openzeppelin/contracts/utils/math/index.ts +4 -0
- package/typechain-types/contracts/mocks/token/ERC20DecimalsMock.ts +6 -50
- package/typechain-types/contracts/mocks/token/ERC20Mock.ts +6 -50
- package/typechain-types/contracts/mocks/token/PrivateERC20/PrivacyBridgeERC20Mock.ts +16 -2
- package/typechain-types/contracts/mocks/token/PrivateERC20/PrivateERC20AuditorSupplyMock.ts +2 -2
- package/typechain-types/contracts/mocks/token/PrivateERC20/PrivateERC20CappedMock.ts +2 -2
- package/typechain-types/contracts/mocks/token/PrivateERC20/PrivateERC20Mock.ts +2 -2
- package/typechain-types/contracts/privacyBridge/PrivacyBridge.ts +16 -2
- package/typechain-types/contracts/privacyBridge/PrivacyBridgeCotiNative.ts +16 -2
- package/typechain-types/contracts/privacyBridge/PrivacyBridgeERC20.sol/PrivacyBridgeERC20.ts +16 -2
- package/typechain-types/contracts/privacyBridge/PrivacyBridgeUSDCe.ts +16 -2
- package/typechain-types/contracts/privacyBridge/PrivacyBridgeUSDT.ts +16 -2
- package/typechain-types/contracts/privacyBridge/PrivacyBridgeWADA.ts +16 -2
- package/typechain-types/contracts/privacyBridge/PrivacyBridgeWBTC.ts +16 -2
- package/typechain-types/contracts/privacyBridge/PrivacyBridgeWETH.ts +16 -2
- package/typechain-types/contracts/privacyBridge/PrivacyBridgegCoti.ts +16 -2
- package/typechain-types/contracts/token/PrivateERC20/PrivateERC20.ts +2 -2
- package/typechain-types/contracts/token/PrivateERC20/tokens/PrivateBridgedUSDC.ts +2 -2
- package/typechain-types/contracts/token/PrivateERC20/tokens/PrivateCOTI.ts +2 -2
- package/typechain-types/contracts/token/PrivateERC20/tokens/PrivateCOTITreasuryGovernanceToken.ts +2 -2
- package/typechain-types/contracts/token/PrivateERC20/tokens/PrivateTetherUSD.ts +2 -2
- package/typechain-types/contracts/token/PrivateERC20/tokens/PrivateWrappedADA.ts +2 -2
- package/typechain-types/contracts/token/PrivateERC20/tokens/PrivateWrappedBTC.ts +2 -2
- package/typechain-types/contracts/token/PrivateERC20/tokens/PrivateWrappedEther.ts +2 -2
- package/typechain-types/contracts/token/index.ts +2 -0
- package/typechain-types/contracts/token/points/CotiTokenPoints004.sol/COTITokenPoints004.ts +826 -0
- package/typechain-types/contracts/token/points/CotiTokenPoints004.ts +826 -0
- package/typechain-types/contracts/token/points/index.ts +4 -0
- package/typechain-types/factories/@openzeppelin/contracts/access/AccessControl__factory.ts +22 -1
- package/typechain-types/factories/@openzeppelin/contracts/access/IAccessControl__factory.ts +22 -1
- package/typechain-types/factories/@openzeppelin/contracts/access/Ownable__factory.ts +22 -0
- package/typechain-types/factories/@openzeppelin/contracts/access/extensions/AccessControlEnumerable__factory.ts +316 -0
- package/typechain-types/factories/@openzeppelin/contracts/access/extensions/IAccessControlEnumerable__factory.ts +265 -0
- package/typechain-types/factories/@openzeppelin/contracts/access/extensions/index.ts +5 -0
- package/typechain-types/factories/@openzeppelin/contracts/access/index.ts +1 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/IERC1363__factory.ts +393 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/IERC5267__factory.ts +71 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC1155Errors__factory.ts +127 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC20Errors__factory.ts +111 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/IERC721Errors__factory.ts +128 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/draft-IERC6093.sol/index.ts +6 -0
- package/typechain-types/factories/@openzeppelin/contracts/interfaces/index.ts +3 -0
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC20/ERC20__factory.ts +84 -110
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC20/IERC20__factory.ts +3 -3
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable__factory.ts +364 -0
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable__factory.ts +382 -0
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit__factory.ts +540 -0
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata__factory.ts +3 -3
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC20/extensions/index.ts +3 -0
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC20/index.ts +1 -0
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC20/utils/SafeERC20__factory.ts +96 -0
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC20/utils/index.ts +4 -0
- package/typechain-types/factories/@openzeppelin/contracts/token/ERC721/ERC721__factory.ts +98 -59
- package/typechain-types/factories/@openzeppelin/contracts/utils/Nonces__factory.ts +57 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/Pausable__factory.ts +71 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/ReentrancyGuard__factory.ts +30 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/ShortStrings__factory.ts +83 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/Strings__factory.ts +90 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/cryptography/ECDSA__factory.ts +91 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/cryptography/EIP712__factory.ts +87 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/cryptography/index.ts +5 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/index.ts +7 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/math/SafeCast__factory.ts +118 -0
- package/typechain-types/factories/@openzeppelin/contracts/utils/math/index.ts +4 -0
- package/typechain-types/factories/contracts/disperse/coinByRatio/FixedRatioCoinDisperserLeftoverS1__factory.ts +12 -1
- package/typechain-types/factories/contracts/disperse/coinByRatio/FixedRatioCoinDisperserUnlimitedWindow__factory.ts +39 -1
- package/typechain-types/factories/contracts/disperse/coinByRatio/FixedRatioCoinDisperser__factory.ts +12 -1
- package/typechain-types/factories/contracts/disperse/disperseToken/MintDisperser.sol/MintDisperser__factory.ts +23 -1
- package/typechain-types/factories/contracts/disperse/disperseToken/TokenDisperser__factory.ts +12 -1
- package/typechain-types/factories/contracts/messaging/PrivateMessaging__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/messaging/PrivateMessagingHarness__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/token/ERC20DecimalsMock__factory.ts +90 -52
- package/typechain-types/factories/contracts/mocks/token/ERC20Mock__factory.ts +90 -52
- package/typechain-types/factories/contracts/mocks/token/PrivateERC20/PrivacyBridgeERC20Mock__factory.ts +90 -2
- package/typechain-types/factories/contracts/mocks/token/PrivateERC20/PrivateERC20AuditorSupplyMock__factory.ts +28 -2
- package/typechain-types/factories/contracts/mocks/token/PrivateERC20/PrivateERC20CappedMock__factory.ts +28 -2
- package/typechain-types/factories/contracts/mocks/token/PrivateERC20/PrivateERC20GtCallerMock__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/token/PrivateERC20/PrivateERC20Mock__factory.ts +28 -2
- package/typechain-types/factories/contracts/mocks/token/PrivateERC721/PrivateERC721URIStorageMock__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/Arithmetic128TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/Arithmetic256TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/ArithmeticTestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/Bitwise128TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/Bitwise256TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/BitwiseTestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/CheckedArithmetic128WithOverflowBitTestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/CheckedArithmetic256WithOverflowBitTestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/CheckedArithmeticWIthOverflowBitTestsContract.sol/CheckedArithmeticWithOverflowBitTestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/Comparison128TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/Comparison1TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/Comparison256TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/Comparison2TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/MinMax128TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/MinMax256TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/MinMaxTestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/MinimalImplementation__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/Miscellaneous1TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/MiscellaneousTestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/MpcOperations128TestContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/MpcOperationsTestContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/Mux128TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/Mux256TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/OffboardToUserKeyTestContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/OnBoard128TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/OnBoard256TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/PrivacyImplementationV1__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/PrivacyImplementationV2__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/Random128TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/Random256TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/Shift128TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/Shift256TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/ShiftTestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/StringTestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/Transfer128TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/Transfer256TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferScalarTestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferTestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance128TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance256TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance64_16TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance64_32TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance64_64TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowance64_8TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowanceScalarTestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/TransferWithAllowanceTestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/ValidateCiphertext128TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/ValidateCiphertext256TestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/utils/mpc/ValidateCiphertextTestsContract__factory.ts +1 -1
- package/typechain-types/factories/contracts/mocks/wallet/PrivateERC20Wallet/PrivateERC20WalletMock__factory.ts +1 -1
- package/typechain-types/factories/contracts/node/CotiNodeRewards__factory.ts +28 -1
- package/typechain-types/factories/contracts/node/SoulboundNodeNFT.sol/SoulboundNodeNFT__factory.ts +126 -1
- package/typechain-types/factories/contracts/onboard/AccountOnboard__factory.ts +1 -1
- package/typechain-types/factories/contracts/privacyBridge/PrivacyBridgeCotiNative__factory.ts +79 -2
- package/typechain-types/factories/contracts/privacyBridge/PrivacyBridgeERC20.sol/PrivacyBridgeERC20__factory.ts +89 -1
- package/typechain-types/factories/contracts/privacyBridge/PrivacyBridgeUSDCe__factory.ts +90 -2
- package/typechain-types/factories/contracts/privacyBridge/PrivacyBridgeUSDT__factory.ts +90 -2
- package/typechain-types/factories/contracts/privacyBridge/PrivacyBridgeWADA__factory.ts +90 -2
- package/typechain-types/factories/contracts/privacyBridge/PrivacyBridgeWBTC__factory.ts +90 -2
- package/typechain-types/factories/contracts/privacyBridge/PrivacyBridgeWETH__factory.ts +90 -2
- package/typechain-types/factories/contracts/privacyBridge/PrivacyBridge__factory.ts +78 -1
- package/typechain-types/factories/contracts/privacyBridge/PrivacyBridgegCoti__factory.ts +90 -2
- package/typechain-types/factories/contracts/token/PrivateERC20/PrivateERC20__factory.ts +27 -1
- package/typechain-types/factories/contracts/token/PrivateERC20/tokens/PrivateBridgedUSDC__factory.ts +28 -2
- package/typechain-types/factories/contracts/token/PrivateERC20/tokens/PrivateCOTITreasuryGovernanceToken__factory.ts +28 -2
- package/typechain-types/factories/contracts/token/PrivateERC20/tokens/PrivateCOTI__factory.ts +28 -2
- package/typechain-types/factories/contracts/token/PrivateERC20/tokens/PrivateTetherUSD__factory.ts +28 -2
- package/typechain-types/factories/contracts/token/PrivateERC20/tokens/PrivateWrappedADA__factory.ts +28 -2
- package/typechain-types/factories/contracts/token/PrivateERC20/tokens/PrivateWrappedBTC__factory.ts +28 -2
- package/typechain-types/factories/contracts/token/PrivateERC20/tokens/PrivateWrappedEther__factory.ts +28 -2
- package/typechain-types/factories/contracts/token/index.ts +1 -0
- package/typechain-types/factories/contracts/token/points/CotiTokenPoints004.sol/COTITokenPoints004__factory.ts +992 -0
- package/typechain-types/factories/contracts/token/points/CotiTokenPoints004__factory.ts +992 -0
- package/typechain-types/factories/contracts/token/points/index.ts +4 -0
- package/typechain-types/factories/contracts/utils/mpc/MpcCore__factory.ts +1 -1
- package/typechain-types/hardhat.d.ts +360 -0
- package/typechain-types/index.ts +36 -4
- package/contracts/mocks/utils/mpc/ArithmeticTestsContract.sol +0 -408
|
@@ -4,7 +4,7 @@ pragma solidity ^0.8.20;
|
|
|
4
4
|
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
|
|
5
5
|
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
6
6
|
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|
7
|
-
import {ReentrancyGuard} from "@openzeppelin/contracts/
|
|
7
|
+
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
|
|
8
8
|
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -76,12 +76,10 @@ contract FixedRatioCoinDisperserUnlimitedWindow is ReentrancyGuard, Ownable {
|
|
|
76
76
|
* @param _pointsToken Address of the ERC20 points token that can be redeemed
|
|
77
77
|
* @param _owner Address that will have admin privileges (can pause, finalize, etc.)
|
|
78
78
|
*/
|
|
79
|
-
constructor(address _pointsToken, address _owner) {
|
|
79
|
+
constructor(address _pointsToken, address _owner) Ownable(_owner) {
|
|
80
80
|
if (_pointsToken == address(0)) revert TokenZeroAddress();
|
|
81
|
-
if (_owner == address(0)) revert OwnerZeroAddress();
|
|
82
81
|
|
|
83
82
|
POINTS_TOKEN = IERC20(_pointsToken);
|
|
84
|
-
_transferOwnership(_owner);
|
|
85
83
|
}
|
|
86
84
|
|
|
87
85
|
// --- Admin ---
|
|
@@ -26,9 +26,7 @@ contract MintDisperser is Ownable {
|
|
|
26
26
|
* @param initialOwner Address that will have owner privileges to execute minting operations
|
|
27
27
|
* @dev Sets the initial owner of the contract using OpenZeppelin's Ownable pattern
|
|
28
28
|
*/
|
|
29
|
-
constructor(address initialOwner) {
|
|
30
|
-
_transferOwnership(initialOwner);
|
|
31
|
-
}
|
|
29
|
+
constructor(address initialOwner) Ownable(initialOwner) {}
|
|
32
30
|
|
|
33
31
|
/**
|
|
34
32
|
* @notice Mint the same amount of tokens to multiple recipients
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// SPDX-License-Identifier: MIT
|
|
2
2
|
|
|
3
|
-
pragma solidity ^0.8.
|
|
3
|
+
pragma solidity ^0.8.20;
|
|
4
4
|
|
|
5
5
|
import {PrivateERC721} from "../../../token/PrivateERC721/PrivateERC721.sol";
|
|
6
6
|
import {PrivateERC721URIStorage} from "../../../token/PrivateERC721/extensions/PrivateERC721URIStorage.sol";
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.20;
|
|
3
|
+
|
|
4
|
+
import "../../../utils/mpc/MpcCore.sol";
|
|
5
|
+
|
|
6
|
+
contract ArithmeticAddTestsContract {
|
|
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
|
+
|
|
45
|
+
function getAddResult() public view returns (uint8) {
|
|
46
|
+
return addResult;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function setPublicValues(AllGTCastingValues memory castingValues, uint8 a, uint8 b) public{
|
|
50
|
+
castingValues.a8_s = MpcCore.setPublic8(a);
|
|
51
|
+
castingValues.b8_s = MpcCore.setPublic8(b);
|
|
52
|
+
castingValues.a16_s = MpcCore.setPublic16(a);
|
|
53
|
+
castingValues.b16_s = MpcCore.setPublic16(b);
|
|
54
|
+
castingValues.a32_s = MpcCore.setPublic32(a);
|
|
55
|
+
castingValues.b32_s = MpcCore.setPublic32(b);
|
|
56
|
+
castingValues.a64_s = MpcCore.setPublic64(a);
|
|
57
|
+
castingValues.b64_s = MpcCore.setPublic64(b);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function decryptAndCompareResults16(Check16 memory check16) public returns (uint16){
|
|
61
|
+
|
|
62
|
+
// Calculate the result
|
|
63
|
+
uint16 result = MpcCore.decrypt(check16.res16_16);
|
|
64
|
+
|
|
65
|
+
require(result == MpcCore.decrypt(check16.res8_16) && result == MpcCore.decrypt(check16.res16_8),
|
|
66
|
+
"decryptAndCompareAllResults: Failed to decrypt and compare all results");
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function decryptAndCompareResults32(Check32 memory check32) public returns (uint32){
|
|
71
|
+
|
|
72
|
+
// Calculate the result
|
|
73
|
+
uint32 result = MpcCore.decrypt(check32.res32_32);
|
|
74
|
+
|
|
75
|
+
require(result == MpcCore.decrypt(check32.res8_32) && result == MpcCore.decrypt(check32.res32_8)
|
|
76
|
+
&& result == MpcCore.decrypt(check32.res32_16) && result == MpcCore.decrypt(check32.res16_32),
|
|
77
|
+
"decryptAndCompareAllResults: Failed to decrypt and compare all results");
|
|
78
|
+
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function decryptAndCompareResults64(Check64 memory check64) public returns (uint64){
|
|
83
|
+
|
|
84
|
+
// Calculate the result
|
|
85
|
+
uint64 result = MpcCore.decrypt(check64.res64_64);
|
|
86
|
+
|
|
87
|
+
require(result == MpcCore.decrypt(check64.res8_64) && result == MpcCore.decrypt(check64.res64_8)
|
|
88
|
+
&& result == MpcCore.decrypt(check64.res64_16) && result == MpcCore.decrypt(check64.res16_64)
|
|
89
|
+
&& result == MpcCore.decrypt(check64.res64_32) && result == MpcCore.decrypt(check64.res32_64),
|
|
90
|
+
"decryptAndCompareAllResults: Failed to decrypt and compare all results");
|
|
91
|
+
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function addTest(uint8 a, uint8 b) public returns (uint8) {
|
|
96
|
+
AllGTCastingValues memory castingValues;
|
|
97
|
+
Check16 memory check16;
|
|
98
|
+
Check32 memory check32;
|
|
99
|
+
Check64 memory check64;
|
|
100
|
+
setPublicValues(castingValues, a, b);
|
|
101
|
+
|
|
102
|
+
// Calculate the expected result
|
|
103
|
+
uint8 result = MpcCore.decrypt(MpcCore.add(castingValues.a8_s, castingValues.b8_s));
|
|
104
|
+
addResult = result;
|
|
105
|
+
|
|
106
|
+
// Calculate the results with casting to 16
|
|
107
|
+
check16.res16_16 = MpcCore.add(castingValues.a16_s, castingValues.b16_s);
|
|
108
|
+
check16.res8_16 = MpcCore.add(castingValues.a8_s, castingValues.b16_s);
|
|
109
|
+
check16.res16_8 = MpcCore.add(castingValues.a16_s, castingValues.b8_s);
|
|
110
|
+
uint16 res16 = decryptAndCompareResults16(check16);
|
|
111
|
+
require(res16 == result, "addTest: cast 16 failed");
|
|
112
|
+
|
|
113
|
+
// Calculate the result with casting to 32
|
|
114
|
+
check32.res32_32 = MpcCore.add(castingValues.a32_s, castingValues.b32_s);
|
|
115
|
+
check32.res8_32 = MpcCore.add(castingValues.a8_s, castingValues.b32_s);
|
|
116
|
+
check32.res32_8 = MpcCore.add(castingValues.a32_s, castingValues.b8_s);
|
|
117
|
+
check32.res16_32 = MpcCore.add(castingValues.a16_s, castingValues.b32_s);
|
|
118
|
+
check32.res32_16 = MpcCore.add(castingValues.a32_s, castingValues.b16_s);
|
|
119
|
+
uint32 res32 = decryptAndCompareResults32(check32);
|
|
120
|
+
require(result == res32, "addTest: cast 32 failed");
|
|
121
|
+
|
|
122
|
+
// Calculate the result with casting to 64
|
|
123
|
+
check64.res64_64 = MpcCore.add(castingValues.a64_s, castingValues.b64_s);
|
|
124
|
+
check64.res8_64 = MpcCore.add(castingValues.a8_s, castingValues.b64_s);
|
|
125
|
+
check64.res64_8 = MpcCore.add(castingValues.a64_s, castingValues.b8_s);
|
|
126
|
+
check64.res16_64 = MpcCore.add(castingValues.a16_s, castingValues.b64_s);
|
|
127
|
+
check64.res64_16 = MpcCore.add(castingValues.a64_s, castingValues.b16_s);
|
|
128
|
+
check64.res32_64 = MpcCore.add(castingValues.a32_s, castingValues.b64_s);
|
|
129
|
+
check64.res64_32 = MpcCore.add(castingValues.a64_s, castingValues.b32_s);
|
|
130
|
+
uint64 res64 = decryptAndCompareResults64(check64);
|
|
131
|
+
require(result == res64, "addTest: cast 64 failed");
|
|
132
|
+
|
|
133
|
+
// Check the result with scalar
|
|
134
|
+
require(result == MpcCore.decrypt(MpcCore.add(a, castingValues.b8_s)) && result == MpcCore.decrypt(MpcCore.add(castingValues.a8_s, b)),
|
|
135
|
+
"addTest: test 8 bits with scalar failed");
|
|
136
|
+
require(result == MpcCore.decrypt(MpcCore.add(a, castingValues.b16_s)) && result == MpcCore.decrypt(MpcCore.add(castingValues.a16_s, b)),
|
|
137
|
+
"addTest: test 16 bits with scalar failed");
|
|
138
|
+
require(result == MpcCore.decrypt(MpcCore.add(a, castingValues.b32_s)) && result == MpcCore.decrypt(MpcCore.add(castingValues.a32_s, b)),
|
|
139
|
+
"addTest: test 32 bits with scalar failed");
|
|
140
|
+
require(result == MpcCore.decrypt(MpcCore.add(a, castingValues.b64_s)) && result == MpcCore.decrypt(MpcCore.add(castingValues.a64_s, b)),
|
|
141
|
+
"addTest: test 64 bits with scalar failed");
|
|
142
|
+
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function checkedAddTest(uint8 a, uint8 b) public returns (uint8) {
|
|
147
|
+
AllGTCastingValues memory castingValues;
|
|
148
|
+
Check16 memory check16;
|
|
149
|
+
Check32 memory check32;
|
|
150
|
+
Check64 memory check64;
|
|
151
|
+
setPublicValues(castingValues, a, b);
|
|
152
|
+
|
|
153
|
+
// Calculate the expected result
|
|
154
|
+
uint8 result = MpcCore.decrypt(MpcCore.checkedAdd(castingValues.a8_s, castingValues.b8_s));
|
|
155
|
+
addResult = result;
|
|
156
|
+
|
|
157
|
+
// Calculate the results with casting to 16
|
|
158
|
+
check16.res16_16 = MpcCore.checkedAdd(castingValues.a16_s, castingValues.b16_s);
|
|
159
|
+
check16.res8_16 = MpcCore.checkedAdd(castingValues.a8_s, castingValues.b16_s);
|
|
160
|
+
check16.res16_8 = MpcCore.checkedAdd(castingValues.a16_s, castingValues.b8_s);
|
|
161
|
+
uint16 res16 = decryptAndCompareResults16(check16);
|
|
162
|
+
require(res16 == result, "addTest: cast 16 failed");
|
|
163
|
+
|
|
164
|
+
// Calculate the result with casting to 32
|
|
165
|
+
check32.res32_32 = MpcCore.checkedAdd(castingValues.a32_s, castingValues.b32_s);
|
|
166
|
+
check32.res8_32 = MpcCore.checkedAdd(castingValues.a8_s, castingValues.b32_s);
|
|
167
|
+
check32.res32_8 = MpcCore.checkedAdd(castingValues.a32_s, castingValues.b8_s);
|
|
168
|
+
check32.res16_32 = MpcCore.checkedAdd(castingValues.a16_s, castingValues.b32_s);
|
|
169
|
+
check32.res32_16 = MpcCore.checkedAdd(castingValues.a32_s, castingValues.b16_s);
|
|
170
|
+
uint32 res32 = decryptAndCompareResults32(check32);
|
|
171
|
+
require(result == res32, "addTest: cast 32 failed");
|
|
172
|
+
|
|
173
|
+
// Calculate the result with casting to 64
|
|
174
|
+
check64.res64_64 = MpcCore.checkedAdd(castingValues.a64_s, castingValues.b64_s);
|
|
175
|
+
check64.res8_64 = MpcCore.checkedAdd(castingValues.a8_s, castingValues.b64_s);
|
|
176
|
+
check64.res64_8 = MpcCore.checkedAdd(castingValues.a64_s, castingValues.b8_s);
|
|
177
|
+
check64.res16_64 = MpcCore.checkedAdd(castingValues.a16_s, castingValues.b64_s);
|
|
178
|
+
check64.res64_16 = MpcCore.checkedAdd(castingValues.a64_s, castingValues.b16_s);
|
|
179
|
+
check64.res32_64 = MpcCore.checkedAdd(castingValues.a32_s, castingValues.b64_s);
|
|
180
|
+
check64.res64_32 = MpcCore.checkedAdd(castingValues.a64_s, castingValues.b32_s);
|
|
181
|
+
uint64 res64 = decryptAndCompareResults64(check64);
|
|
182
|
+
require(result == res64, "addTest: cast 64 failed");
|
|
183
|
+
|
|
184
|
+
// Check the result with scalar
|
|
185
|
+
require(result == MpcCore.decrypt(MpcCore.checkedAdd(a, castingValues.b8_s)) && result == MpcCore.decrypt(MpcCore.checkedAdd(castingValues.a8_s, b)),
|
|
186
|
+
"addTest: test 8 bits with scalar failed");
|
|
187
|
+
require(result == MpcCore.decrypt(MpcCore.checkedAdd(a, castingValues.b16_s)) && result == MpcCore.decrypt(MpcCore.checkedAdd(castingValues.a16_s, b)),
|
|
188
|
+
"addTest: test 16 bits with scalar failed");
|
|
189
|
+
require(result == MpcCore.decrypt(MpcCore.checkedAdd(a, castingValues.b32_s)) && result == MpcCore.decrypt(MpcCore.checkedAdd(castingValues.a32_s, b)),
|
|
190
|
+
"addTest: test 32 bits with scalar failed");
|
|
191
|
+
require(result == MpcCore.decrypt(MpcCore.checkedAdd(a, castingValues.b64_s)) && result == MpcCore.decrypt(MpcCore.checkedAdd(castingValues.a64_s, b)),
|
|
192
|
+
"addTest: test 64 bits with scalar failed");
|
|
193
|
+
|
|
194
|
+
return result;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.20;
|
|
3
|
+
|
|
4
|
+
import "../../../utils/mpc/MpcCore.sol";
|
|
5
|
+
|
|
6
|
+
contract ArithmeticMulTestsContract {
|
|
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 mulResult;
|
|
44
|
+
|
|
45
|
+
function getMulResult() public view returns (uint8) {
|
|
46
|
+
return mulResult;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function setPublicValues(AllGTCastingValues memory castingValues, uint8 a, uint8 b) public{
|
|
50
|
+
castingValues.a8_s = MpcCore.setPublic8(a);
|
|
51
|
+
castingValues.b8_s = MpcCore.setPublic8(b);
|
|
52
|
+
castingValues.a16_s = MpcCore.setPublic16(a);
|
|
53
|
+
castingValues.b16_s = MpcCore.setPublic16(b);
|
|
54
|
+
castingValues.a32_s = MpcCore.setPublic32(a);
|
|
55
|
+
castingValues.b32_s = MpcCore.setPublic32(b);
|
|
56
|
+
castingValues.a64_s = MpcCore.setPublic64(a);
|
|
57
|
+
castingValues.b64_s = MpcCore.setPublic64(b);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function decryptAndCompareResults16(Check16 memory check16) public returns (uint16){
|
|
61
|
+
|
|
62
|
+
// Calculate the result
|
|
63
|
+
uint16 result = MpcCore.decrypt(check16.res16_16);
|
|
64
|
+
|
|
65
|
+
require(result == MpcCore.decrypt(check16.res8_16) && result == MpcCore.decrypt(check16.res16_8),
|
|
66
|
+
"decryptAndCompareAllResults: Failed to decrypt and compare all results");
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function decryptAndCompareResults32(Check32 memory check32) public returns (uint32){
|
|
71
|
+
|
|
72
|
+
// Calculate the result
|
|
73
|
+
uint32 result = MpcCore.decrypt(check32.res32_32);
|
|
74
|
+
|
|
75
|
+
require(result == MpcCore.decrypt(check32.res8_32) && result == MpcCore.decrypt(check32.res32_8)
|
|
76
|
+
&& result == MpcCore.decrypt(check32.res32_16) && result == MpcCore.decrypt(check32.res16_32),
|
|
77
|
+
"decryptAndCompareAllResults: Failed to decrypt and compare all results");
|
|
78
|
+
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function decryptAndCompareResults64(Check64 memory check64) public returns (uint64){
|
|
83
|
+
|
|
84
|
+
// Calculate the result
|
|
85
|
+
uint64 result = MpcCore.decrypt(check64.res64_64);
|
|
86
|
+
|
|
87
|
+
require(result == MpcCore.decrypt(check64.res8_64) && result == MpcCore.decrypt(check64.res64_8)
|
|
88
|
+
&& result == MpcCore.decrypt(check64.res64_16) && result == MpcCore.decrypt(check64.res16_64)
|
|
89
|
+
&& result == MpcCore.decrypt(check64.res64_32) && result == MpcCore.decrypt(check64.res32_64),
|
|
90
|
+
"decryptAndCompareAllResults: Failed to decrypt and compare all results");
|
|
91
|
+
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function mulTest(uint8 a, uint8 b) public returns (uint8) {
|
|
96
|
+
AllGTCastingValues memory castingValues;
|
|
97
|
+
Check16 memory check16;
|
|
98
|
+
Check32 memory check32;
|
|
99
|
+
Check64 memory check64;
|
|
100
|
+
setPublicValues(castingValues, a, b);
|
|
101
|
+
|
|
102
|
+
// Calculate the expected result
|
|
103
|
+
mulResult = MpcCore.decrypt(MpcCore.mul(castingValues.a8_s, castingValues.b8_s));
|
|
104
|
+
|
|
105
|
+
// Calculate the result with casting to 16
|
|
106
|
+
check16.res16_16 = MpcCore.mul(castingValues.a16_s, castingValues.b16_s);
|
|
107
|
+
check16.res8_16 = MpcCore.mul(castingValues.a8_s, castingValues.b16_s);
|
|
108
|
+
check16.res16_8 = MpcCore.mul(castingValues.a16_s, castingValues.b8_s);
|
|
109
|
+
uint16 res16 = decryptAndCompareResults16(check16);
|
|
110
|
+
require(mulResult == res16, "mulTest: cast 16 failed");
|
|
111
|
+
|
|
112
|
+
// Calculate the result with casting to 32
|
|
113
|
+
check32.res32_32 = MpcCore.mul(castingValues.a32_s, castingValues.b32_s);
|
|
114
|
+
check32.res8_32 = MpcCore.mul(castingValues.a8_s, castingValues.b32_s);
|
|
115
|
+
check32.res32_8 = MpcCore.mul(castingValues.a32_s, castingValues.b8_s);
|
|
116
|
+
check32.res16_32 = MpcCore.mul(castingValues.a16_s, castingValues.b32_s);
|
|
117
|
+
check32.res32_16 = MpcCore.mul(castingValues.a32_s, castingValues.b16_s);
|
|
118
|
+
uint32 res32 = decryptAndCompareResults32(check32);
|
|
119
|
+
require(mulResult == res32, "mulTest: cast 32 failed");
|
|
120
|
+
|
|
121
|
+
// Calculate the result with casting to 64
|
|
122
|
+
check64.res64_64 = MpcCore.mul(castingValues.a64_s, castingValues.b64_s);
|
|
123
|
+
check64.res8_64 = MpcCore.mul(castingValues.a8_s, castingValues.b64_s);
|
|
124
|
+
check64.res64_8 = MpcCore.mul(castingValues.a64_s, castingValues.b8_s);
|
|
125
|
+
check64.res16_64 = MpcCore.mul(castingValues.a16_s, castingValues.b64_s);
|
|
126
|
+
check64.res64_16 = MpcCore.mul(castingValues.a64_s, castingValues.b16_s);
|
|
127
|
+
check64.res32_64 = MpcCore.mul(castingValues.a32_s, castingValues.b64_s);
|
|
128
|
+
check64.res64_32 = MpcCore.mul(castingValues.a64_s, castingValues.b32_s);
|
|
129
|
+
uint64 res64 = decryptAndCompareResults64(check64);
|
|
130
|
+
require(mulResult == res64, "mulTest: cast 64 failed");
|
|
131
|
+
|
|
132
|
+
// Check the result with scalar
|
|
133
|
+
require(mulResult == MpcCore.decrypt(MpcCore.mul(a, castingValues.b8_s)) && mulResult == MpcCore.decrypt(MpcCore.mul(castingValues.a8_s, b)),
|
|
134
|
+
"mulTest: test 8 bits with scalar failed");
|
|
135
|
+
require(mulResult == MpcCore.decrypt(MpcCore.mul(a, castingValues.b16_s)) && mulResult == MpcCore.decrypt(MpcCore.mul(castingValues.a16_s, b)),
|
|
136
|
+
"mulTest: test 16 bits with scalar failed");
|
|
137
|
+
require(mulResult == MpcCore.decrypt(MpcCore.mul(a, castingValues.b32_s)) && mulResult == MpcCore.decrypt(MpcCore.mul(castingValues.a32_s, b)),
|
|
138
|
+
"mulTest: test 32 bits with scalar failed");
|
|
139
|
+
require(mulResult == MpcCore.decrypt(MpcCore.mul(a, castingValues.b64_s)) && mulResult == MpcCore.decrypt(MpcCore.mul(castingValues.a64_s, b)),
|
|
140
|
+
"mulTest: test 64 bits with scalar failed");
|
|
141
|
+
|
|
142
|
+
return mulResult;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function checkedMulTest(uint8 a, uint8 b) public returns (uint8) {
|
|
146
|
+
AllGTCastingValues memory castingValues;
|
|
147
|
+
Check16 memory check16;
|
|
148
|
+
Check32 memory check32;
|
|
149
|
+
Check64 memory check64;
|
|
150
|
+
setPublicValues(castingValues, a, b);
|
|
151
|
+
|
|
152
|
+
// Calculate the expected result
|
|
153
|
+
mulResult = MpcCore.decrypt(MpcCore.checkedMul(castingValues.a8_s, castingValues.b8_s));
|
|
154
|
+
|
|
155
|
+
// Calculate the result with casting to 16
|
|
156
|
+
check16.res16_16 = MpcCore.checkedMul(castingValues.a16_s, castingValues.b16_s);
|
|
157
|
+
check16.res8_16 = MpcCore.checkedMul(castingValues.a8_s, castingValues.b16_s);
|
|
158
|
+
check16.res16_8 = MpcCore.checkedMul(castingValues.a16_s, castingValues.b8_s);
|
|
159
|
+
uint16 res16 = decryptAndCompareResults16(check16);
|
|
160
|
+
require(mulResult == res16, "mulTest: cast 16 failed");
|
|
161
|
+
|
|
162
|
+
// Calculate the result with casting to 32
|
|
163
|
+
check32.res32_32 = MpcCore.checkedMul(castingValues.a32_s, castingValues.b32_s);
|
|
164
|
+
check32.res8_32 = MpcCore.checkedMul(castingValues.a8_s, castingValues.b32_s);
|
|
165
|
+
check32.res32_8 = MpcCore.checkedMul(castingValues.a32_s, castingValues.b8_s);
|
|
166
|
+
check32.res16_32 = MpcCore.checkedMul(castingValues.a16_s, castingValues.b32_s);
|
|
167
|
+
check32.res32_16 = MpcCore.checkedMul(castingValues.a32_s, castingValues.b16_s);
|
|
168
|
+
uint32 res32 = decryptAndCompareResults32(check32);
|
|
169
|
+
require(mulResult == res32, "mulTest: cast 32 failed");
|
|
170
|
+
|
|
171
|
+
// Calculate the result with casting to 64
|
|
172
|
+
check64.res64_64 = MpcCore.checkedMul(castingValues.a64_s, castingValues.b64_s);
|
|
173
|
+
check64.res8_64 = MpcCore.checkedMul(castingValues.a8_s, castingValues.b64_s);
|
|
174
|
+
check64.res64_8 = MpcCore.checkedMul(castingValues.a64_s, castingValues.b8_s);
|
|
175
|
+
check64.res16_64 = MpcCore.checkedMul(castingValues.a16_s, castingValues.b64_s);
|
|
176
|
+
check64.res64_16 = MpcCore.checkedMul(castingValues.a64_s, castingValues.b16_s);
|
|
177
|
+
check64.res32_64 = MpcCore.checkedMul(castingValues.a32_s, castingValues.b64_s);
|
|
178
|
+
check64.res64_32 = MpcCore.checkedMul(castingValues.a64_s, castingValues.b32_s);
|
|
179
|
+
uint64 res64 = decryptAndCompareResults64(check64);
|
|
180
|
+
require(mulResult == res64, "mulTest: cast 64 failed");
|
|
181
|
+
|
|
182
|
+
// Check the result with scalar
|
|
183
|
+
require(mulResult == MpcCore.decrypt(MpcCore.checkedMul(a, castingValues.b8_s)) && mulResult == MpcCore.decrypt(MpcCore.checkedMul(castingValues.a8_s, b)),
|
|
184
|
+
"mulTest: test 8 bits with scalar failed");
|
|
185
|
+
require(mulResult == MpcCore.decrypt(MpcCore.checkedMul(a, castingValues.b16_s)) && mulResult == MpcCore.decrypt(MpcCore.checkedMul(castingValues.a16_s, b)),
|
|
186
|
+
"mulTest: test 16 bits with scalar failed");
|
|
187
|
+
require(mulResult == MpcCore.decrypt(MpcCore.checkedMul(a, castingValues.b32_s)) && mulResult == MpcCore.decrypt(MpcCore.checkedMul(castingValues.a32_s, b)),
|
|
188
|
+
"mulTest: test 32 bits with scalar failed");
|
|
189
|
+
require(mulResult == MpcCore.decrypt(MpcCore.checkedMul(a, castingValues.b64_s)) && mulResult == MpcCore.decrypt(MpcCore.checkedMul(castingValues.a64_s, b)),
|
|
190
|
+
"mulTest: test 64 bits with scalar failed");
|
|
191
|
+
|
|
192
|
+
return mulResult;
|
|
193
|
+
}
|
|
194
|
+
}
|