diff --git a/README.md b/README.md index 47d7198..f698eb9 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,10 @@ There are two ways to use Simple Assets: 2) Dapps can Deploy their own copy of Simple Assets and make modifications to have greater control of functionality. We consider this an example of a dapp being its own "ownership authority." Before deploying, Simple Assets should be modified to prevent anyone from making assets. --------------------------- +# Change Log v0.3.2 +- Added `memo` parameter to action `offer`; +- Added `memo` parameter to action `delegate`; + # Change Log v0.3.1 - Internal action for NFT `createlog` added. Used by create action to log assetid so that third party explorers can easily get new asset ids and other information. - New singelton table `tokenconfigs` added. It helps external contracts parse actions and tables correctly (Usefull for decentralized exchanges, marketplaces and other contracts that use multiple tokens). @@ -89,14 +93,14 @@ https://github.com/CryptoLions/SimpleAssets/blob/master/include/SimpleAssets.hpp transfer (from, to , [assetid1,..,assetidn], memo) burn (owner, [assetid1,..,assetidn], memo) - offer (owner, newowner, [assetid1,..,assetidn]) + offer (owner, newowner, [assetid1,..,assetidn], memo) canceloffer (owner, [assetid1,..,assetidn]) claim (claimer, [assetid1,..,assetidn]) regauthor (name author, data, stemplate) authorupdate (author, data, stemplate) - delegate (owner, to, [assetid1,..,assetidn], period) + delegate (owner, to, [assetid1,..,assetidn], period, memo) undelegate (owner, from, [assetid1,..,assetidn]) diff --git a/build/SimpleAssets/SimpleAssets.abi b/build/SimpleAssets/SimpleAssets.abi index 3f9c779..b41a0e5 100644 --- a/build/SimpleAssets/SimpleAssets.abi +++ b/build/SimpleAssets/SimpleAssets.abi @@ -1,5 +1,5 @@ { - "____comment": "This file was generated with eosio-abigen. DO NOT EDIT Wed Mar 27 13:50:53 2019", + "____comment": "This file was generated with eosio-abigen. DO NOT EDIT Fri Mar 29 17:59:05 2019", "version": "eosio::abi/1.1", "structs": [ { @@ -243,6 +243,10 @@ { "name": "period", "type": "uint64" + }, + { + "name": "memo", + "type": "string" } ] }, @@ -305,6 +309,10 @@ { "name": "assetids", "type": "uint64[]" + }, + { + "name": "memo", + "type": "string" } ] }, @@ -602,12 +610,12 @@ { "name": "createlog", "type": "createlog", - "ricardian_contract": "" + "ricardian_contract": "## ACTION NAME: createlog (internal)" }, { "name": "delegate", "type": "delegate", - "ricardian_contract": "## ACTION NAME: delegate\n\n ### INTENT\n\t\tDelegates asset to {{to}}. This action changes the asset owner by calling the transfer action.\n\t\tIt also adds a record in the delegates table to record the asset as borrowed. This blocks\n\t\tthe asset from all owner actions (transfers, offers, burning by borrower).\n\n ### Input parameters:\n\t\t`owner` - current asset owner account;\n\t\t`to` - borrower account name;\n\t\t`assetids` - array of assetid's to delegate;\n\t\t`period` - time in seconds that the asset will be lent. Lender cannot undelegate until \n\t\t the period expires, however the receiver can transfer back at any time.\n\n ### TERM\n This Contract expires at the conclusion of code execution.\n\n by CryptoLions [ https://cryptolions.io ]" + "ricardian_contract": "## ACTION NAME: delegate\n\n ### INTENT\n\t\tDelegates asset to {{to}}. This action changes the asset owner by calling the transfer action.\n\t\tIt also adds a record in the delegates table to record the asset as borrowed. This blocks\n\t\tthe asset from all owner actions (transfers, offers, burning by borrower).\n\n ### Input parameters:\n\t\t`owner` - current asset owner account;\n\t\t`to` - borrower account name;\n\t\t`assetids` - array of assetid's to delegate;\n\t\t`period` - time in seconds that the asset will be lent. Lender cannot undelegate until \n\t\t the period expires, however the receiver can transfer back at any time.\n\t\t`memo` - memo for delegate action\n\n ### TERM\n This Contract expires at the conclusion of code execution.\n\n by CryptoLions [ https://cryptolions.io ]" }, { "name": "issuef", @@ -617,7 +625,7 @@ { "name": "offer", "type": "offer", - "ricardian_contract": "## ACTION NAME: offer\n\n ### INTENT\n\t\tOffer asset for claim. This is an alternative to the transfer action. Offer can be used by an \n\t\tasset owner to transfer the asset without using their RAM. After an offer is made, the account\n\t\tspecified in {{newowner}} is able to make a claim, and take control of the asset using their RAM.\n\t\tOffer action is not available if an asste is delegated (borrowed).\n\n ### Input parameters:\n\t\t`owner` - current asset owner account;\n\t\t`newowner` - new asset owner, who will able to claim;\n\t\t`assetids` - array of assetid's to offer;\n\n ### TERM\n This Contract expires at the conclusion of code execution.\n\n by CryptoLions [ https://cryptolions.io ]" + "ricardian_contract": "## ACTION NAME: offer\n\n ### INTENT\n\t\tOffer asset for claim. This is an alternative to the transfer action. Offer can be used by an \n\t\tasset owner to transfer the asset without using their RAM. After an offer is made, the account\n\t\tspecified in {{newowner}} is able to make a claim, and take control of the asset using their RAM.\n\t\tOffer action is not available if an asste is delegated (borrowed).\n\n ### Input parameters:\n\t\t`owner` - current asset owner account;\n\t\t`newowner` - new asset owner, who will able to claim;\n\t\t`assetids` - array of assetid's to offer;\n\t\t`memo` - memo for offer action\n\n ### TERM\n This Contract expires at the conclusion of code execution.\n\n by CryptoLions [ https://cryptolions.io ]" }, { "name": "openf", @@ -652,7 +660,7 @@ { "name": "updatever", "type": "updatever", - "ricardian_contract": "" + "ricardian_contract": "## ACTION NAME: updatever (internal)" } ], "tables": [ diff --git a/build/SimpleAssets/SimpleAssets.wasm b/build/SimpleAssets/SimpleAssets.wasm index 85fde4e..4b0a991 100755 Binary files a/build/SimpleAssets/SimpleAssets.wasm and b/build/SimpleAssets/SimpleAssets.wasm differ diff --git a/include/SimpleAssets.hpp b/include/SimpleAssets.hpp index 5121ede..0535994 100644 --- a/include/SimpleAssets.hpp +++ b/include/SimpleAssets.hpp @@ -147,8 +147,9 @@ CONTRACT SimpleAssets : public contract { * owner - current asset owner account; * newowner - new asset owner, who will able to claim; * assetids - array of assetid's to offer + * memo - memo for offer action */ - ACTION offer( name owner, name newowner, std::vector& assetids); + ACTION offer( name owner, name newowner, std::vector& assetids, string memo); using offer_action = action_wrapper<"offer"_n, &SimpleAssets::offer>; @@ -187,8 +188,9 @@ CONTRACT SimpleAssets : public contract { * assetids - array of assetid's to delegate; * period - time in seconds that the asset will be lent. Lender cannot undelegate until * the period expires, however the receiver can transfer back at any time. + * memo - memo for delegate action */ - ACTION delegate( name owner, name to, std::vector& assetids, uint64_t period ); + ACTION delegate( name owner, name to, std::vector& assetids, uint64_t period, string memo ); using delegate_action = action_wrapper<"delegate"_n, &SimpleAssets::delegate>; diff --git a/ricardian/SimpleAssets.contracts.md b/ricardian/SimpleAssets.contracts.md index 2dc172c..decf067 100644 --- a/ricardian/SimpleAssets.contracts.md +++ b/ricardian/SimpleAssets.contracts.md @@ -135,6 +135,7 @@ `owner` - current asset owner account; `newowner` - new asset owner, who will able to claim; `assetids` - array of assetid's to offer; + `memo` - memo for offer action ### TERM This Contract expires at the conclusion of code execution. @@ -193,6 +194,7 @@ `assetids` - array of assetid's to delegate; `period` - time in seconds that the asset will be lent. Lender cannot undelegate until the period expires, however the receiver can transfer back at any time. + `memo` - memo for delegate action ### TERM This Contract expires at the conclusion of code execution. @@ -327,6 +329,9 @@ by CryptoLions [ https://cryptolions.io ] - +

