Search Results
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 |
Questions regarding the development of smart contracts
1
vote
Should I create separate contract copy for every post or just one contract to deal with all ...
You should store them all in one contract; there's no reason to create an arbitrary amount of contracts.
In Solidity, you can use a dynamically sized array to store all the posts. A simple example wo …
0
votes
How to check if a particular address is already present in an array
As the amount of players grows, that loop will consume more and more gas. If you get a lot of players, it will start to cost too much in transaction fees.
If the amount of players should be unlimited, …
3
votes
Correct way of sending Token via contract
You cannot do this using the ERC20 transfer(..) function.
You will need to call the transferFrom(..) function on the ERC20 contract.
To be able to use transferFrom(..), your [Sender] will first have …
1
vote
Interacting with dapps using wrapper smart contract (and not personal accounts)
You can use the encodeParameters function of web3.js function to convert the function arguments into a hexadecimal string. Here's a documentation link:
https://web3js.readthedocs.io/en/1.0/web3-eth-a …
5
votes
Accepted
TypeError: Operator == not compatible with types function () view external returns (address)...
Variables behave like functions from the perspective of other contracts.
The error is telling you that b._addr is not an address, but a function that returns an address.
In contract A, try doing b._ …
6
votes
Accepted
Sign data with a contract account
Contracts don't have a private key, so they can't sign anything with it. In fact, contract addresses don't have anything to do with public/private key cryptography. Contract addresses are the hash of …
1
vote
Block gas limit lower than required to deploy a contract
Could you share your contract code so we can try to see what's causing the high deployment cost?
There may or may not be an easy solution to this problem. You should check how much gas is being spent …
2
votes
Accepted
Transaction succeed even if require() is false
The msg.value contains an amount in wei, not an amount in Ether.
1 Ether is equal to 1000000000000000000 wei, so if you send 1 ether to your function the value of msg.value will be 100000000000000000 …
6
votes
Accepted
smart contract variable storage
All data stored inside a smart contract (in the blockchain) is always publicly accessible.
All the data that the code of the smart contract can access, can be accessed by everyone.
The data is not e …
4
votes
Accepted
Revert()/throw/invalid are so powerful they can even put back an already self-destructed con...
If some code reverts/throws the current contract call will have no effects, but not necessarily the entire transaction. The assembly instruction CALL to code that reverted will return false to indicat …
12
votes
Accepted
How do I share an enum definition between contracts?
Enums defined inside a contract are by default accessible from other contracts. In Producer you can use the expressions:
Supplier.State.inactive
Supplier.State.active
Supplier.State.kaput
Your cod …
7
votes
Accepted
Where is the barrier between using uint256 and bytes32?
uint256 is generally used for:
Addresses
Numbers
Account balances
Doing math like + - * / or **
bytes32 is generally used for:
Small strings of no more than 32 characters
Hashes (the sha3(..) fu …
2
votes
Accepted
Always use "memory" for variables created within functions. Bad practice?
It's good practice to explicitly use memory or storage to clarify whether a variable contains a pointer to memory or storage.
You should not always use the memory keyword, because it could make your …
1
vote
Make Smart Contract Only Accessible from a Web App
These kinds of things are fundamentally impossible. Front-end code by definition is running on the user's machine. The user controls their machine, so they control the front-end.
Imagine a hypothetic …
1
vote
Refund Ether stored in a Contract
I just looked at your transactions, and I see that you are not calling the paybackEther() function at all:
0x9afb64e3082d06e0915f7d89a2b436ae3f9f273630407b52662d3a5785933336
0xd70b7dae05ee903868fc93 …