Skip to content

Commit

Permalink
v0.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ansigroup committed Mar 29, 2019
1 parent 88c97e1 commit 74e1fd6
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 15 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -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])
Expand Down
18 changes: 13 additions & 5 deletions build/SimpleAssets/SimpleAssets.abi
Original file line number Diff line number Diff line change
@@ -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": [
{
Expand Down Expand Up @@ -243,6 +243,10 @@
{
"name": "period",
"type": "uint64"
},
{
"name": "memo",
"type": "string"
}
]
},
Expand Down Expand Up @@ -305,6 +309,10 @@
{
"name": "assetids",
"type": "uint64[]"
},
{
"name": "memo",
"type": "string"
}
]
},
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -652,7 +660,7 @@
{
"name": "updatever",
"type": "updatever",
"ricardian_contract": ""
"ricardian_contract": "## ACTION NAME: updatever (internal)"
}
],
"tables": [
Expand Down
Binary file modified build/SimpleAssets/SimpleAssets.wasm
Binary file not shown.
6 changes: 4 additions & 2 deletions include/SimpleAssets.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint64_t>& assetids);
ACTION offer( name owner, name newowner, std::vector<uint64_t>& assetids, string memo);
using offer_action = action_wrapper<"offer"_n, &SimpleAssets::offer>;


Expand Down Expand Up @@ -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<uint64_t>& assetids, uint64_t period );
ACTION delegate( name owner, name to, std::vector<uint64_t>& assetids, uint64_t period, string memo );
using delegate_action = action_wrapper<"delegate"_n, &SimpleAssets::delegate>;


Expand Down
7 changes: 6 additions & 1 deletion ricardian/SimpleAssets.contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -327,6 +329,9 @@

by CryptoLions [ https://cryptolions.io ]
<h1 class="contract"> updatever </h1>
## ACTION NAME: updatever (internal)

<h1 class="contract"> createlog </h1>
## ACTION NAME: createlog (internal)
8 changes: 3 additions & 5 deletions src/SimpleAssets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint64_t>& assetids){
ACTION SimpleAssets::offer( name owner, name newowner, std::vector<uint64_t>& assetids, string memo){

require_auth( owner );
require_recipient( owner );
Expand Down Expand Up @@ -356,7 +356,7 @@ ACTION SimpleAssets::burn( name owner, std::vector<uint64_t>& assetids, string m
}


ACTION SimpleAssets::delegate( name owner, name to, std::vector<uint64_t>& assetids, uint64_t period ){
ACTION SimpleAssets::delegate( name owner, name to, std::vector<uint64_t>& assetids, uint64_t period, string memo ){

require_auth( owner );
require_recipient( owner );
Expand Down Expand Up @@ -390,11 +390,9 @@ ACTION SimpleAssets::delegate( name owner, name to, std::vector<uint64_t>& 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} );
}


Expand Down

0 comments on commit 74e1fd6

Please sign in to comment.