Vote Contract
Vote
Users vote on governance proposals through this contract.
Request
Fields:
proposalAccountId: The public key of the account being created as the proposal account.
proposalType: Represents the governance proposal type using the following enum
votes: array of user votes represented by BalanceLine's
If user is voting on a non-allocation update the assetCode will be YES or NO
If user is voting on an allocation update the assetCode will be a liability token code, pool token code, or YBX
amount is the number of votes the user wishes to cast
High-Level Contract Process Flow (MAY BE OUTDATED)
User enters the contract through an event handler which transforms their request.
Contract prerequisite data from horizon.
Pool Account Data
User Account Data
User Position Data
Contract builds a transaction builder object.
This is the object operations will be added to throughout the rest of the contract process flow.
Contract checks that the user has sufficient voting power for the total amount of votes they entered by looking at their veYBX holdings. If they do not the proposal rejects.
Contract adds a
allowTrust
operation where the escrow account authorizes the user to hold vYBX.Contract checks how much vYBX the user currently has.
If the user does not have sufficient vYBX to cast their votes the contract adds a
payment
operation where the escrow account pays the necessary vYBX to the user.If the user has too much vYBX the contract adds a
payment
operation that pays the excess vYBX to the escrow account.
Contract adds
manageSellOffer
operations where the user offers to sell vYBX for their input vote assets. Vote assets are assets with the input asset code with the proposal account as the issuer.Contract adds a
allowTrust
operation where the escrow account authorizes the user to maintain vYBX liabilities.Turret builds, signs, and returns the XDR.
Last updated