Skip to content

Commit

Permalink
Merge pull request #36 from Telos-Foundation/developer
Browse files Browse the repository at this point in the history
Telos Oak Release
  • Loading branch information
eedsilva authored Dec 11, 2018
2 parents 9fb672a + d3d95f7 commit 79295f0
Show file tree
Hide file tree
Showing 53 changed files with 6,104 additions and 754 deletions.
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ add_subdirectory(eosio.msig)
add_subdirectory(eosio.wrap)
add_subdirectory(eosio.system)
add_subdirectory(eosio.token)
#add_subdirectory(eosio.arbitration)
add_subdirectory(eosio.amend)
add_subdirectory(eosio.trail)
add_subdirectory(eosio.arbitration)
add_subdirectory(eosio.amend)
add_subdirectory(eosio.saving)
add_subdirectory(telos.tfvt)
add_subdirectory(telos.free)


if (APPLE)
Expand All @@ -48,4 +50,4 @@ elseif (UNIX)
endif()
set(SECP256K1_ROOT "/usr/local")

include(UnitTestsExternalProject.txt)
#include(UnitTestsExternalProject.txt)
2 changes: 2 additions & 0 deletions eosio.amend/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
add_contract(eosio.amend eosio.amend ${CMAKE_CURRENT_SOURCE_DIR}/src/eosio.amend.cpp) #NOTE: this path needs to change

