rubixchain / rubixgoplatform

GNU General Public License v3.0
8 stars 17 forks source link

Resolving smart-contract folder renaming error #183

Closed KryptSai closed 1 month ago

KryptSai commented 2 months ago

While deploying a smart-contract, the deployer creates a temporary folder and renames it with the smart-contract hash. But there already exists a folder with the name as smart-contract hash, which was created while generating smart-contract. Thus, throwing renaming error. To resolve it, this PR is removing the existing folder before renaming it.

This PR also resolves another error which occurs while trying to re-create the same smart-contract token. While deploying, a function FetchSmartContract is called, which calls the function CreateSmartContractToken, and CreateSmartContractToken tries to over-write the smart-contract information in the SQLite3 DB. To resolve it, we are checking if the data already exists in the DB before writing to the DB.

This PR is tested on Linux as well as Windows OS with voting-contract and bidding-contract.