Questions tagged [contract-development]

Questions regarding the development of smart contracts

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

When I hit sign transaction in deploying contract, the send button is greyed out

I have 0.5 ROP but it is saying send 0. My wallet address is 0xef534b8ea9B3897a014Bf47E84c642Ad7952A120
2
votes
1answer
106 views

Watching the transaction of an external account using smart contract

Is their any way to execute a function of smart contract whenever a transaction to a predefined external account occurs? I mean if someone transfers some ethers to account A, a function of a smart ...
0
votes
0answers
12 views

VM error (revert) when trying to send value to a contract's fallback function

I'm going through the Solidity docs and in the fallback function section, I'm having some issues running the example provided, specifically in terms of sending value to the receive function of ...
0
votes
1answer
140 views

unable to write transactions on rinkeby from javascript file

I have written a contract which read and write data into blockchain using truffle. when i deployed that contract on rinkeby and called functions using web3.js the read functions works fine. but write ...
12
votes
6answers
5k views

Sorting an Array of integer with Ethereum

I'm trying to have a simple array of integer sorted in Solidity but i couldn't find any real ressources so instead i'm trying to do it "the hard way" but so far with very little success. Is anyone ...
0
votes
1answer
12 views

Trying to do interaction between 2 contracts. But compilation failure showing should be declared Abstract

WinCon.sol EnemyCon.sol To create interaction, I am creating interface for EnemyCon in WinCon.sol, but Remix is throwing compilation error stating "EnemyCon should be marked abstract". I ...
0
votes
1answer
89 views

Is it possible to modify privateFor addreses in a private Smart Contract (Quorum)?

I know how a private smart contract works providing a list of accepted addreses to privateFor property, but what if I want to disable (or enable) any address visibility? Should I deploy a new Smart ...
0
votes
0answers
15 views

Test execution error: 'The contract code couldn't be stored, please check your gas limit.'

When I was coding the unitary tests for my smart contract on Remix, I encountered a problem of gas limit: contract deployment failed after trying twice: The contract code couldn't be stored, please ...
2
votes
2answers
179 views

How to generate a new token for ERC1155?

Developing an ERC1155 contract, how to generate an address for a new token? I need to create an API function like function createToken() returns (address). How? Should I just use an incrementing-by-...
0
votes
1answer
733 views

Uncaught Error: Cannot find module 'web3-eth-personal'

