Questions tagged [solidity]

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.

5,296 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3 votes
1 answer
364 views

What's the difference between unlinked_binary and bytecode?

I have two different projects. In one, the build/token.json file contains an unlinked_binary field. In the other, there's no unlinked_binary, but there's bytecode. What's the difference between the ...
Daniel Que's user avatar
3 votes
1 answer
88 views

CALL always throws exception on SSTORE

this.call(bytes4(keccak256("setGBA(uint32)")), 12); How to call function by string name? I can't modify store in function. How to do this?
Vladimir Kovalchuk's user avatar
3 votes
0 answers
620 views

Why the transaction reverted?

Try to run my contract in remix JavaScriptVM and faced with error. Contract code: ... /** * @title Burnable Token * @dev Token that can be irreversibly burned (destroyed). */ contract ...
savao's user avatar
  • 31
3 votes
1 answer
479 views

Update struct from function only if parameters exists

What's the appropriate way to update a struct via a function only if the parameters exist? For example struct MyStruct { bytes32 someThing bytes32 someOtherThing } function updateStruct(bytes32 ...
pizzarob's user avatar
  • 415
3 votes
1 answer
164 views

Solidity standard library: how to contribute?

I'd like to contribute to Solidity standard library, which seems a bit feature-less. How can I do that? Is there are some agreements about Solidity standard lib like in c++? I have implemented some ...
Alianse777's user avatar
3 votes
0 answers
668 views

Brew linkapps deprecated, unable to install on Mac

brew linkapps solidity Warning: brew linkapps has been deprecated and will eventually be removed! Unfortunately brew linkapps cannot behave nicely with e.g. Spotlight using either aliases or symlinks ...
user avatar
3 votes
2 answers
169 views

Is Solidity creating an implicit getter for a nested contract that is created?

