Programming Project - Phase 2

Hey @Jose_Hernandez

Can you push your project to GitHub? I want to try to deploy it and see if the error is somewhere in your project or in the pkg you have installed :slight_smile:

Ping me once pushed to GitHub, I will take a look

1 Like

Sorry, do you have a good recommendation on what to watch regarding how to use github? Or would it be easier to just drag and drop the files?

Thanks again!

Hi, I think you just missed a ; after event LogNewProvableQuery…

2 Likes

Hi! There is just a missing semi-colon at the end of this line. Hope you have smooth sailing from here :smiley:

2 Likes

https://github.com/jlthcrypto/coin-flip

Hope I did it right :sweat_smile:

1 Like

@dan-i You don’t understand my problem
I want to run npm init on bet project path. so that folder node_modules will be created as suggested by filip.
It ran successfully but the path node_modules was not created.
I copied the path node_modules from my old project and run npm install truffle-hdwallet-provider in order to install the wallet provider. it throws the error

After i done what you suggested it came with error

@dan-i the code that is shown above is not working for me, I am scratching my head for couple of days now but latest number I am getting back is always 0.

Can you please take a look at the code again and tell me if I am missing something. On UI side I make sure the abi and network address is the latest deployed so no issues there.

Hey @Jose_Hernandez

Thanks for uploading :slight_smile:

I tried to deploy your contract and I get this error:

Although you don’t see the error message, the error location looks the same.

In your previous post:
at Object.run ([.......]**packages/migrate/index.js:96:1**)

Which is the same in my screenshot.

Let’s analyse the error together :slight_smile:

  • Notice that the error happens during the migration of 1_initial_migration.js;
  • Notice the error message This function is restricted to the contract's owner

So let’s just follow the clues:

  • Open the file 1_initial_migration.js
  • You are migrating the project from account[1] that is not the owner. The owner is always accounts[0].
    Notice that you should never touch the file 1_initial_migration.js, it is created and used by the system and you must leave it as it is.

Just cancel your modification and set is back at its initial state:

const Migrations = artifacts.require("Migrations");

module.exports = function(deployer) {
  deployer.deploy(Migrations);
};

This fixes the issue.

You have another issue in your 2nd migration file 2_coinFlip_migration.js :slight_smile:
Let’s see if you can spot the issue by yourself.

If you need help I am here so no worries!

Happy coding,
Dani

2 Likes

Hi @chim4us

There are no errors in this screenshots, just warnings that you can ignore.

Also in your screenshot above, I see a package.json file, so I don’t understand what’s wrong

Can you send a screenshot of your truffle project directory where all the files are visible?

Thanks!
Dani

Hi @dan-i

How can i ignore them. Please find attach as request

Best Regards
Chimguy

Still stuck with this issue :sleepy:
I pushed on GitHub my project, even though it’s still at an early stage. Still needs lots of changes, but in this way I think you can figure it out better. CoinFlip.sol

@dan-i could you spot the error?

Sorry to bother you. :sweat_smile: Thanks!
Daniel

Thank you so much! Also removed the json object in 2_coinFlip_migration.js

So are we always tied to using accounts[0] as the owner? Or is there a way to choose a different one like in Ganache?

Accounts[0] is the owner by default :slight_smile:

Cheers,
Dani

1 Like

Hi @chim4us

From your screenshot I do not see any error, you can move forward and keep coding.

regards,
Dani

Hey @NamaWho

@dan-i could you spot the error? is a bit too generic :grin:
Can you please describe the issue? What happens, when?

thanks!
Dani

I think I’ve described it here

Anyway, if it sounds still too generic I’ve got no problem trying to explain myself better. :smile:
The fact is that even though I have a mapping where I match “betId” -> “playerAddress” (in placeBet()), then when I try to read the same record in closeBet() it seems it doesn’t exist. You can see this behavior from the events that are emitted in both functions, which I pasted in the previous comment.

hello,

I finally finished my projects :slight_smile:

this is the project made with ganache: https://github.com/enricofabris/COIN_CONTRACT-GANACHE

this is the project made with provable oracle and ropsten: https://github.com/enricofabris/COIN_CONTRACT---ORACLE---ROPSTEN

I tried both of them and they seem to work.
Could you please let me know some feedbak? :slight_smile:

besides I was able to use the test only with the first project because in the course it is shown to use the test through console.
But in the second project when we use ropsten how can we do the test of the contract?

thanks :slight_smile:

@filip I did not see provableAPI.sol you mention on your lesson

Hey @NamaWho

Can you please post the whole contract? I am interested in checking the function update().
Let me know :slight_smile:

Cheers,
Dani

Course, you can find it here.

P.S. I changed a bit those functions from yesterday but the logic is still the same; the error too :smile: