diff --git a/lib/rouge.mjs b/lib/rouge.mjs index c2f6964..4383463 100644 --- a/lib/rouge.mjs +++ b/lib/rouge.mjs @@ -92,7 +92,7 @@ export const calculateStampProof = async ({ contract, signer, secret, tokenId, c trace('[calculateStampProof OUT]', { channelId, secretHash, salt, index }) // XXX trace wrong secret ? // console.log('MAIN LIB', `${chainId}:${contract.address}:${channelId}:${secretHash}:${salt}:${index}`) - return ethers.id(`${chainId}:${contract.address}:${channelId}:${secretHash}:${salt}:${index}`) + return ethers.id(`${chainId}:${await contract.getAddress()}:${channelId}:${secretHash}:${salt}:${index}`) } export const encodeAnnotatedProof = ({ contract, bearer, tokenId, proof }) => { @@ -156,11 +156,12 @@ export const abiEncodeAcquire = async ({ channels, signer, secret, contract, acq let index = 1 let nativeTotal = 0n // throw if twice same channelId => also solidityCheck ? + const contractAddress = await contract.getAddress() const loop = ({ channelId, qty = 1 } = {}, i) => { // XXX check uint8 qty, uint16 channelId ? const stamps = [] for (let i = 1; i <= qty; i++) { - const proof = ethers.id(`${chainId}:${contract.address}:${channelId}:${secretHash}:${salt}:${index}`) + const proof = ethers.id(`${chainId}:${contractAddress}:${channelId}:${secretHash}:${salt}:${index}`) trace('[abiEncodeAcquire]', { channelId, qty, index: i, proof }) stamps.push(getStamp(proof)) index++;