Questions tagged [interfaces]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
9 views

Interface validation

I want to share my pain, guys 🙂 I learn Solidity and found that there are no normal interface validations. I am not sure of how to really interact with external contracts without importing them ...
0
votes
1answer
13 views

How to check If the smart contract support an interface?

I have token contract which implements IERC2981 interface and I've overridden the supportsInterface function like so. function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721,...
0
votes
1answer
19 views

How to get contract address when receiving an ERC-721 token in a contract?

I'm writing an NFT staking contract and I want my contract to accept NFTs only from 3 specific contracts. I have implemented IERC721Receiver and the onERC721Received function successfully fires. What ...
0
votes
0answers
10 views

So, anyone can access any smart contract just by using interfaces right? [duplicate]

If true, how can I restrict access to my future contracts to only me?
0
votes
1answer
27 views

solidity interface - Contracts calling unimplemented functions

I'm new to solidity and OOP. I'm trying to understand the code in this simple lottery game example: https://github.com/alphachainio/chainlink-lottery/blob/master/ethereum/contracts/ I am confused when ...
0
votes
1answer
12 views

How do I find the code of a external interface function?

I am learning about importing contracts and noticed with the following contract there is an external interface function with no code block. Where does this code come from? function version() external ...
0
votes
1answer
27 views

How to declare getter function signature in interface for a mapping?

I have a contract that implements an interface, the contract has a state variable mapping(address => bytes32[]) public usersLists, I defined a getter function signature in the interface for this ...
0
votes
0answers
22 views

How to use vyper's external_interface in brownie?

An external interface can be generated by vyper as such: vyper -f external_interface contracts/CurveCryptoSwap.vy Doing that results in the following output: # External Interfaces interface ...
0
votes
1answer
25 views

How is an interface initialised?

// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity =0.7.6; pragma abicoder v2; import '@uniswap/v3-periphery/contracts/libraries/TransferHelper.sol'; import '@uniswap/v3-periphery/contracts/...
0
votes
0answers
17 views

calling functions from deployed library