I have these two lines of code to unlock the default account, But i keep on getting error , tough the require path points to proper directory of web3-eth-personal, var personal = require('./...
0
votes
1answer
15 views

Unable to approve [closed]

/// pragma solidity ^0.6.0; import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol"; import "https://github.com/OpenZeppelin/...
3
votes
4answers
1k views

How to calculate an Ethereum Contract's address during its creation using the Solidity language?

Now I know and have read the other thread saying that a contract's address is created deterministically via RLP encoding the creator's address and his nonce and then hashed with Keccak-256 but the ...
-1
votes
0answers
24 views

How to calc to 0.000025 [duplicate]

values[i].mul(100*100*100 * (now.sub(invest.lastDepositTime).div(RATE_DIVIDER[0]))); I got like that: 0.000025, but in contract return 0. I have added: uint256[] memory uint256[] memory calcWithdraw =...
0
votes
3answers
284 views

Error when trying to add a payable function in erc20

Most of the ERC20 examples on the internet have this function: // ------------------------------------------------------------------------ // Don't accept ETH // --------------------------------------...
0
votes
1answer
55 views

“out of gas” when trying to send back ETH from a contract to tx.origin

(UPDATED) The contract should have more than enough ETH. I deploy the contract with 0.1 ETH: https://git.io/JUBdy const consumerExample = await ConsumerExampleFactory.deploy(process.env....
0
votes
1answer
32 views

What happens if someone DOS's my infura api link?

I have an infura link, and put it on my frontend as the default provider url. What happens if someone DOS's that link and uses up the daily api request limit? It's unclear how infura protects against ...
0
votes
0answers
17 views

How to use the arithmetic increment operator in an if statement? [closed]

What do I need to change to make these examples work? Example #1 uint256 totalDeposits; uint256 thisValue; if(amount > 0) { totalDeposits++; } if(totalDeposits == totalDeposits++) { ...
0
votes
2answers
207 views

Create Tokens Pegged to Ether

I would like to create tokens where its price is pegged to the price of Ethereum (i.e. Ether price goes up, my token price goes up). Regardless of number tokens been sold or changed hands.Is it ...
2
votes
2answers
651 views

How can I trigger a quorum private smart contract deployment from my js client app?

My question follows directly this answer to a similar question. I need for my client app users to be able to trigger private contract deployment. I've tried using privateFor with both the web3 and ...
2
votes
2answers
133 views

How to make users trust my contract and me?

I bought a ticket to attend StrangeLoop 2017 (IMO, one of the best conferences out there), but something came up and I can no longer attend. Since I'm learning about Ethereum, I thought it might be a ...
0
votes
0answers
18 views

Mapping duplicate

I have a mapping in my smart contract, which works as a user's historic. Each time the user adds or transfer a kit, the information about this said kit has added to the mapping. These kits have an id ...
4
votes
2answers
2k views

How to trigger contract fallback function from Javascript

For a simple contract: pragma solidity ^0.4.11; contract Test { uint private val; function getVal() constant returns(uint) { return val; } function setVal(uint newVal) payable { ...
0
votes
0answers
15 views

What's the difference between the two ways of calling the function of another contract, i.e., interacting with another contract?

1.Here is an example from official doc:https://solidity.readthedocs.io/en/v0.7.3/control-structures.html#external-function-calls // SPDX-License-Identifier: GPL-3.0 pragma solidity >=0.6.2 <0.8....
0
votes
0answers
15 views

What's the difference between the two ways that contract B interacts with contract A?

The deployed contract A: A.sol: contract A { function testA() public returns(uint) {return 1;}; } Here is the first way that contract B interacts with contract A: B.sol: import "./A.sol"...
2
votes
1answer
31 views

What are the changes to EVM from Constantinople fork and later forks? [duplicate]

What are the changes to EVM from Constantinople fork and later forks? Could you tell me which commit in git? Or Could you provide a list? Thank you!
0
votes
1answer
172 views

Freeze account for a limited time after transaction

Is it possible ina contract to freeze an account for a specific period of time, 1 month in example, after a transaction, let say the user sends 1 ETH to my contract and he can't do another transaction ...
0
votes
1answer
863 views

Input data on Solidity

I'm trying to do something simple like Hello World that shows on a webpage. I've written a smart contract like this: pragma solidity ^0.4.18; contract HelloContract { string word = "Hello World!"...
0
votes
1answer
137 views

Is it possible for a ERC20 token to be associated with an application account after the fact?

Say you want to create a new utility token offering, and owning that token will be useful in an application still in development. You don't want to dissuade people from purchasing by requiring a lot ...
2
votes
0answers
49 views

Swap tokens to Ether on Uniswap V2 TRANSFER_FROM_FAILED

I am trying to swap DAI to ETH on kovan testnet my wallet and contract both have DAI tokens. Whenever I swap the token through web3 the transaction fails Fail with error 'TransferHelper: ...
0
votes
0answers
19 views

How do I verify a contract that has imports on etherscan?

There is an answer from 2017 here saying that it's not possible but it's been 3 years since then so hopefully there is progress. My Vyper contract looks something like this: import ERC20 as ERC20 ...
2
votes
3answers
3k views

How to do an air drop to all ETH token holders?

Say I have an ERC20 token and I want to distribute it 1:1 to all ETH token holders at a given block. Is there a straight forward way to make a smart contract that anyone could call in order to receive ...
0
votes
2answers
174 views

Create2 and new contract deploy at used address

Given that it seems possible, using somehow CREATE2, to deploy a new smart contract at a certain address where a different smart contract existed before to be killed... (see @smarx answer here Can ...
0
votes
0answers
16 views

How to transfer another erc20 token with a smart contract?

I want to send the'B(erc20)' token of msg.sender inside the function of'A' Smartcontract. Create transaction that msg.sender approve B token After that, the msg.sender creates a transaction ...
0
votes
2answers
97 views

Are there any code quality certifications or standards for smart contracts

In light of recent statistics on # of bugs in smart contracts and the DAO heists I like to know if there are any kind of smart contract quality certification framework , smart contract standards or ...
0
votes
1answer
26 views

How do I get the decimals of an erc20 contract when the decimals variable is not there?

What is the best practice for doing this? In the ERC20 standard having a public decimals: uint256 is marked as optional. But obviously you cannot display a token balance in the UI without having the ...
0
votes
2answers
318 views

2FA / Authentication Through Smart Contract

How can I generate something similar to 2FA on-chain? Could the private key or public key be used somehow in secrecy to compute a value or something? I need a way to authenticate a smart contract user ...
0
votes
1answer
370 views

Contract not using Upgraded Proxy Contracts

There's 2 contracts A and B, A imports B, where B is a library that can be upgraded. To achieve this, I tried replacing B with a proxy contract and a delegate contract. We now have contracts Foo, ...
1
vote
1answer
12 views

Running test with multiple contract address on a local Ganache blockchain

I'm developing with Truffle and Ganache I have an standard ERC20 ABI that I import in my test file. it only has 3 optionals functions name, symbol and decimals. const Token = artifacts.require('./...
0
votes
0answers
12 views

Buidler + Aragon: deploy contracts from a separate package [closed]

I have a Buidler package with smart contracts. It uses Buidler Deploy. I also have a Buidler + Aragon app package. I need the second package to be able to compile and deploy contracts from the first ...
4
votes
1answer
166 views

How to deploy existing DAPP to my private ethereum node?

I am looking to build a PoC around a trading platform on a block chain platform. I am trying to deploy the dapp available here to my local ethereum node. Package contains: a. HTML frontend part b. ...
19
votes
4answers
14k views

Convert address to string

In Solidity, how can I convert the sender address to a string? The comments in How to convert an address to bytes in Solidity? did not provide a working solution
0
votes
1answer
22 views

Contract Interaction and Batch Transaction with Web3

I've reviewed most all of the posts on this topic, but none of the answers are doing exactly what I need. I have an application that allows users to submit their tokens from their contract into my &...
1
vote
2answers
198 views

function approveAndCall error

I creat token contract using remix. The function approveAndCall code is following. function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) { ...
0
votes
1answer
32 views

How to call contract function [closed]

I need to call function from my contract. I got: Uncaught (in promise) TypeError: contract.getBadgeOwner is not a function async function a() { let contract = await tronWeb.contract().at(".......
0
votes
1answer
26 views

How do I read ALL of the data in a hashmap/array in a smart contract

To read from a mapping in ethers/web3.js, we do this: const value = await myContract.someMapping(someKey); We can search up one key/value in the mapping at a time. How can I get ALL values within the ...
0
votes
1answer
17 views

Why does this code not work with Tron address?

function transfer(address to, uint256 value) public returns (bool) { require(value <= _balances[msg.sender]); require(to != address(0)); uint256 tokensToBurn = findPercent(value); ...
0
votes
1answer
10 views

How do you handle a chain re-org with contract events?

Given that events are fired whenever a transaction is included in a newly mined block, how do you handle the situation when the mined block containing the transaction gets orphaned? Say I have a ...
1
vote
2answers
162 views

How to use a date time from an API to prevent contract interactions if the date is a string?

I want an to use an oracle to prevent contract interaction after certain time cutoffs This is the APIs format: "event":"event2","timezone":"UTC+1","datetime":"2018-06-07 01:00:00" I think doing all ...
1
vote
0answers
22 views

solc unable to import scoped packages

I am trying to import these lines on solidity and compile it with solc import '@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol'; import '@uniswap/v2-periphery/contracts/interfaces/...
0
votes
1answer
148 views

Are there any security issues to send token in fallback function?

I want to have a contract that releases an erc-20 token as soon as someone pays ether to contract. Let's call this contract Bid Contract. The abstract code goes like: function askForTokens() public ...

1
2 3 4 5
67