Permalink
Browse files

Merge pull request #24 from eosdac/Add-check-for-terms-update-length

Add check for the update terms action to ensure the length
  • Loading branch information...
michaeljyeates committed Dec 5, 2018
2 parents 8ba64a9 + b12d920 commit f280c6c737076a46a58bfaabbdef922a4fb78a94
@@ -6,81 +6,6 @@ Once this contract is launched we will issue a quantity of eosDAC tokens equival

https://github.com/EOSIO/eos/blob/master/contracts/eosio.token/eosio.token.abi#L4

## create
Standard currency create action, will mint a certain number of tokens and credit them to the account mentioned

if `transferred_locked` is set `true` the contract will prevent all transfers except from the token creator.

## issue

Standard currency action. Issue tokens and send them to the account specified (standard currency method). This will require a privileged account.

## unlock

Unlock a token to allow transfers from accounts other than the token creator. The parameter passed in must be a standard asset in the form of "1000.0000 ABC". Although the amount component eg. 1000.000 is ignored for the logic it is required for the format of an asset parameter.

***This can only be done to `unlock` a token and cannot be reversed to lock a token again.***

## transfer

Standard currency contract function to facilitate transfer.

## memberadd

This is called to add an existing eos account to the members db and transfer an amount of tokens to the given account. It must be called from the contract owner account.

Parameters:

* **newmember** - a pre-existing eos account to be added to this contract as a member.
* **quantity** - an asset to transfer from the contract account to the newmember account.
* **memo** - a string to pass to the underlying transfer method on the `eosio.token` contract.

***Note:*** *The `agreedterms` would be left un-set after this action since the user has not yet agreed to the terms. This would be completed by the individual account holder with their required permission.*

## memberadda
This is a pluralised version of the `memberadd` action to facilitate batch importing members in one action.

Parameters:

* **newmembers** - a vector of objects representing pre-existing eos accounts and an asset quantity to transfer.
* **memo** - a string to pass in for the transfer action as in the single version of this action. The same memo would be used for all transfers to save space of the message.

## memberreg

This is called to indicate that the account has agreed to the terms of the DAC. It will update an internal database of member accounts. This action must supply the hash of the agreement, most recently agreed to, and can be called multiple times to update the hash.

Parameters:

* **sender** - (account_name) - The account registering
* **agreedterms** (string) - The hash of the agreed constitution

Check that the account has permissions of account
Update the members database to include the account name and the new hash

## memberunreg

Unregister the account, this signifies that they no longer agree to any terms and we should update the database to remove the account.

Parameters:

* **sender** (account_name) - The account unregistering

Check that the account has permissions of account
Update the members database to remove the account name


## burn

Will burn tokens by removing them from the account and reducing the total supply variable. This could be used by worker proposals to burn some of the eosDAC tokens.

Parameters:

* **quantity** - an asset to burn

***Note:*** *This action ensures that the burn amount will only burn available tokens that have not been allocated to other users (part of the circulating supply) or is greater than the available supply.*


## clear (for debugging)

This action is used for debugging only and should **not** be deployed to the production chain.
It is required for the unit tests to first clear the created token and member tables. Ideally this would be hidden behind a compiler flag but this does not seem possible with the current `eosiocpp` implementation.
All the actions available in the contract are detailed in:
* [Ricardian contracts](eosdactokens.contracts.md)
* [Ricardian clauses](eosdactokens.clauses.md)
@@ -18,9 +18,9 @@
**PARAMETERS:**
* __to__ is a type of eosio accountname to issue tokens to
* __quantity__ is a type of eosio asset
* __memo__ is a string with a maximum of 256 charaters
* __memo__ is a string with a maximum of 256 characters

**INTENT:** The intent of {{ issue }} is to issue tokens {{ quantity }} and send them to the account specified {{ to }} using the transfer action. This requires a privilaged account. A note {{ memo }} can be sent to the receiver.
**INTENT:** The intent of {{ issue }} is to issue tokens {{ quantity }} and send them to the account specified {{ to }} using the transfer action. This requires a privileged account. A note {{ memo }} can be sent to the receiver.

**TERM:** The action lasts for the duration of the processing of the contract.

@@ -68,11 +68,11 @@ s

