Questions tagged [interfaces]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
3 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
5 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
19 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
8 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
10 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
21 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 ...
0
votes
1answer
15 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
18 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
6 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
83 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
17 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
23 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
54 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
29 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
8 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
0answers
51 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
12 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
437 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
16 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
66 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
24 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
25 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
11 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
353 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
8 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
41 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
15 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
81 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
51 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; } ...
0
votes
1answer
13 views

How this snippet is linking contracts? How each contract finds the other

I'm trying to understand how can two contracts be deployed and interact with each other, given that I don't have their addresses before deployment. I ended in this question and I don't understand the ...
1
vote
1answer
338 views

Why use the Interface (IERC20), instead of the implementation contract (ERC20)?

I'm playing with a contract that uses an ERC20 token, and I can see basically 2 options to init the token: Use the interface contract (IERC20) Use the implemented contract (ERC20) Interface version: ...
0
votes
1answer
70 views

Reflect Base contract's update in another contract

I have wanted to know what concept is it called when we want two contracts which are deployed on the Network, reflect the transaction and updates in another contract. for example: contract Base{ ...
1
vote
3answers
61 views

Do view functions cause reentrancy vulnerabulity?

It's well known that calling an external function before changing something in the contract causes a security problem called "reentrancy vulnerability". Does calling an external function ...
0
votes
0answers
24 views

How to use web3 when one smart contract is interfacing with another?

A few months back I posted this question on this form. Since then, I've used the interface method to make my smart contracts interact together. I didn't have any problem while testing and developing ...
0
votes
0answers
89 views

how to pass fix size array via interface in solidity 0.4.25

I used the following code interface test{ function testfunction(uint[20] memory P, uint[20] memory Q) external returns(uint,bool,uint); } It gives the error Location has to be calldata for external ...
1
vote
1answer
21 views

In interface does the function listed have to be exactly the same as they are in contract?

In solidity 0.7.x, I am creating an interface of contract A in contract B to allow contract B call functions in contract A. contract A { function transfer(address recipient, uint256 amount) public ...
0
votes
2answers
122 views

remote contract function call with solidity

I've deployed this very simple Contract: contract Contract1 { function myfunction(uint param1) public returns (uint) { return param1+1; } } Now, I've deployed a second contract: ...
0
votes
1answer
227 views

Is it possible to call a public array from another contract?

Let's say there is a uint[] public MyArray declared in contract_A. Is there a possiblility to create an interface contract_A that would allow to read the values in MyArray from another contract, or ...
3
votes
2answers
1k views

Can't override ERC20 Methods

I try to override ERC20 methods ... The doc says it should be possible but I get the error: CompileError: @openzeppelin/contracts/token/ERC20/ERC20.sol:96:5: TypeError: Trying to override non-virtual ...
0
votes
1answer
267 views

ERC20 Interface

When you make a token, must you have an ERC20 Interface (such as the one below)? What is the purpose of it? pragma solidity 0.6.6; /// @notice ERC20 https://eips.ethereum.org/EIPS/eip-20 with ...
0
votes
0answers
188 views

Wrapping functions in interfaces to enable higher order function capability in Solidity?

Let's say I want to have higher order function capabilities in my Solidity Dapp. Also I want to be able to pass in new functions as input to higher order functions contained within contracts that were ...
0
votes
1answer
259 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 ...
0
votes
1answer
1k 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 ...
2
votes
1answer
610 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
53 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
72 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
315 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
147 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 ?
2
votes
1answer
281 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(...
0
votes
2answers
60 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 ...