Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 97072

Solidity is a contract-oriented, high-level language whose syntax is similar to that of JavaScript and it is designed for writing smart contracts in Ethereum to run on the EVM. Solidity is statically typed, supports inheritance, libraries and complex user-defined types among other features.

2 votes
Accepted

Can an interface extend a struct in Solidity and what would happen as a result?

You can declare a struct inside an interface and use it as a parameter. pragma solidity ^0.8.0; interface MyInterface { struct MyStruct { string bar; } function foo(MyStruct memory …
LAYcodes's user avatar
  • 176
2 votes
Accepted

BigNumber error

Your contract works fine. As the two previous replies mentioned, you're "deploying" your contract with a void input. In other words, you haven't specified the value of your data. type any uint value i …
LAYcodes's user avatar
  • 176
2 votes
Accepted

How can I use timestamp for comparisons safely?

The 15-second Rule states that if your contract's code does not rely on a time interval of less then 15 seconds, than it is probably safe to use block.timestamp . If the scale of your time-dependent …
LAYcodes's user avatar
  • 176
1 vote

I`m trying compilate this code and getting Parse error

You're missing a semicolon when you defined MAx_AMOUNT. this is the line causing the parsing error: uint256 constant public MAx_AMOUNT = 10000 corrected: uint256 constant public MAx_AMOUNT = 10000;
LAYcodes's user avatar
  • 176
1 vote

Why are we using payable modifiers in both the ERC20 transferFrom and approve functions?

The payable keyword is required for functions and addresses to be able to receive Ether. By declaring it in transferFrom() and approve(), you are not only able to pay a contract with your ERC20 token, …
LAYcodes's user avatar
  • 176
1 vote

cost fee according to the size of a mapping

It really depends on the key/value size. As a general rule, the larger are the keys/values, the more gas it requires to add or update a mapping object. Since mapping in Ethereum is a type of storage …
LAYcodes's user avatar
  • 176
1 vote

Member "store" not found or not visible after argument-dependent lookup in contract

there is no function called store() in contract SimpleStoragePractice. Changing function storeToArray(uint _index, string memory _name) public { ssfpArray[_index].store(_name); } to functi …
LAYcodes's user avatar
  • 176
0 votes

Constructor functions

No it doesn't. The most and obvious reason is that a function can never have the same name as the contract. Function can only be called at a defined time to perform a specific task and it requires a …
LAYcodes's user avatar
  • 176
0 votes

Why can't I initialize storage array right away?

Your code works perfectly fine! I added a view function getArray() to get your storage array. contract Example { uint256[4] array = [1, 2, 3, 4]; constructor () {} function getArray() exte …
LAYcodes's user avatar
  • 176
0 votes

Does everything revert when a transaction runs out of gas when it was executed from another ...

All the changes (including do stuff in ContractA) will be reverted. However, you won't get reimbursed for the gas used for computations. Miners will collect that gas whether the transaction is valid o …
LAYcodes's user avatar
  • 176
0 votes

How can I transfer eth from an account wallet to a smart contract

In order to send or receive Ether, you must declare a function with the keyword payable . By applying the following changes: function subscribe(uint planId, address payable _to) public payable { P …
LAYcodes's user avatar
  • 176
0 votes

nested struct in solidity

be this: struct UserInfo{ Pdetails pdetails; Addr addr; uint id; } Your map will be this: mapping(uint => UserInfo) idToUserInfo Now sum it all up: pragma solidity
LAYcodes's user avatar
  • 176
0 votes

Pass enum value in mapping

You want to pass an Enum value of type Category to your TLBs map, so you have to declare category in your struct TLB as Category. Category[] category; must be as follows Category category;
LAYcodes's user avatar
  • 176
0 votes

Division of big numbers in a smart contract

A way to solve this problem: isFactor? / \ yes no / \ calculateRent introduce 'x' so that input - x = factor …
LAYcodes's user avatar
  • 176
0 votes

Deleting values from a struct

Based on your code, deleteAccount will look something like this: function deleteAccount(address _addr) public { delete accDetails[_addr]; delete balanceOf[_addr]; delete addrTo …
LAYcodes's user avatar
  • 176

15 30 50 per page