From 067268cda40584e27ae840c63804f49e81929ef1 Mon Sep 17 00:00:00 2001 From: Charles Jhong Date: Mon, 13 Mar 2023 17:24:37 +0800 Subject: [PATCH] remove MMP_VERSION_5 --- src/signer/rfqv1.ts | 14 -------------- src/signer/types.ts | 2 +- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/signer/rfqv1.ts b/src/signer/rfqv1.ts index 6fb7566..de2d084 100644 --- a/src/signer/rfqv1.ts +++ b/src/signer/rfqv1.ts @@ -50,20 +50,6 @@ export async function signByMMPSigner( ]) signature = '0x' + signatureBuffer.toString('hex') return signature - } else if (walletType === WalletType.MMP_VERSION_5) { - // |1 byte| 32 byte | 32 byte | 1 byte | - // +------|---------|---------|---------+ - // | V | R | S | type(6) | - // +------|---------|---------|---------+ - let signature = await wallet.signMessage(utils.arrayify(orderSignDigest)) - const { v, r, s } = await utils.splitSignature(signature) - signature = `0x${v.toString(16)}${r.slice(2)}${s.slice(2)}` - const signatureBuffer = Buffer.concat([ - ethUtils.toBuffer(signature), - ethUtils.toBuffer(SignatureType.Wallet), - ]) - signature = '0x' + signatureBuffer.toString('hex') - return signature } else if (walletType === WalletType.ERC1271_EIP712_EIP191) { // | 32 byte | 32 byte |1 byte| 1 bytes | // +---------|---------|------|---------+ diff --git a/src/signer/types.ts b/src/signer/types.ts index f012bb1..7f0bc86 100644 --- a/src/signer/types.ts +++ b/src/signer/types.ts @@ -46,7 +46,7 @@ export enum SignatureType { export enum WalletType { MMP_VERSION_4 = 1, // https://gist.github.com/NIC619/a3db1a743175bf592f2db983f17680dd#file-mmpv4-sol-L1236 - MMP_VERSION_5 = 2, // https://github.com/consenlabs/tokenlon-contracts/blob/e2edf7581b69bc8a40e61ff7fc1cd29674ae4887/contracts/MarketMakerProxy.sol#L19 + MMP_VERSION_5 = 2, // DEPRECATED ERC1271_EIP712_EIP191 = 3, // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.6.0/contracts/utils/cryptography/SignatureChecker.sol#L36 EOA = 4, // less security for market makers ERC1271_EIP712 = 5,