**PARAMETERS:**
* __sender__ is a type of eosio account_name
* __agreedterms__ is a hash reference to a document contained in a string with a maximum of 256 charaters
* __agreedterms__ is a hash reference to a document contained in a string with a maximum of 256 characters

**INTENT:** The intent of memberreg is to indicate that the account has agreed to the terms of the DAC. It will update an internal database of member accounts. This action must supply the hash of the agreement in {{ agreedterms }}, it will hold the most recently agreed to, and can be called multiple times to update the hash.

**TERM:** This action lasts for the duration of the processing of the contract. The member registration will persist on the deployed contract as long as it is active or superceeded by an updated memberreg or memberunreg action.
**TERM:** This action lasts for the duration of the processing of the contract. The member registration will persist on the deployed contract as long as it is active or superseded by an updated memberreg or memberunreg action.

<h1 class="contract">
memberunreg
@@ -83,7 +83,7 @@ s

**INTENT:** The intent of memberunreg is to allow an account {{ sender }} to unregister its membership.

**TERM:** This action lasts for the duration of the processing of the contract. The action will persist on the deployed contract as long as it is active or superceeded by an updated memberreg action.
**TERM:** This action lasts for the duration of the processing of the contract. The action will persist on the deployed contract as long as it is active or superseded by an updated memberreg action.

<h1 class="contract">
updateterms
@@ -95,7 +95,7 @@ s

**INTENT:** The intent of {{ updateterms }} is to change the URL link specifying where the terms of a pre-existing record of member terms are located, associated with the given version {{ termsid }}.

**TERM:** The update terms action lasts until it is superceded by a subsequent action.
**TERM:** The update terms action lasts until it is superseded by a subsequent action.

<h1 class="contract">
updateconfig
@@ -113,11 +113,12 @@ s
</h1>

**PARAMETERS:**
* __notifycontr__ is a contract to also be notified of all transactions in this token contract.
* __owner__ is the owner of a balance entry for the token.
* __symbol__ is the symbol for the currency entry to close

**INTENT:** Notify a listening contract so that it can update it's internal state based on transactions in here.
**INTENT:** Close a balance entry for a token. This allows for a 0 balance to be kept open while still holding a valid entry in the token table.
Term: The updateconfig action lasts for the duration of the processing of the contract.

**TERM:** The updateconfig action lasts for the duration of the processing of the contract.

