if redeemable.recipient is zero, the redeemable doesn't exist

This commit is contained in:
Andrea Franz 2020-05-13 13:06:47 +02:00
parent eb980ce1a2
commit a3e988a419
No known key found for this signature in database
GPG Key ID: 4F0D2F2D9DE7F29D
2 changed files with 4 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import IERC20Detailed from '../embarkArtifacts/contracts/IERC20Detailed';
import IERC721Metadata from '../embarkArtifacts/contracts/IERC721Metadata';
import { config } from "../config";
import { Dispatch } from 'redux';
import { ZERO_ADDRESS } from "../utils";
export const ERROR_REDEEMABLE_NOT_FOUND = "ERROR_REDEEMABLE_NOT_FOUND";
export interface ErrRedeemableNotFound {
@ -180,7 +181,7 @@ export const loadRedeemable = (bucketAddress: string, recipientAddress: string)
bucket.methods.expirationTime().call().then((expirationTime: number) => {
bucket.methods.redeemables(recipientAddress).call().then((result: any) => {
const { recipient, data, code } = result;
if (data === "0") {
if (recipient === ZERO_ADDRESS) {
dispatch(redeemableNotFound())
return;
}

View File

@ -9,6 +9,8 @@ import {
export const KECCAK_EMPTY_STRING = "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470";
export const KECCAK_EMPTY_STRING2 = sha3(KECCAK_EMPTY_STRING);
export const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
export const toBaseUnit = (fullAmount: string, decimalsSize: number, roundDecimals: number) => {
const amount = new BN(fullAmount);
const base = new BN(10).pow(new BN(decimalsSize));