updatever

+## ACTION NAME: updatever (internal) +

createlog

+## ACTION NAME: createlog (internal) diff --git a/src/SimpleAssets.cpp b/src/SimpleAssets.cpp index 64fe760..f36e55a 100644 --- a/src/SimpleAssets.cpp +++ b/src/SimpleAssets.cpp @@ -262,7 +262,7 @@ ACTION SimpleAssets::update( name author, name owner, uint64_t assetid, string m } -ACTION SimpleAssets::offer( name owner, name newowner, std::vector& assetids){ +ACTION SimpleAssets::offer( name owner, name newowner, std::vector& assetids, string memo){ require_auth( owner ); require_recipient( owner ); @@ -356,7 +356,7 @@ ACTION SimpleAssets::burn( name owner, std::vector& assetids, string m } -ACTION SimpleAssets::delegate( name owner, name to, std::vector& assetids, uint64_t period ){ +ACTION SimpleAssets::delegate( name owner, name to, std::vector& assetids, uint64_t period, string memo ){ require_auth( owner ); require_recipient( owner ); @@ -390,11 +390,9 @@ ACTION SimpleAssets::delegate( name owner, name to, std::vector& asset s.period = period; }); - if (i != 0) assetidsmemo += ", "; - assetidsmemo += std::to_string(assetid); } - SEND_INLINE_ACTION( *this, transfer, { {owner, "active"_n} }, { owner, to, assetids, "delegate assetids: "+ assetidsmemo} ); + SEND_INLINE_ACTION( *this, transfer, { {owner, "active"_n} }, { owner, to, assetids, memo} ); }