Development of Smart Contract for the WPS

EOSeoul
EOS Worker Proposals
4 min readSep 12, 2018

Over the past few months, WPS development team has been busy designing and developing its front-end/back-end to build the first website for the EOS Worker Proposal System(WPS).

To make a platform for the WPS, our lead back-end engineers have been working on the 2 most important parts — WPS smart contract, back-end server — of the website.

I. Structure

The WPS contract sends only data that matters for decentralization. (e.g. Vote count, Project status)
Voters and proposers can see the actual data stored on both back-end server and on-chain contract from its website.

WPS website contract/back-end structures

II. wps-contract

Github

There are 6 types of accounts with permission levels for each action on the WPS platform. Each account can only initiate actions they are allowed to do.

  • eosio.wps (Contract account)
    setwpsenv: Sets up the global WPS parameters, which includes vote participation required, duration of voting for a proposal, the maximum duration of a project, and the number of times the funding is divided and claimed (for security reasons). The default values proposed when the WPS is ratified will be 5, 30, 180, and 6, respectively.
    regcommittee: Register a committee responsible for a certain category. The account is added to the committee table. RAM is billed to the contract’s account. All fields are required. Oversight power is given to the oversight committee. Committees can only be registered using eosio.wps permissions.
    edcommittee: Edit committee information.
    rmvcommittee: Remove committee from the committee table.
  • Committee Oversight (Supervised account for entire WPS platform)
    commitvote:
    Oversight automatically checks proposals with the CHECK VOTES status using the database and verifies that the proposal passed the vote threshold through this action. The proposal status changes to CHECKED VOTES.
    rollbackvote: Oversight automatically checks proposals with the CHECK VOTES status using the database. If the vote threshold hasn’t been met, it rolls the status of the proposal back to ON VOTE.
    rejectfund: Reject a proposal with APPROVED status being funded. The proposal is transferred to the rejected proposals table.
  • Committee (Supervised account for each category)
    regreviewer: Register account as a reviewer. All fields required. RAM billed to committee account. The reviewer is added to reviewer table, with the committee that the account is associated with.
    editreviewer: Edit reviewer information.
    rmvreviewer: Remove reviewer from the reviewer table.
  • Reviewer
    acceptprop: Accept a proposal with PENDING status. Change its status to ON VOTE.
    rejectprop: Reject a proposal with PENDING status. Change its status to REJECTED. Move proposal to the rejected proposals table.
    checkvote: Request the database to verify that the proposal with FINISHED VOTING status has passed the vote threshold. Change its status to CHECK VOTES.
    approve: Approve funding for proposals with the CHECKED VOTES status. Proposal status changes to APPROVED.
    rmvreject: Clear a proposal on the rejected proposals table when it is no longer needed there.
    rmvcompleted: Clear a proposal on the completed proposals table when it is no longer needed there.
  • Proposer
    regproposal: Register a proposal. Account must be on the proposer table. All fields required. RAM is billed to the proposer’s account. The proposal is added to the proposals table. One proposer can register only one proposal at a time.
    editproposal: Edit proposal info.
    rmvproposal: Delete the proposal from the proposals table.
    claimfunds: Claim to fund for a proposal with the APPROVED status. The proposer can claim a portion of the funds for each iteration of the project’s duration. When all iterations have been completed, the proposal status changes to COMPLETED. It is then transferred to the completed proposals table.
  • Account Owner (Voters)
    regproposer: Register an account as a proposer. RAM is billed to the registrant’s account. The account is added to the proposer table.
    editproposer: Edit proposer info.
    rmvproposer: Remove account from the proposer table.
    vote: Vote for a proposal. The voter can choose to vote yes (true) or no (false) for a given proposal. In the database, the account’s stake weight is counted. The account is added to the votings table.
    unvote: Unvote for a proposal. The account is removed from the votings table.

III. wps-backend, Infrastructure

Github

WPS back-end server stores initial data and information for its website.
Visit Github link for more information. Below diagram shows detailed infrastructures of WPS back-end servers and its dev environment.

Infrastructure Diagram

IV. Front-end, User Interface

Github

The user interface design is being worked on by our front-end engineers and product designers.

An initial screenshot can be seen below displaying a landing page of the WPS website that is currently under development.

The landing page of WPS website

--

--