Set Up
Quick Overview:
To set up the Raffle Contract, follow these steps:
- Deploy Raffle Contract and set its status to
Active
. - Deploy Ticket (ERC721) Contract and grant the
MINTER_ROLE
role to the Raffle Contract. - Configure ChainLink: Set the Raffle Contract Address as a consumer by
subscriptionId
and set thissubscriptionId
to the Raffle Contract. - Grant
MINTER_ROLE
to the Exchange Contract from the Raffle Contract.
Let's dive into each step:
Deploy the Raffle Contract
- Go to Dashboard > Raffle > Contract and click the Deploy button. Confirm by clicking OK.
- Wait for the transaction to process. Once displayed on the screen, you should see the contract name
Raffle
and three buttons (edit, delete, and actions). - Click the Edit Button, change the contract status to
Active
, and optionally update the title and description.
Click OK when done.
Deploy the Ticket (ERC721) Contract and Grant MINTER_ROLE to Raffle
- Go to Dashboard > Raffle > Ticket and click the Deploy Button.
You can also connect your own ticket with Create Button (if contract already deployed), but we don't recomend to do that because each ticket token suppose to be tasted and have to include several functions like mintTicket, getTicketData and setPrize.
- Grant
MINTER_ROLE
to Raffle ContractWithout this permission, the Raffle contract would not be able to mint any tokens from Ticket contract.
- Go to Dashboard > Raffle > Tickets and find the created ticket EthBerry Raffle Ticket.
- Go to Dashboard > Raffle > Tickets and find the created ticket
EthBerry Raffle Ticket
- Click
•••
[action button] and click Grant Role - Choose
MINTER_ROLE
in the Role field and search forRaffle
or enter itsaddress
in the Address field. - Search for Raffle Contract Title not for
Raffle Ticket Title - And click OK Button
Grant MINTER_ROLE to Exchange Contract
The Exchange contract is used for selling tickets, so it needs the MINTER_ROLE
from the Raffle Contract to mint and sell tickets.
- Go to Dashborad > Raffle > Contract, click the
•••
action button and selectGrant Role
- Choose
MINTER_ROLE
in the Role field - Search for
Exchange
in the Address field. Select the contract on the same network as the Raffle contract. - Click Ok.
Configure ChainLink
For detailed instructions on setting up ChainLink, refer to this page.