Questions tagged [interfaces]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
14 views

What does this function actually do in ERC1820?

I am unable to understand these two functions from the ERC1820 contract and its use. What does it actually do under the hood? Function 1 : /// @notice Checks whether the hash is a ERC165 interface (...
Serenity's user avatar
1 vote
1 answer
22 views

What is the right way to import a contract type that uses an interface in hardhat?

I have a contract with an interface that I want to test with hardhat the contract looks like this interface IGame { function play(uint guess) external; } contract Test { address private owner;...
Eugene1111's user avatar
1 vote
1 answer
39 views

question about interfaces and inheritance

I am building my own application for an erc1155 dapp but have some questions about interfaces and inheritance. How do you re-declare functionality that you inherit from another contract? Also, how do ...
EGstacking's user avatar
1 vote
1 answer
41 views

Do interface functions revert on failure?

I was wondering if interface functions automatically revert the whole transaction on failure or not? Let's say I want to call the sync() function of a liquidityPair, which usually returns no boolean: ...
Andy's user avatar
  • 185
1 vote
2 answers
46 views

Is it possible to define interface getters for arrays of structs?

Given a state variable defined like this: struct Segment { uint256 foo; uint256 bar; } Segment[] public override segments; Is it possible to define a getter in an interface? I've tried this ...
Paul Razvan Berg's user avatar
1 vote
1 answer
45 views

Why do some developers make their base contract inherit its Interface?

Some protocols and developers inherit the contract's Interface inside of the base contract and then have the interface contain the actual NatSpec, is this simply for human readability/code ...
Rohan Nero's user avatar
  • 1,408
0 votes
1 answer
35 views

Calling a safeTransferFrom of a contract that implements an ERC721Upgradeable interface

I have a contract A that inherits the following contracts: contract NftTemplate is Initializable, ERC721Upgradeable, ERC721URIStorageUpgradeable, AccessControlUpgradeable, ...
Allennick's user avatar
  • 233
0 votes
1 answer
159 views

Best practices for putting structs in interfaces

I have a struct struct Person { string firstName; string lastName; uint8 age; uint256 favNumber; } I have a function that returns a Person struct from an array Person[] private ...
chriscrutt's user avatar
0 votes
1 answer
215 views

Transforming Ethereum ABI(JSON) into Human-Readable ABI in Python

I know there is one example to do it: ethersjs implementation But how to transforming Ethereum ABI into Human-Readable ABI in Python?
LEVI_104's user avatar
0 votes
1 answer
34 views

Solidity Interfaces : VM revert Error

Im implementing a NFT Marketplace. Where I created Two contracts and an Interface. One contract is Tokens.sol and anotherone is MarketPlace.sol In Tokens Contract I Implemented functions like Minting ...
karthikeya Gundumogula's user avatar
0 votes
1 answer
50 views

How to get how many tokens are left to mint from an ERC721 smart contract that implements a max supply?

I have an ERC721 that implements a public maxSupply value, so I cannot mint more than a certain amount of tokens. Thanks to the public modifier, this exposes a method I can call to see what the ...
Falcon Stakepool's user avatar
1 vote
0 answers
31 views

How to pass argument with a specific interface into constructor for a sucessfull etherscan verification?

I have an marketplace contract that needs to be verified. It looks like this: // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC721/IERC721.sol&...
weird-dreams's user avatar
2 votes
1 answer
388 views

Why an external call using an interface reverts if an error occurs in the called function, but why it doesn't rever if it was made using the .call()?

I was wondering what happens under the hood when a tx makes an external call using an interface compared to calling the exact same function but using the low-level call() function and the function's ...
Stalin Macias's user avatar
0 votes
1 answer
59 views

Difference between storing an address versus a contract instance?

What is the difference between storing an address of a contract and using a interface to interact with it, versus storing the type of the contract itself (i.e. IPriceFeed v. PriceFeed) within the ...
Origami's user avatar
  • 136
0 votes
2 answers
58 views

Does Interface inherits modifiers?

Lets say i have contract that has couple functions which i want to call them by my other contracts, so i add some modifiers which help to doing this and. For interacting with my contract i use ...
Alireza's user avatar
  • 350
1 vote
1 answer
65 views

What does a non-existing external function returns?

I added a custom function, customRoyaltyInfo, to Openzeppelin's IERC2981 interface. I need the means to check if a contract that implements this interface IERC2981 support my custom function ...
Abk's user avatar
  • 125
0 votes
1 answer
82 views

Variable of interface type ? what is the purpose of giving interface name as variable type?

//SPDX-License-Identifier:MIT pragma solidity ^0.8.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract staking{ IERC20 public s_stakingToken; IERC20 public ...
Prem's user avatar
  • 1
0 votes
1 answer
217 views

ParserError: Source "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol" not found: File outside of allowed directories

I'm trying to compile a "FundMe.sol" contract: the issue is that when I try to compile it I keep getting the following Compiler Error: Brownie v1.19.2 - Python development framework for ...
waterlilyjack's user avatar
0 votes
0 answers
103 views

yul constructor ABI

I am using an interface as my ABI for ethersJs instead of using an hardcoded Interface like the following. const iface = new Interface([ // Constructor "constructor(string symbol, string name)...
Tashun Sandaru's user avatar
0 votes
1 answer
186 views

Waiting for contract to receive an ERC721 token

I'm trying to create a smart contract for raffling a NFT between users. Whenever an user tries create a raffle they need to specify the tokenContract which is the contract address of the NFT, and the ...
TRS's user avatar
  • 131
0 votes
1 answer
43 views

what is return value `uint liquidity` in IUniswapV2Router addLiquidity?

this is from IUniswapV2Router01.sol: function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, ...
Yilmaz's user avatar
  • 1,540
1 vote
0 answers
54 views

How to import interface from lower level of Solidity?

I'm extending a large codebase with another contract and I need to import an interface. My new contract uses 0.8.9 but the rest of the codebase is in 0.6.12. I'm using Hardhat multi compile to do ...
doylio's user avatar
  • 115
0 votes
1 answer
66 views

How to make sure that a contract's interface and functionality isn't lost after converting it to byte code?

Since Ethereum contracts are stored on the blockchain as byte code but people will want to understand how to interact with contracts, I wonder if there is enough information stored about contracts on ...
Rik Schoonbeek's user avatar
0 votes
1 answer
259 views

How to access the contents of an array in an external contract?

So, there's this contract (which I don't own) with a public variable: contract challenge { address[] public winners; } I need to know If my address was successfully added to the list, I have tried ...
Msantamaria's user avatar
0 votes
1 answer
29 views

Not being able to get interface to work

I have been trying to get a basic interface working on remix, but havent managed to. Did read a few examples but I must still be making some mistake. Trying to interact with this contract: // SPDX-...
Msantamaria's user avatar
1 vote
1 answer
48 views

When declaring an Interface, do i have to declare the mappings of the contract too?

Actually im wondering if in order to use a mapping from a 3d party contract in an other contract, can i devlare the mapping in the interface and use it like Mycontract.mapping() and view/modifiy it ,...
cutedwannabe's user avatar
0 votes
1 answer
568 views

Why do we need an Interface or the contract in ethers.getContractAt() function?

As per my understanding, if we want to get or interract with an already deployed contract, we can use this ethers.getContractAt() function. But since it's already deployed, can't we just give the ...
Aniket Kumar Paul's user avatar
1 vote
0 answers
27 views

Using interfaces as function parameters in solidity

Is it recommended to use contract interfaces as function parameters in solidity against using address. like... function doSomething (IERC20 token) external { ... } rather than function doSomething (...
Michael Amadi's user avatar
0 votes
2 answers
119 views

Why import library inside own contract?

I have noticed, in Uniswap v2 for exemple, that the contract imports its own library. For exemple, UniswapV2Pair.sol pragma solidity =0.5.16; import './interfaces/IUniswapV2Pair.sol'; ... import './...
Olivier Demeaux's user avatar
1 vote
1 answer
150 views

getContract from forked testnet

when I run hardhat on forked testnet and try to run test script that includes dai = await ethers.getContractAt("IERC20", DAI) I get this error: NomicLabsHardhatPluginError: ...
Mourad's user avatar
  • 123
0 votes
1 answer
77 views

What contract is AggregatorV3Interface using?

I understand that you combine an interface (which puts function names and parameter/return types in scope) and a deployed contract address which actually implements these functions. My question is, ...
J. Doe's user avatar
  • 105
0 votes
1 answer
176 views

When calling function from another contract via interface, get transaction reverted

I'm searching everywhere and also looking carefully at my simple code. Of course I'm a newbie but have the feelling that everything is fine on my code (pretty simple): // SPDX-License-Identifier: MIT ...
Zaesar's user avatar
  • 127
0 votes
1 answer
26 views

Is it not necessary to use deployed contract for using interface?

I've been practicing Ethernaut Elevator problem. In this code, it just passing msg.sender to Building interface. But, I think that it should be passing deployed contract address of Building to use ...
Shift_that's user avatar
1 vote
1 answer
97 views

what is the best and efficient way to call functions of an already deployed contract?

if I want to call a function of an already deployed contract for example an ERC20 token which one is the best and efficient way to call it's functions? using call method (bool success, bytes memory ...
Meysam's user avatar
  • 81
1 vote
3 answers
614 views

Why do we need interfaces in solidity?

Let's say contractA has a special function. And made an interface that contains the special function without implementation. To use the function in the other contractB, we can use the interface but ...
Shift_that's user avatar
1 vote
1 answer
327 views

Uncaught (in promise) Error: 'args.method' must be a non-empty string

This is the error I am getting in my console.. I am unable to understand the bug inpage.js:8 Uncaught (in promise) Error: 'args.method' must be a non-empty string. at o (inpage.js:8:31826) at ...
Abhishek Yadav's user avatar
0 votes
1 answer
94 views

How to properly instantiate a Open Z ERC-20 token within a smart contract?

I just want to double check if my below approach is correct. I've made two ERC 20 compliant tokens (Token A and Token B) as based on OZ standard: // SPDX-License-Identifier: MIT pragma solidity ^0.8....
Mike Chan's user avatar
0 votes
1 answer
49 views

How do I create an interface for a contract that has a function parameter type of another contract?

I'm creating an interface for SudoSwap's Router And the first function requires has a struct parameter function swapETHForAnyNFTs( PairSwapAny[] calldata swapList, ...... )... And ...
Ryan Sea's user avatar
  • 608
2 votes
1 answer
105 views

What is the practical purpose of interface contracts?

I wanted to make sure I understood the purpose of interface contracts. I understand that they are contracts with unimplemented functions, but wanted to make sure I understood all the ways programmers ...
J. Doe's user avatar
  • 105
0 votes
1 answer
215 views

A few simple question about using interfaces vs. standard contracts (IERC721 vs. ERC721)

1.)Is it correct to say..... if i import ERC721.sol into my contract then all the ERC721.sol functions are accessible even if i don't list all the functions in the contract? Meaning... i don't ...
Blockpain's user avatar
  • 143
0 votes
2 answers
565 views

Solidity interface between two contracts

i am trying to connect two different Smart Contracts. On one hand I have CRUD.sol, which implements CRUD operations in a struct "Data". I have programmed a method readAllData() that returns ...
WakiApi's user avatar
  • 33
2 votes
0 answers
359 views

How should supportsInterface be implemented for interfaces with multiple levels of inheritance in ERC165?

When an interface has multiple levels of inheritance, should the supportsInterface in ERC165 checks the entire entire inheritance stack of the interface or just the top-most level? Here's an example. ...
xenon's user avatar
  • 447
3 votes
1 answer
418 views

Get interfaceId from interface in ethers js or hardhat

Solidity has this wonderful way to quickly get the interface id from an interface. Suppose I have the interface interface undernose { function overmouth() external; } then solidity (at least in ...
Marlo's user avatar
  • 297
1 vote
1 answer
440 views

Solidity class inherit an interface but doesn't implement all its function

I have an interface IA and a contract A which inherit IA. Now if there's a function a() in IA, but I don't implement a() in A. Is there a default behavior when calling A.a()?
user3799934's user avatar
4 votes
1 answer
669 views

Interface overriding giving error. Overriding public state variable return types differ [duplicate]

I am trying to import interface in it's contract and overriding function. But 1 mapping is giving error. Error: Overriding public state variable return types differ. Interface: interface ...
Shubham Sharma's user avatar
0 votes
1 answer
94 views

Can't access a struct from one contract in another contract through interfaces. Any help?

I am trying to use a struct defined in one contract in another with the ise of interfaces. But my test cases is giving an error, AssertionError: Expected transaction to be reverted with Amount cannot ...
Shubham Sharma's user avatar
0 votes
1 answer
168 views

How to mock an instance of an interface?

Having these interfaces interface IERC20 { function totalSupply() external view returns (uint); function balanceOf(address account) external view returns (uint); function transfer(address ...
JP Segurado's user avatar
0 votes
1 answer
16 views

implementation is in different address

I have a weird situation. Here is the contract address of Compound Comptroller contract. However, the address above doesn't implement the contract. Actual implementation is in different address. What ...
Emrah's user avatar
  • 1,564
0 votes
1 answer
323 views

Brownie contract Interface not working on mainnet-fork

I'm following Patric Collins youtube video and trying to deposit wETH in the wETH contract using an interface and working using a fork of mainnet. I am trying to deposit eth in the next contract. ...
ericgc1997's user avatar
0 votes
1 answer
40 views

Smart Contract Architecture for Wide Ecosystem

I am building my first complex project involving a wide variety of applications. This ecosystem involves multiple contracts, from minting various NFT collections, to a fungible token, community ...
RodrigoR's user avatar