/bitbet-smart-contracts

Bitcoin betting smart contracts.

Primary LanguageTypeScriptMIT LicenseMIT

bitbet-smart-contracts  
Hardhat   License: MIT

./contracts/
├── ECDSAVerificator.sol
└── PaymentsSolDec082022.sol

██     Acknowledgements     ██████████████

This project was built on top of Paul Berg's awesome hardhat template.

██     Sensible Defaults     ████████████████

NOTE: There are sensible default configurations in the following files:

├── .commitlintrc.yml
├── .editorconfig
├── .eslintignore
├── .eslintrc.yml
├── .gitignore
├── .prettierignore
├── .prettierrc.yml
├── .solcover.js
├── .solhintignore
├── .solhint.json
├── .yarnrc.yml
└── hardhat.config.ts

██     SM Overview     ██████████████████

Components

Contracts Libraries Interfaces Abstract
1 1 0 0

Functions

Public Payable External
10 2 7
Internal Private Pure View
12 3 4 4

State Variables

Total Public
13 0

Solidity pragmas used

>=0.8.0 <0.9.0;   >=0.7.0 <0.9.0.

Attributes

  • Able to receive funds
  • Uses EVM Assembly calls
  • Contains hash functions
  • Able to transfer ETH
  • Uses ECRecover
  • Contains call failure handling (try/catch)
  • Able to create new contracts (Create/Create2)
  • Uses unchecked arithmetics
  • Contains suicidal/destroyable contracts
  • Contains low-level calls
  • Contains delegatecalls


██     Risk Specs     ██████████████████

    Specs    


██     Inheritance (C3 linearization)     ██████████████████

    Inheritance    



██     SM Callgraph     ██████████████████

NOTE: In-depth per-method analysis can be found in docs.

Callgraph



██     Usage     ███████████████████████

You can automate all steps (setting your configs, installing the project, compiling with type generation, running unit tests on Mainnet fork) by running this script and properly filling in the prompted fields:

$ ./init.sh

Or do it all manually:

      Pre Requisites

  • Before installing, create a .env file and set a BIP-39 compatible mnemonic and other env criteria as in .env.example.
  • Then, proceed with installing dependencies:
$ yarn install

      Compile

Compile the smart contracts with Hardhat:

$ yarn compile

NOTE: TypeChain artifacts generated at compile time.

      Deploy

Deploy the contracts to a specified network:

$ yarn deploy
    --daily-withdrawal-limit "{INSERT_VAL}"
    --public-key "{INSERT_VAL}"
    --network {INSERT_NETWORK_NAME}

      Test

Run the tests with Hardhat:

  • Don't forget to add an Alchemy API Key to your .env in order to be able to run unit tests against an Ethereum Mainnet fork.
$ yarn test

NOTE: See the gas usage per unit test and average gas per method call:

$ REPORT_GAS=true yarn test

      Coverage

Generate the code coverage report:

$ yarn coverage

NOTE: To view the coverage report generated by yarn coverage, just click Go Live from the status bar to turn the server on/off.

      Clean

Delete the smart contract artifacts, the coverage reports and the Hardhat cache:

$ yarn clean

License

MIT