Questions tagged [interfaces]

The tag has no usage guidance.

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

Uncaught TypeError: TheContract.at is not a function

just trying my first steps in ethereum and web3. So i found this tutorial: https://www.youtube.com/watch?v=hcTPjpPvas8 But it raise an error: index.html:85 Uncaught TypeError: TheContract.at is not a ...
1
vote
1answer
233 views

creating and array using type Big.Int and counting the sum of all integers inside it

Im communicating with a smart contract trying to get the balances from a list of addresses. I then want to get the sum of all balances but I am stuck on actually creating the array to store all the ...
0
votes
1answer
41 views

How to call “payable function” via interface in solidity [duplicate]

I have a function marked as payable in contract A and I want to call it from contract B so that msg.value in contract A can have its desired value and contract A must have balance of sent amount , how ...
0
votes
1answer
49 views

DAPP WALLET transaction always fails

To improve my skills in solidity I'm working on a "wallet dapp". Based on smart contracts only, users can send ERC20 to another wallet. It works like that: user gives the following parameters: ...
2
votes
1answer
48 views

How to properly define an interface in Solidity 0.6?

One of the breaking changes of solidity 0.5 was making explicit function visibility mandatory, hence all interface functions must be defined as external today. In solidity 0.6, there seems to be two ...
1
vote
1answer
25 views

How to deploy smart contract so that average user can interact with its public functions?

I sucesfully wrote and deployed smart contract using Remix and Metask to generate hashes used as keys. This contract has few payable public functions that set or get some numbers. After deploying ...
0
votes
1answer
19 views

Like an ERC20 interface, do we have any interface or a smart contract that supports creating and transferring Ether on Ethereum?

To create a token on Ethereum, we use ERC20 token interface to design our token smart contract that captures functions required like mint(), tranfer(), balanceOf(), etc. Similarly, do we have any ...
0
votes
1answer
34 views

Buy tokens form other smart contract using interface

I have two separate contracts, let's say Token and BuyFrom. pragma solidity >=0.4.22 <0.7.0; interface InterfaceToken { function invest(address contributor) external payable; } contract ...
0
votes
0answers
16 views

is there any possibility to read struct via interface from deployed contract?

the contract is deployed which has no view function for that particular struct, is there any way to read values via interface in another contract which I want to write and deploy ?
0
votes
1answer
48 views

What is the use of a interface or function without implementation?

Take, for example, this code. The interface contains function without implementation, so how it's useful. pragma solidity ^0.5.0; interface Calculator { function getResult() external view returns(...
1
vote
1answer
510 views

Solidity function overloading and selectors — member not unique