Suppose I have the follow Library deployed at Address A library aLibrary { address constant owner = //AddressB; function customSend(uint256 value, address receiver) public returns (bool) { ...
1
vote
1answer
38 views

How to access a public state variable from another smart contract through an interface in Solidity

I have a newbie question about accessing a public variable in another contract which was deployed. Contract Escrow needs to get value from another contract DoubleTrade deployed at an address. Here is ...
1
vote
1answer
84 views

How to override supportsInterface() function if contract needs to support many interfaces?

I'm creating a basic ERC721 token that extends ERC721, ERC721Enumerable, AccessControlEnumerable. I want it to support ERC721Enumerable and AccessControlEnumerable interfaces. Is it enough to call ...
0
votes
1answer
19 views

What contract does an interface points to?

I keep reviewing code with interfaces, without seeing any reference anywhere of what contract that interface points to. For example in this contract for the popular cryptocurrency Axie Infinity: ...
1
vote
0answers
67 views

Using imported solidity interfaces with brownie

It seems like brownie compile doesn't produce ABI for an imported interface. I would like to use OpenZeppelin IERC20 interface. Here is the setup: brownie-config.yaml: dependencies: - OpenZeppelin/...
0
votes
0answers
22 views

Defining vs Casting an Interface

When reviewing smart contracts, I often see the interfaces of other contracts in the same file, however I never understood how that specific contract knows which contract that interface is referencing....
0
votes
0answers
11 views

interacting with an enum as an interface in other contract

having this issue of using enum as interface in other contract: will appreciate your help... // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.9; interface interEnum { enum SIDE { ...
0
votes
1answer
87 views

How do Interfaces in Solidity know which contract they are interfacing?

To my understanding, an address at some point needs to be provided so that the name of the interface that you write in your code is linked to the existing external contract you want to interface with. ...
0
votes
1answer
88 views

How to interact with Ethernaut contracts via Remix

I'm going through the Ethernaut levels and I have some fundamental questions I need answered before I can continue. This question is particularly in reference to the levels that require you to deploy ...
0
votes
1answer
98 views

Is there a way to get an interface ID of a Solidity interface using ethersjs?

Is there a way to get an interface ID of a Solidity interface using ethersjs? I'm using ethersjs in my test file and I want to test if the supportsInterface is returning a correct interface ID. I ...
0
votes
1answer
105 views

What's the interfaceID for ERC-20?

What's the interfaceID for ERC-20? It's not in the EIP. It's shown for 165 and 721 but not for ERC-20.
0
votes
0answers
11 views

What happens if there a different interface is passed into a function in solidity?

Given a deployed contract with a method that has an interface for ERC20 interface IERC20 { function totalSupply() external view returns (uint256); } contract SomePublicContract { function ...
1
vote
1answer
10 views

Can a cross-contract interface be utilized maliciously?

As far as I am aware an interface is just like an ABI, which allows a contract to encode data it sends to another contract. But, can't any contract implement an arbitrary function "bar(address,...
0
votes
0answers
13 views

Why neither interface name nor its events participate in interface identifier in accordance to EIP-165?

EIP-165 aims to provide a way for a contract to communicate whether it has implemented a certain interface or not. The standard defines the interface identifier as the XOR of all function selectors in ...
0
votes
1answer
40 views

Check for interface superset

I want to see if a contract supports an interface that is a superset of a current interface. In specific, I want make sure that any arbitray contract supports "SafeTransferFrom(address,address,...
0
votes
1answer
50 views

Declaring functions of two different smart contracts inside a single interface

pragma solidity ^0.7.0; interface IUniswap { function swapExactTokensForETH( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) ...
0
votes
1answer
103 views

contracts/ISwapRouter.sol:11:26: TypeError: Interfaces cannot inherit

So I am using some uniswapv3 contracts (which are pragma 0.7+) within another contract (which is pragma 0.5.0) and when compiling I have this error : ```These files import other files that use a ...
0
votes
1answer
44 views

Error: DeclarationError: Undeclared identifier while using IERC20

Code: pragma solidity ^0.6.2; import "@opengsn/gsn/contracts/BaseRelayRecipient.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; contract MyContract is ...
1
vote
1answer
52 views

supportsInterface reverts without message when address does not implement ERC165

In my transfer function, I want to only allow the to address to be a contract that implements a certain interface. I used this to check: require(IERC165(to).supportsInterface(0xabcdef), "Wrong ...
0
votes
2answers
67 views

Should external non-pure functions have any return values?

Does it make sense for a non-pure/non-view external function to return any values at all? This is especially when this external function is likely going to be called off-chain. Since they are likely ...
0
votes
1answer
10 views

Why passing arguments to an interface does not lead to an error?

I am studying a sample contract and found the interface to be defined and declared as: interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens(...
1
vote
0answers
362 views

Getting an interface from a contract deployed on etherscan?

Given a contract address, is their some way to get an interface of the code deployed there? For example, I want to create an interface containing all the methods I can use on the balancer vault here: ...
0
votes
0answers
40 views

How can I get this mapping function in an interface? [duplicate]

I have this mapping in a smart contract: mapping (uint256 => mapping (address => UserInfo)) public userInfo; I want to call this in a interface like function view returns: Can someone tell me ...
0
votes
1answer
118 views

Access struct of other contract via interface

I am trying to access the struct of another contract via an interface. I am having two different contracts that I want to deploy on the chain: Contract: contract cat { uint id = 0; mappung(...
1
vote
2answers
415 views

How can I reference a deployed library in my solidity contract

Suppose I have a contract that uses a library, which has already been deployed to the blockchain at a certain address. Is there a way to reference that deployed library in the contract similar to ...
-1
votes
1answer
32 views

External ERC-20 token implementation into my contract

I want to implement USDC into my contract which is currently using ETH. I know I need to implement ERC20 interface in order to let my contract know which functions it should expect. But how should I ...
1
vote
0answers
10 views

Possible Security Issues On Web Layer Payment Request and Confirmation

This is more likely a design consultation rather than an issue. I want to introduce additional standards in ISO20022 to promote crypto payment through common payment interface to eliminate 3rd party ...
1
vote
1answer
122 views

Uniswap Fork: Able to add liquidity, but not able to swap

I am forking uniswap and deploying it on Rinkbey TestNet. I have successfully deployed factory, router, weth contracts. I have replaced the respective addresses in the uniswap interface code. I ...
0
votes
1answer
15 views

Loop contract addresses with dynamic Interface Name

I have multiple contract's addresses and their respective interfaces. Name of contracts are: 1. ContractA_v1 2. ContractA_v2 Name of interfaces are: 1. IContractA_v1 2. IContractA_v2 ...
0
votes
1answer
1k views

Fork uniswap including interfcae

I am trying to fork uniswap. I have successfully deployed uniswap-core and uniswap-periphery on my local machine (ganache).For this, I could get many tutorials and articles. But could not find a ...
0
votes
1answer
22 views

Putting interfaces in one interface

A noob question: is it possible or a good practice to put interfaces into one master interface such that all contracts in a DApp only import one interface?
0
votes
1answer
647 views

Solidity: Interfaces in contracts

Recently, I have stumbled upon multiple examples of Solidity contracts that make use of Interfaces, yet seem to define an interface for one and one contract only. Said Interface is then defined in the ...
1
vote
0answers
76 views

Implement interface function as mapping property

Why can we implement an interface function as mapping property? There's something on doc that explains this behaviour? I couldn't find anything related, but I'm assuming that a mapping property ...
0
votes
0answers
40 views

Enum in interface

Is it possible by creating any function in the interface user can declare his own set of enum states? Let's say for example:- I want to create an interface using which the user can declare his own set ...
0
votes
1answer
14 views

Can we have a instance of a interface?

I came across this code, I wanted to know what exactly IERC20(token address) is signifying here whether it is the instance of token or just the reference to the contract of token to which the user is ...
0
votes
1answer
1k views

How to properly use IERC20 interface in a contract using solidity 0.8.0 [duplicate]

Dear Ethereum/Solidity developers, I have a small solidity contract which should allow the contract to spend the owner's ERC20 tokens. I currently have the following interface defined interface IERC20 ...
0
votes
1answer
11 views

Do I have to include every method in an interface?

I'm using a 3rd party contract in one of my contracts. I've created an interface for the 3rd party, do I have to include every external method in the interface, or just the ones that I need to use in ...
1
vote
1answer
90 views

Convert ABI to HTML interface (input)

Is there a way to get code that convert ABI to HTML interface ? I found example in multiples apps but can't find the code, lot of dead github. Apps where I find what I want : https://abi.hashex.org/ ...
0
votes
0answers
23 views

MyEtherWallet interact with contract : generate input from ABI

Do you know some code to generate a contract interaction from ABI like there is on MyEtherWallet ?
1
vote
0answers
142 views

ERC-2222 : Funds Distribution Token implementation for a fee contract

My MainCore contract is a contract who sell NFT, and all the sell and buy have a 1% fee for team developper (uint DevelopperCutTotalSupply). I try to implement the ERC-2222 "Funds Distribution ...
0
votes
1answer
74 views

TxOriginVictim(msg.sender).transferTo(owner, msg.sender.balance): What is the purpose of Interface and what is TxOriginVictim(msg.sender)?

I have two contracts in the context of tx.origin Vulnerability: pragma solidity ^0.5.8; contract TxOriginVictim { address owner; constructor() public{ owner = msg.sender; } ...