From a98b70b13372bbc8a102809b3244008bd8f5dc0f Mon Sep 17 00:00:00 2001 From: cebgcontract <99630598+cebgcontract@users.noreply.github.com> Date: Mon, 21 Feb 2022 16:40:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8D=87=E7=BA=A7=E6=97=B6?= =?UTF-8?q?=E7=9A=84=E5=9C=B0=E5=9D=80=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contracts/EvolveProxy.sol | 11 +++++++++++ contracts/HasSignature.sol | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/contracts/EvolveProxy.sol b/contracts/EvolveProxy.sol index 19e469f..b121f5a 100644 --- a/contracts/EvolveProxy.sol +++ b/contracts/EvolveProxy.sol @@ -58,6 +58,12 @@ contract EvolveProxy is Ownable, Initializable, HasSignature { tokenIds[0] > 0 && tokenIds[1] > 0, "EvolveProxy: hero to evolve and burn can not be 0" ); + + require( + tokenIds[0] != tokenIds[1], + "EvolveProxy: hero to evolve and burn can not be same" + ); + require( hero.ownerOf(tokenIds[0]) == msg.sender, "EvolveProxy: not owner of this hero now" @@ -97,6 +103,11 @@ contract EvolveProxy is Ownable, Initializable, HasSignature { "EvolveProxy: equip to evolve and burn can not be 0" ); + require( + tokenIds[0] != tokenIds[1], + "EvolveProxy: equip to evolve and burn can not be same" + ); + require( equip.ownerOf(tokenIds[0]) == msg.sender, "EvolveProxy: current address is not owner of this equip now" diff --git a/contracts/HasSignature.sol b/contracts/HasSignature.sol index 9bbd1cf..fd49534 100644 --- a/contracts/HasSignature.sol +++ b/contracts/HasSignature.sol @@ -92,7 +92,7 @@ contract HasSignature { address signer, bytes32 structHash, bytes memory signature - ) external view{ + ) public view{ bytes32 digest = _hashTypedDataV4(structHash); address recovered = ECDSA.recover(digest, signature); require(recovered == signer, "[BE] invalid signature"); @@ -103,7 +103,7 @@ contract HasSignature { address signer, bytes32 hash, bytes memory signature - ) external pure { + ) public pure { require(signature.length == 65, "[BE] invalid signature length"); bytes32 ethSignedMessageHash = ECDSA.toEthSignedMessageHash( hash