omchain
Search
K

Solidity

Object-oriented programming language for writing smart contracts.
You can use Solidity to deploy smart contracts on Jupiter. Solidity was proposed by Gavin Wood at 2014 and later was developed by Christian Reitwiessner.
You can deploy your smart contract written in Solidity to Jupiter, Ethereum, BSC and other EVM supporting chains.

Simple Storage

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.16 <0.9.0;
contract SimpleStorage {
uint storedData;
function set(uint x) public {
storedData = x;
}
function get() public view returns (uint) {
return storedData;
}
}
The first line in the code shows us that the contract is licensed under GPL v3.0. It is important to include the license notification if you are going to publish the smart contract publicly.
The next line shows us that the smart contract is valid starting from Solidity version 0.4.16 till 0.9.0
The line uint storedData; declares a state variable called storedData of type uint (unsigned integer of 256 bits). You can think of it as a single slot in a database that you can query and alter by calling functions of the code that manages the database. In this example, the contract defines the functions set and get that can be used to modify or retrieve the value of the variable.
Now that we understood the basics of Solidity and seen an example contract, we can now move our test contract to Jupiter.