Questions tagged [inheritance]

Inheritance in this stackexchange refers to parent child contract relationship where the child contract is considered to be a type of the parent contract and hence implement the parent contract functions. This is same like inheritance in OOP in generic programming except for the fact that in this community its used in a contract oriented programming domain.

11 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
1answer
55 views

What order is code copied for inheritance?

The Solidity documentation says it supports inheritance by copying code, but is unclear about where the code is copied to. I am building a genesis block for a Quorum-based chain, starting from the ...
2
votes
2answers
837 views

Gas estimation failed in Remix

Can't really use the transfer function as it is written. It assumes the owner uses it. So made a new function for the "minting" function for the faucet to use. Not sure why the compiler message is so ...
1
vote
2answers
107 views

How can I check if a specific contract's address inherits from a interface or contract?

I have a special contract with few extra functions. In the transfer wei function I want to send it to the special method or if receiver doesn't have it (because is a wallet or doesn't inherit from my ...
1
vote
2answers
136 views

Is library use inherited?

When a base class uses a library, do derived classes also use the same library? For example: contract A { using SafeMath for uint256; ... } contract B is A { //is code here using ...
1
vote
0answers
34 views

Deploy many instances of configured base contracts or track multiple agreements on one contract?

I am playing around with solidity, truffle, and node and i was wondering if I am trying to make a game that allows players to browse a list of games and join the ones they want. Would it be best to ...
1
vote
0answers
133 views

Truffle: How to test for inheritance

I have a Contract B which should inherit from contract A. Using Truffle, how can I test that this is indeed the case?
0
votes
0answers
19 views

Trustless contract upgrades using inheritance

I've been struggling to find a solution to the problem of upgradeability that maximizes trustlessness while also putting minimal burden on users. I really wanted to use signed messages to validate ...
0
votes
1answer
14 views

linking the CoreContract and the ERC20 token contract

What is the standard way of making the link between our CoreContract and the ERC20Token contract used by the Core Contract? Are people used to use inheritance like: MyCoreContract is MyERC20Contract { ...
0
votes
1answer
24 views

Why is it that my first original contract containing the setters and gettters are not showing up when I hit deploy?

pragma solidity ^0.4.24; contract Bank{ uint private value; constructor(uint amount) public{ value = amount; } function deposit(uint amount) public{ value += amount; ...
0
votes
1answer
217 views

C++ (or generally OOP) inheritance in Solidity

In Solidity, when one does inheritance, the two contracts share state. Some pseudocode, contract A { uint myVar = 1 setVar() {myVar = 3} } contract B is A { myVar = 2 } If I deploy A, A.myVar = 1. ...
0
votes
1answer
179 views

Getting ABI interface using solc offline

Suppose I have an inheritance contract (xyz.sol) with three contracts A, B and C such that C is B, I am trying to compile using solc offline in node console. Upon compiling, I have three separate ...