Questions tagged [contract-development]

Questions regarding the development of smart contracts

Filter by
Sorted by
Tagged with
0
votes
1answer
10 views

Ethereum contract size limit for multipage contract

I got to know that there is a size limitation for Ethereum contract, but to avoid this I split up functions of my contract in two sol files and one contract extends other contract and this solve the ...
0
votes
1answer
15 views

Data privacy protection in smart contracts

When I call the function of smart contract, I will pass some parameters that involve some users' private data, so I hope to protect these users' private data as much as possible. I checked some ...
-2
votes
0answers
9 views

first time using solidity keep getting TypeError: No matching declaration found after variable lookup

pragma solidity ^0.5.8; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; ...
0
votes
1answer
12 views

Will the parameters in the smart contract function be exposed?

A function in the smart contract needs to accept parameters to execute. If I pass this parameter to the contract, but don’t save the parameter on the chain, is it theoretically transparent on the ...
0
votes
0answers
22 views

How do I set up and mint erc1155? [closed]

I am facing a challenge and I wanted to ask you for advice, I am just starting to learn solidity and they asked me to make a smart contract where I can mint erc1155 and another contract that is a ...
0
votes
0answers
22 views

how dangerous is it to have voting system in blockchain? [closed]

There're lots of says that voting system shouldn't be done on blockchain because of security vulnerabilities. I am trying to understand what these vulnerabilities are and why it's a bad idea. I will ...
0
votes
0answers
10 views

estimateGasPrice succeeds but sending a transaction fails?

