How can it be possible?

It is the video of limit order function solution but as you can see at the end of the lines 38, 39, 40 Philip wrote something to explain us how things work. But he didn’t delete it and everything was working perfectly. But how!??
And also he used a function called depositEth(), when I use that function it says there is no function like that. What is the reason?

Hi @jieunpro

That code from line 38,39 and 40 did not throw any error because javascript runs that code successfully. It first runs the await function successfully and then it looks for index [300] on the response from the await function, which is undefined or null in this case.

In terms of how Javascript executes the code, it is not wrong. And if you try to log the value of code in line 38,39 and 40, then the value will be undefined or null as Javascript cant find any data from that code after adding [300]

let res = await dex.createLimitOrder(0, web3.utils.fromUtf8("LINK"), 1, 300) [300];

console.log(res) // 👈 This value will be undefined / null

And regarding the code related to depositEth() I have replied on the your other post.
can you check if the name of the function in contract is matching with depositEth()?

There is nothing called depositEth(). Does philip has this function? Because I couldn’t see in the videos.

Hi @jieunpro

You are correct it was mentioned in the Assignment Limit order test, probably because it is a simple function. Here is how it looks. You can add it in your dex contract. That should fix the errors related to depositETH.

function depositETH() payable public {
        balances[msg.sender]["ETH"] = balances[msg.sender]["ETH"].add(msg.value);