Module Voting

Source
Expand description

Generated by the following Solidity interface…

interface Voting {
    struct VotingInfo {
        uint256 threshold;
        uint256 deadline;
        uint256 nonce;
        address owner;
    }

    event Voted(bytes32 indexed votingId, address indexed voter, uint256 indexed choice);
    event Winner(bytes32 indexed votingId, uint256 indexed choice);

    function register(VotingInfo memory v) external;
    function setWinner(VotingInfo memory v, uint256 choice) external;
    function vote(VotingInfo memory v, uint256 choice) external;
    function votingId(VotingInfo memory v) external pure returns (bytes32);
}

…which was generated by the following JSON ABI:

[
  {
    "type": "function",
    "name": "register",
    "inputs": [
      {
        "name": "v",
        "type": "tuple",
        "internalType": "struct Voting.VotingInfo",
        "components": [
          {
            "name": "threshold",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "deadline",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "nonce",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "owner",
            "type": "address",
            "internalType": "address"
          }
        ]
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "setWinner",
    "inputs": [
      {
        "name": "v",
        "type": "tuple",
        "internalType": "struct Voting.VotingInfo",
        "components": [
          {
            "name": "threshold",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "deadline",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "nonce",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "owner",
            "type": "address",
            "internalType": "address"
          }
        ]
      },
      {
        "name": "choice",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "vote",
    "inputs": [
      {
        "name": "v",
        "type": "tuple",
        "internalType": "struct Voting.VotingInfo",
        "components": [
          {
            "name": "threshold",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "deadline",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "nonce",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "owner",
            "type": "address",
            "internalType": "address"
          }
        ]
      },
      {
        "name": "choice",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "votingId",
    "inputs": [
      {
        "name": "v",
        "type": "tuple",
        "internalType": "struct Voting.VotingInfo",
        "components": [
          {
            "name": "threshold",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "deadline",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "nonce",
            "type": "uint256",
            "internalType": "uint256"
          },
          {
            "name": "owner",
            "type": "address",
            "internalType": "address"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "",
        "type": "bytes32",
        "internalType": "bytes32"
      }
    ],
    "stateMutability": "pure"
  },
  {
    "type": "event",
    "name": "Voted",
    "inputs": [
      {
        "name": "votingId",
        "type": "bytes32",
        "indexed": true,
        "internalType": "bytes32"
      },
      {
        "name": "voter",
        "type": "address",
        "indexed": true,
        "internalType": "address"
      },
      {
        "name": "choice",
        "type": "uint256",
        "indexed": true,
        "internalType": "uint256"
      }
    ],
    "anonymous": false
  },
  {
    "type": "event",
    "name": "Winner",
    "inputs": [
      {
        "name": "votingId",
        "type": "bytes32",
        "indexed": true,
        "internalType": "bytes32"
      },
      {
        "name": "choice",
        "type": "uint256",
        "indexed": true,
        "internalType": "uint256"
      }
    ],
    "anonymous": false
  }
]

Structs§

Voted
Event with signature Voted(bytes32,address,uint256) and selector 0xe4abc5380fa6939d1dc23b5e90b3a8a0e328f0f1a82a5f42bfb795bf9c717505.
VotingInfo
VotingInstance
A Voting instance.
Winner
Event with signature Winner(bytes32,uint256) and selector 0x269d3a24712436f77df15d63de7d2337a060c9102dee6f46c909fb0fa2d52f0c.
registerCall
Function with signature register((uint256,uint256,uint256,address)) and selector 0x8f253c75.
registerReturn
Container type for the return parameters of the register((uint256,uint256,uint256,address)) function.
setWinnerCall
Function with signature setWinner((uint256,uint256,uint256,address),uint256) and selector 0x9747a952.
setWinnerReturn
Container type for the return parameters of the setWinner((uint256,uint256,uint256,address),uint256) function.
voteCall
Function with signature vote((uint256,uint256,uint256,address),uint256) and selector 0x152d18c4.
voteReturn
Container type for the return parameters of the vote((uint256,uint256,uint256,address),uint256) function.
votingIdCall
Function with signature votingId((uint256,uint256,uint256,address)) and selector 0x39db6659.
votingIdReturn
Container type for the return parameters of the votingId((uint256,uint256,uint256,address)) function.

Enums§

VotingCalls
Container for all the Voting function calls.
VotingEvents
Container for all the Voting events.

Functions§

new
Creates a new wrapper around an on-chain Voting contract instance.