Questions tagged [contract-development]

Questions regarding the development of smart contracts

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

Error: This contract may be abstract

My solidity contract compiles in Remix, but when I try to deploy it it fails and throws Error: This contract may be abstract, not implement an abstract parent's methods completely or not invoke an ...
1
vote
1answer
18 views

Multiple transactions with same nonce, pending ones makes me crazy rest is ok, but why?

I am playing with smart contracts in code, sending/receiving transactions to/from it. Some transactions with lower gasPrice are stuck in a pending state. However, having same nonce with a higher ...
0
votes
1answer
34 views

TypeError: Type int_const 0 is not implicitly convertible to expected type address payable

Hi I'm trying to update this code from solidity 0.4.X to 0.5.X and am currently stuck on this bug struct JediBet { uint guess; address payable addr; BetStatusEnum status; uint ...
0
votes
0answers
29 views

Can we trust a dApp as much as we would trust Ethereum?

I was reading about bridging Ethereum and IPFS and I stumbled upon an article that uploads the file to IPFS and records the hash of it as an Ethereum transaction. I then tried to understand the ...
2
votes
2answers
52 views

How to generate calldata for a function

I have got as far as generating the method ID for the function: function transfer(address src, address dst, uint256 amount); The method ID would be: bytes4(keccak256("transfer(address,address,...
1
vote
2answers
51 views

Can you use a generic ABI and grab any Smart Contract by its contract address?

This might be a basic question, but I was walking through how to interact with the DAI (an ERC20 token) smart contract in Web3.js which led to this: const daiTokenAddress = "...
0
votes
1answer
62 views

Ether Forward and Token Sweep Contract? [closed]

I've written a simple ether forwarding contract coupled with a sweep function which when called automatically, sweeps all tokens of specified token contract address to pre-defined recipient addresses. ...
0
votes
0answers
32 views

Ethereum option contract

I want to create ethereum option contract that works with dai but i face 2 problems I want to create a function that identifies current ethereum price and automatically runs if that price is below a ...
0
votes
1answer
24 views

What's the difference between contract creation and contract deployment?

According to the solidity documentation: One way to create contracts programmatically on Ethereum is via the JavaScript API web3.js. It has a function called web3.eth.Contract to facilitate contract ...
1
vote
1answer
26 views

Solidity - selfdestruct doesnt work!

I implemented selfdestruct(), also it showed succeeded on Etherscan. Afterwards, I still am able to send transactions to the contract. Can you tell me why? Doesn't selfdestruct() delete the contract ...
0
votes
1answer
32 views

remix compiler warning infinite gas requirement

I'm trying to deploy a trivial faucet program which compiles OK with remix but I get the following error. "Gas requirement of function Faucet.withdraw(uint256) high: infinite. " This means that while ...
0
votes
0answers
18 views

How to get a list of struct that has a mapping as attribute

I have the struct Offer so that it contains already a mapping of assets. I have created a mapping of offers for the struct Offer storage. Now I need to implement the getAll function of Offer. The ...
0
votes
1answer
44 views

What happens when i redeploy my contract on truffle?

I am very confused by the term 'Contracts are immutable' does it mean when I deploy my contracts, I can't update my code again, and what actually happens when I redeploy my smart contracts after and ...
1
vote
0answers
21 views

exponential function with fractional numbers

With solidity, we cannot directly calculate 0.1 or 0.001. We usually use decimal multiplier and divisor integer to calculate those numbers like this 0.01 = 1 / 100 When the number is more than 1, it ...
0
votes
1answer
19 views

How do i keep a contract's value changed by another one constant?

There are 3 contracts; A, B, and C. C has a state variable that initialized null. A changes that state variable to Yerevan. After that, B sees that variable. Evaluating by A is successfull but B sees ...
0
votes
0answers
22 views

Solidity - can I predict reverts?

I have a voting system and admin groups contracts. Each admin group (it contains array of addresses allowed to vote) can grab a voting contract and vote for changing code in my contracts environment. ...
0
votes
1answer
24 views

XMLHttpRequest() does not work probably in a Truffle project

I want to connect to my smart contract in a Truffle project and get some information from it. The smart contract's name is "TEST". The follow is my app.js code that should communicate with my smart ...
0
votes
1answer
22 views

Trouble deploying one contract from another

Why creating a contract new RewardCourts() in another contract takes more than ten kilobytes of bytecode in the contract it is called from? (It makes bytecode too big and I can't deploy it!) What to ...
0
votes
1answer
22 views

How do you pass an array as an argument to a contract *constructor* using Truffle deployment script

I need to pass array as argument to contract constructor using truffle deployment script. My contract code looks like this: pragma solidity ^0.5.0; contract ArrayArgument { uint[] public arrsv;...
1
vote
2answers
32 views

Smart Contract States

I have been encountering the word 'state' in a lot of research papers, and I was wondering what they exactly mean by the state of the smart contract. I am aware of the following answer; however, it ...
0
votes
0answers
35 views

Sending ether to Contract from another Contract

pragma solidity ^0.5.0; contract Contract1 { address payable owner; uint public value; constructor() public payable { owner = msg.sender; value = msg.value; } function() ...
3
votes
2answers
105 views

Map or Array…?

I'm having a huge dilemma! I'm developping a smart contract that has, let's say Struct A and Struct B. Because I want to have a function retrieving all objects type A and B, I created a Struct All ...
0
votes
0answers
22 views

Gas Estimation Failed error when scheduling Aion call

I am trying to understand the Aion scheduling system, so I tried their code example from here. Below is the code snippet: pragma solidity ^0.4.24; // interface Aion contract Aion { uint256 ...
0
votes
1answer
28 views

Erc20 token with rewards [closed]

I want to create an etc 20 token that can be used to rais funds for projects and later distributes the revenue from the project to people who bought the token. How to do that ?
2
votes
1answer
27 views

Whats the best way of translating this struct?

Let's say I must have this data structure: ├── Operations (struct) │ ├── date_begining (uint) │ └── date_end (uint) │ └── responsible (address) │ └── type **(?)** │ ├── Observation (...
0
votes
2answers
32 views

Costs of storing an empty dynamic array of length 2**256-1 vs length 4

If the array is completely empty, is it more expensive to store uint[] of length 2**256-1 vs of length 4?
2
votes
2answers
112 views

Smart contract and oracles

I'm having trouble understanding the flow: Contract <==observes/injects== Oracle <==requestdata==> API I read several articles like this and I'm aware of the theory of the flow. But what ...
1
vote
1answer
25 views

ERC20 coin transaction not successful

I called the mint function on a default coin to send some of my new coin to my METAMASK account but it looks like nothing was received. I can't tell what specifically could have gone wrong, so here's ...
4
votes
2answers
158 views

Is it possible to deploy a contract using create2 in Solidity?

Can I deploy a contract in Solidity (not in-line assembly) using create2?
1
vote
1answer
24 views

Who Guarantees the Accuracy of a Smart Contract? [closed]

Assume Client A wants to sell a package to client B.
1
vote
1answer
23 views

Smart contract DB

Is it a good practice to create a smart contract to serve as a DB table? For example, lets say that I have users that need to create Operations. My operations objects need to contain id, description,...
1
vote
2answers
185 views

How to withdraw DAI from DSR (Oasis Saving Dapp / MakerDao) using the contract only, not the Dapp frontend?

I am currently testing the Oasis Saving Dapp by MakerDao (https://oasis.app/save). After converting some DAI to DSR, users can earn savings and whenever they want, withdraw their funds (convert back ...
1
vote
3answers
47 views

How to call function from SmartContract?

I have a smart contract deployed having the following function. function getTime() public view returns (uint){ return now; } However, when I try to call the function like this. ("einstance"...
0
votes
1answer
20 views

DaoAttack not working

I am trying to replicate the famous DAO attack for a cryptocurrencies course. I have the following contract already deployed on the blockchain. pragma solidity ^0.5.4; contract EDao { address ...
2
votes
1answer
20 views

It is possible to run out of gas when calling bytes32[]?

Is possible to run out of gas when calling bytes32[], even when count e.g. 1k entries?
0
votes
0answers
37 views

what is wrong with this token contract?

This one: https://etherscan.io/address/0xc12d1c73ee7dc3615ba4e37e4abfdbddfa38907e As you can see most of the last transfer fail, the transfer function is: function transfer(address recipient, ...
0
votes
1answer
38 views

Contract with a method to send received erc20 token to two different owner addresses

Was wondering if there is already an open source solidity code with method to sweep erc20 tokens received in contract address to destination address by calling an in-contract method such as "sweep()". ...
0
votes
2answers
66 views

ERC20 and/or ERC721

Consider the following scenario. A person owns a asset called "A". Now the asset is very high valued and unique but you can allow other persons to own a certain part of that asset. EDIT: Ownership ...
0
votes
2answers
34 views

Retrieving Contract instance from .abi and address

Having the .abi file and the address of a Smart Contract. Can I somehow retrieve the smart contract object instance? I know for the web3.js we could do something like: var inst = eth.contract(abi)....
0
votes
2answers
35 views

What is an example of when a solidity variable must NOT be public? Where it would break the security of the contract?

I'm really struggling to understand variable visibility. I'm aware that everything is public on a blockchain. Yes you can make a variable private to make it invisible to other contracts, but so what? ...
0
votes
2answers
56 views

Why in solidity 0.6 these functions are no more free? [duplicate]

Try this code pragma solidity >=0.5.0 <0.6.0; contract test05 { address payable public admin = msg.sender; function() payable external {} function getBalance() public view ...
0
votes
2answers
93 views

ERC20 Mixer to transfer fund privatly

I am working on idea to mix erc20 token from one account to many account. i have seen many example but all example has some limitation. like you can mix fixed amount. Sender can mix one ...
1
vote
0answers
32 views

Exiting out of a smart contract early?

Basically i want to have a smart contract that can allow users to exit early under specific conditions. Does anyone have any resources for this or know whether its possible?
0
votes
3answers
36 views

Can an NFT (e.g. ERC721) simultaneously belong to two different entities, say an user Owner, as well as a user Custodian?

For example, on the blockchain say you own a ERC721 Car token at your wallet address, but you want to park it in the ERC998ERC721 top down composable Garage owned by your friend, while still retaining ...
1
vote
2answers
47 views

Can i disable direct transactions to smart contract address?

I want to use rewardsAmount variable to calculate my rewards: uint rewardsAmount = 0; // Only here i can withdraw rewards function withdrawRewards() onlyOwner external { require(rewardsAmount !=...
2
votes
1answer
21 views

How to check if a mapping has not been written yet?

I have this mapping: mapping (uint256 => string ) private storedData; I am trying to do this: modifier dataNotStored(uint256 _index) { require( keccak256(abi.encodePacked(storedData[...
0
votes
2answers
23 views

Tokens & Smart Contract “Upgrade”

I'm not very technical, but I have a question. Supposing that a Smart Contract is being upgraded to a new one, would it be possible in the new contract to not send new tokens to certain wallets? So ...
7
votes
4answers
118 views

ABI and Bytecode stored inside Contract

I was scrolling around Ethereum StackExchange and I came across with an interesting thought that I have never read or seen anyone talk about. I'm perfectly aware of how contracts work and are ...
0
votes
1answer
38 views

Why the gas estimation of erc20 approve() change with executation?

The approve function code in my ERC20 contract is below: function approve(address _spender, uint256 _amount) public returns (bool success) { allowed[msg.sender][_spender] = _amount; Approval(...
0
votes
0answers
20 views

zeppelin tutorial smart contract (noob alert) can't connect to network

I am following this tutorial - https://docs.openzeppelin.com/learn/deploying-and-interacting#local-blockchain Everything was going good until i was asked to type the command - $npx oz accounts - ...

1 2
3
4 5
64