Skip to content

Commit

Permalink
v0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ansigroup committed Mar 27, 2019
1 parent 9718651 commit 88c97e1
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 6 deletions.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Git: https://github.com/CryptoLions/SimpleAssets

Presentation: https://medium.com/@cryptolions/introducing-simple-assets-b4e17caafaa4

Events Receiver Example for authors: https://github.com/CryptoLions/SimpleAssets-EventReceiverExample

---------------------------

There are two ways to use Simple Assets:

1) As an "ownership authority". When deployed on an EOSIO chain, Simple Assets will be a separate contract which other Dapps can call to manage their digital assets. This serves as an additional guarantee to users of the Dapp that the ownership of assets is managed by a reputable outside authority, and that once created, the Dapp can only manage the asset's mdata. All the ownership-related functionality exists outside the game.
Expand All @@ -17,6 +21,16 @@ 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.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).
Marketplaces, exchanges and other reliant contracts will be able to view this info using the following code.
```
Configs configs("simpl1assets"_n, "simpl1assets"_n.value);
configs.get("simpl1assets"_n);
```
- added action `updatever`. It updates version of this SimpleAstes deployment for 3rd party wallets, marketplaces, etc;
- New examples for Event notifications: https://github.com/CryptoLions/SimpleAssets-EventReceiverExample