<h1 class="contract">
newmemterms
@@ -219,12 +219,14 @@ namespace eosdac {
void eosdactokens::updateterms(uint64_t termsid, string newterms) {

require_auth(_self);
eosio_assert(newterms.length() <= 256, "ERR::UPDATEMEMTERMS_TERMS_TOO_LONG::Member terms document url should be less than 256 characters long.");

memterms memberterms(_self, _self.value);

auto existingterms = memberterms.find(termsid);
eosio_assert(existingterms != memberterms.end(), "ERR::UPDATETERMS_NO_EXISTING_TERMS::Existing terms not found for the given ID");


memberterms.modify(existingterms, name{}, [&](termsinfo &t) {
t.terms = newterms;
});
@@ -1,5 +1,5 @@
{
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT Sat Nov 24 13:54:20 2018",
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT Tue Dec 4 19:50:18 2018",
"version": "eosio::abi/1.1",
"structs": [
{
@@ -245,7 +245,7 @@
{
"name": "close",
"type": "close",
"ricardian_contract": "**PARAMETERS:** \n* __notifycontr__ is a contract to also be notified of all transactions in this token contract.\n\n**INTENT:** Notify a listening contract so that it can update it's internal state based on transactions in here.\n\n**TERM:** The updateconfig action lasts for the duration of the processing of the contract."
"ricardian_contract": "**PARAMETERS:** \n* __owner__ is the owner of a balance entry for the token.\n* __symbol__ is the symbol for the currency entry to close\n\n**INTENT:** Close a balance entry for a token. This allows for a 0 balance to be kept open while still holding a valid entry in the token table.\nTerm: The updateconfig action lasts for the duration of the processing of the contract."
},
{
"name": "create",
@@ -255,17 +255,17 @@
{
"name": "issue",
"type": "issue",
"ricardian_contract": "**PARAMETERS:** \n* __to__ is a type of eosio accountname to issue tokens to\n* __quantity__ is a type of eosio asset\n* __memo__ is a string with a maximum of 256 charaters\n \n**INTENT:** The intent of {{ issue }} is to issue tokens {{ quantity }} and send them to the account specified {{ to }} using the transfer action. This requires a privilaged account. A note {{ memo }} can be sent to the receiver.\n\n**TERM:** The action lasts for the duration of the processing of the contract."
"ricardian_contract": "**PARAMETERS:** \n* __to__ is a type of eosio accountname to issue tokens to\n* __quantity__ is a type of eosio asset\n* __memo__ is a string with a maximum of 256 characters\n \n**INTENT:** The intent of {{ issue }} is to issue tokens {{ quantity }} and send them to the account specified {{ to }} using the transfer action. This requires a privileged account. A note {{ memo }} can be sent to the receiver.\n\n**TERM:** The action lasts for the duration of the processing of the contract."
},
{
"name": "memberreg",
"type": "memberreg",
"ricardian_contract": "**PARAMETERS:** \n* __sender__ is a type of eosio account_name \n* __agreedterms__ is a hash reference to a document contained in a string with a maximum of 256 charaters\n\n**INTENT:** The intent of memberreg is to indicate that the account has agreed to the terms of the DAC. It will update an internal database of member accounts. This action must supply the hash of the agreement in {{ agreedterms }}, it will hold the most recently agreed to, and can be called multiple times to update the hash.\n\n**TERM:** This action lasts for the duration of the processing of the contract. The member registration will persist on the deployed contract as long as it is active or superceeded by an updated memberreg or memberunreg action."
"ricardian_contract": "**PARAMETERS:** \n* __sender__ is a type of eosio account_name \n* __agreedterms__ is a hash reference to a document contained in a string with a maximum of 256 characters\n\n**INTENT:** The intent of memberreg is to indicate that the account has agreed to the terms of the DAC. It will update an internal database of member accounts. This action must supply the hash of the agreement in {{ agreedterms }}, it will hold the most recently agreed to, and can be called multiple times to update the hash.\n\n**TERM:** This action lasts for the duration of the processing of the contract. The member registration will persist on the deployed contract as long as it is active or superseded by an updated memberreg or memberunreg action."
},
{
"name": "memberunreg",
"type": "memberunreg",
"ricardian_contract": "**PARAMETERS:** \n* __sender__ is a type of eosio account_name\n\n**INTENT:** The intent of memberunreg is to allow an account {{ sender }} to unregister its membership.\n\n**TERM:** This action lasts for the duration of the processing of the contract. The action will persist on the deployed contract as long as it is active or superceeded by an updated memberreg action."
"ricardian_contract": "**PARAMETERS:** \n* __sender__ is a type of eosio account_name\n\n**INTENT:** The intent of memberunreg is to allow an account {{ sender }} to unregister its membership.\n\n**TERM:** This action lasts for the duration of the processing of the contract. The action will persist on the deployed contract as long as it is active or superseded by an updated memberreg action."
},
{
"name": "newmemterms",
@@ -290,7 +290,7 @@
{
"name": "updateterms",
"type": "updateterms",
"ricardian_contract": "**PARAMETERS:** \n* __termsid__ is a number id of the terms reference stored in the contract.\n* __terms__ is checksum hash of the updated terms.\n\n**INTENT:** The intent of {{ updateterms }} is to change the URL link specifying where the terms of a pre-existing record of member terms are located, associated with the given version {{ termsid }}.\n\n**TERM:** The update terms action lasts until it is superceded by a subsequent action."
"ricardian_contract": "**PARAMETERS:** \n* __termsid__ is a number id of the terms reference stored in the contract.\n* __terms__ is checksum hash of the updated terms.\n\n**INTENT:** The intent of {{ updateterms }} is to change the URL link specifying where the terms of a pre-existing record of member terms are located, associated with the given version {{ termsid }}.\n\n**TERM:** The update terms action lasts until it is superseded by a subsequent action."
}
],
"tables": [
Binary file not shown.
Oops, something went wrong.

0 comments on commit f280c6c

Please sign in to comment.