Skip to content

Commit

Permalink
ethers6 lib migration
Browse files Browse the repository at this point in the history
  • Loading branch information
clbrge committed Apr 19, 2023
1 parent 4c7b2de commit 3e6b22c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/rouge.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand Down Expand Up @@ -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++;
Expand Down

0 comments on commit 3e6b22c

Please sign in to comment.