I want to reuse on type DateRange in two contracts. However, I fail with multiple errors. Currently I have one error:

G21FE98E9 Member "endTicks" not found or not visible after argument-dependent lookup in tuple(uint64,uint64)

I didn't find any related info that could help solve this issue.

Here is complete contract code:

pragma solidity ^0.4.21;

contract SeasonFactory {    
    address public owner;
    address[] public seasons;

    event SeasonCreated(uint64 indexed beginTicks, uint64 indexed endTicks, address season);

    function SeasonFactory() public {
        owner = msg.sender;

    function newSeason(uint64 beginTicks, uint64 endTicks) public restricted {
        require(beginTicks < endTicks);
        require(seasons.length == 0 || Season(seasons[seasons.length - 1]).period().endTicks() < beginTicks);

        Season season = new Season(owner, beginTicks, endTicks);
        emit SeasonCreated(beginTicks, endTicks, season);

    function getSeasonsCount() public view returns(uint) {
        return seasons.length;

    function getSeasonForDate(uint64 ticks) public view returns(address) {
        for (uint i = seasons.length - 1; i >= 0; i--) {
            Season season = Season(seasons[i]);
            if (ticks >= season.period.beginTicks() && ticks <= season.period.endTicks())
                return season;
        return 0;

    modifier restricted {
        require(owner == msg.sender);

contract Season {
    address public owner;
    SharedTypes.DateRange public period;

    function Season(address owner_, uint64 beginTicks, uint64 endTicks) public {
        owner = owner_;
        period = SharedTypes.DateRange(beginTicks, endTicks);

library SharedTypes {
    struct DateRange {    
        uint64 beginTicks;
        uint64 endTicks;

What could be wrong here?

  • What is the purpose of Season(seasons[seasons.length - 1]).period().endTicks() < beginTicks) and Season season = Season(seasons[i]) when Season needs 3 parameters?
    – ReyHaynes
    Apr 24, 2018 at 15:15
  • Also, if you're inheriting the Season function from contract Season, you need to place that contract above the SeasonFactory and inherit it properly with contract SeasonFactory is Season {}
    – ReyHaynes
    Apr 24, 2018 at 15:18
  • @ReyHaynes usage with single parameter should be a cast, I guess. I found it somewhere on the internet. There is no inheritance, Factory is obviosly not an object. Apr 24, 2018 at 15:20
  • Functions are explicit in use, if it has 3 parameters, you need 3 parameters. You can, however, create multiple functions with the same name and different amount of parameters, which is called Function Overloading
    – ReyHaynes
    Apr 24, 2018 at 15:28
  • I'm just casting some address which is known to be a contract T. See dappsforbeginners.wordpress.com/tutorials/… Apr 24, 2018 at 15:57

1 Answer 1


According to this post, a contract cannot access another contract's storage directly.

You probably need to implement a getter function, as described in this post.

I tried using the following function in your Season contract and it worked fine:

function getTicks(uint ind) view public returns( uint64 ){
    if(ind == 1) return period.endTicks;
    else return period.beginTicks;
  • 1
    Yet another solidity surprise. Thank you for an answer. Apr 25, 2018 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.