jeudi 7 juin 2018

How to initialize a struct when testing a Solidity contract?

How can I initialize the Item struct and assign to a variable?

contract ArbitrableBlacklist {

    enum ItemStatus {
        Absent,                     
        Cleared,                      
    }

    struct Item {
        ItemStatus status;       
        uint lastAction;         

    }
}

Testing above (simplified for question) contract using Truffle but I couldn't find the way to initialize the Item struct.

I have tried:

let x = ArbitrableBlacklist.Item({
        status: 0,
        lastAction: 0
      });

And got

TypeError: ArbitrableBlacklist.Item is not a function

Aucun commentaire:

Enregistrer un commentaire