Skip to content

Commit

Permalink
Merge pull request #40 from Telos-Foundation/developer
Browse files Browse the repository at this point in the history
Trial and TFVT Patch
  • Loading branch information
ARoomWithABue authored Dec 18, 2018
2 parents 79295f0 + a92862a commit 1945dab
Show file tree
Hide file tree
Showing 21 changed files with 643 additions and 70 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ add_subdirectory(eosio.amend)
add_subdirectory(eosio.saving)
add_subdirectory(telos.tfvt)
add_subdirectory(telos.free)
add_subdirectory(token.registry)


if (APPLE)
Expand Down
1 change: 1 addition & 0 deletions eosio.amend/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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_compile_options(eosio.amend.wasm PUBLIC -Wunknown-pragmas)
target_include_directories(eosio.amend.wasm
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
Expand Down
1 change: 1 addition & 0 deletions eosio.arbitration/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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_compile_options(eosio.arbitration.wasm PUBLIC -Wunknown-pragmas)
target_include_directories(eosio.arbitration.wasm
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
Expand Down
6 changes: 3 additions & 3 deletions eosio.arbitration/src/eosio.arbitration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ arbitration::~arbitration() {

void arbitration::setconfig(uint16_t max_elected_arbs, uint32_t election_duration, uint32_t start_election, uint32_t arbitrator_term_length, vector<int64_t> fees) {
require_auth("eosio"_n);

eosio_assert(max_elected_arbs < uint16_t(21), "Maximum elected arbitrators must be less than 22.");

eosio_assert(max_elected_arbs > uint16_t(0), "Arbitraitors must be greater than 0");
_config = config{get_self(), // publisher
max_elected_arbs,
Expand Down Expand Up @@ -60,7 +59,8 @@ void arbitration::initelection() {
void arbitration::candaddlead( name candidate, string creds_ipfs_url ) {
require_auth(candidate);
validate_ipfs_url(creds_ipfs_url);

eosio_assert(_config.auto_start_election, "there is no active election");

pending_candidates_table candidates(_self, _self.value);
auto c = candidates.find(candidate.value);
eosio_assert(c != candidates.end(), "Candidate isn't an applicant. Use regcand action to register candidate");
Expand Down
2 changes: 2 additions & 0 deletions eosio.saving/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
add_contract(eosio.saving eosio.saving ${CMAKE_CURRENT_SOURCE_DIR}/src/worker.proposals.cpp) #NOTE: this path needs to change

target_compile_options(eosio.saving.wasm PUBLIC -R${CMAKE_CURRENT_SOURCE_DIR}/resources)
target_include_directories(eosio.saving.wasm
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
Expand Down
68 changes: 68 additions & 0 deletions eosio.saving/resources/eosio.saving.clauses.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<h1 class="clause">Intent</h1>
The intention of the authors and invoker of this smart contract is to manage the submission, voting, and claiming of payment for a worker proposal. A proposal may also be cancelled prior to voting, however its submission fee will not be refunded.

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.
73 changes: 73 additions & 0 deletions eosio.saving/resources/eosio.saving.contracts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<h1 class="contract">submit</h1>
This human-language contract for the `eosio.saving` action `submit` 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

* **proposer** (account name of the proposer, who owns the proposal submission)

* **title** (title of the proposal)

* **cycles** (number of voting cycles the proposal will recur)

* **ipfs_location** (object hash of a document stored on IPFS that describes the proposals goals, the work required, its benefits, costs, schedules, etc.)

* **amount** (token amount to be paid to the receiver if a cycle passes the threshold of required YES votes)

### Intent

The intention of the authors and the invoker of this contract is to allow Members to submit a proposal to the contract and to emplace a ballot and proposal object in the eosio.trail tables provided the proposer has transferred the required TLOS fee to `eosio.saving`. 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 worker proposal entitled, {{title}} described by the document stored at {{ipfs_location}} with the intention that the proposal shall recur for {{cycles}} cycles and pay {{amount}} to the designated receivers.

<h1 class="contract">cancelsub</h1>
This human-language contract for the `eosio.saving` 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** (unique id of the submission to be cancelled)

* **signer** (account name of the signer - _implied parameter_)

### Intent

The intention of the authors and the invoker of this contract is to cancel the submission of a previously submitted proposal prior to the start of voting, **without refunding the submission fee**. 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 the submission of my proposal, {{sub_id}}. I acknowledge that I will not receive a refund of any submission fee paid.

<h1 class="contract">openvoting</h1>
This human-language contract for the `eosio.saving` 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** (unique id of the submission to be opened for voting)

* **signer** (account name of the signer - _implied parameter_)

### Intent

The intention of the authors and the invoker of this contract is to commence the voting period of the designated 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 commence the voting period of the worker proposal: {{sub_id}}.

<h1 class="contract">claim</h1>
This human-language contract for the `eosio.saving` action `claim` 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** (unique id of the submission to be claimed)

* **signer** (account name of the signer - _implied parameter_)

### Intent

The intention of the authors and the invoker of this contract is to claim for the proposer of a voter-approved worker proposal: {{sub_id}}, the amount of TLOS described in its proposal 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 claim the allocated amount of TLOS from the voter-approved worker proposal: {{sub_id}} for its submitter. **I acknowledge that paid worker proposals that do not deliver their promised work products or services, or otherwise fail to deliver on what the Telos voters approved are subject to arbitration proceedings to reclaim funds for undelivered work.
1 change: 1 addition & 0 deletions eosio.trail/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
add_contract(eosio.trail eosio.trail ${CMAKE_CURRENT_SOURCE_DIR}/src/eosio.trail.cpp) #NOTE: this path needs to change

target_compile_options(eosio.trail.wasm PUBLIC -R${CMAKE_CURRENT_SOURCE_DIR}/resources)
target_compile_options(eosio.trail.wasm PUBLIC -Wunknown-pragmas)
target_include_directories(eosio.trail.wasm
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include)
Expand Down
6 changes: 3 additions & 3 deletions eosio.trail/src/eosio.trail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1240,10 +1240,10 @@ bool trail::vote_for_leaderboard(name voter, uint64_t ballot_id, uint64_t board_

print("\nVote Recast: SUCCESS");

} else if(vr.expiration == board.end_time && has_direction(direction, vr.directions)) { //NOTE: vote already exists for candidate (recasting)
} else if (vr.expiration == board.end_time && has_direction(direction, vr.directions)) { //NOTE: vote already exists for candidate (recasting)
eosio_assert(reg.settings.is_recastable, "token registry disallows vote recasting");

//TODO: implement recasting logic
eosio_assert(true == false, "Feature currently disabled"); //NOTE: temp fix
new_voter = 0;
}

}
Expand Down
1 change: 1 addition & 0 deletions telos.free/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
add_contract(telos.free telos.free ${CMAKE_CURRENT_SOURCE_DIR}/src/telos.free.cpp)

target_compile_options(telos.free.wasm PUBLIC -R${CMAKE_CURRENT_SOURCE_DIR}/resources)
target_compile_options(telos.free.wasm PUBLIC -Wunknown-pragmas)
target_include_directories(telos.free.wasm
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include)
Expand Down
1 change: 1 addition & 0 deletions telos.tfvt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
add_contract(telos.tfvt telos.tfvt ${CMAKE_CURRENT_SOURCE_DIR}/src/telos.tfvt.cpp) #NOTE: this path needs to change

target_compile_options(telos.tfvt.wasm PUBLIC -R${CMAKE_CURRENT_SOURCE_DIR}/resources)
target_compile_options(telos.tfvt.wasm PUBLIC -Wunknown-pragmas)
target_include_directories(telos.tfvt.wasm
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../eosio.trail/include
Expand Down
15 changes: 9 additions & 6 deletions telos.tfvt/src/telos.tfvt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ void tfvt::closeissue(name holder, name proposer) {

void tfvt::nominate(name nominee, name nominator) {
require_auth(nominator);
eosio_assert(is_account(nominee), "nominee account must exist");
eosio_assert(is_tfvt_holder(nominator), "caller must be a TFVT holder");
eosio_assert(!is_board_member(nominee) || is_term_expired(), "nominee is a board member, nominee's term must be expired");

nominees_table noms(get_self(), get_self().value);
auto n = noms.find(nominee.value);
Expand Down Expand Up @@ -296,6 +298,8 @@ void tfvt::makeelection(name holder, string info_url) {
void tfvt::addcand(name nominee, string info_link) {
require_auth(nominee);
eosio_assert(is_nominee(nominee), "only nominees can be added to the election");
eosio_assert(_config.is_active_election, "no active election for board members at this time");
eosio_assert(!is_board_member(nominee) || is_term_expired(), "nominee can't already be a board member, or their term must be expired.");

action(permission_level{get_self(), name("active")}, name("eosio.trail"), name("addcandidate"), make_tuple(
get_self(), //publisher
Expand Down Expand Up @@ -393,7 +397,7 @@ void tfvt::add_to_tfboard(name nominee) {

members_table mems(get_self(), get_self().value);
auto m = mems.find(nominee.value);
eosio_assert(m == mems.end(), "nominee is already a board member");
eosio_assert(m == mems.end(), "nominee is already a board member"); //NOTE: change if error occurs in live environment

noms.erase(n); //NOTE remove from nominee table

Expand Down Expand Up @@ -528,7 +532,7 @@ void tfvt::remove_and_seize(name member) {

void tfvt::set_permissions(vector<permission_level_weight> perms) {
auto self = get_self();
uint16_t active_weight = perms.size() < 4 ? 1 : (perms.size() / 4);
uint16_t active_weight = perms.size() < 3 ? 1 : ((perms.size() / 3) * 2);

perms.emplace_back(
permission_level_weight{ permission_level{
Expand Down Expand Up @@ -556,15 +560,14 @@ void tfvt::set_permissions(vector<permission_level_weight> perms) {
return lvlw.permission.actor == self;
});
perms.erase(tf_it);

uint16_t major_weight = perms.size() < 3 ? 1 : ((perms.size() / 3) * 2);
uint16_t minor_weight = perms.size() < 4 ? 1 : (perms.size() / 4);
action(permission_level{get_self(), "owner"_n }, "eosio"_n, "updateauth"_n,
std::make_tuple(
get_self(),
name("major"),
name("minor"),
name("owner"),
authority {
major_weight,
minor_weight,
std::vector<key_weight>{},
perms,
std::vector<wait_weight>{}
Expand Down
Loading

0 comments on commit 1945dab

Please sign in to comment.