New answers tagged

0 votes

Verifying signed messages on chain

Either try looking into the chains CSV reports or what is allowed in the contracts const convertedSignature = ethers.utils.splitSignature(signature); const recoveredAddress = ethers.utils....
0 votes

How I do I calculate the price of a Token as the amount of the token bought increases

Bruh, what you gunna call the coin.. call it Pussy Protocol or something good def calculate_token_price(num_coins: int) -> float: """ min_amount = 150 max_amount = 20000 ...
0 votes

Verifying signed messages on chain

If you are trying to use the EIP-712 standard, particularly the SignTypedData V4 defined by MetaMask, verifying that signed data via smart contract is not straightforward. It's so complex indeed that ...
0 votes

Failing to Demonstrate a Re-entrancy attack on withdraw function?

To send Ether to other contracts, you can use these three methods: transfer (2300 gas, throws an error) send (2300 gas, returns bool) call (forward all gas or set gas, returns bool) To ensure ...
  • 1,489
0 votes

Remix error when deploying

Here are the possible fixes for the error: Turn off your VPN if your're using one. Refresh the remix page Open Remix in new tab and reconnect. Restart your browser (this may be common with chrome ...
0 votes

Problem with expensive function

Right function: function uintTostring(uint _number) internal pure returns (string memory _uintAsString) { bytes memory curNumber = new bytes(32); if(_number==0) return "0"; ...
0 votes

Transalte Assembly(Solidity)

Solution: function stringToUint256(string memory _str) internal pure returns(uint256 res) { bytes memory stringNumber = bytes(_str); for (uint256 i = 0; i < bytes(_str).length; i++) { ...
2 votes
Accepted

Was trying to create a Reset Tokens Function, But I keep getting an error

The issue with the Reset_tokens() function is that the loop condition in line 64 includes the length of the participants array as well, which causes an index out of bounds error when the loop reaches ...
0 votes

Why does Remix does not show the description of the error anymore?

I have observed this. It got really bad to correct errors and debug now. Before, everything was better. That update they made was really bad. They made this update and a solution (mandatory) is to ...
1 vote

@custom:dev-run-script NatSpec tag

Just add this on top of where your contract starts. /** * @title ContractName * @dev ContractDescription * @custom:dev-run-script scripts/deploy_with_ethers.ts */ Adjust file path ...
  • 57
1 vote

@custom:dev-run-script NatSpec tag

The default workshop includes two scripts to deploy contracts: scripts/deploy_with_ethers.ts scripts/deploy_with_web3.ts If you choose the first one, you have to edit it to set the name of the ...
0 votes

buildChainlinkRequest function of Chainlink is not working properly

Can you remove the recordChainlinkFulfillment() modifier from the fulfill() function? One thing this modifier limits is who can call the function. When you call sendChainlinkRequest, it adds the ...
0 votes

How to mapping a struct EnumerableSet.AddressSet / UintSet?

The errors you are encountering are because you cannot assign a struct containing (nested) mappings directly, and you cannot construct a struct containing (nested) mappings. Additionally lockedNft and ...
  • 523
0 votes

Eth recovery from a created eth smart contract

Sorry to say, but it is a scam. You cannot get it back. There have been multiple reports of it. I reverse-engineered it for you. When the withdrawal function is called, the funds from your contract ...
  • 428
1 vote
Accepted

buildChainlinkRequest function of Chainlink is not working properly

Chainlink.Request memory req = buildChainlinkRequest( stringToBytes32(_jobId), callBackContract, functionSelector ); This function is present in the ChainlinkClient contract ...
0 votes

buildChainlinkRequest function of Chainlink is not working properly

I'm sorry to hear that the buildChainlinkRequest function is not working properly. Have you tried restarting the application or checking the logs to see if there are any errors? If you are still ...
0 votes

How to deploy my smart contract with correct inputs

I decide to use this technique. This is what I was told to try by a friend, and I suggest you do the same. Smart contracts can be deployed in a straightforward manner. To get started with contracts, ...
0 votes

Error with getting balance of an ERC20 token for a wallet address solidity

the better solution is here, add a validation to check if the address passed is a contract or not. that would handle almost all the challenges for this. here is the code: function isContract(address ...
0 votes

How to deploy my smart contract with correct inputs

You can deploy your smart contract by using a development environment such as Ethereum, Remix, or Truffle. You will then need to provide the correct inputs, such as parameters and variables, to make ...
0 votes

How to deploy my smart contract with correct inputs

You need to make sure you consider the number of decimals in your token. By default, it is 18 decimals in most open source implementations. If you want one token and youre interacting on say etherscan,...
  • 532
0 votes

Error: Address must be type "payable"

When you use .transfer() or .send() on an address it must be an address payable. See this for more detailed information. Those two methods are now discouraged because they have an hard coded gas ...
1 vote

Does this code have any malicious scam code?

Solely by checking the withdrawal function I think there is 95% to be malicious :) /* * @dev withdrawals profit back to contract creator address * @return `profits`. */ function ...
0 votes
Accepted

TranferFrom in delegate call

Delegatecall requires target and source to have compatible storage layouts. You'll be executing the target's bytecode in the source contract's storage. If the Multicall contracts delegatecalls to the ...
  • 30.2k
0 votes

Solidity smart contract to send hard coded ether amount to hard coded wallet address in Remix IDE with out using the Remix input value field

What you're asking for is simply impossible, the amount of ether sent by a transaction is decided by the sender, you can't pull ether from a wallet with a smart contract. You can require that the ...
  • 2,943
1 vote

How to Compile and Deploy a Smart Contract without running a full node?

[2023 update] Two things: (a) you don't need to run your own node (b) you don't need to use Remix's default node provider either (this is the top "Environment" section when you go to deploy)....
0 votes

Deploy using alchemy or remix

Here's the contract write + deployment process in case it's helpful: Add and compile the contract code into Remix Add your chosen RPC provider (e.g., Alchemy, Moralis, etc) as a network in Metamask. ...
1 vote

How to Change Wallet Address Used to Deploy Contract in Remix IDE

The issue could also be that another wallet without the right network or networks tokens is already connected as the "Injected Provider" environment in Remix. If this is the case, make sure ...
1 vote
Accepted

What is wrong in this program ? Arrays submitters and approvers inside the struct FormData are not getting set

Be aware that the default getter for formIdToFormData doesn't return the dynamic fields like arrays or mappings. In order to access the FormData you could define your own getter. Something like this: ...
  • 30.2k
1 vote
Accepted

How to change the value of wei in a solidity smart contract after deployment

Your transaction is reverting. In your setRequiredWei you are checking that msg.sender is the owner. You get the owner address from function owner(), which gets it from address(this). The problem is ...
1 vote

Solidity public or external function - Which is more gas efficient?

Using external functions instead of public does not affect gas. Up until solidity 0.6.9, only external functions allowed calldata arguments. Public functions forced the use of the more expensive ...
1 vote

Solidity public or external function - Which is more gas efficient?

Let's see, you should create 2 contracts StorageP and StorageE. contract StorageP { uint256 public number; function inc(uint256 i) public { number = number + i; } } contract ...
0 votes

Why Injected Provider - MetaMask not working

Clear Cache files in your system and now try connecting metamask from remix. Save your work before clearing catch. It worked.
0 votes
Accepted

Why Injected Provider - MetaMask not working

Replying here instead of comment (level too low). It seems that it is a remix issue, since they updated recently. Here are possible solutions: Connect to remix with other wallets (you will have to ...
0 votes

Learning to write a basic contract that sends goerli ethereum to another contract

This is the best time to learn about interfaces and contract calling another contract. in this case you can do this: contract Solution { function Solve(address _target) external payable{ _target....
1 vote
Accepted

python web3 error: Unknown Account

Found the solution, I needed to create a transaction and sign it using my private key, when I did that, everything worked fine NB: send a transaction only when calling a function that will change the ...
  • 33
1 vote
Accepted

Error with getting balance of an ERC20 token for a wallet address solidity

I've tested your contract, there is no problem I could call your function, maybe you got the wrong address for the Dai token, because there are some different Dai tokens on testnet network (I used ...
  • 300
0 votes

Remix not connecting to testrpc

ok it seems I just needed to change the url provided by remix from 127.0.0.1:8545 to localhost:8545. I thought localhost and 127.0.0.1 functioned the same tho. I have tried using them interchangeably ...
  • 1
2 votes
Accepted

How can I keep updating a struct value in an array using user inputs?

Your problem is that you are using an array, and array elements in Solidity are only addressable by their index. You should consider a mapping if you need to address your cars by licensePlate, maybe ...
  • 466
0 votes

How to get the contract ABI in new Remix IDE?

If you have source code of smart contract, you can easily get abi. https://i.stack.imgur.com/3r4Qb.png
  • 1
1 vote
Accepted

invalid opcode: REVERT

The problem is that you are trying to deploy the contract with the 100 wei amount. The 1_Storage.sol contract doesn't have a payable constructor, so it doesn't need any amount of ETH as input. Just ...
1 vote
Accepted

Inputting an Array value in Remix

I have tried your code and figured out how the inputs should be provided. You just need to send a variable array of arrays containing exactly 4 elements. For example, [[1,2,3,4],[5,6,7,8],[9,10,11,12]]...
0 votes

unable to verify etherscan contract may be due to high optimize runs

You should be able to verify using truffle. Take a look at this article. Remember to change settings as required in truffle-config.js file. Note: command to run for already deployd contract truffle ...
  • 778
3 votes
Accepted

AggregatorV3Interface address for ETH/USD for sepolia

You can get them on chain-link official docs: https://docs.chain.link/data-feeds/price-feeds/addresses/#Sepolia%20Testnet It's 0x694AA1769357215DE4FAC081bf1f309aDC325306

Top 50 recent answers are included