Enhance general coding practices for better structures

Hi,

While studying CertiK audit reports, I noticed that they have commented following things on most of the contracts,

  • Enhance general coding practices for better structures of source codes
  • Add enough unit tests to cover the possible use cases

Audit report - https://www.certik.org/projects/pancakeswap (Page no. 03)

Source code - https://bscscan.com/address/0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82#code

Does anyone have an idea what exactly mean by them and any resource that I can find a complete template of the ERC20 token (Single file), which followed the correct structure?

And is there any order of placing followings,

  • interface IERC20 {
  • abstract contract Context {
  • library SafeMath {
  • contract Ownable is Context {
  • library Address {
  • interface IPancakeswapV2Factory {
  • interface IPancakeswapV2Pair {
  • interface IPancakeswapV2Router01 {
  • interface IPancakeswapV2Router02 is IPancakeswapV2Router01 {
  • contract Token is Context, IERC20, Ownable {

Appreciate your advice and guidance.

Thank you very much in advance.

Hi.

Sorry, I am not sure for this, maybe this is only a usual official statement. And I think you can just try to connect them directly to ask your doubts. And I think for different audit teams, they have different focuses.

Emmmm, for me, I always order contracts by interface, library, abstract contract and then the final contract. I am not sure whether there are some special requirements, but you should have your own code style.

1 Like

Thank you very much...

1 Like

Found out the exact answer I have been looking for.
https://www.tutorialspoint.com/solidity/solidity_style_guide.htm

1 Like