Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abandon function patch #17

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions contracts/works/include/works.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ CONTRACT works : public contract {

//withdraw from account balance
ACTION withdraw(name account_name, asset quantity);

//abandon funds from account balance
ACTION abandon(name account_name, asset quantity);

//delete an account
ACTION deleteacct(name account_name);
Expand Down
4 changes: 2 additions & 2 deletions contracts/works/resources/works.clauses.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h1 class="clause">Intent</h1>
The intention of the authors and invoker of this smart contract is to ...
The intention of the authors and invoker of this smart contract is to interact with the Telos Works proposal system by creating, editing, deleting ballots and opening them for voting, voting on proposals, closing completed proposals, providing milestone reports, and claiming, withdrawing or abandoning funds from completed proposals.

<h1 class="clause">Term</h1>
This Contract expires at the conclusion of code execution.
Expand Down Expand Up @@ -41,4 +41,4 @@ In any action arising hereunder or any separate action pertaining to the validit
The rule requiring construction or interpretation against the drafter is waived. The document shall be deemed as if it were drafted by both parties in a mutual effort."

<h1 class="clause">In Witness Whereof</h1>
IN WITNESS WHEREOF, the parties hereto have caused this Agreement to be executed by themselves or their duly authorized representatives as of the date of execution, and authorized as proven by the cryptographic signature on the transaction that invokes this contract.
IN WITNESS WHEREOF, the parties hereto have caused this Agreement to be executed by themselves or their duly authorized representatives as of the date of execution, and authorized as proven by the cryptographic signature on the transaction that invokes this contract.
166 changes: 130 additions & 36 deletions contracts/works/resources/works.contracts.md
Original file line number Diff line number Diff line change
@@ -1,152 +1,246 @@
<h1 class="contract">init</h1>

---
spec_version: "0.2.0"
spec_version: "0.2.1"

title: Initialize
summary: 'Initialize Contract'

summary: 'Initialize Contract: The intent of `init()` function is to set the initial values of parameters for the Telos Works contract.'

icon: https://github.com/Telos-Foundation/images/raw/master/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f

---

<h1 class="contract">setversion</h1>

---
spec_version: "0.2.0"
spec_version: "0.2.1"

title: Set Version
summary: 'Set Contract Version'

summary: 'Set Contract Version: The intent of the `setversion()` function is to increase the version number of the contract to reflect unique code deployments.'

icon: https://github.com/Telos-Foundation/images/raw/master/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f

---

<h1 class="contract">setadmin</h1>

---
spec_version: "0.2.0"

spec_version: "0.2.1"

title: Set Admin
summary: 'Set Contract Admin'

summary: 'Set Contract Admin: The intent of the `setadmin()` function is to change the contract address that has the rights to administer the Telos Works smart contract.'

icon: https://github.com/Telos-Foundation/images/raw/master/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f

---

<h1 class="contract">setthresh</h1>

---
spec_version: "0.2.0"

spec_version: "0.2.1"

title: Set Thresholds
summary: 'Set Contract Thresholds'

summary: 'Set Contract Thresholds: The intent of the `setthresh()` function is to set the voting thresholds at which ballots shall pass or recieve their deposit back.'

icon: https://github.com/Telos-Foundation/images/raw/master/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f

---

<h1 class="contract">draftprop</h1>

---
spec_version: "0.2.0"

spec_version: "0.2.1"

title: Draft Proposal
summary: 'Draft New Telos Works Proposal'

summary: 'Draft New Telos Works Proposal: The intent of the `draftprop()` function is to submit data for a new proposal prior to opening votin.'

icon: https://github.com/Telos-Foundation/images/raw/master/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f

---

<h1 class="contract">launchprop</h1>

---
spec_version: "0.2.0"

spec_version: "0.2.1"

title: Launch Proposal
summary: 'Launch Proposal'

summary: 'Launch Proposal: The intent of the `launchprop()` function is to open a proposal for voting.'

icon: https://github.com/Telos-Foundation/images/raw/master/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f

---

<h1 class="contract">cancelprop</h1>

---
spec_version: "0.2.0"
spec_version: "0.2.1"

title: Cancel Proposal
summary: 'Cancel Telos Works Proposal'

summary: 'Cancel Telos Works Proposal: The intent of the `cancelprop()` function is to cancel an existing proposal in whatever stage it may be. This includes proposals that have already been passed. This function will eliminate even a proposal that has passed so that funds will not be accessable.'

icon: https://github.com/Telos-Foundation/images/raw/master/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f

---

<h1 class="contract">deleteprop</h1>

---
spec_version: "0.2.0"

spec_version: "0.2.1"

title: Delete Proposal
summary: 'Delete Telos Works Proposal'

summary: 'Delete Telos Works Proposal: The intent of the deleteprop()` function is to delete a proposal that is not active.'

icon: https://github.com/Telos-Foundation/images/raw/master/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f

---

<h1 class="contract">addmilestone</h1>

---
spec_version: "0.2.0"
spec_version: "0.2.1"

title: Add Milestone
summary: 'Add Milestone To Proposal'

summary: 'Add Milestone To Proposal: The intent of the `addmilestone()` function is to add a new milestone to an existing proposal.'

icon: https://github.com/Telos-Foundation/images/raw/master/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f

---

<h1 class="contract">rmvmilestone</h1>

---
spec_version: "0.2.0"

spec_version: "0.2.1"

title: Remove Milestone
summary: 'Remove Milestone From Proposal'

summary: 'Remove Milestone From Proposal: The intent of the `rmvmilestone()` function is to remove an existing milestone from a proposal.'

icon: https://github.com/Telos-Foundation/images/raw/master/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f

---

<h1 class="contract">editms</h1>

---
spec_version: "0.2.0"

spec_version: "0.2.1"

title: Edit Milestone
summary: 'Edit Milestone Reuested Funds'

summary: 'Edit Milestone Reuested Funds: The intent of the `editms() function is to edit an existing milestone in a proposal.'

icon: https://github.com/Telos-Foundation/images/raw/master/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f

---

<h1 class="contract">closems</h1>

---
spec_version: "0.2.0"

spec_version: "0.2.1"

title: Close Milestone
summary: 'Close Milestone Voting'

summary: 'Close Milestone Voting: The intent of the `closeme()` function is to finalize a milestone of a proposal following completion of voting. This means calculating all votes and whether the proposal passes both the required threshold and quorum rwquired for passage, and, optionally, broadcasting that result to be written on the blockchain.'

icon: https://github.com/Telos-Foundation/images/raw/master/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f

---

<h1 class="contract">nextms</h1>

---
spec_version: "0.2.0"

spec_version: "0.2.1"

title: Start Next Milestone
summary: 'Start Next Milestone Voting'

summary: 'Start Next Milestone Voting: The intent of the `nextms()` function is to advance a proposal to its next milestone.'

icon: https://github.com/Telos-Foundation/images/raw/master/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f

---

<h1 class="contract">submitreport</h1>

---
spec_version: "0.2.0"

spec_version: "0.2.1"

title: Submit Report
summary: 'Submit Milestone Report'

summary: 'Submit Milestone Report: The intent of the `submitreport() is to submit a report on the results of the most recent milestone., and to unlock claiming of any earned funds.'

icon: https://github.com/Telos-Foundation/images/raw/master/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f

---

<h1 class="contract">claimfunds</h1>

---
spec_version: "0.2.0"

spec_version: "0.2.1"

title: Claim Funds
summary: 'Claim Milestone Funds'

summary: 'Claim Milestone Funds: The intent of the `claimfunds()` function is to transfer the designated amount of funds from the Telos Works contract to the recipient's account for the given proposal.'

icon: https://github.com/Telos-Foundation/images/raw/master/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f

---

<h1 class="contract">withdraw</h1>

---
spec_version: "0.2.0"
title: Withdraw
summary: 'Withdraw Funds'

spec_version: "0.2.1"

title: Withdraw Funds

summary: 'Withdraw Funds: The intent of the `withdraw()` function is to transfer the specified amount of the token asset to the designated account and to reduce the corresponding account's balance in the `accounts` table by the same amount.'

icon: https://github.com/Telos-Foundation/images/raw/master/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f

---

<h1 class="contract">abandon</h1>

---

spec_version: "0.2.1"

title: Abandon Funds

summary: 'Abandon Funds: The intent of the `abandon()` function is to reduce the specified account's balance in the `accounts` table by the amount specified without transfering any funds'

icon: https://github.com/Telos-Foundation/images/raw/master/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f

---

<h1 class="contract">deleteacct</h1>

---
spec_version: "0.2.0"

spec_version: "0.2.1"

title: Delete Account
summary: 'Delete Telos Works Account'

summary: 'Delete Telos Works Account: The intent of the `deleteact()` function is to remove an account with a zero balance from the `accounts` table.'
icon: https://github.com/Telos-Foundation/images/raw/master/ricardian_assets/eosio.contracts/icons/account.png#3d55a2fc3a5c20b456f5657faf666bc25ffd06f4836c5e8256f741149b0b294f
---

---
14 changes: 14 additions & 0 deletions contracts/works/src/works.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,20 @@ ACTION works::withdraw(name account_name, asset quantity) {

}

ACTION works::abandon(name account_name, asset quantity) {

//authenticate
require_auth(account_name);

//validate
check(quantity.symbol == TLOS_SYM, "can only abandon TLOS");
check(quantity.amount > 0, "can only abandon a positive amount");

//subtract balance from account
sub_balance(account_name, quantity);

}

ACTION works::deleteacct(name account_name) {

//authenticate
Expand Down