I have a simple contract with a function (simplified for the sake of discussion): function test(address tokenAddress, address userAddress) external { IERC20 token = IERC20(tokenAddress); ...
0
votes
2answers
36 views

How do oracle services interact with logs?

I am approaching blockchain and smart contracts for the first time and I have trouble understanding some concepts. I read this article https://medium.com/decentlabs/building-your-first-ethereum-oracle-...
0
votes
0answers
25 views

My smart contract works properly on Ganache network but not on Ropsten [closed]

I have a smart contract that is fully tested on ganache network through truffle. The contract implements a trade system where there are two main functions namely invest() and withdraw(). When I test ...
0
votes
0answers
13 views

How much is cost to deposit some ETH from 10 EOA address to a smart contract and withdraw the funds to one EOA address? [closed]

How much is cost to deposit some ETH from 10 EOA address to a smart contract and withdraw the funds to one EOA address? I want to know how much gas-limit is need to execute it? deposit part ...
0
votes
1answer
19 views

ERC20 Interface

When you make a token, must you have an ERC20 Interface (such as the one below)? What is the purpose of it? pragma solidity 0.6.6; /// @notice ERC20 https://eips.ethereum.org/EIPS/eip-20 with ...
0
votes
1answer
23 views

Simple contract to contract token transfer failing

I'm trying to write a contract that combines two different function calls into one transaction, for which I then can hopefully use the CHI gas token. However, for now I can't even get my contract to ...
0
votes
1answer
21 views

Withdraw function in my staking dapp not working as it should

I'm making a staking dApp (tutorial project) and my withdraw and reward function that is to be called when the msg.sender wants to stop staking doesn't work well. The function calls and returns a ...
0
votes
0answers
16 views

Issue Instantiating instance of a deployed smart contract. TypeError Should be marked Abstract

I'm having an issue using an instance of a deployed smart contract in my code. This could easily be me being a solidity novice, but perhaps some of you might be able to point out what I am missing. I ...
0
votes
1answer
20 views

Query token balance before transferFrom

I am trying, but without luck, to query the token balance of the approver address before transferFrom event. function transferFrom(IERC20Token _token, address _sender, address _receiver) external ...
0
votes
0answers
11 views

Mint ERC-1155 Token with user defined variables

I would like to allow users to change the property of their items. Let it be the color. In my understanding though there is no way of changing the property of an already minted erc-1155 token. ...
0
votes
1answer
9 views

Invalid implicit conversion from contract to address

pragma solidity 0.5.10; contract ERC20 { function totalSupply() public view returns (uint supply); function balanceOf(address _owner) public view returns (uint balance); function transfer(...
0
votes
0answers
9 views

How do I create a Token Tracker for my ERC20 token on Etherscan? [closed]

On the Ropenstine Test Network, It took only a few seconds for my ERC20 token to have a tracker page. Not a contract page, but the ones that say "Token: (Token Name)". Here's the contract: ...
0
votes
0answers
36 views

Send any ERC20 token with Approve and transferFrom functions

I have already read a lot of examples regarding my question, but the answers vary a lot so i am forced to ask this question again, hopefully i will better understand if my implementation is correct. ...
0
votes
0answers
11 views

comparing msg.value with uint [closed]

I got tx reverted after i compare it in function on contract. function checkPremiumisPayed() public payable returns(bool){ require(msg.value == _acommon.PremiumPayment ); return true; ...
0
votes
0answers
16 views

Why is metamask so far off in it's gas prediction? [closed]

Metamask predicts the gas cost will be 475,138 gas - The actual cost and total used gas is 1.478 million gas. I am using local javascript based EVM with hardhat. Why is metamask so far off in it's gas ...
0
votes
0answers
7 views

Blockchain & Solidity : Could you someone explain me what function entrySet is for?

I found this code online.It's about notorization of some document. I need to understand this code real quick. So could you tell me what function entrySet(bytes32 _checksum) do? pragma solidity ^0.5.0; ...
0
votes
0answers
7 views

Any ideas how to recover my 400 UNI drop from an old instadapp mcd vault smart contract?

I apologize for having to post this again because my lack of reputation but maybe I can reword it better this time. My ETH address: 0x34A2860bbbA761ae27005799b02D3DbD8b4b5fEb Old InstadApp MCD Vault ...
0
votes
1answer
22 views

Contract calling a function in another contract : TypeError

I have three contracts Ignition.sol , Factory.sol, Cookie.sol , Ignition should call the function 'factoryStart()' in the Factory contract. newCookie() creates new Cookie.sol contracts depending on ...
1
vote
0answers
21 views

How to pass array in web3js(0.20) as function parameter to solidity?

I have a function in solidity which take array as argument and processed that array. function add_level_income(address[] memory _referredBy, uint256 taxedTokenAmount) public returns(bool) { ...
1
vote
1answer
31 views

What is Uniswap's AmountoutMin(uint256)?

I want to use the Uniswap router contract to buy a token. However, I got confused by the amountoutmin(unit256) in the swapExactETHForTokensSupportingFeeOnTransferTokens of uniswap. I read the unswap ...
3
votes
3answers
114 views

Does an SSTORE where the new value is the same as the existing value cost gas?

For example (in Vyper): @external def foo(bar: uint256): self.baz = bar foo(3) foo(3) # Is the gas cost here still 5000? Is it better to do this instead? def foo(bar: uint256): if self.baz != ...
0
votes
1answer
16 views

How to handle precision errors in solidity? [closed]

Say I have some division and the result is the answer is off-by-one. I've multiplied it by 10^18 to give the decimals but the issue is its still off by one. How do i stop repetitions of this ...
2
votes
1answer
197 views

What is DSProxy and how does it work?

Several Ethereum projects use DSProxy to make their protocols more user-friendly. What is DSProxy exactly and how does it work?
0
votes
1answer
36 views

How to swap ETH to WETH on Uniswap

I'm trying to swap ETH to WETH tokens within contract, but cannot find any information how to do it. Can anybody help? Thanks!
0
votes
1answer
7 views

Implementing Forwarder to Contract

I am using this code for implementing Forwarder in my Contract. contract Forward { address public destinationAddress; event LogForwarded(address indexed sender, uint amount); event LogFlushed(...
0
votes
1answer
17 views

contract interaction error: function should be payable

I apologize if it is a simple question. I tried to create a simple contract interaction. I've tried to follow instructions on https://ethereum.stackexchange.com/questions/51760/contract-interaction, ...
0
votes
1answer
19 views

Transaction has been reverted by the EVM(Error encountered during contract execution [out of gas] )

I am trying to execute a function from the truffle console and getting the error without much information. contract LPTokenWrapper { IERC20 public lp_tkn = IERC20(...
0
votes
0answers
23 views

Member “mint” not found or not visible after argument-dependent lookup in contract IERC20 [closed]

contract LP is LPTokenWrapper, IRewardDistributionRecipient { using SafeERC20 for IERC20; IERC20 public bcoin = IERC20(0xa605936776F13d6A236FF9d5065818979aeC13cb); // other smart contract function ...
2
votes
1answer
24 views

Calling super class external functions

Is there a way in Solidity to call super class external functions? Normally with inherited contracts, when overriding inherited functions you can also call the original function logic with super....
1
vote
1answer
25 views

Explicit type conversion not allowed contract IERC20

How can I use IERC20("0xf7a35Eef60dC35fa2D3188Dfb22e635E4308fc8b"); it is throwing the error for me. I am try to use the another contract inside my contract. contract LPTokenWrapper { ...
0
votes
0answers
19 views

Import error for openzeppelin

I have tried both pragma solidity ^0.5.0; import "openzeppelin/contracts/math/Math.sol"; pragma solidity ^0.5.0; import "@openzeppelin/contracts/math/Math.sol"; Getting an ...
0
votes
1answer
15 views

refund function in smart contract [closed]

I am looking to add a Refund function in my smart contract. Like If User A deposited 1 ETH in the contract, and uses refund function, he gets 1 ETH - Gas Fee back. I can do the transfer(address....
0
votes
1answer
18 views

fee of smart contract deploying as transfer channel

I want to deploy a smart contract for deposit part of an exchange...I know the creator of a smart contract should pay fee(gas fee) to deploy it...my question is as follows: do senders also should pay ...
1
vote
1answer
17 views

Is there a gas cost incurred when creating a contract abstraction?

I have a smart contract in vyper (SomeContract) that gets called within another smart contract: some_contract: address = _some_contract SomeContract(some_contract).foo() # Is there a cost incurred ...
2
votes
0answers
29 views

How to make sure an external smart contract can only call one function in my smart contract per transaction?

How do I make sure that only users and smart contracts can call one function per transaction? Say I have two functions: function foo() {} function bar() {} It's ok to call each function in isolation, ...
1
vote
1answer
14 views

When upgrading contracts can you change the logic inside functions?

I am trying to wrap my head around all this and am looking for someone to help clarify. Lets say I have the following: contract Test { public c = 3; function A(uint a) returns(uint){ ...
1
vote
0answers
66 views

How does Uniswap calculate price impact without fee on the swap page?

Context: We are creating a smart contract which integrates Uniswap DEX for swapping Tokens to ETH. We need to make sure one swap does not impact the token price more than 3%. We are in need to write a ...
1
vote
1answer
39 views

Are newer solidity versions 'safer'? Should I update my existing code to use a newer version?

I have created a set of contracts that will shortly be undergoing an audit. It's a DeFi platform that is intended to hold real value. The project began as a fork of a fairly old project, that uses ...
0
votes
1answer
19 views

Error while testing a smart contract functionality with Mocha

I wanted to test my code functionality with the Mocha Framework, but every time it responded me with an error, not an assertion. The specific error was: Error:cannot find module "ganache-cli&...
0
votes
1answer
35 views

Invalid implicit conversion from uint256 to bytes32 requested

I am trying to run someone else's code from GitHub and I encounter this issue. It said that Invalid implicit conversion from uint256 to bytes32 requested. Please have a look on this code. function ...
0
votes
1answer
29 views

How to remove this ParserError of contract in solidity langauge. I am using remix ide

pragma experimental ABIEncoderV2; pragma solidity >=0.4.18; contract Record { struct MedRecord { string password; string name; address patient; address[] ...
1
vote
1answer
25 views

Uniswap V1 Calculation of token_amount When Adding Liquidity

In the Exchange contract of Uniswap v1, the addLiquidity function involves calculating token_amount using the formula token_amount: uint256 = msg.value * token_reserve / eth_reserve + 1 Why is there ...
0
votes
0answers
14 views

UniSwapV2Router.sol contract failing - “Gas required exceed allowance / Always failing transaction”

I am trying to recreate the Sushiswap protocol for educational reasons, but I am stumbling into an issue. When I try to run the addLiquidity function inside the UniswapV2Router.sol contract with the ...
1
vote
1answer
18 views

TransferFrom ERC20 token to burn address from another Contract

I am working on a migration contract and the flow is as follows: Contract function calculates balance of XXX coin -> Contract sends amount XXX of OLD token to burn address -> Contract sends xxx ...

1
2 3 4 5
68