# Change Log v0.3.0
- Added event notifications using deferred transaction. Assets author will receive notification on assets create, transfer, claim or burn. To receive it please add next action to your author contract:
Expand All @@ -26,7 +40,7 @@ There are two ways to use Simple Assets:
ACTION saeclaim ( name account, std::vector<uint64_t>& assetids );
ACTION saeburn ( name account, std::vector<uint64_t>& assetids, std::string memo );
```
- `untildate` parametr changed to `period` (in seconds) for actions `delegate` and table `sdelegates`
- `untildate` parameter changed to `period` (in seconds) for actions `delegate` and table `sdelegates`


# Change Log v0.2.0
Expand Down
73 changes: 72 additions & 1 deletion 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 Tue Mar 26 14:51:41 2019",
"____comment": "This file was generated with eosio-abigen. DO NOT EDIT Wed Mar 27 13:50:53 2019",
"version": "eosio::abi/1.1",
"structs": [
{
Expand Down Expand Up @@ -168,6 +168,36 @@
}
]
},
{
"name": "createlog",
"base": "",
"fields": [
{
"name": "author",
"type": "name"
},
{
"name": "category",
"type": "name"
},
{
"name": "owner",
"type": "name"
},
{
"name": "idata",
"type": "string"
},
{
"name": "mdata",
"type": "string"
},
{
"name": "assetid",
"type": "uint64"
}
]
},
{
"name": "currency_stats",
"base": "",
Expand Down Expand Up @@ -414,6 +444,20 @@
}
]
},
{
"name": "tokenconfigs",
"base": "",
"fields": [
{
"name": "standard",
"type": "name"
},
{
"name": "version",
"type": "string"
}
]
},
{
"name": "transfer",
"base": "",
Expand Down Expand Up @@ -501,6 +545,16 @@
"type": "string"
}
]
},
{
"name": "updatever",
"base": "",
"fields": [
{
"name": "version",
"type": "string"
}
]
}
],
"types": [],
Expand Down Expand Up @@ -545,6 +599,11 @@
"type": "createf",
"ricardian_contract": "## ACTION NAME: createf\n\n ### INTENT\n\t\tCreates fungible token with specified maximum supply; You can not change anything after creation.\n\n ### Input parameters:\n\t\t`author` - fungible token author;\n\t\t`maximum_supply` - maximum token supply, example \"10000000.0000 GOLD\", \"10000000 SEED\", \"100000000.00 WOOD\". Precision is also important here;\n\t\t`authorctrl` - if true(1) allow token author (and not just owner) to burnf and transferf. Cannot be changed after creation!\n\t\t\n ### TERM\n This Contract expires at the conclusion of code execution.\n\n by CryptoLions [ https://cryptolions.io ]"
},
{
"name": "createlog",
"type": "createlog",
"ricardian_contract": ""
},
{
"name": "delegate",
"type": "delegate",
Expand Down Expand Up @@ -589,6 +648,11 @@
"name": "update",
"type": "update",
"ricardian_contract": "## ACTION NAME: update\n\n ### INTENT\n\t\tUpdate assets mutable data (mdata) field. Action is available only for authors.\n\n ### Input parameters:\n\t\t`author` - authors account;\n\t\t`owner` - current assets owner;\n\t\t`assetid` - assetid to update;\n\t\t`mdata` - stringified json with mutable assets data. All mdata will be replaced;\n\n ### TERM\n This Contract expires at the conclusion of code execution.\n\n by CryptoLions [ https://cryptolions.io ]"
},
{
"name": "updatever",
"type": "updatever",
"ricardian_contract": ""
}
],
"tables": [
Expand Down Expand Up @@ -640,6 +704,13 @@
"index_type": "i64",
"key_names": [],
"key_types": []
},
{
"name": "tokenconfigs",
"type": "tokenconfigs",
"index_type": "i64",
"key_names": [],
"key_types": []
}
],
"ricardian_clauses": [
Expand Down
Binary file modified build/SimpleAssets/SimpleAssets.wasm
Binary file not shown.
37 changes: 36 additions & 1 deletion include/SimpleAssets.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* WebSite: https://simpleassets.io
* GitHub: https://github.com/CryptoLions/SimpleAssets
* Presentation: https://medium.com/@cryptolions/introducing-simple-assets-b4e17caafaa4
*
* Event Receiver: https://github.com/CryptoLions/SimpleAssets-EventReceiverExample
*
*/

Expand All @@ -25,6 +27,13 @@ CONTRACT SimpleAssets : public contract {
public:
using contract::contract;

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
/*
* Update version of this SimpleAstes deployment for 3rd party wallets, marketplaces, etc
*/
ACTION updatever( string version);
using updatever_action = action_wrapper<"updatever"_n, &SimpleAssets::updatever>;


// ===============================================================================================
// ============= Non-Fungible Token Actions ======================================================
Expand Down Expand Up @@ -80,7 +89,14 @@ CONTRACT SimpleAssets : public contract {
ACTION create( name author, name category, name owner, string idata, string mdata, bool requireclaim);
using create_action = action_wrapper<"create"_n, &SimpleAssets::create>;


//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
/*
* Empty action. Used by create action to log assetid so that third party explorers can easily get new asset ids and other information.
*
*/
ACTION createlog( name author, name category, name owner, string idata, string mdata, uint64_t assetid);
using createlog_action = action_wrapper<"createlog"_n, &SimpleAssets::createlog>;

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
/*
* Claim the specified asset (assuming it was offered to claimer by the asset owner).
Expand Down Expand Up @@ -307,6 +323,7 @@ CONTRACT SimpleAssets : public contract {
}



//=============================================================================================================================
//=============================================================================================================================
private:
Expand Down Expand Up @@ -488,6 +505,24 @@ CONTRACT SimpleAssets : public contract {
};

typedef eosio::multi_index< "stat"_n, currency_stats > stats;


//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
/*
* Helps external contracts parse actions and tables correctly (Usefull for decentralized exchanges,
* marketplaces and other contracts that use multiple tokens)
*
* Marketplaces, exchanges and other reliant contracts will be able to view this info using the following code.
* Configs configs("simpl1assets"_n, "simpl1assets"_n.value);
* configs.get("simpl1assets"_n);
*/
TABLE tokenconfigs {
name standard;
std::string version;
};

typedef singleton<"tokenconfigs"_n, tokenconfigs> Configs;

};

Expand Down
22 changes: 19 additions & 3 deletions src/SimpleAssets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,21 @@
* WebSite: https://simpleassets.io
* GitHub: https://github.com/CryptoLions/SimpleAssets
* Presentation: https://medium.com/@cryptolions/introducing-simple-assets-b4e17caafaa4
*
* Event Receiver: https://github.com/CryptoLions/SimpleAssets-EventReceiverExample
*
*/


#include <SimpleAssets.hpp>

ACTION SimpleAssets::updatever( string version ) {
require_auth(get_self());

Configs configs(_self, _self.value);
configs.set(tokenconfigs{"simpleassets"_n, version}, _self);

}

ACTION SimpleAssets::regauthor( name author, string data, string stemplate) {

Expand Down Expand Up @@ -94,6 +103,12 @@ ACTION SimpleAssets::create( name author, name category, name owner, string idat

//Events
sendEvent(author, author, "saecreate"_n, std::make_tuple(owner, newID));
SEND_INLINE_ACTION( *this, createlog, { {_self, "active"_n} }, { author, category, owner, idata, mdata, newID} );
}


ACTION SimpleAssets::createlog( name author, name category, name owner, string idata, string mdata, uint64_t assetid) {
require_auth(get_self());
}


Expand Down Expand Up @@ -664,12 +679,13 @@ void SimpleAssets::sendEvent(name author, name rampayer, name seaction, const st

//------------------------------------------------------------------------------------------------------------

EOSIO_DISPATCH( SimpleAssets, (create)(transfer)(burn)(update)
EOSIO_DISPATCH( SimpleAssets, (create)(createlog)(transfer)(burn)(update)
(offer)(canceloffer)(claim)
(regauthor)(authorupdate)
(delegate)(undelegate)
(createf)(issuef)(transferf)(burnf)
(openf)(closef) )
(openf)(closef)
(updatever))

//============================================================================================================
//=======================================- SimpleAssets.io -==================================================
Expand Down

0 comments on commit 88c97e1

Please sign in to comment.