Is Solidity creating an implicit getter or not for a nested contract that is created? Example: contract Foo { .... } contract Bar { Foo public foo; Bar() { foo = new Foo(); } ...
Qqwy's user avatar
  • 131
3 votes
0 answers
286 views

Homomorphic Secret Sharing

Speaking of Ethereum blockchain, Is it possible to perform homomorphic secret sharing algorithmic calculations like SSS/pVSS/VSS on-chain? or should this be calculations performed off-chain
NemesisChain's user avatar
3 votes
1 answer
325 views

error: invalid opcode using modifier

Im getting the following error when trying to run my js test file using truffle: Error: VM Exception while executing eth_call: invalid opcode The js test file is the following: var DebitService = ...
Willian Siquieri's user avatar
3 votes
0 answers
1k views

ParserError: Source "contracts/Token.sol" not found: File import callback not supported

I have problem when I use truffle test. I seperated files used in contract with Solidity framework and I can't compile my code(see below). When code is not seperated works fine. I tried reinstall ...
Thaian's user avatar
  • 131
3 votes
0 answers
172 views

Is there a "gas penalty" for using too many asserts in a contract?

I'm at a very puzzling scenario. While using Remix, I noticed that adding a few asserts has caused a significant increase in execution cost (from ~50K to ~59K). And not only did it increase the ...
goodvibration's user avatar
3 votes
0 answers
1k views

Why is the transaction hash (tx.hash) not available in Solidity?

Why not solidity provide tx.TxHash (only tx.gasprice , tx.origin)? reference https://solidity.readthedocs.io/en/develop/units-and-global-variables.html, tx.TxHash,Transaction(ID) Hash, it should be ...
Jack's user avatar
  • 31
3 votes
0 answers
209 views

Contract creation from another contract succeeds, then fails?

I have a first contract with some very basic functionality : contract ContractA { uint public supplyA; function ContractA (uint _supply) { supplyA = _supply; } function ...
Matthieu Merlyn's user avatar
3 votes
0 answers
206 views

What is the runtime performance of Ethereum Libraries compared to Contracts?

I'm looking for the cheapest way (in terms of gas price) to design upgradeable contracts. I don't expect many upgrades. Being inspired by Writing upgradable contracts in Solidity, I'm investigating ...
Robert Zaremba's user avatar
3 votes
0 answers
131 views

Assuming EIP140, is remaining gas refunded when a called contract throws?

Under EIP140 (REVERT) and assuming Solidity ≥0.4.10. If I call from my contract to a function on an external contract, and this external function does an invalid jump, does my contract still call ...
Remco's user avatar
  • 403
3 votes
0 answers
127 views

What is the fastest way to call a function for incoming ICO

We have Alarm Contract: http://docs.ethereum-alarm-clock.com/en/latest/ We have parity client-side scheduling: Parity - How to schedule a transaction? We can write custom contracts similar to this ...
rstormsf's user avatar
  • 4,327
3 votes
0 answers
258 views

Checking if an address is encoded on the end of a bytes array

I have a bytes array. Within the last 20 bytes, there is an address stored. I am trying to compare the address at the end of this array to the address of a msg.sender, and am wondering if there is a ...
Nate Rush's user avatar
  • 770
3 votes
0 answers
218 views

Implement constant search function in Solidity or in Javascript?

I am working with Meteor + Web3. Is it recommendable to implement a constant search function in Solidity or to transfer the data into a javascript array each time to then search in it? Thank you!
Immo Garlichs's user avatar
3 votes
0 answers
144 views

Is there any reference on writing contracts directly with the bytecode language?

It would be great to have a complete reference of all the opcodes available, their exact effects and costs, and an example "Hello World" in ethereum assembly. Edit: this question isn't a duplicate of ...
MaiaVictor's user avatar
  • 3,177
3 votes
0 answers
96 views

Solidty Browser doesn't load properly

Solidity Browser doesn't load anymore. Here is a screenshot with the Chrome Developer open. on Chrome Version 52.0.2743.116 m It's stuck on loading and I see in developer some error messages. It ...
Gyonder's user avatar
  • 295
3 votes
0 answers
106 views

Contribute function of crowdsale is not working

I am having a crowdsale contract. I am trying to run contribute function using command: contractInstance.contribute.sendTransaction(101,{from:eth.accounts[0],value:200, gas:4000000}). It is creating a ...
Aniket's user avatar
  • 3,515
3 votes
0 answers
152 views

How are strings coerced into uint?

I executed a call checkConstant("ein schnitzel") on the following contract, and it worked. Obviously, type coercion but the documentation doesn't tell. How does this happen in detail? contract X{ ...
Roland Kofler's user avatar
3 votes
0 answers
253 views

Secure unit conversion in Solidity

Let's say you want mint a token TOK that is pegged to the USD. Then following must hold: (1) TOKUSD = USDTOK = 1 (2) USDETH = 1/ETHUSD (3) TOKETH = 1/ETHTOK The formula of the exchange rate is TOKETH =...
Roland Kofler's user avatar
3 votes
0 answers
707 views

Compile Smart Contract with Solidity on Windows 10

I wanted to use solidity within geth in Windows 10. I tried the compiled version that comes with Ethereum 1.0 but it has an issue mentioned in this thread. I'd like to get a new binary of a newer ...
Paul Exchange's user avatar
3 votes
0 answers
162 views

How to use an accessor for imbricated data types?

I'm looking at information about accessors in solidity/js for more complex data structures than just a public array/mapping. How can i access the array in that code for: struct AnotherStruct {....} ...
user697's user avatar
  • 2,156
3 votes
1 answer
461 views

What is the maximum computation a query or constant function in solidity can perform?

Since query or constant functions are just executed on single node there is no dependency on gas or gas limit. I am performing Quicksort in query/constant method. EVM can sort an array of length up to ...
Subhod I's user avatar
  • 927
3 votes
1 answer
990 views

Full Integration Testing smart contracts

What is the most agile way to fully integration test smart contract code? I've seen people use shell, etc. Is there a golden standard somewhere?
NemesisChain's user avatar
3 votes
1 answer
3k views

What is the burn() and burnFrom() function in EThereum Token Creation contract?

Please find the below ethereum token creation contract. It has two burn functions. It is having redendent params also. Why it is placed, what is the importance of the functions. pragma solidity ^0.4....
Seetharaman GR's user avatar
3 votes
2 answers
653 views

Keepers with VRF Error "Callback gas limit set too low error"

Im trying to create a dynamic nft by following the tutorial by alchemy, the NFT should update when performUpkeep is called which should get a random number using VRF v2 and change the NFT token URI. ...
abdulqgg's user avatar
2 votes
1 answer
14 views

Is it profitable for a miner to manipulate blocks in a small Ethereum project?

In the context of my blockchain project, I’m using the blockhash() function to generate randomness. However, I’m concerned about the potential vulnerability of this method. I’d like to know if, in a ...
Vlad's user avatar
  • 21
2 votes
1 answer
20 views

Has Solidity Introduced Storage Optimization for Smaller Integer Types in Structs?

I am working on a project where storage efficiency is of utmost importance. Specifically, I have a scenario where I want to store an ID of type uint16 and a code of type uint8. The current plan is to ...
MShakeG's user avatar
  • 1,408
2 votes
1 answer
45 views

Transaction data is not a multiple of 32 bytes

My understanding is that in a transaction's input data, the first 4 bytes, i.e. 8 characters, is reserved for a function signature. The rest of the data, after processed by the API, will be fitted to ...
Khanh's user avatar
  • 41
2 votes
0 answers
17 views

How ERC1155 can behave like ERC20?

As we say that ERC1155 can define both fungible and NFTs, how exactly is that implemented? The ERC has all the functions like an ERC721, and also it attaches a URI with all of the tokens, but ERC20 ...
Serenity's user avatar
2 votes
0 answers
84 views

Hardhat public network fork: Error calling view functions with ethers.js on browser

I have my hardhat network configured as a fork of Binance Smart Chain like this: const config: HardhatUserConfig = { solidity: { version: "0.8.0", settings: { optimizer: { ...
Alexander Herranz's user avatar
2 votes
0 answers
58 views

Is it possible for a function to revert if called by staticcall, and not revert if called with a state changing call?

I am trying to figure out if it is possible to write a function in either Solidity or Yul, or some combination thereof, which is capable of detecting when it is being called with staticcall and ...
Chev_603's user avatar
  • 157
2 votes
0 answers
79 views

Impossible to get my bundle include even with 20 eth as priority fees

Bundle was not included in target block. Hello everyone, I hope you're all doing well. I'm currently attempting to execute a SwapExactETHForTokens transaction on Uniswap V2 using EIP-1559. When I try ...
PandaKungFuu's user avatar
2 votes
1 answer
16 views

Truffle console: How to print uint array

How to print uint array in Truffle's Java script environment? Hi, I am following the link: Printing uint256 value to console while debugging with Truffle I am working on truffle console environment ...
zak100's user avatar
  • 1,416
2 votes
0 answers
15 views

How to inherite modifier into multiple contracts ? Best practice?

I have a project with severals contracts. To put some security, I've created a "onlyContract" modifier on a Roles contract so some functions in diferents contracts can only be called if the ...
noubidev's user avatar
2 votes
0 answers
11 views

How can i implement `MinimalBeaconProxy`?

I'm trying to make MinimalBeaconProxy. But seems like the assembly codes don't work. Can I get some advice of this codes? Contracts contract BeaconProxyCreator { constructor(address beacon) ...
Dongwu Kim's user avatar
2 votes
0 answers
25 views

Seeking Recommended ECIES Libraries or Contracts for Solidity Development

Ethereum community, I'm currently working on a Solidity project that requires the implementation of ECIES (Elliptic Curve Integrated Encryption Scheme) for encryption and decryption purposes. I wanted ...
Esraa's user avatar
  • 21
2 votes
1 answer
84 views

Tool to re-create state of smart contract locally

I would like to be able to simulate transactions with smart contracts based on their solidity source code. The process should be entirely automated. While I am aware that some tools allow forking the ...
davidsawyer's user avatar
2 votes
1 answer
256 views

Do we need OpenZeppelin's Counter with Solidiity 8 any more?

According to Solidity documentation: Prior to Solidity 0.8.0, arithmetic operations would always wrap in case of under- or overflow leading to widespread use of libraries that introduce additional ...
Alexander Herranz's user avatar
2 votes
0 answers
74 views

Can not sign transaction with signer get from mnemonic

I'm writing test for MAX_SUPPLY of this function // contract.sol function mintStandard() public payable whenNotPaused { require( _standardCounter.current() <= 2222, &...
dtnwen's user avatar
  • 33
2 votes
0 answers
187 views

Question on foundry

I am using foundry, I am new in it, I am noticing one thing that whenever I delete or install any package I am having to add commit, is it nature of foundry?
Hacek 's user avatar
  • 665
2 votes
1 answer
135 views

Where can I get simple implementation of ERC 4337?

I read about https://eips.ethereum.org/EIPS/eip-4337 few months ago. Now, I want to start implementing it for a project . Is there any beginner friendly repository from where I can understand this erc ...
Gaurav Pant's user avatar
2 votes
1 answer
28 views

Integrating smart contract with tweet

Is there a way to get a user to send out a tweet once an action on a smart contract happens without doing it on the server-side? And for the tweet to be sent out exactly once? For example, listening ...
joyceas's user avatar
  • 21
2 votes
1 answer
18 views

Query on typecasting in solidity

I am following uniswap v3 development book. We have a code: pool = address( new UniswapV3Pool{ salt: keccak256(abi.encodePacked(tokenX, tokenY, tickSpacing)) }() ); My question is, ...
Hacek 's user avatar
  • 665
2 votes
1 answer
21 views

Help me to understand it

if ( _zeroForOne ? _sqrtPriceLimitX96 > _slot0.sqrtPriceX96 || _sqrtPriceLimitX96 < TickMath.MIN_SQRT_RATIO : _sqrtPriceLimitX96 &...
Hacek 's user avatar
  • 665
2 votes
1 answer
101 views

How to send Wei to payable function with ethers

I want to send this function 1 wei using ethersJS while testing it on hardhat: modifier payFee() { bool sent = payable(address(this)).send(msg.value); require(sent, "Didn't receive fee.&...
Shadq's user avatar
  • 83
2 votes
0 answers
132 views

Using Brownie to verify contract error

I added sepolia with my infura api key to deploy my contract it works fine. Until I try to verify my contract with publish_source=True in FundMe.deploy function: from brownie import FundMe from ...
Rhaegar's user avatar
  • 31