Using Truffle
Setting up and launching anDRC20 Token Smart Contract on the Deelance Testnet using Truffle.
Last updated
Setting up and launching anDRC20 Token Smart Contract on the Deelance Testnet using Truffle.
Last updated
Truffle is a development framework and suite of tools primarily used for building, deploying, and managing smart contracts and decentralized applications (DApps) on blockchain platforms. It provides developers with a set of utilities and commands to streamline the development process and make it easier to work with blockchain technologies.
Before we dive in, ensure you have the following essentials installed: Requirements:
Windows, Linux or Mac OS X
After we've set up those tools, we just need a single command to get Truffle:
Let's ensure Truffle is correctly installed. Open your terminal and type truffle version
. If some error shows up, make sure your computer knows where to find the npm modules.
Our first task is to set up a Truffle project. We'll use TokenDeelance.sol
as our guide, demonstrating how to create a token that can be shared between accounts:
Create a new directory for your Truffle project
Initialize your project:
After completing this step, you'll have a project organized with these folders:
contracts/: Directory for Solidity contracts
migrations/: Directory for scriptable deployment files
test/: Directory for test files for testing your application and contracts
truffle-config.js: Truffle configuration file
Create a PepeDeelance.sol
file within the contracts/:
directory.
Copy the below code and place it into the PepeDeelance.sol
file:
Create a 1_deploy_contracts.js
file within the migrations/:
directory and insert the following code:
Next, paste the following code into your truffle-config.js
file:
To compile your Truffle project, execute the following command:
Execute the given command at the base of the project folder:
The contract will deploy on the Deelance Testnet and will appear in your terminal as follows:
Keep in mind that your address, transaction_hash, and other details will vary. The information above is simply to give you a sense of the format.
Well done! You've successfully launched the DRC20 Smart Contract on Deelance Network. You can now engage with the Smart Contract.
Ensure you have the package since our Solidity code relies on it. To get it, execute: npm i @openzeppelin/contracts
in terminal.
Ensure you've set up , as mentioned in the file. To get this package, type npm i @truffle/hdwallet-provider
in your terminal.