1.0.0 • Published 8 months ago

connector-frontend-cryptopayments-v1.07 v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

Prerequisites

  • Docker
pnpm install
alias escrow="pnpm run -C services/escrow"
escrow build # install solc and other tools in the docker image

Don't forget to copy the .env.example file to a file named .env, and then edit it to fill in the details.

Running all the tests

escrow test
escrow test:trace       # shows logs + calls
escrow test:fresh       # force compile and then run tests
escrow test:coverage    # run tests with coverage reports

Formatters & Linters

You can use the below packages,

  • Solhint
  • ESLint
  • Prettier
  • CSpell
  • ShellCheck
escrow format
escrow lint

Analyzers

You can use the below tools,

  • Slither
  • Mythril
escrow analyze:static path/to/contract
escrow analyze:security path/to/contract
escrow analyze:all path/to/contract

Deploy Contract & Verification

To try out Etherscan verification, you first need to deploy a contract to an Ethereum network that's supported by Etherscan, such as Goerli.

In this project, copy the .env.example file to a file named .env, and then edit it to fill in the details.

  • Enter your Etherscan API key
  • Goerli node URL (eg from Alchemy or Infura)
  • The private key of the account which will send the deployment transaction.

With a valid .env file in place, first deploy your contract:

escrow compile
# related to scripts/deploy/<CONTRACT_FILE_NAME>.ts
escrow deploy goerli Escrow    

# related to scripts/deploy.ts
escrow deploy:all goerli

Also, you can add contract(s) manually to your tenderly projects from the output. https://dashboard.tenderly.co/contract/<NETWORK_NAME>/<CONTRACT_ADDRESS>

And then verify it:

escrow verify <DEPLOYED_CONTRACT_ADDRESS> "<CONSTRUCTOR_ARGUMENT(S)>"    # hardhat.config.ts to see all networks

Finder

escrow finder --path contracts/Workshop.sol --name Workshop abi --colorify --compact --prettify    # find contract outputs of specific contract
escrow finder --help    # see all supported outputs (abi, metadata, bytecode and more than 20+ outputs)

Miscellaneous

escrow generate:docs    # generate docs according to the contracts/ folder
escrow generate:flatten ./path/to/contract     # generate the flatten file (path must be "./" prefixed)
escrow generate:abi ./path/to/contract         # generate the ABI file (path must be "./" prefixed)
escrow generate:bin ./path/to/contract         # generate the binary in a hex (path must be "./" prefixed)
escrow generate:metadata ./path/to/contract    # generate the metadata (path must be "./" prefixed)
escrow generate:all-abi
escrow generate:all-bin
escrow generate:all-metadata
escrow share    # share project folder with remix ide
  • Smart contracts hardhat commands
1. yarn deploy-payment --network "<NETWORK_NAME>" #deploy Payment contract
2. yarn deploy-simple-escrow --network "<NETWORK_NAME>" #deploy Escrow contract
3.(OPTIONAL) yarn deploy-token --network "<NETWORK_NAME>" #deploy ERC20 FakeUSDT token for testing escrow

TODO

  • Increase diversity in the Workshop Contract
  • Add Workshop Contract tests
  • Add TSLint as a TypeScript linter