0

In my test file I have this set up:

let acc = await Account.deployed()

Then when I call a method, I can get the logs in the receipt:

let deposit = await acc.deposit()
console.log(deposit.receipt.logs)

But when I do this:

let acc = await Account.at(sellerAcc)
let deposit = await acc.deposit()
console.log(deposit.receipt.logs)

There are no logs on the receipt and the console returns undefined! Not sure how this is functioning but I know the difference is with Contract.deployed() and Contract.at(), so what's going on?

How do I get sellerAcc in above:

let fac = await AccountFactory.deployed()
let seller = accounts[0]
let sellerAcc = await fac.getAccount(seller)

let acc = await Account.at(sellerAcc)

getAccount function from Factory contract

user_to_account: map(address, address)

@public
@constant
def getAccount(user: address) -> address:
    return self.user_to_account[user]
  • What is address? – goodvibration Nov 8 at 9:08
  • BTW, at is not an async function, so you don't need to precede it with await. – goodvibration Nov 8 at 9:09
  • @goodvibration address is the address of an Account contract – isomotic Nov 8 at 9:09
  • Well, apparently it's not. Can you please post your code for obtaining this value? – goodvibration Nov 8 at 9:11
  • @goodvibration posted, thank you for helping me out – isomotic Nov 8 at 9:16
0

I fixed my issue.

I have my AccountFactory contract that helps setup new Account contracts. AccountFactory takes one parameter for the init: TemplateAddress. This template address is a deployed instance of Account contract.

My problem: I was not passing in the correct TemplateAddress, I was passing in my accounts[0] address.

By passing in the correct template address, my code functioned properly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.