Using Truffle
Setting up and launching anDRC20 Token Smart Contract on the Deelance Testnet using Truffle.
Last updated
mkdir PepeDeelance
cd PepeDeelancetruffle init// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract PepeDeelance is ERC20, Ownable {
constructor() ERC20("PepeDeelance", "PEPEDLANCE") {
_mint(msg.sender, 1000000000 * 10 ** decimals());
}
function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}
}const PepeDeelance = artifacts.require("PepeDeelance");
module.exports = function (deployer) {
deployer.deploy(PepeDeelance);
};
const HDWalletProvider = require("@truffle/hdwallet-provider");
module.exports = {
networks: {
development: {
host: "127.0.0.1",
port: 9545,
network_id: "*",
},
testnet: {
provider: () =>
new HDWalletProvider(
"<YOUR_WALLET_PRIVATE_KEY>",
`https://testnet-rpc.deelance.com`
),
network_id: 455214,
confirmations: 10,
timeoutBlocks: 200,
skipDryRun: true,
},
},
// Set default mocha options here, use special reporters etc.
mocha: {
// timeout: 100000
},
// Configure your compilers
compilers: {
solc: {
version: "0.8.0", // A version or constraint - Ex. "^0.5.0"
},
},
};
truffle compiletruffle migrate --network testnet1_deploy_contracts.js
=====================
Deploying 'PepeDeelance'
------------------------
> transaction hash: 0x42a4fe45d66cdc7648d9a8607f4f8c0044946074c1bf07963cf501bf14a8f493
> Blocks: 2 Seconds: 8
> contract address: 0xE6D82514Fe6A796D947b5580Fc26090Dd818412e
> block number: 37296
> block timestamp: 1692550864
> account: 0x2bd250B5e8eEeB4e0E9fC6023f525Ac62b72c0ae
> balance: 9.984142327455598517
> gas used: 1491671 (0x16c2d7)
> gas price: 2.500000007 gwei
> value sent: 0 ETH
> total cost: 0.003729177510441697 ETH
Pausing for 10 confirmations...
--------------------------------
> confirmation number: 1 (block: 37297)
> confirmation number: 2 (block: 37298)
> confirmation number: 3 (block: 37299)
> confirmation number: 4 (block: 37300)
> confirmation number: 5 (block: 37301)
> confirmation number: 6 (block: 37302)
> confirmation number: 7 (block: 37303)
> confirmation number: 8 (block: 37304)
> confirmation number: 9 (block: 37305)
> confirmation number: 10 (block: 37306)
> Saving artifacts
-------------------------------------
> Total cost: 0.003729177510441697 ETH
Summary
=======
> Total deployments: 1
> Final cost: 0.003729177510441697 ETH