Skip to content

Commit

Permalink
Merge pull request #56 from consenlabs/remove-MMP_VERSION_5-type
Browse files Browse the repository at this point in the history
remove MMP_VERSION_5 of RFQv1
  • Loading branch information
charlesjhongc authored May 10, 2023
2 parents a7faf82 + 067268c commit 3aa9cbb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
14 changes: 0 additions & 14 deletions src/signer/rfqv1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
// +---------|---------|------|---------+
Expand Down
2 changes: 1 addition & 1 deletion src/signer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 3aa9cbb

Please sign in to comment.