Permalink
Browse files

Add check for the update terms action to ensure the length is not unb…

…ounded. Also update the README to work with the ricardian contracts actions since that format is now human readable.
  • Loading branch information...
dallasjohnson committed Dec 4, 2018
1 parent 8ba64a9 commit d1814815e6019f980e32278b0afa95f941cfff9b
@@ -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)
@@ -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 09:41:38 2018",
"version": "eosio::abi/1.1",
"structs": [
{
Binary file not shown.
@@ -1,5 +1,5 @@
{
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT Sat Nov 24 13:54:24 2018",
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT Tue Dec 4 09:41:42 2018",
"version": "eosio::abi/1.1",
"structs": [
{
Binary file not shown.
@@ -1,5 +1,5 @@
{
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT Sat Nov 24 13:54:28 2018",
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT Tue Dec 4 09:41:46 2018",
"version": "eosio::abi/1.1",
"structs": [
{
Binary file not shown.

0 comments on commit d181481

Please sign in to comment.