use recipient to test existance

This commit is contained in:
Michele Balistreri 2020-04-08 14:00:16 +03:00
parent 456f699f67
commit 84850e0270
No known key found for this signature in database
GPG Key ID: E9567DA33A4F791A
2 changed files with 3 additions and 3 deletions

View File

@ -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");

View File

@ -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,