0

so I really want to create a smart contract for the community to use - one where two people can easily and trustlessly make a bet between each other. V1 of the smart contract would be where two people (or more) bet that cryptocurrency pair X will reach the price of Y by a certain date Q. Once the condition is met, the funds are released to the winner.

It is one of my first smart contracts, I appreciate any help I can get. I know it is far from finished, but maybe someone can point me in the right direction? Would be greatly appreciated. I have a cool and useful product in mind :)

Once the Betting contract is finished, I will want to hook it up with Chainlink decentralized oracle to provide data to the blockchain. Oh, and I would like the dApp to run on Matic.

Where can I learn to do it? I've been watching videos and trying, but I think I reached a point where I can learn further only by trying to do it myself.

'''

pragma solidity ^0.6.7;

contract Betting {

enum State { Created, Locked, Released }

struct Bet {

string pair;

uint price;

uint date;
}

event BetMade(address bettor, uint amount);

function bet() public payable {

    emit BetMade(msg.sender, msg.value);

}



} 

'''

0

Once you're ready to obtain external price data, be sure to check out the Chainlink docs on how to do this, it's super easy!

I know this isn't a hackathon submission, but we also have a great hackathon resources page with some links that could be useful to you as part of your learning journey

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.