Skip to content
This repository has been archived by the owner on Apr 26, 2023. It is now read-only.

symfoni/conference

Repository files navigation

Conference

Simple Conference application where an conference owner can create a conference. Features are:

  1. Set ticket price of conference in ether. Could be [DAI](https://en.wikipedia.org/wiki/Dai_(cryptocurrency), USDC or any other token. E.g an ERC20-token.
  2. Set reward factor which is used to decide how much speakers will recieve as reward.
  3. Auth actors before they can be attendees or speakers
  • This is done like this here, but we don't want the conference owner to pre-auth the actors. Should be done otherwise e.g. third-party authorization which then call the auth function
  1. Delegate auth priviligess to auth provider
  2. Give tickets to attendees
  3. Close registration which enables reward claims for conference owner and speakers
  4. Claim reward as conference owner/speaker

This repo is created to illustrate role logic in smart contracts and demonstrate development and testing of smart contract and how to interact with them from js/ts.

Get started

This process will let you run the frontend(dApp) with a local blockchain that runs the Conference contract. This let you use and develop you dApp locally. Hot-reload is enabled for both the contracts and frontend-code. You will need to download the Metamask to use the dApp with ethereum accounts(signing transactions).

  1. Clone the repo and cd into it git clone https://github.com/symfoni/conference MyConference && cd MyConference
  2. Install deps with yarn yarn or npm npm install
  3. Run tests by npx hardhat test
  4. Start hardhat npx hardhat node --watch

It runs up a Hardhat node, compile contracts, generates typescript interfaces, creates React context and instantiates your contract instances and factories with frontend provider.
  1. Open up a new terminal
  2. Enter the frontend directory: cd frontend
  3. Install dependencies: npm install and start react app with npm start
  4. Open your browser and install Metamask. IMPORTANT! Do this in a seperate profile in your browser to prevent using your real Metamask wallet
  5. Open Metamask extension
  6. Click Get started
  7. Click Import wallet by the No, I already have a Secret Recovery Phrase option. Click I agree.
  8. In the "Secret Recovery Phrase, use test test test test test test test test test test test junk. This is the same phrase used for deployment of the smart contract on your local hardhat node network.
  9. Set a password(not important to be secure because this is just for testing on a test network)
  10. Click "All done"
  11. You will now see your Metamask account
  12. Click on your account avatar in top right corner.
  13. Click on "Settings"
  14. Go to "Advanced"
  15. Enable "Show test networks"
  16. Close Settings
  17. Change network in Metmask extension to local network at http://localhost:8545. This is the network you have running locally with hardhat from Get Started

22. Click on your "avatar" again to add more Accounts. Tips: give your accounts role names like "conference owner", "attendee" etc for easier testing. 1. The 10 first accounts will have 10000ETH to play with (test ether).
  1. Ensure Metamask RPC is set to http://localhost:8545 and chainID 31337.

The frontend should open at http://localhost:3000/

Because of this default hardhat.config.ts it will first try to connect with an injected provider like Metamask (web3modal package does this).

If nothing found it will try to connect with your hardhat node. On localhost and hardhat nodes it will inject your mnemonic into the frontend so you have a "browser wallet" that can both call and send transactions. NB! Dont ever put a mnemonic with actual value here.

In hardhat.config.ts there is example on how to instruct your hardhat-network to use mnemonic or privatekey.

const config: HardhatUserConfig = {
  react: {
    providerPriority: ["web3modal", "hardhat"],
  },
};

Ensure you are useing RPC to http://localhost:8545.

You may also need to set the chainID to 31337 if you are useing Hardhat blockchain development node.

Invalid nonce.

eth_sendRawTransaction
  Invalid nonce. Expected X but got X.

Reset your account in Metamask.

We ❤️ these Ethereum projects: