ProxyVoting

Git Source

State Variables

shareClass

ShareClass public shareClass;

proposalCount

uint256 public proposalCount;

proposals

mapping(uint256 => Proposal) public proposals;

proxies

mapping(address => address) public proxies;

Functions

constructor

constructor(address _shareClass);

createProposal

Creates a new proposal.

function createProposal(string memory description, uint256 duration) external;

Parameters

Name
Type
Description

description

string

The description of the proposal.

duration

uint256

The voting duration in seconds.

vote

Casts a vote on a proposal.

function vote(uint256 proposalId, bool inFavor) external;

Parameters

Name
Type
Description

proposalId

uint256

The ID of the proposal.

inFavor

bool

True if voting in favor, false if against.

assignProxy

Assigns a proxy for the sender's votes.

function assignProxy(address proxy) external;

Parameters

Name
Type
Description

proxy

address

The address of the proxy.

executeProposal

Executes a proposal if it has passed.

function executeProposal(uint256 proposalId) external;

Parameters

Name
Type
Description

proposalId

uint256

The ID of the proposal.

Events

ProposalCreated

event ProposalCreated(uint256 indexed proposalId, string description, uint256 deadline);

VoteCast

event VoteCast(uint256 indexed proposalId, address indexed voter, bool inFavor, uint256 weight);

ProxyAssigned

event ProxyAssigned(address indexed shareholder, address indexed proxy);

Structs

Proposal

struct Proposal {
    string description;
    uint256 deadline;
    uint256 forVotes;
    uint256 againstVotes;
    bool executed;
    mapping(address => bool) voted;
}

Last updated

Was this helpful?