Questions tagged [solidity]

Solidity is a language for smart contracts for blockchain technologies like Ethereum. It is designed to compile code for the Ethereum Virtual Machine. Use this tag for questions about programming smart contracts using the Solidity language.

Solidity is an object-oriented language whose syntax is similar to that of ECMAScript, but with static typing, and it is designed to compile to code for the Ethereum Virtual Machine for use in smart contracts in blockchain technologies.

6642 questions
1
vote
1 answer

How to deploy a smart contract with on-chain NFTs and complex/long svgs?

I want to deploy a smart contract that creates NFTs on-chain, it means that the data of the image/svg, in my case, lives on the blockchain and it will be drawable thanks to Base64 encryption. I studied the topic, but I don't know how to make the…
Sawy
  • 57
  • 1
  • 4
1
vote
1 answer

Why does removing a SLOAD in constructor save so much gas?

I changed the state variable in the constructor to a numeric value and printed the difference in gas consumed. Here's my code. The results showed that constructing the BeforeDemo consumed 93915 gas, constructing the AfterDemo consumed 76288 gas and…
Zoey
  • 33
  • 3
1
vote
2 answers

How to slice bytes memory in solidity?

Im trying to slice bytes such as bytes memory bytesData = result[32:64]; and its throwing: TypeError: Index range access is only supported for dynamic calldata arrays. it works fine with calldata... what about memory?
Matt Jaf
  • 339
  • 2
  • 8
1
vote
1 answer

Solidity: I need to reference bytes constants efficiently

I am implementing an on-chain font in Solidity. It works great, but I am not able to eliminate unnessary copies of bytes from code space (bytes constants) to the storage. Here is the current implementation. contract LondrinaSolid is IFontProvider { …
Satoshi Nakajima
  • 1,863
  • 18
  • 29
1
vote
0 answers

Metamask generated signature | verification works when calling erecover function in remix but not in golang

I am trying to verify a signature generated in metamask with go-web3. Solidity verification code contract Verify { function VerifyMessage(bytes32 _hashedMessage, uint8 _v, bytes32 _r, bytes32 _s) public pure returns (address) { bytes…
1
vote
1 answer

Greatest of 4 Numbers Solidity Assembly Code

I'm trying to create a function to find the greatest of the 4 numbers input as parameters. Using solidity assembly code. I've made a successful greatest of 2 numbers already, but can't seem to figure this one out. Heres my code it just returns 0…
1
vote
1 answer

Uniswap pair = address(uint(keccak256(abi.encodePacked() Error

I don't understand why i get this error when i try to compile my contract to swap tokens on different dex. Here the Code: //SPDX-License-Identifier: MIT import "./Interfaces/IUniswapV2Router02.sol"; import…
1
vote
0 answers

How to use selfPermit with Multicall?

Modern AMM routers (eg UniswapV3, Trident) feature an abstract contract selfPermit.sol that allow users to submit their own ERC712 permit signature and call another contract function in a single transaction. As per Uniswap documentation, "These…
Pm Rivière
  • 191
  • 2
  • 13
1
vote
0 answers

ERC721 How to sign EIP-712 and verify if the signer of signature is the owner of the NFT?

How to sign EIP-712 and verify if the signer of signature is the owner of the NFT ? using Counters for Counters.Counter; using ECDSA for bytes32; Counters.Counter private _tokenIdCounter; mapping(address => uint256) private userInfo; bytes32…
Software14
  • 155
  • 1
  • 9
1
vote
0 answers

VSC Remix extension not being able to compile files with import statements

My Remix VSC extension is not able to compile any contract that has an import statement. This happens even if the imports are local files (located in the same folder than the compiling contract). This is a sample of the contract I try to compile…
1
vote
2 answers

Get Smart Contract instance from its address

In Solidity, given a Smart Contract instance named foo MySmartContract foo = new MySmartContract() I can get this Smart Contract instance's address by using address(foo) address fooAdress = address(foo) How do I get back foo object, given only its…
Thaiminhpv
  • 314
  • 2
  • 10
1
vote
0 answers

How to access IPFS for NFT storage giving out authentication 401 error

I'm building a simple NFT minter dapp, the images are not being uploaded to IPFS storage while using Web3.storage, despite using my secret project ID and key I tried creating a different project ID and key to access the IPFS storage yet still gets…
codepipr
  • 11
  • 1
1
vote
2 answers

Uncaught (in promise) Error: call revert exception

Uncaught (in promise) Error: call revert exception [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (method="name()", data="0x", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION,…
1
vote
2 answers

Is it possible to inherit the Ethereum contract to my contract?

Is it possible to inherit the Ethereum contract it self and add some function to it? I just want to know it is possible to do and if it is how?
Omid
  • 13
  • 2
1
vote
1 answer

TypeError: assert.equal is not a function

I created solidity contracts and compiled it with truffle successfully but when I run truffle test for test files of my contracts it gives the error TypeError: assert.equal is not a function my code const { assert } = require('console'); const…