Home
Explore
New post
Dashboard
Newsletter
Search...
Ctrl
+
K
CryptoVincent
Sign in
CryptoVincent
Subscribe
Search...
Ctrl
+
K
CryptoVincent
Sign in
Subscribe
Previous
1
2
Next
Previous
1
2
Next
Subscribe
Subscribe
CryptoVincent
Oct 27
Array
📃Solidity arrays can have a compile-time fixed size or a dynamic size.
CryptoVincent
Oct 27
Array
📃Solidity arrays can have a compile-time fixed size or a dynamic size.
CryptoVincent
Oct 21
Mappings
🗺️Mappings are created with the syntax mapping(keyType => valueType). 🗺️The keyType can be any built-in value type, bytes, string, or any contract. 🗺️valueType can be any type including another mapping or an array. 🗺️Mappings are not iterable. 🗺️In the code we have a Mapping contract with a state variable declared myMap of typeValue: mapping with keyType: address and valueType: uint. 🗺️It has a function get(address), in it we can get values from the mapping, passing to it an address and...
CryptoVincent
Oct 21
Mappings
🗺️Mappings are created with the syntax mapping(keyType => valueType). 🗺️The keyType can be any built-in value type, bytes, string, or any contract. 🗺️valueType can be any type including another mapping or an array. 🗺️Mappings are not iterable. 🗺️In the code we have a Mapping contract with a state variable declared myMap of typeValue: mapping with keyType: address and valueType: uint. 🗺️It has a function get(address), in it we can get values from the mapping, passing to it an address and...
CryptoVincent
Oct 19
Loops
🔃Solidity supports for, while, and do while loops. 🔃Don't write loops that are unbounded as this can hit the gas limit, causing your transaction to fail. 🔃For the reason above, while and do while loops are rarely used.
CryptoVincent
Oct 19
Loops
🔃Solidity supports for, while, and do while loops. 🔃Don't write loops that are unbounded as this can hit the gas limit, causing your transaction to fail. 🔃For the reason above, while and do while loops are rarely used.
CryptoVincent
CryptoVincent
CryptoVincent
Oct 18
Conditional
🤷Conditional Statements (If / Else) 🤷Solidity supports conditional statements if, else if and else. 🤷The first function "foo" we have: ➡️"if(condition is true?) then do something (condition is false?) next step" ➡️"else if(another condition is true?) then do something (condition is false?) next step" ➡️"else do something" 🤷The second function "ternary" we have another way to do an if/else statement by using "condition" ? (true part) : (false part)
CryptoVincent
Oct 18
Conditional
🤷Conditional Statements (If / Else) 🤷Solidity supports conditional statements if, else if and else. 🤷The first function "foo" we have: ➡️"if(condition is true?) then do something (condition is false?) next step" ➡️"else if(another condition is true?) then do something (condition is false?) next step" ➡️"else do something" 🤷The second function "ternary" we have another way to do an if/else statement by using "condition" ? (true part) : (false part)
CryptoVincent
Oct 16
Gas
How much ether do you need to pay for a transaction?You pay gas spent * gas price amount of ether, where: gas is a unit of computation gas spent is the total amount of gas used in a transaction gas price is how much ether you are willing to pay per gas Transactions with higher gas price have higher priority to be included in a block. Unspent gas will be refunded.Gas LimitThere are 2 upper bounds to the amount of gas you can spend gas limit (max amount of gas you're willing to use for you...
CryptoVincent
Oct 16
Gas
How much ether do you need to pay for a transaction?You pay gas spent * gas price amount of ether, where: gas is a unit of computation gas spent is the total amount of gas used in a transaction gas price is how much ether you are willing to pay per gas Transactions with higher gas price have higher priority to be included in a block. Unspent gas will be refunded.Gas LimitThere are 2 upper bounds to the amount of gas you can spend gas limit (max amount of gas you're willing to use for you...
CryptoVincent
Oct 13
Read & Write State Variable
✨To write or update a state variable you need to send a transaction, as in set() function within our contract. ✨On the other hand, you can read state variables, for free, without any transaction fee, as in get() function within our contract.
CryptoVincent
Oct 13
Read & Write State Variable
✨To write or update a state variable you need to send a transaction, as in set() function within our contract. ✨On the other hand, you can read state variables, for free, without any transaction fee, as in get() function within our contract.
CryptoVincent
Oct 13
Constants
🏷️ Constants are variables that cannot be modified. 🏷️ Their value is hard coded and using constants can save gas costs. 🏷️ This contract is simple and self-explanatory, we have only 2 constants declared.
CryptoVincent
Oct 13
Constants
🏷️ Constants are variables that cannot be modified. 🏷️ Their value is hard coded and using constants can save gas costs. 🏷️ This contract is simple and self-explanatory, we have only 2 constants declared.
CryptoVincent
Oct 7
First Contract App
Here we have a simple contract, increment and decrement the count store in this contract.// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; contract Counter { uint public count; // Function to get the current count function get() public view returns (uint) { return count; } // Function to increment count by 1 function inc() public { count += 1; } // Function to decrement count by 1 function dec() public { // This function will fail if count = 0 count -= 1; } } There are some points we s...
CryptoVincent
Oct 7
First Contract App
Here we have a simple contract, increment and decrement the count store in this contract.// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; contract Counter { uint public count; // Function to get the current count function get() public view returns (uint) { return count; } // Function to increment count by 1 function inc() public { count += 1; } // Function to decrement count by 1 function dec() public { // This function will fail if count = 0 count -= 1; } } There are some points we s...
CryptoVincent
Oct 14
Ether & Wei
🚀Transactions are paid with ether. 🚀Similar to how one dollar is equal to 100 cent, one ether is equal to 10^18 wei. 🚀There's a useful page to visualize eth-wei conversion: https://eth-converter.com/
CryptoVincent
Oct 14
Ether & Wei
🚀Transactions are paid with ether. 🚀Similar to how one dollar is equal to 100 cent, one ether is equal to 10^18 wei. 🚀There's a useful page to visualize eth-wei conversion: https://eth-converter.com/
CryptoVincent
Oct 7
Hello Solidity World
This is a series of my initial approach to Solidity language.// SPDX-License-Identifier: MIT // compiler version must be greater than or equal to 0.8.13 and less than 0.9.0 pragma solidity ^0.8.13; contract HelloSolidityWorld { string public greet = "Hello Solidity World!"; } pragma specifies the compiler version of Solidity. By convention the contract name is written in UpperCamelCase, for that reason here we see HelloSolidityWorld as the contract name. The contract has a state variable name...
CryptoVincent
Oct 7
Hello Solidity World
This is a series of my initial approach to Solidity language.// SPDX-License-Identifier: MIT // compiler version must be greater than or equal to 0.8.13 and less than 0.9.0 pragma solidity ^0.8.13; contract HelloSolidityWorld { string public greet = "Hello Solidity World!"; } pragma specifies the compiler version of Solidity. By convention the contract name is written in UpperCamelCase, for that reason here we see HelloSolidityWorld as the contract name. The contract has a state variable name...
CryptoVincent
Oct 9
Variables
There are 3 types of variables in Solidity LocalDeclared inside a functionNot stored on the blockchainStateDeclared outside a functionStored on the blockchainGlobalProvides information about the blockchainHere is the link to global variables docs https://docs.soliditylang.org/en/develop/cheatsheet.html#global-variables
CryptoVincent
Oct 9
Variables
There are 3 types of variables in Solidity LocalDeclared inside a functionNot stored on the blockchainStateDeclared outside a functionStored on the blockchainGlobalProvides information about the blockchainHere is the link to global variables docs https://docs.soliditylang.org/en/develop/cheatsheet.html#global-variables
CryptoVincent
Oct 13
Immutable
🔰Immutable variables are like constants. 🔰Values of immutable variables can be set inside the constructor but cannot be modified afterwards.
CryptoVincent
Oct 13
Immutable
🔰Immutable variables are like constants. 🔰Values of immutable variables can be set inside the constructor but cannot be modified afterwards.
CryptoVincent
Oct 8
Primitive Data Types
Here I introduce you to some primitive data types available in Solidity.Line 6, we have a bool variable, this type of variable only can have two possible values, true or false. Lines 8-10, we have uint type, uint stands for unsigned integer, meaning non negative integers. We can declare uint8 where the possible values goes from 0 to 2 ** 8-1, uint16 (0 to 2 ** 16-1), uint32 …. uint256, by declaring “uint” is an alias for uint256. The same applies for int type, lines 12-14, but it works with n...
CryptoVincent
Oct 8
Primitive Data Types
Here I introduce you to some primitive data types available in Solidity.Line 6, we have a bool variable, this type of variable only can have two possible values, true or false. Lines 8-10, we have uint type, uint stands for unsigned integer, meaning non negative integers. We can declare uint8 where the possible values goes from 0 to 2 ** 8-1, uint16 (0 to 2 ** 16-1), uint32 …. uint256, by declaring “uint” is an alias for uint256. The same applies for int type, lines 12-14, but it works with n...
Written by
CryptoVincent
Written by
CryptoVincent