Skip to content

Mokshith456/Solidity-Assessment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 

Repository files navigation

Solidity Assessment

MyToken Smart Contract

This project is the first step for beginners to comprehend and understand the working of functions, data types, loops, etc. in Solidity and use these basics to create a token.

Description

This is a simple program written in Solidity that is used to create smart contracts on the Ethereum-based blockchain. In this program, we have created a token named "LCOIN" and given it an abbreviation and a total supply value. We use two functions, mint and burn, which are used to mint or burn the tokens within the balances of the total supply of the account. This program is a very simple representation of how to create a token using Solidity.

Getting Started

Run the following program on an online IDE that supports Solidity. You can use REMIX, which is an online IDE that allows you to code in Solidity and deploy your smart contract. You can simply visit REMIX Ethereum IDE. Create a new file and copy-paste the following code and deploy it. You can use this code template to create your own token.

// public variables here
string public tokenName = "LCOIN";
string public tokenAbbreviation = "LCN";
uint public totalSupply = 250;

// mapping variable here
mapping(address => uint) public balances;

// mint function
function mint(address accntaddr, uint val) public {
    totalSupply += val;
    balances[accntaddr] += val;
}

// burn function
function burn(address accntaddr, uint val) public {
    if (balances[accntaddr] >= val) {
        totalSupply -= val;
        balances[accntaddr] -= val;
    }
}

You can compile the code by simply clicking Ctrl+S, then deploy the smart contract by clicking the deploy option on the left side of your screen. Once the smart contract is deployed, you can provide the parameters to the functions and experiment to see how the code works.

Authors

Mokshith P
Email: mokshithlucky06@gmail.com

License

This smart contract is licensed under the MIT License.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors