klaytn / klaytn

Official Go implementation of the Klaytn protocol
GNU Lesser General Public License v3.0
380 stars 187 forks source link

Need of automatic build script for a contract and its binding handler? #1221

Closed hyunsooda closed 2 years ago

hyunsooda commented 2 years ago

Hi all,

I'm working on a support value transfer feature for KIP-7 and KIP-17 standards on Service Chain (SC). I'm new to developing the blockchain platform with smart contracts. I just learned and the following steps explain my method.

  1. Do export both solc and abigen binareis to $PATH
  2. Build script for abigen is ready in Makefile, but no solc. We need to manually install it with the corresponding version (v0.5.6 for contracts in SC at least)
  3. Run go generate to make go-binding handler
  4. Compile the contracts with solc to make both bin and abi files.
  5. Replace contents in bin and abi files with the contents from the newly generated binding file
  6. Import both bin and abi files to your deploy and transfer scripts.

Phew, it's done. I think it would give us to focus on making a contract and its handler without paying the cost for build steps if these manual fixed steps are automatically done while it's working though.

Most of the contract files were not touched on average for two years, even three years. I'm not sure this suggestion is demandless since the untouched duration may explain it. If there is a shortcut that has already been developed by the Klaytn team for these similar tasks, It would be appreciated if you advise me. Thanks a lot.

kjhman21 commented 2 years ago

Thanks for sharing your difficulties. You can also create a such script to support other newbies because it is an open-source project! :)

hyunsooda commented 2 years ago

Hi @kjhman21,

Let me post PR soon. Thank you.