I have the following contract: pragma solidity ^0.4.17; contract test{ mapping(bytes4 => bool) internal supportedInterfaces; uint public a; function test() public{ supportedInterfaces[...
0
votes
2answers
39 views

What does it mean to declare an item of type contract?

Wasn't quite sure how to word the title, but in the following code: contract KittyInterface { ... } contract ZombieFeeding is ZombieFactory { KittyInterface kittyContract; } what is the ...
2
votes
1answer
448 views

Why public variables aren't able to implement interface functions?

I'm curious why interfaces don't accept public variables as implementations, since public variables have getter functions generated for them. For example why couldn't the ERC20 balanceOf interface ...
0
votes
2answers
45 views

How bad is it to change a function inside ERC721 interface?

I'm creating a NFT and I want the transferFrom function to be payable. In order to do so I need to edit the ERC721 interface and make that function payable also there. If I do so everything compiles ...
2
votes
2answers
507 views

Anyone knows what does this contract code mean?

Refer to the link below: https://github.com/bokkypoobah/Tokens/blob/master/contracts/MyToken.sol Line 62: contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 tokens,...
1
vote
1answer
120 views

Can abstract contracts in solidity have state variables?

I want to have one deployed contract with my data structure and all data and another separate contract with functions that calls the deployed contract. If i've understood things correctly, one should ...
2
votes
0answers
38 views

Nested usage of interfaces?

Using solidity ^4.x, it seems I can use an interface as a parameter type in a function from a different interface. Example: interface IERC20 { function transfer() external; } import "./IERC20....
2
votes
2answers
165 views

ERC20 Interfaces overwriting ERC721 functions - Possible to adhere to standard?

Is it possible to have a contract that both generates and manages its own NFT according to the ERC721 Standard, and is able to make calls to outside ERC20 contracts? My contract currently inherits the ...
1
vote
1answer
35 views

What does mutability guarantees mean in erc721

Some functions from ERC-721 interface contain payable modifiers. function transferFrom(address _from, address _to, uint256 _tokenId) external payable; I was wondering why it is payable and found ...
0
votes
2answers
2k views

File import callback not supported import “./IERC20.sol”;

when I try to compile my contract I see errors like this : DemirelToken.sol https://eksiup.com/p/4z49413damc3 here's the code : pragma solidity ^0.5.0; import "node_modules/openzeppelin-...
3
votes
2answers
569 views

Can we modify ERC20 functions?

I have to create and transfer token using ERC 20.Inside the standard interface of ERC 20, we have function approve(address spender,using token) which inturn approves spender to take some token from (...
2
votes
1answer
182 views

ERC721: Interface ID Registration

Why we need to register Interface ID in ERC721 token. I was just going through the openzeppelin-solidity erc721 code and curious to know that why we need to use this. That interface id register code ...
3
votes
1answer
664 views

How to interact with ERC20 interface?

My target is to send from the ERC20Wrapper.sol deployed contract BAT tokens to my hard coded address. I've created ERC20 Interface: pragma solidity 0.4.18; interface ERC20 { function ...
0
votes
3answers
181 views

REMIX:This contract does not implement all functions and thus cannot be created

What should I do? pragma solidity ^0.4.21; contract ScoreInterface { function hit() public; function score() public view returns (uint); } This contract does not implement all ...
0
votes
1answer
189 views

Solidity, how to cast SmartContract type to address

I am currently a bit stuck with my contract, the issue is following: I define a smartcontract type which is used for another address (aka address is smartcontract that provides the specified interface)...
0
votes
2answers
167 views

Solidity how to check if user is already used another contract?

I am trying to figure out how to set up a simple communication between contracts. For example, we have a contract Passport, in which the user writes his data. After that, through the Election ...
1
vote
1answer
21 views

In case we have an interface written in a seperate .sol file how do we migrate it successfully?

HI consider i have 3 smart contracts A,B,C. I have a separate file D.sol which is an interface used in all A,B and C. What would the migration script look like for this project?
0
votes
1answer
86 views

Interfaces implementation visibility

I have this interface: pragma solidity ^0.4.24; interface EventsInterface { function removeValueFromArray(uint _userId, uint[] array) external returns(uint[]); } And this contract: pragma ...
1
vote
0answers
116 views

Can I extend the interface of a contract without redeploying it?

The case I'm dealing with is a contract which should serve as a Data Abstraction Layer. So ideally, it should provide only getter functions and setter functions. For example, my interface is: ...
0
votes
1answer
88 views

how to parse values returned by one contract into another?

I've two contracts deployed one is UserRegistration and another is Exam I've getUser(uint id) method to fetch data of particular user using users mapping, function getUser(uint _id) public constant ...
1
vote
2answers
141 views

Why are all parameters prepended by an underscore in ERC interfaces? [duplicate]

For instance, both ERC-721 and ERC-725 have underscores(_) before any function parameter. I understand that normally their goal is to avoid variable overloading. However, what is the rationale for ...
0
votes
1answer
117 views

Enum in interfaces

Following the documentation I try to add a enum to my interface. Inside the interface I have a method called get that returns one of the enum value. Im trying to add the enum to the interface, because ...
0
votes
1answer
106 views

Interface overriding

I have two contracts. One of them inherits another. Inside the parent contract I have the interface interface Token { function transfer(address to, uint256 value) external returns (bool); } I ...
0
votes
1answer
827 views

Interfaces in solidity

I have one interface like the following: pragma solidity ^0.4.11; interface TokenInterface { function transfer(address recipient, uint amount) external returns(bool); } And the implementation in ...
2
votes
2answers
233 views

Variables in interfaces

Im trying to implement my first interface. But when I try to add a new variable, Remix tell me that can´t add variables in interfaces. It have sense to set the fixed variables that the extended ...
1
vote
1answer
43 views

Simple but important question: How to get the value of contract's state when using Metamask? [closed]

I'm designing an HTML file (or a user interface: UI) for my smart contract. let's assume that my contract has a state as follows: address public owner;// it is set to "...
0
votes
0answers
73 views

Why is not Metamask invoked in my user interface?

I'm running a private Ethereum blockchain on my computer. I've installed Metamask on my chrome as well. I can create an account on metamask, and then interact with my smart contract deployed on my ...
0
votes
1answer
85 views

Error in external function parameter defination for an interface

Dear community members, I have come across an error while defining an interface (just using the standard one interface ERC721TokenReceiver) this interface is mentioned in this link https://github....
1
vote
2answers
33 views

Is it possible to have an optional property or method in an interface?

I currently can't deploy any contract which doesn't adhere 100% to the specified interface(s). Is there a way to mark some properties or methods as optional and, if not, is this a planned feature?
0
votes
1answer
65 views

Contract Using An Interface Is Not Compiling

I am learning Solidity and I am using Remix to experiment and enhance my learning. I am currently trying to create a simple contract that uses an Interface. pragma solidity ^0.4.19; contract ...
2
votes
2answers
460 views

How to create Interface to read Struct in mapping?

There are 2 contracts A and B. A has a mapping which returns Struct: mapping (bytes32 => Cup) public cups; How can we read the cups mapping in contract B? Following code doesn't work for sure:...
0
votes
1answer
148 views

Should Solidity interfaces always specify return types?

I've seen interfaces in which the function definitions specify a return type, ie: (from openZepplin's IERC721.sol) function balanceOf(address owner) public view returns (uint256 balance); and ...
0
votes
1answer
870 views

how to call one contract function into another contract

contract xyz { mapping(address => bool) Users; function add(address userAddress) { require(userAddress != 0x0 && !Users[userAddress]); Users[...
5
votes
1answer
5k views

Deploying abstract contracts and interfaces

I am trying to create a basic inheritance hierarchy with abstract/virtual formalisms. Consider the following two contracts: Abstract Contract (IUser.sol): contract IUser { function addUser (...
0
votes
0answers
14 views

what do I do with compiled interface output?

I created a token sale smart contract. And it has an interface that resolves to a token contract address. Now the output folder has the compiled token sale smart json file and the interface json file....
1
vote
1answer
308 views

Smart Contract Design: Escrow/Controller contract

How would I go about creating follow: Escrow/Controller contract A which is capable of accepting ERC20tokens from contract B, and ETH from party C and do a swap when certain conditions are met. This ...
1
vote
1answer
656 views

What are the benefits of abstract contracts?

I've seen similar questions, but none answer why people use abstract contracts. I come from a non-OOP JavaScript background, so I have some trouble understanding these things. From the docs: pragma ...
3
votes
2answers
502 views

ERC-721 safeTransferFrom is overloaded?

According to ERC-721 interface the function safeTransferFrom seems to be overloaded: function safeTransferFrom(address _from, address _to, uint256 _tokenId) public; function safeTransferFrom(address ...
3
votes
1answer
265 views

Ethereum address URL

Is there a standard or a convention for URLs of Ethereum address? That is I want clicking xxx://0x... to initiate transfer to this account.
1
vote
1answer
92 views

Why standard tokens inherit interface?

I was wondering why most tokens inherit from an ERC20 interface, instead of just implementing all the functions directly. Are there are any problems that arise if the interface functions are just ...