mirror of
https://github.com/status-im/keycard-redeem.git
synced 2025-01-15 22:54:56 +00:00
use recipient to test existance
This commit is contained in:
parent
456f699f67
commit
84850e0270
@ -92,7 +92,7 @@ contract GiftBucket {
|
||||
require(_availableSupply >= amount, "low supply");
|
||||
|
||||
Gift storage gift = gifts[recipient];
|
||||
require(gift.amount == 0, "recipient already used");
|
||||
require(gift.recipient == address(0), "recipient already used");
|
||||
|
||||
gift.recipient = recipient;
|
||||
gift.amount = amount;
|
||||
@ -112,7 +112,7 @@ contract GiftBucket {
|
||||
address recipient = recoverSigner(_redeem, sig);
|
||||
|
||||
Gift storage gift = gifts[recipient];
|
||||
require(gift.amount > 0, "not found");
|
||||
require(gift.recipient == recipient, "not found");
|
||||
|
||||
bytes32 codeHash = keccak256(abi.encodePacked(_redeem.code));
|
||||
require(codeHash == gift.code, "invalid code");
|
||||
|
@ -148,7 +148,7 @@ contract("GiftBucket", function () {
|
||||
gas: gas,
|
||||
});
|
||||
|
||||
const bucketAddress = receipt.events.Created.returnValues.bucket;
|
||||
const bucketAddress = receipt.events.BucketCreated.returnValues.bucket;
|
||||
const jsonInterface = _GiftBucket.options.jsonInterface;
|
||||
GiftBucket = new EmbarkJS.Blockchain.Contract({
|
||||
abi: jsonInterface,
|
||||
|
Loading…
x
Reference in New Issue
Block a user