I'm trying to test my code in Truffle but I'm facing something weird, when I create a new contract instance in one my functions, it seems to have the address 0x0000.
My function:
function createNewPot(string memory _name, string memory _description) public {
uint newPotIndex = lastPotIndex++;
potList[newPotIndex] = new Pot(this, newPotIndex, _name, _description, msg.sender);
}
My test:
describe('Pot creation', () => {
it('creates a new pot', async () => {
const title = "Titre de dingue"
const description = "Description de ouf"
await potManager.createNewPot(title, description, { from: sophie })
let lastPotIndex = await potManager.lastPotIndex.call()
let potCreatedAddress = await potManager.potList.call(lastPotIndex)
console.log({ potCreatedAddress })
})
})
And here is the result of my console.log:
{ potCreatedAddress: '0x0000000000000000000000000000000000000000' }
Do you know why am I not receiving a valid address ? Thanks