target_compile_options(eosio.amend.wasm PUBLIC -R${CMAKE_CURRENT_SOURCE_DIR}/resources)
target_include_directories(eosio.amend.wasm
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
Expand Down
67 changes: 67 additions & 0 deletions eosio.amend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# RatifyAmend Core Contract

The RatifyAmend contract stores and manages the core governance documents for Telos. Updates to these governance documents are proposed, evaluated, and applied/rejected through this contract.

## Contract Usage

* `insertdoc(string title, vector<string> clauses)`

The insertdoc action will add a new document to the `documents` table.

`title` is the title of the document.

`clauses` is a list of clauses that make up the document. Ideally, each clause would be it's own IPFS hash.

* `makeproposal(string sub_title, uint64_t doc_id, uint8_t new_clause_num, string new_ipfs_url, name proposer)`

The makeproposal action will make a new proposal and call `regballot()` on Trail with the given values. This will also store the "metadata" of the proposal on this contract.

`sub_title` is the title of the submission.

`doc_id` is the document id for which the proposal will update.

`new_clause_num` is the new clause number to update.

`new_ipfs_url` is the link to the new clause text.

`proposer` is the proposer of the submission.

* `addclause(uint64_t sub_id, uint8_t new_clause_num, string new_ipfs_url)`

The addclause action will add a new clause to a currently existing submission.

`sub_id` is the submission id of the submission for which to add the clause.

`new_clause_num` is the clause number to update.

`new_ipfs_url` is the link to the new clause text.

* `openvoting(uint64_t sub_id)`

The openvoting action will open a submission up for voting.

`sub_id` is the submission id for which to open voting.

* `cancelsub(uint64_t sub_id)`

The cancelsub action will cancel a pending submission.

`sub_id` is the submission to cancel.

* `closeprop(uint64_t sub_id)`

The closeprop action will close an proposal.

`sub_id` is the submission to close.

* `getdeposit(name owner)`

The getdeposit action will return an unspent deposit for an account held on RatifyAmend.

`owner` is the name of the account for which to get the deposit.

* `setenv(config new_environment)`

The setenv action sets the contract environment.

`new_environment` is the new environment to set.
1 change: 1 addition & 0 deletions eosio.amend/include/eosio.amend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/

#include <trail.voting.hpp>
#include <trail.tokens.hpp>
#include <trail.system.hpp>

#include <eosiolib/eosio.hpp>
Expand Down
70 changes: 70 additions & 0 deletions eosio.amend/resources/eosio.amend.clauses.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<h1 class="clause">Intent</h1>
The intention of the authors and invoker of this smart contract is to

[<<Add intentions of each contract here or consolidate>>]

All actions of this smart contract are governed by the Telos Blockchain Network Core Governance Documents referenced below and inherits the defined terms of those documents. Any person invoking this contract accepts these documents as binding agreements in all matters related to the use or recording of information on the Telos Blockchain Network.

**The "Telos Blockchain Network Core Governance Documents" are comprised of:**

* [Telos Blockchain Network Operating Agreement](https://web.ipfs.telosfoundation.io/Qmexc2Uejr2f5f8bCQxTkt5CfTAC9szXLpG6mu6No7pmVs)

* [Telos Blockchain Network Arbitration Rules and Procedures](https://web.ipfs.telosfoundation.io/QmWZEpPcudrAmQ9tzi8rCpdqAFfVjuAKc6vkpMRRa2hXsz)

* [Telos Regproducer contract](https://web.ipfs.telosfoundation.io/QmSwzSPZf2xpvjKV6qWRodAVD8uYZpKZ1WfzTEA825RjfR)

* [Telos Regarb contract](https://web.ipfs.telosfoundation.io/QmWXmx9KAZZ6dcxT67Ap4WHivfJ5s1nFgMFXpHyriCkNCR)

* [Telos Block Producer Minimum Requirements](https://web.ipfs.telosfoundation.io/QmUvx45rtKr3H4SYf3Kei7AjEPEfKvxspBV4AXAEqWsyXU)

* [Telos Arbitrator Minimum Requirements](https://web.ipfs.telosfoundation.io/QmfW8UGVUKLVsacy58eTmFLqLMaT1STxaycJFnCpNfhV82)

* [Telos Blockchain Network Data Protection Policy](https://web.ipfs.telosfoundation.io/QmeYV6f4B5S2z3CycASNVHSLtMzcJzWRyam4Q1WzFAtsLe)

**Translations:**

* [TBNOA - Chinese language version](https://web.ipfs.telosfoundation.io/QmTWZG5moSZbH63Hk5oH4KRYshMDwH7kjyktqHa65jZUvA)

* [TBNOA - Korean language version](https://web.ipfs.telosfoundation.io/QmVGMcfWsGqFi9TR1QEk6W8thRY4f9et9nX8WJLXQvWtqb)

<h1 class="clause">Term</h1>
This Contract expires at the conclusion of code execution.

<h1 class="clause">Warranty</h1>
{{ name }} shall uphold its Obligations under this Contract in a timely and workmanlike manner, using knowledge and recommendations for performing the services which meet generally acceptable standards set forth by Telos Blockchain Network Block Producers.

<h1 class="clause">Default</h1>
The occurrence of any of the following shall constitute a material default under this Contract:

<h1 class="clause">Remedies</h1>
In addition to any and all other rights a party may have available according to law, if a party defaults by failing to substantially perform any provision, term or condition of this Contract, the other party may terminate the Contract by providing written notice to the defaulting party. This notice shall describe with sufficient detail the nature of the default. The party receiving such notice shall promptly be removed from being a Block Producer and this Contract shall be automatically terminated."

<h1 class="clause">Force Majeure</h1>
If performance of this Contract or any obligation under this Contract is prevented, restricted, or interfered with by causes beyond either party's reasonable control (\"Force Majeure\"), and if the party unable to carry out its obligations gives the other party prompt written notice of such event, then the obligations of the party invoking this provision shall be suspended to the extent necessary by such event. The term Force Majeure shall include, without limitation, acts of God, fire, explosion, vandalism, storm or other similar occurrence, orders or acts of military or civil authority, or by national emergencies, insurrections, riots, or wars, or strikes, lock-outs, work stoppages, or supplier failures. The excused party shall use reasonable efforts under the circumstances to avoid or remove such causes of non-performance and shall proceed to perform with reasonable dispatch whenever such causes are removed or ceased. An act or omission shall be deemed within the reasonable control of a party if committed, omitted, or caused by such party, or its employees, officers, agents, or affiliates."

<h1 class="clause">Dispute Resolution</h1>
Any controversies or disputes arising out of or relating to this Contract will be resolved by binding arbitration under Telos Blockchain Network Arbitration Rules and Procedures. The arbitrator's award will be final."

<h1 class="clause">Entire Agreement</h1>
This Contract contains the entire agreement of the parties, and there are no other promises or conditions in any other agreement whether oral or written concerning the subject matter of this Contract. This Contract supersedes any prior written or oral agreements between the parties, except for the Telos Blockchain Network Core Governance Documents"

<h1 class="clause">Severability</h1>
If any provision of this Contract will be held to be invalid or unenforceable for any reason, the remaining provisions will continue to be valid and enforceable. If a court finds that any provision of this Contract is invalid or unenforceable, but that by limiting such provision it would become valid and enforceable, then such provision will be deemed to be written, construed, and enforced as so limited."

<h1 class="clause">Governing Law</h1>
This Contract shall be construed in accordance with the Telos Blockchain Network Core Governance Documents, previously referenced.

<h1 class="clause">Notice</h1>
Any notice or communication required or permitted under this Contract shall be sufficiently given if delivered to a verifiable email address or to such other email address as one party may have publicly furnished in writing, or published on a broadcast contract provided by this blockchain for purposes of providing notices of this type.

<h1 class="clause">Waiver of Contractual Right</h1>
The failure of either party to enforce any provision of this Contract shall not be construed as a waiver or limitation of that party's right to subsequently enforce and compel strict compliance with every provision of this Contract.

<h1 class="clause">Arbitrator's Fees to Prevailing Party</h1>
In any action arising hereunder or any separate action pertaining to the validity of this Agreement, both sides shall pay half the initial cost of arbitration, and the prevailing party shall be awarded reasonable arbitrator's fees and costs.

<h1 class="clause">Construction and Interpretation</h1>
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.
133 changes: 133 additions & 0 deletions eosio.amend/resources/eosio.amend.contracts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<h1 class="contract">addclause</h1>
This human-language contract for the `eosio.amend` action `addclause()` is legally binding and can be used in the event of a dispute. Disputes shall be settled through arbitration by Telos Elected Arbitrators as described in the Telos Blockchain Network Operating Agreement and the Telos Blockchain Network Arbitration Rules and Procedures.

### Parameters

* **sub_id** (proposal ID number of the submission for which to add the clause)

* **new_clause_num** (clause number to update)

* **new_ipfs_url** (link to the new clause text)

### Intent

The intention of the authors and the invoker of this contract is to make a new clause to an existing ratification or amendment proposal. It shall have no other effect.

### Body

I attest that I am the owner or authorized user of this account {{proposer}} and that I intend to submit a new clause to ratification or amendment Proposal number: {{sub_id}}, with clause number: {{ new_clause_num }} which is comprised of the exact text stored at this IPFS location {{new_ipfs_url}}.

<h1 class="contract">cancelsub</h1>
This human-language contract for the `eosio.amend` action `cancelsub()` is legally binding and can be used in the event of a dispute. Disputes shall be settled through arbitration by Telos Elected Arbitrators as described in the Telos Blockchain Network Operating Agreement and the Telos Blockchain Network Arbitration Rules and Procedures.

### Parameters

_**sub_id** (proposal ID number of the submission to be cancelled)

### Intent

The intention of the authors and the invoker of this contract is to cancel a voting submission. It shall have no other effect.

### Body

I attest that I am the owner or authorized user of this account {{signer}} and that I intend to cancel voting on the issue election designated with the ID number: {{sub_id}}.

<h1 class="contract">closeprop</h1>
This human-language contract for the `eosio.amend` action `closeprop()` is legally binding and can be used in the event of a dispute. Disputes shall be settled through arbitration by Telos Elected Arbitrators as described in the Telos Blockchain Network Operating Agreement and the Telos Blockchain Network Arbitration Rules and Procedures.

### Parameters

* **sub_id** (proposal ID number of the submission to be closed and finalized)

### Intent

The intention of the authors and the invoker of this contract is to close a voting submission that has finished its voting period and execute the result. It shall have no other effect.

### Body

I attest that I am the owner or authorized user of this account {{signer}} and that I intend to close out voting and finalize results for the issue election designated with the ID number: {{sub_id}}.

<h1 class="contract">getdeposit</h1>
This human-language contract for the `eosio.amend` action `getdeposit()` is legally binding and can be used in the event of a dispute. Disputes shall be settled through arbitration by Telos Elected Arbitrators as described in the Telos Blockchain Network Operating Agreement and the Telos Blockchain Network Arbitration Rules and Procedures.

### Parameters

* **owner** (name of the account that owns the deposit)

### Intent

The intention of the authors and the invoker of this contract is to claim for its owner, the depost that the owner made in order to submit a proposal. It shall have no other effect.

### Body

I attest that I am the owner or authorized user of this account {{signer}} and that I intend to instruct this contract to send the rafify and amend deposit that is owned by the account {{owner}}.

<h1 class="contract">insertdoc</h1>
This human-language contract for the `eosio.amend` action `insertdoc()` is legally binding and can be used in the event of a dispute. Disputes shall be settled through arbitration by Telos Elected Arbitrators as described in the Telos Blockchain Network Operating Agreement and the Telos Blockchain Network Arbitration Rules and Procedures.

### Parameters

* **title** (title of the document)

* **clauses** (a list of clauses that make up the document - ideally, each clause would be its own IPFS hash)

### Intent

The intention of the authors and the invoker of this contract is to add a new document to the table of Telos Core Governance documents. It shall have no other effect.

### Body

I attest that I am the owner or authorized user of this account {{proposer}} and that I intend to submit a add a new document entitled, {{ title }} to the table of Telos Core Governance documents. {{title}} is comprised of the clauses {{vector: clauses}}.

<h1 class="contract">makeproposal</h1>
This human-language contract for the `eosio.amend` action `makeproposal()` is legally binding and can be used in the event of a dispute. Disputes shall be settled through arbitration by Telos Elected Arbitrators as described in the Telos Blockchain Network Operating Agreement and the Telos Blockchain Network Arbitration Rules and Procedures.

### Parameters

* **sub_title** (title of the submission)

* **doc_id** (document id for which the proposal will update)

* **new_clause_num** (new clause number to update)

* **new_ipfs_url** (link to the new clause text)

* **proposer** (proposer of the submission)

### Intent

The intention of the authors and the invoker of this contract is to make a new proposal and call regballot() on the Trail Service with the given values and to store the metadata of the proposal on this contract in order to record the values submitted with this contract. It shall have no other effect.

### Body

I attest that I am the owner or authorized user of this account {{signer}} and that I intend to submit a proposal to the Telos Members under the name {{proposer}} to ratify or amend the Telos Core Governance document with the ID number {{doc_id}} as described herein. My proposal, entitled {{sub_title}} proposes to change the document's clause number: {{new_clause_num}} with the exact text stored at this IPFS location {{new_ipfs_url}}, if the text is different than the current text of this clause, or to ratify the existing clause if the text is identical. I may add additional clauses to this proposal.

<h1 class="contract">openvoting</h1>
This human-language contract for the `eosio.amend` action `openvoting()` is legally binding and can be used in the event of a dispute. Disputes shall be settled through arbitration by Telos Elected Arbitrators as described in the Telos Blockchain Network Operating Agreement and the Telos Blockchain Network Arbitration Rules and Procedures.

### Parameters

* **sub_id** (proposal ID number of the submission for which to open voting)

### Intent

The intention of the authors and the invoker of this contract is to open an amendment issue for voting. It shall have no other effect.

### Contract Text

I attest that I am the owner or authorized user of this account {{signer}} and that I intend to open voting on the issue election designated with the ID number: {{sub_id}}.

<h1 class="contract">setenv</h1>
This human-language contract for the `eosio.amend` action `setenv()` is legally binding and can be used in the event of a dispute. Disputes shall be settled through arbitration by Telos Elected Arbitrators as described in the Telos Blockchain Network Operating Agreement and the Telos Blockchain Network Arbitration Rules and Procedures.

### Parameters

* **new_environment** (new environment to set)

### Intent

The intention of the authors and the invoker of this contract is to set the config for a new contract environment. It shall have no other effect.

### Body

I attest that I am the owner or authorized user of this account {{signer}} and that I intend to set the config for an new contract environment to {{new_environment}}.
10 changes: 5 additions & 5 deletions eosio.amend/src/eosio.amend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void ratifyamend::makeproposal(string sub_title, uint64_t doc_id, uint8_t new_cl
eosio_assert(d_itr != deposits.end(), "Deposit not found, please transfer your TLOS fee");

auto dep = *d_itr;
asset fee = asset(int64_t(1000000), symbol("TLOS", 4));
asset fee = asset(configs_struct.fee, symbol("TLOS", 4));
eosio_assert(dep.escrow >= fee, "Deposit amount is less than fee, please transfer more TLOS");

if(dep.escrow > fee) {
Expand Down Expand Up @@ -264,18 +264,18 @@ void ratifyamend::closeprop(uint64_t sub_id) {
eosio_assert(prop.end_time < now(), "Proposal is still open");
eosio_assert(prop.status == uint8_t(0), "Proposal is already closed");

environment_singleton environment("eosio.trail"_n, "eosio.trail"_n.value);
auto e = environment.get();
registries_table registries("eosio.trail"_n, "eosio.trail"_n.value);
auto e = registries.find(symbol("VOTE", 4).code().raw());

asset total_votes = (prop.yes_count + prop.no_count + prop.abstain_count); //total votes cast on proposal
asset non_abstain_votes = (prop.yes_count + prop.no_count);

//pass thresholds
uint64_t voters_pass_thresh = (e.totals[1] * configs_struct.threshold_pass_voters) / 100;
uint64_t voters_pass_thresh = (e->total_voters * configs_struct.threshold_pass_voters) / 100;
asset votes_pass_thresh = (non_abstain_votes * configs_struct.threshold_pass_votes) / 100;

//fee refund thresholds
uint64_t voters_fee_thresh = (e.totals[1] * configs_struct.threshold_fee_voters) / 100;
uint64_t voters_fee_thresh = (e->total_voters * configs_struct.threshold_fee_voters) / 100;
asset votes_fee_thresh = (total_votes * configs_struct.threshold_fee_votes) / 100;

if( prop.yes_count >= votes_fee_thresh && prop.unique_voters >= voters_fee_thresh) {
Expand Down
5 changes: 4 additions & 1 deletion eosio.arbitration/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
add_contract(eosio.arbitration eosio.arbitration ${CMAKE_CURRENT_SOURCE_DIR}/src/eosio.arbitration.cpp)

target_compile_options(eosio.arbitration.wasm PUBLIC -R${CMAKE_CURRENT_SOURCE_DIR}/resources)
target_include_directories(eosio.arbitration.wasm
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include)
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/../eosio.trail/include)

set_target_properties(eosio.arbitration.wasm
PROPERTIES
Expand Down
Loading

0 comments on commit 79295f0

Please sign in to comment.