Questions tagged [interfaces]
184 questions
8
votes
2 answers
Interface initiailization
I'm following cryptozombies solidity tutorial.
In lesson 2, chapter 11 it explains how to create an interface for CryptoKitties as follows:
contract KittyInterface {
function getKitty(uint256 _id) external view returns (
bool isGestating,
…
gionni
- 183
- 4
3
votes
2 answers
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 solidity files are going to have?? Or I´m making a…
UnexpectedCharacter
- 852
- 1
- 11
- 30
2
votes
2 answers
Why are all parameters prepended by an underscore in ERC interfaces?
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 the ERC interfaces? Is is that in this way we make…
Paul Razvan Berg
- 17,902
- 6
- 73
- 143
1
vote
1 answer
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 in the get function one of the return value is…
UnexpectedCharacter
- 852
- 1
- 11
- 30
1
vote
0 answers
What's so special about the .call() function?
All that the docs have to say about it is that it "lets the Ethereum network know we're not intending to persist any changes." So I get that it's used when not conducting a transaction.
So, I decided to test this:
truffle(development)>…
Jossie Calderon
- 792
- 1
- 8
- 14
1
vote
1 answer
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,address,uint256)", and the originating contract wouldn't…
antioi
- 61
- 3
0
votes
1 answer
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 solidity ^0.4.24;
import…
UnexpectedCharacter
- 852
- 1
- 11
- 30
0
votes
0 answers
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 beforehand. Let's say the user creates the NFT and wants…
user17732087
- 9
- 2
0
votes
1 answer
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,uint)". What's the best way to check for this?
antioi
- 61
- 3
0
votes
1 answer
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(
address token,
uint liquidity,
…
Pe Dro
- 127
- 5