diff --git a/README.md b/README.md index bc4040d..ee12a67 100644 --- a/README.md +++ b/README.md @@ -674,6 +674,10 @@ to be the main image. ----------------- # Change Logs +## Change Log v1.6.2 +- deprecated sae* actions + brunlog +- createflog and offerflog added + ## Change Log v1.6.1 - support for token-back NFT contract - Changed map structure type to vector in `saeclaim` and `saechautor` log actions diff --git a/build/SimpleAssets/SimpleAssets.abi b/build/SimpleAssets/SimpleAssets.abi index b7b4dac..37b421b 100644 --- a/build/SimpleAssets/SimpleAssets.abi +++ b/build/SimpleAssets/SimpleAssets.abi @@ -167,24 +167,6 @@ } ] }, - { - "name": "burnlog", - "base": "", - "fields": [ - { - "name": "owner", - "type": "name" - }, - { - "name": "assetids", - "type": "uint64[]" - }, - { - "name": "memo", - "type": "string" - } - ] - }, { "name": "burnntt", "base": "", @@ -203,24 +185,6 @@ } ] }, - { - "name": "burnnttlog", - "base": "", - "fields": [ - { - "name": "owner", - "type": "name" - }, - { - "name": "assetids", - "type": "uint64[]" - }, - { - "name": "memo", - "type": "string" - } - ] - }, { "name": "canceloffer", "base": "", @@ -387,6 +351,32 @@ } ] }, + { + "name": "createflog", + "base": "", + "fields": [ + { + "name": "newID", + "type": "uint64" + }, + { + "name": "author", + "type": "name" + }, + { + "name": "maximum_supply", + "type": "asset" + }, + { + "name": "authorctrl", + "type": "bool" + }, + { + "name": "data", + "type": "string" + } + ] + }, { "name": "createlog", "base": "", @@ -766,68 +756,28 @@ ] }, { - "name": "openf", + "name": "offerflog", "base": "", "fields": [ { - "name": "owner", - "type": "name" - }, - { - "name": "author", - "type": "name" - }, - { - "name": "symbol", - "type": "symbol" - }, - { - "name": "ram_payer", - "type": "name" - } - ] - }, - { - "name": "saeburn", - "base": "", - "fields": [ - { - "name": "author", - "type": "name" + "name": "newID", + "type": "uint64" }, { "name": "owner", "type": "name" }, { - "name": "assetids", - "type": "uint64[]" - }, - { - "name": "memo", - "type": "string" - } - ] - }, - { - "name": "saechauthor", - "base": "", - "fields": [ - { - "name": "author", - "type": "name" - }, - { - "name": "newauthor", + "name": "newowner", "type": "name" }, { - "name": "owner", + "name": "author", "type": "name" }, { - "name": "assetids", - "type": "tuple_uint64_name[]" + "name": "quantity", + "type": "asset" }, { "name": "memo", @@ -836,80 +786,24 @@ ] }, { - "name": "saeclaim", - "base": "", - "fields": [ - { - "name": "author", - "type": "name" - }, - { - "name": "claimer", - "type": "name" - }, - { - "name": "assetids", - "type": "tuple_uint64_name[]" - } - ] - }, - { - "name": "saecreate", + "name": "openf", "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": "requireclaim", - "type": "bool" - } - ] - }, - { - "name": "saetransfer", - "base": "", - "fields": [ { "name": "author", "type": "name" }, { - "name": "from", - "type": "name" + "name": "symbol", + "type": "symbol" }, { - "name": "to", + "name": "ram_payer", "type": "name" - }, - { - "name": "assetids", - "type": "uint64[]" - }, - { - "name": "memo", - "type": "string" } ] }, @@ -1235,20 +1129,6 @@ } ] }, - { - "name": "tuple_uint64_name", - "base": "", - "fields": [ - { - "name": "field_0", - "type": "uint64" - }, - { - "name": "field_1", - "type": "name" - } - ] - }, { "name": "undelegate", "base": "", @@ -1372,21 +1252,11 @@ "type": "burnflog", "ricardian_contract": "---\nspec_version: 0.0.2\ntitle: burnflog (internal)\nsummary: burnflog (internal) \nicon: https://cryptolions.io/assets/images/sa-icons-256/burn.png#76954820d84563187e968b461a706ab089a9c00f5332df96a4e5bb2e69ed5e84\n---" }, - { - "name": "burnlog", - "type": "burnlog", - "ricardian_contract": "---\nspec_version: 0.0.2\ntitle: burnlog (internal)\nsummary: burnlog (internal) \nicon: https://cryptolions.io/assets/images/sa-icons-256/burn.png#76954820d84563187e968b461a706ab089a9c00f5332df96a4e5bb2e69ed5e84\n---" - }, { "name": "burnntt", "type": "burnntt", "ricardian_contract": "---\nspec_version: 0.0.2\ntitle: Burn non transferable asset\nsummary: Burn non transferable asset\nicon: https://cryptolions.io/assets/images/sa-icons-256/burn.png#76954820d84563187e968b461a706ab089a9c00f5332df96a4e5bb2e69ed5e84\n---\n\nThis action is only available for the asset owner. After executing, the asset will disappear forever, and RAM used for asset will be released.\n\nInput parameters:\n`owner` - current asset owner account;\n`assetids` - array of assetid's to burn;\n`memo` - memo for burn action;\n\nTERM\nThis Contract expires at the conclusion of code execution.\nby CryptoLions [ https://cryptolions.io ]" }, - { - "name": "burnnttlog", - "type": "burnnttlog", - "ricardian_contract": "---\nspec_version: 0.0.2\ntitle: burnnttlog (internal)\nsummary: burnnttlog (internal) \nicon: https://cryptolions.io/assets/images/sa-icons-256/burn.png#76954820d84563187e968b461a706ab089a9c00f5332df96a4e5bb2e69ed5e84\n---" - }, { "name": "canceloffer", "type": "canceloffer", @@ -1432,6 +1302,11 @@ "type": "createf", "ricardian_contract": "---\nspec_version: 0.0.2\ntitle: Creates fungible token\nsummary: Creates fungible token\nicon: https://cryptolions.io/assets/images/sa-icons-256/claimf.png#80086207646470fa9cbaf4638ba0dedec96ea0e84d5059b567adc9e4b8543c30\n---\n\nCreates fungible token with specified maximum supply; You can not change anything after creation.\n\nInput parameters:\n`author` - fungible token author;\n`maximum_supply` - maximum token supply, example \"10000000.0000 GOLD\", \"10000000 SEED\", \"100000000.00 WOOD\". Precision is also important here;\n`authorctrl` - if true(1) allow token author (and not just owner) to burnf and transferf. Cannot be changed after creation!\n`data` - stringify json (recommend including keys `img` and `name` for better displaying by markets)\n\nTERM\nThis Contract expires at the conclusion of code execution.\nby CryptoLions [ https://cryptolions.io ]" }, + { + "name": "createflog", + "type": "createflog", + "ricardian_contract": "---\nspec_version: 0.0.2\ntitle: createlog (internal)\nsummary: createlog (internal) \nicon: https://cryptolions.io/assets/images/sa-icons-256/claimf.png#80086207646470fa9cbaf4638ba0dedec96ea0e84d5059b567adc9e4b8543c30\n---\n\nTERM\nThis Contract expires at the conclusion of code execution.\nby CryptoLions [ https://cryptolions.io ]" + }, { "name": "createlog", "type": "createlog", @@ -1507,36 +1382,16 @@ "type": "offerf", "ricardian_contract": "---\nspec_version: 0.0.2\ntitle: Offer fungible tokens to claim\nsummary: Offer fungible tokens for another EOS user to claim\nicon: https://cryptolions.io/assets/images/sa-icons-256/offerf.png#a34462918e536372610a523225e5221cd2685eff3c329499ded7298907f8524b\n---\n\nThis is an alternative to the transfer action. Offer can be used by a FT owner to transfer the FTs without using their RAM. After an offer is made, the account specified in new owner is able to make a claim, and take control of the asset using their RAM. FTs will be removed from the owner's balance while the offer is open\n\nInput parameters:\n`owner` - original owner of the FTs\n`newowner` - account which will be able to claim the offer\n`author` - account of fungible token author;\t\n`quantity` - amount to transfer, example \"1.00 WOOD\";\n`memo` - offer's comment;\n\nTERM\nThis Contract expires at the conclusion of code execution.\nby CryptoLions [ https://cryptolions.io ]" }, + { + "name": "offerflog", + "type": "offerflog", + "ricardian_contract": "---\nspec_version: 0.0.2\ntitle: offerflog (internal)\nsummary: offerflog (internal) \nicon: https://cryptolions.io/assets/images/sa-icons-256/claimf.png#80086207646470fa9cbaf4638ba0dedec96ea0e84d5059b567adc9e4b8543c30\n---\n\nTERM\nThis Contract expires at the conclusion of code execution.\nby CryptoLions [ https://cryptolions.io ]" + }, { "name": "openf", "type": "openf", "ricardian_contract": "---\nspec_version: 0.0.2\ntitle: Opens accounts table for fungible token\nsummary: Opens accounts table for specified fungible token\nicon: https://cryptolions.io/assets/images/sa-icons-256/attach.png#0b039adbbe1011a494959963917df4765dbae378004e00911464f865e58ef452\n---\n\nInput parameters:\n`owner` - account who woud like to close table with fungible token;\n`author` - account of fungible token author;\n`symbol` - token symbol, example \"WOOD\", \"ROCK\", \"GOLD\";\n`ram_payer` - account who will pay for ram used for table creation;\n\nTERM\nThis Contract expires at the conclusion of code execution.\nby CryptoLions [ https://cryptolions.io ]" }, - { - "name": "saeburn", - "type": "saeburn", - "ricardian_contract": "---\nspec_version: 0.0.2\ntitle: Internal action used for creating log\nsummary: Internal action used for creating log\nicon: https://cryptolions.io/assets/images/sa-icons-256/burn.png#76954820d84563187e968b461a706ab089a9c00f5332df96a4e5bb2e69ed5e84\n---\n\nThis action is called during burn in deferred transaction \n\nInput parameters:\n`author` - asset's author;\n`owner` - current asset owner account;\n`assetids` - array of assetid's to burn;\n`memo` - memo for burn action;\n\nTERM\nThis Contract expires at the conclusion of code execution.\nby CryptoLions [ https://cryptolions.io ]" - }, - { - "name": "saechauthor", - "type": "saechauthor", - "ricardian_contract": "---\nspec_version: 0.0.2\ntitle: Internal action used for creating log\nsummary: Internal action used for creating log\nicon: https://cryptolions.io/assets/images/sa-icons-256/regauthor.png#c6a539be8e7dfd1a4c466ba9cabfd13571cd77d5c988c652d2e8f87096f3548e\n---\t\n\nInput parameters:\n`author` - asset's author, who will able to change author name asset's;\n`newauthor` - asset's new author name;\n`owner` - assets owner;\n`assetids` - array of assetid's\n\nTERM\nThis Contract expires at the conclusion of code execution.\nby CryptoLions [ https://cryptolions.io ]" - }, - { - "name": "saeclaim", - "type": "saeclaim", - "ricardian_contract": "---\nspec_version: 0.0.2\ntitle: Internal action used for creating log\nsummary: Internal action used for creating log\nicon: https://cryptolions.io/assets/images/sa-icons-256/claim.png#8c3fdf140ea14a3cb9762a0f6ec0f0d73f8c2eeeec3ea2f109f394a9f35f472d\n---\n\nInput parameters:\n`author` - asset's author, who will able to updated asset's mdata;\n`claimer` - account claiming the asset;\n`assetids` - array of assetid's to claim;\n\nTERM\nThis Contract expires at the conclusion of code execution.\nby CryptoLions [ https://cryptolions.io ]" - }, - { - "name": "saecreate", - "type": "saecreate", - "ricardian_contract": "---\nspec_version: 0.0.2\ntitle: Internal action used for creating log\nsummary: Internal action used for creating log\nicon: https://cryptolions.io/assets/images/sa-icons-256/create.png#db2bc53cef5dbbce5247543a91234373ec4bd1baf743301a0d92a35b053eeb70\n---\t\n\nInput parameters:\n`author` - asset's author, who will able to updated asset's mdata;\n`category` - assets category;\n`owner` - assets owner;\n`idata` - stringified json with immutable assets data\n`mdata` - stringified json with mutable assets data, can be changed only by author\n`requireclaim` - true or false. If disabled, upon creation, the asset will be transfered to owner (but \n\t\t\t\t but AUTHOR'S memory will be used until the asset is transferred again). If enabled,\n\t\t\t\t author will remain the owner, but an offer will be created for the account specified in \n\t\t\t\t the owner field to claim the asset using the account's RAM.\n\nTERM\nThis Contract expires at the conclusion of code execution.\nby CryptoLions [ https://cryptolions.io ]" - }, - { - "name": "saetransfer", - "type": "saetransfer", - "ricardian_contract": "---\nspec_version: 0.0.2\ntitle: Internal action used for creating log\nsummary: Internal action used for creating log\nicon: https://cryptolions.io/assets/images/sa-icons-256/transfer.png#23227a4901414db5cd0973d1cc5df13f9b82375b21c6315fd3402cb4acd50cbf\n---\n\nThis action is called during transfer in deferred transaction \n\nInput parameters:\n`author` - asset's author;\n`from` - account who sends the asset;\n`to` - account of receiver;\n`assetids` - array of assetid's to transfer;\n`memo` - transfers comment;\n\nTERM\nThis Contract expires at the conclusion of code execution.\nby CryptoLions [ https://cryptolions.io ]" - }, { "name": "setarampayer", "type": "setarampayer", diff --git a/build/SimpleAssets/SimpleAssets.wasm b/build/SimpleAssets/SimpleAssets.wasm index 15c0ee6..994f00d 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 0b0bdb7..e9fdec3 100644 --- a/include/SimpleAssets.hpp +++ b/include/SimpleAssets.hpp @@ -1,7 +1,7 @@ /* * @file * @author (C) 2021 by CryptoLions [ https://CryptoLions.io ] - * @version 1.6.0 + * @version 1.6.2 * * @section LICENSE * @@ -188,53 +188,56 @@ CONTRACT SimpleAssets : public contract{ using createlog_action = action_wrapper< "createlog"_n, &SimpleAssets::createlog >; /* - * Create a new log entry for burn action. + * Create a new log entry for burnflog action. * * This action is doeing nothing, and it can only be called by SimpleAsset contract. It creates an entry * in transaction trace, so that that third party explorers can retrieve burn asset IDs and other * information. * - * @param owner is current asset owner. - * @param assetids is array of asset id's to burn. - * @param memo is burn comment. + * @param from is account that burns the token. + * @param author is account of fungible token author. + * @param quantity is amount to burn, example "1.00 WOOD". + * @param memo is memo for burnf action. * @return no return value. */ - ACTION burnlog( name owner, vector& assetids, string memo ); - using burnlog_action = action_wrapper< "burnlog"_n, &SimpleAssets::burnlog >; + ACTION burnflog( name from, name author, asset quantity, string memo ); + using burnflog_action = action_wrapper< "burnflog"_n, &SimpleAssets::burnflog >; /* - * Create a new log entry for burnnttlog action. + * Create a new log entry for createflog action. * * This action is doeing nothing, and it can only be called by SimpleAsset contract. It creates an entry * in transaction trace, so that that third party explorers can retrieve burn asset IDs and other * information. * - * @param owner is current asset owner. - * @param assetids is array of asset id's to burnnttlog. - * @param memo is burnnttlog comment. + * @param author is the fungible token author. + * @param maximum_supply is created symbol and quantity of fungible tokens. Example "1.00 WOOD". + * @param authorctrl is new owner of fungible token. + * @param owner is the owner who offer fungible token. * @return no return value. */ - ACTION burnnttlog( name owner, vector& assetids, string memo ); - using burnnttlog_action = action_wrapper< "burnnttlog"_n, &SimpleAssets::burnnttlog >; + ACTION createflog(uint64_t newID, name author, asset maximum_supply, bool authorctrl, string data); + using createflog_action = action_wrapper< "createflog"_n, &SimpleAssets::createflog >; /* - * Create a new log entry for burnflog action. + * Create a new log entry for offerflog action. * * This action is doeing nothing, and it can only be called by SimpleAsset contract. It creates an entry * in transaction trace, so that that third party explorers can retrieve burn asset IDs and other * information. * - * @param from is account that burns the token. - * @param author is account of fungible token author. - * @param quantity is amount to burn, example "1.00 WOOD". - * @param memo is memo for burnf action. + * @param newID is id of offer fungible token. + * @param author is the fungible token author. + * @param quantity is offered quantity of fungible tokens. + * @param newowner is new owner of fungible token. + * @param owner is the owner who offer fungible token. * @return no return value. */ - ACTION burnflog( name from, name author, asset quantity, string memo ); - using burnflog_action = action_wrapper< "burnflog"_n, &SimpleAssets::burnflog >; + ACTION offerflog(uint64_t newID, name owner, name newowner, name author, asset quantity, string memo); + using offerflog_action = action_wrapper< "offerflog"_n, &SimpleAssets::offerflog >; /* * Claim asset. @@ -729,88 +732,6 @@ CONTRACT SimpleAssets : public contract{ ACTION mdremove( uint64_t id ); using mdremove_action = action_wrapper< "mdremove"_n, &SimpleAssets::mdremove >; - /* - * Action for notification after transfering one or more assets. - * - * This action will notify author with help of require_recepient - * after transfers one or more assets. - * - * @param author is author of the asset. - * @param from is account who sends the asset. - * @param to is account of receiver. - * @param assetids is array of assetid's to transfer. - * @param memo is transfers comment. - * @return no return value. - */ - ACTION saetransfer( name author, name from, name to, vector& assetids, string memo ); - using saetransfer_action = action_wrapper< "saetransfer"_n, &SimpleAssets::saetransfer >; - - /* - * Action for notification after burning asset. - * - * This action will notify author with help of require_recepient - * after burn one or more assets. - * - * @param author is author of the asset. - * @param owner is current asset owner account. - * @param assetids is array of asset id's to burn. - * @param memo is memo for burn action. - * @return no return value. - */ - ACTION saeburn( name author, name owner, vector& assetids, string memo ); - using saeburn_action = action_wrapper< "saeburn"_n, &SimpleAssets::saeburn >; - - /* - * Action for notification after changing author of asset. - * - * This action will notify author with help of require_recepient - * after chaning of one or more assets author. - * - * @param author is author of the asset. - * @param newauthor is new author of the asset. - * @param owner is current asset owner account. - * @param assetids is array of asset id's to change author. - * @param memo is memo for change author action. - * @return no return value. - */ - ACTION saechauthor( name author, name newauthor, name owner, vector< tuple >& assetids, string memo ); - using saechauthor_action = action_wrapper< "saechauthor"_n, &SimpleAssets::saechauthor >; - - /* - * Action for notification after creating a new asset. - * - * This action will notify author with help of require_recepient - * after creating a new asset. - * - * @param author is the asset's author. This account is allowed to update the asset's mdata. - * @param category is asset category. - * @param owner is asset owner. - * @param idata is stringified JSON or sha256 string with immutable asset data. - * @param mdata is stringified JSON or sha256 string with mutable asset data. It can be changed only by author. - * @param assetid is new asset id. - * @param requireclaim is true or false. If set to "false", the newly created asset will be transferred to the - * owner (but author's RAM will be used until the asset is transferred again). If set to - * "true", the author will remain to be the owner, but an offer will be created for the - * account specified in the owner field to claim the asset using the owner's RAM. - * @return no return value. - */ - ACTION saecreate( name author, name category, name owner, string idata, string mdata, uint64_t assetid, bool requireclaim ); - using saecreate_action = action_wrapper< "saecreate"_n, &SimpleAssets::saecreate >; - - /* - * Action for notification after claiming the assets. - * - * This action will notify author with help of require_recepient - * after claiming the assets. - * - * @param claimer is account claiming the asset. - * @param assetids is array of asset id's to claim. - * @return no return value. - */ - - ACTION saeclaim(name author, name claimer, vector< tuple >& assetids); - using saeclaim_action = action_wrapper< "saeclaim"_n, &SimpleAssets::saeclaim >; - /* * Action for setting a ram payer for author and category. * diff --git a/ricardian/SimpleAssets.contracts.md b/ricardian/SimpleAssets.contracts.md index 7a173de..017cb89 100644 --- a/ricardian/SimpleAssets.contracts.md +++ b/ricardian/SimpleAssets.contracts.md @@ -576,15 +576,6 @@ summary: createlog (internal) icon: https://cryptolions.io/assets/images/sa-icons-256/claimf.png#80086207646470fa9cbaf4638ba0dedec96ea0e84d5059b567adc9e4b8543c30 --- -

burnlog

- ---- -spec_version: 0.0.2 -title: burnlog (internal) -summary: burnlog (internal) -icon: https://cryptolions.io/assets/images/sa-icons-256/burn.png#76954820d84563187e968b461a706ab089a9c00f5332df96a4e5bb2e69ed5e84 ---- -

burnflog

--- @@ -594,15 +585,6 @@ summary: burnflog (internal) icon: https://cryptolions.io/assets/images/sa-icons-256/burn.png#76954820d84563187e968b461a706ab089a9c00f5332df96a4e5bb2e69ed5e84 --- -

burnnttlog

- ---- -spec_version: 0.0.2 -title: burnnttlog (internal) -summary: burnnttlog (internal) -icon: https://cryptolions.io/assets/images/sa-icons-256/burn.png#76954820d84563187e968b461a706ab089a9c00f5332df96a4e5bb2e69ed5e84 ---- -

createntt

--- @@ -758,141 +740,62 @@ TERM This Contract expires at the conclusion of code execution. by CryptoLions [ https://cryptolions.io ] -

saetransfer

- ---- -spec_version: 0.0.2 -title: Internal action used for creating log -summary: Internal action used for creating log -icon: https://cryptolions.io/assets/images/sa-icons-256/transfer.png#23227a4901414db5cd0973d1cc5df13f9b82375b21c6315fd3402cb4acd50cbf ---- - -This action is called during transfer in deferred transaction - -Input parameters: -`author` - asset's author; -`from` - account who sends the asset; -`to` - account of receiver; -`assetids` - array of assetid's to transfer; -`memo` - transfers comment; - -TERM -This Contract expires at the conclusion of code execution. -by CryptoLions [ https://cryptolions.io ] - -

saeburn

- ---- -spec_version: 0.0.2 -title: Internal action used for creating log -summary: Internal action used for creating log -icon: https://cryptolions.io/assets/images/sa-icons-256/burn.png#76954820d84563187e968b461a706ab089a9c00f5332df96a4e5bb2e69ed5e84 ---- - -This action is called during burn in deferred transaction - -Input parameters: -`author` - asset's author; -`owner` - current asset owner account; -`assetids` - array of assetid's to burn; -`memo` - memo for burn action; - -TERM -This Contract expires at the conclusion of code execution. -by CryptoLions [ https://cryptolions.io ] - -

saechauthor

+

setarampayer

--- spec_version: 0.0.2 -title: Internal action used for creating log -summary: Internal action used for creating log -icon: https://cryptolions.io/assets/images/sa-icons-256/regauthor.png#c6a539be8e7dfd1a4c466ba9cabfd13571cd77d5c988c652d2e8f87096f3548e ---- - -Input parameters: -`author` - asset's author, who will able to change author name asset's; -`newauthor` - asset's new author name; -`owner` - assets owner; -`assetids` - array of assetid's - -TERM -This Contract expires at the conclusion of code execution. -by CryptoLions [ https://cryptolions.io ] - -

saecreate

- +title: Action for setting a ram payer for author and category. +summary: Action for setting a ram payer for author and category. +icon: https://cryptolions.io/assets/images/sa-icons-256/claim.png#8c3fdf140ea14a3cb9762a0f6ec0f0d73f8c2eeeec3ea2f109f394a9f35f472d --- -spec_version: 0.0.2 -title: Internal action used for creating log -summary: Internal action used for creating log -icon: https://cryptolions.io/assets/images/sa-icons-256/create.png#db2bc53cef5dbbce5247543a91234373ec4bd1baf743301a0d92a35b053eeb70 ---- Input parameters: -`author` - asset's author, who will able to updated asset's mdata; -`category` - assets category; -`owner` - assets owner; -`idata` - stringified json with immutable assets data -`mdata` - stringified json with mutable assets data, can be changed only by author -`requireclaim` - true or false. If disabled, upon creation, the asset will be transfered to owner (but - but AUTHOR'S memory will be used until the asset is transferred again). If enabled, - author will remain the owner, but an offer will be created for the account specified in - the owner field to claim the asset using the account's RAM. +`author` - asset's author, who will able to updated asset's mdata; +`category` - assets category; +`usearam` - flag for on or off author is a ram payer functionaity; TERM This Contract expires at the conclusion of code execution. by CryptoLions [ https://cryptolions.io ] -

saeclaim

+

delarampayer

--- spec_version: 0.0.2 -title: Internal action used for creating log -summary: Internal action used for creating log +title: Action for deleting a ram payer record; +summary: Action for deleting a ram payer record; icon: https://cryptolions.io/assets/images/sa-icons-256/claim.png#8c3fdf140ea14a3cb9762a0f6ec0f0d73f8c2eeeec3ea2f109f394a9f35f472d --- Input parameters: -`author` - asset's author, who will able to updated asset's mdata; -`claimer` - account claiming the asset; -`assetids` - array of assetid's to claim; +`id` - is id of a ram payer record; TERM This Contract expires at the conclusion of code execution. by CryptoLions [ https://cryptolions.io ] -

setarampayer

+

createflog

--- spec_version: 0.0.2 -title: Action for setting a ram payer for author and category. -summary: Action for setting a ram payer for author and category. -icon: https://cryptolions.io/assets/images/sa-icons-256/claim.png#8c3fdf140ea14a3cb9762a0f6ec0f0d73f8c2eeeec3ea2f109f394a9f35f472d +title: createlog (internal) +summary: createlog (internal) +icon: https://cryptolions.io/assets/images/sa-icons-256/claimf.png#80086207646470fa9cbaf4638ba0dedec96ea0e84d5059b567adc9e4b8543c30 --- -Input parameters: -`author` - asset's author, who will able to updated asset's mdata; -`category` - assets category; -`usearam` - flag for on or off author is a ram payer functionaity; - TERM This Contract expires at the conclusion of code execution. by CryptoLions [ https://cryptolions.io ] -

delarampayer

+

offerflog

--- spec_version: 0.0.2 -title: Action for deleting a ram payer record; -summary: Action for deleting a ram payer record; -icon: https://cryptolions.io/assets/images/sa-icons-256/claim.png#8c3fdf140ea14a3cb9762a0f6ec0f0d73f8c2eeeec3ea2f109f394a9f35f472d +title: offerflog (internal) +summary: offerflog (internal) +icon: https://cryptolions.io/assets/images/sa-icons-256/claimf.png#80086207646470fa9cbaf4638ba0dedec96ea0e84d5059b567adc9e4b8543c30 --- -Input parameters: -`id` - is id of a ram payer record; - TERM This Contract expires at the conclusion of code execution. by CryptoLions [ https://cryptolions.io ] - diff --git a/ricardian/SimpleAssets.contracts.md.in b/ricardian/SimpleAssets.contracts.md.in index 6e74a71..63a9b10 100644 --- a/ricardian/SimpleAssets.contracts.md.in +++ b/ricardian/SimpleAssets.contracts.md.in @@ -576,15 +576,6 @@ summary: createlog (internal) icon: @ICON_BASE_URL@/@CLAIMF_ICON_URI@ --- -

burnlog

- ---- -spec_version: 0.0.2 -title: burnlog (internal) -summary: burnlog (internal) -icon: @ICON_BASE_URL@/@BURN_ICON_URI@ ---- -

burnflog

--- @@ -594,15 +585,6 @@ summary: burnflog (internal) icon: @ICON_BASE_URL@/@BURN_ICON_URI@ --- -

burnnttlog

- ---- -spec_version: 0.0.2 -title: burnnttlog (internal) -summary: burnnttlog (internal) -icon: @ICON_BASE_URL@/@BURN_ICON_URI@ ---- -

createntt

--- @@ -758,141 +740,62 @@ TERM This Contract expires at the conclusion of code execution. by CryptoLions [ https://cryptolions.io ] -

saetransfer

- ---- -spec_version: 0.0.2 -title: Internal action used for creating log -summary: Internal action used for creating log -icon: @ICON_BASE_URL@/@TRANSFER_ICON_URI@ ---- - -This action is called during transfer in deferred transaction - -Input parameters: -`author` - asset's author; -`from` - account who sends the asset; -`to` - account of receiver; -`assetids` - array of assetid's to transfer; -`memo` - transfers comment; - -TERM -This Contract expires at the conclusion of code execution. -by CryptoLions [ https://cryptolions.io ] - -

saeburn

- ---- -spec_version: 0.0.2 -title: Internal action used for creating log -summary: Internal action used for creating log -icon: @ICON_BASE_URL@/@BURN_ICON_URI@ ---- - -This action is called during burn in deferred transaction - -Input parameters: -`author` - asset's author; -`owner` - current asset owner account; -`assetids` - array of assetid's to burn; -`memo` - memo for burn action; - -TERM -This Contract expires at the conclusion of code execution. -by CryptoLions [ https://cryptolions.io ] - -

saechauthor

+

setarampayer

--- spec_version: 0.0.2 -title: Internal action used for creating log -summary: Internal action used for creating log -icon: @ICON_BASE_URL@/@REGAUTHOR_ICON_URI@ ---- - -Input parameters: -`author` - asset's author, who will able to change author name asset's; -`newauthor` - asset's new author name; -`owner` - assets owner; -`assetids` - array of assetid's - -TERM -This Contract expires at the conclusion of code execution. -by CryptoLions [ https://cryptolions.io ] - -

saecreate

- +title: Action for setting a ram payer for author and category. +summary: Action for setting a ram payer for author and category. +icon: @ICON_BASE_URL@/@CLAIM_ICON_URI@ --- -spec_version: 0.0.2 -title: Internal action used for creating log -summary: Internal action used for creating log -icon: @ICON_BASE_URL@/@CREATE_ICON_URI@ ---- Input parameters: -`author` - asset's author, who will able to updated asset's mdata; -`category` - assets category; -`owner` - assets owner; -`idata` - stringified json with immutable assets data -`mdata` - stringified json with mutable assets data, can be changed only by author -`requireclaim` - true or false. If disabled, upon creation, the asset will be transfered to owner (but - but AUTHOR'S memory will be used until the asset is transferred again). If enabled, - author will remain the owner, but an offer will be created for the account specified in - the owner field to claim the asset using the account's RAM. +`author` - asset's author, who will able to updated asset's mdata; +`category` - assets category; +`usearam` - flag for on or off author is a ram payer functionaity; TERM This Contract expires at the conclusion of code execution. by CryptoLions [ https://cryptolions.io ] -

saeclaim

+

delarampayer

--- spec_version: 0.0.2 -title: Internal action used for creating log -summary: Internal action used for creating log +title: Action for deleting a ram payer record; +summary: Action for deleting a ram payer record; icon: @ICON_BASE_URL@/@CLAIM_ICON_URI@ --- Input parameters: -`author` - asset's author, who will able to updated asset's mdata; -`claimer` - account claiming the asset; -`assetids` - array of assetid's to claim; +`id` - is id of a ram payer record; TERM This Contract expires at the conclusion of code execution. by CryptoLions [ https://cryptolions.io ] -

setarampayer

+

createflog

--- spec_version: 0.0.2 -title: Action for setting a ram payer for author and category. -summary: Action for setting a ram payer for author and category. -icon: @ICON_BASE_URL@/@CLAIM_ICON_URI@ +title: createlog (internal) +summary: createlog (internal) +icon: @ICON_BASE_URL@/@CLAIMF_ICON_URI@ --- -Input parameters: -`author` - asset's author, who will able to updated asset's mdata; -`category` - assets category; -`usearam` - flag for on or off author is a ram payer functionaity; - TERM This Contract expires at the conclusion of code execution. by CryptoLions [ https://cryptolions.io ] -

delarampayer

+

offerflog

--- spec_version: 0.0.2 -title: Action for deleting a ram payer record; -summary: Action for deleting a ram payer record; -icon: @ICON_BASE_URL@/@CLAIM_ICON_URI@ +title: offerflog (internal) +summary: offerflog (internal) +icon: @ICON_BASE_URL@/@CLAIMF_ICON_URI@ --- -Input parameters: -`id` - is id of a ram payer record; - TERM This Contract expires at the conclusion of code execution. -by CryptoLions [ https://cryptolions.io ] - +by CryptoLions [ https://cryptolions.io ] \ No newline at end of file diff --git a/src/SimpleAssets.cpp b/src/SimpleAssets.cpp index d302a27..b8038bf 100644 --- a/src/SimpleAssets.cpp +++ b/src/SimpleAssets.cpp @@ -17,8 +17,6 @@ ACTION SimpleAssets::changeauthor( name author, name newauthor, name owner, vect sassets assets_f( _self, owner.value ); - map< name, vector< tuple > > uniqauthor; - for ( auto i = 0; i < assetids.size(); ++i ) { const auto itr = assets_f.require_find( assetids[i], string("asset id: " + to_string(assetids[i]) +" was not found").c_str() ); @@ -41,21 +39,9 @@ ACTION SimpleAssets::changeauthor( name author, name newauthor, name owner, vect assets_f.modify( itr, author, [&]( auto& a ) { a.author = newauthor; }); - - uniqauthor[itr->author].emplace_back(make_tuple(assetids[i] , itr->owner)); - } - - // Send Event as deferred - for ( auto uniqauthorIt = uniqauthor.begin(); uniqauthorIt != uniqauthor.end(); ++uniqauthorIt ) { - name keyauthor = move( uniqauthorIt->first ); - sendEvent( _self, author, "saechauthor"_n, make_tuple( author, newauthor, owner, uniqauthor[keyauthor], memo ) ); } } -ACTION SimpleAssets::saechauthor( name author, name newauthor, name owner, vector< tuple >& assetids, string memo ) { - require_recipient( author ); -} - ACTION SimpleAssets::authorreg( name author, string dappinfo, string fieldtypes, string priorityimg ) { require_auth( author ); @@ -126,14 +112,9 @@ ACTION SimpleAssets::create( name author, name category, name owner, string idat }); //Events - sendEvent( _self, author, "saecreate"_n, make_tuple( author, category, owner, idata, mdata, newID, requireclaim ) ); SEND_INLINE_ACTION( *this, createlog, { {_self, "active"_n} }, { author, category, owner, idata, mdata, newID, requireclaim } ); } -ACTION SimpleAssets::saecreate( name author, name category, name owner, string idata, string mdata, uint64_t assetid, bool requireclaim ) { - require_recipient( author ); -} - ACTION SimpleAssets::createlog( name author, name category, name owner, string idata, string mdata, uint64_t assetid, bool requireclaim ) { require_auth( get_self() ); @@ -194,15 +175,6 @@ ACTION SimpleAssets::claim( name claimer, vector& assetids ) { if (empty_scope) { assets_t.erase(assets_t.find(IMPOSSIBLE_ID)); } - - for ( auto uniqauthorIt = uniqauthor.begin(); uniqauthorIt != uniqauthor.end(); ++uniqauthorIt ) { - name keyauthor = move( uniqauthorIt->first ); - sendEvent( _self, claimer, "saeclaim"_n, make_tuple( keyauthor, claimer, uniqauthor[keyauthor] ) ); - } -} - -ACTION SimpleAssets::saeclaim(name author, name claimer, vector< tuple >& assetids) { - require_recipient(author); } void SimpleAssets::check_empty_vector( vector& vector_ids, string vector_name ) { @@ -291,12 +263,6 @@ ACTION SimpleAssets::transfer( name from, name to, vector& assetids, s if ( empty_scope ) { assets_t.erase( assets_t.find( IMPOSSIBLE_ID ) ); } - - //Send Event as deferred - for ( auto uniqauthorIt = uniqauthor.begin(); uniqauthorIt != uniqauthor.end(); ++uniqauthorIt ) { - name keyauthor = move( uniqauthorIt->first ); - sendEvent( _self, authorized_account, "saetransfer"_n, make_tuple( keyauthor, from, to, uniqauthor[keyauthor], memo ) ); - } } name SimpleAssets::get_payer( name author, name category, uint64_t id ) @@ -315,10 +281,6 @@ name SimpleAssets::get_payer( name author, name category, uint64_t id ) return result; } -ACTION SimpleAssets::saetransfer(name author, name from, name to, vector& assetids, string memo) { - require_recipient(author); -} - ACTION SimpleAssets::update( name author, name owner, uint64_t assetid, string mdata ) { require_auth( author ); @@ -410,32 +372,12 @@ ACTION SimpleAssets::burn( name owner, vector& assetids, string memo ) uniqauthor[itr->author].push_back( assetids[i] ); assets_f.erase(itr); } - - //Send Event as deferred - for ( auto uniqauthorIt = uniqauthor.begin(); uniqauthorIt != uniqauthor.end(); ++uniqauthorIt ) { - name keyauthor = move( uniqauthorIt->first ); - sendEvent(_self, owner, "saeburn"_n, make_tuple( keyauthor, owner, uniqauthor[keyauthor], memo ) ); - } - - SEND_INLINE_ACTION(*this, burnlog, { {_self, "active"_n} }, { owner, assetids, memo }); -} - -ACTION SimpleAssets::saeburn(name author, name owner, vector& assetids, string memo) { - require_recipient(author); } ACTION SimpleAssets::burnflog( name from, name author, asset quantity, string memo ) { require_auth(get_self()); } -ACTION SimpleAssets::burnnttlog(name owner, vector& assetids, string memo) { - require_auth(get_self()); -} - -ACTION SimpleAssets::burnlog( name owner, vector& assetids, string memo ) { - require_auth(get_self()); -} - ACTION SimpleAssets::delegate( name owner, name to, vector& assetids, uint64_t period, bool redelegate, string memo ) { check( owner != to, "cannot delegate to yourself" ); @@ -620,14 +562,22 @@ ACTION SimpleAssets::createf( name author, asset maximum_supply, bool authorctrl stats statstable( _self, author.value ); check( statstable.find( sym.code().raw() ) == statstable.end(), "token with symbol already exists" ); + const auto newID = getid(asset_id); + statstable.emplace( author, [&]( auto& s ) { s.supply.symbol = maximum_supply.symbol; s.max_supply = maximum_supply; s.issuer = author; - s.id = getid( asset_id ); + s.id = newID; s.authorctrl = authorctrl; s.data = data; }); + + SEND_INLINE_ACTION(*this, createflog, { {_self, "active"_n} }, { newID, author, maximum_supply, authorctrl, data }); +} + +ACTION SimpleAssets::createflog(uint64_t newID, name author, asset maximum_supply, bool authorctrl, string data) { + require_auth(get_self()); } ACTION SimpleAssets::updatef( name author, symbol sym, string data ) { @@ -732,8 +682,10 @@ ACTION SimpleAssets::offerf( name owner, name newowner, name author, asset quant } } + const auto newID = getid(offer_id); + offerft.emplace( owner, [&]( auto& s ) { - s.id = getid( offer_id ); + s.id = newID; s.author = author; s.quantity = quantity; s.offeredto = newowner; @@ -741,6 +693,12 @@ ACTION SimpleAssets::offerf( name owner, name newowner, name author, asset quant s.cdate = current_time_point().sec_since_epoch(); }); sub_balancef( owner, author, quantity ); + + SEND_INLINE_ACTION(*this, offerflog, { {_self, "active"_n} }, { newID, owner, newowner, author, quantity, memo }); +} + +ACTION SimpleAssets::offerflog(uint64_t newID, name owner, name newowner, name author, asset quantity, string memo) { + require_auth(get_self()); } ACTION SimpleAssets::cancelofferf( name owner, vector& ftofferids ) { @@ -1053,11 +1011,6 @@ ACTION SimpleAssets::claimntt( name claimer, vector& assetids ) { assets_owner.erase( itr ); nttoffert.erase( itrc ); } - - //for ( auto uniqauthorIt = uniqauthor.begin(); uniqauthorIt != uniqauthor.end(); ++uniqauthorIt ) { - // name keyauthor = move( uniqauthorIt->first ); - // sendEvent( keyauthor, claimer, "saeclaim"_n, make_tuple( claimer, uniqauthor[keyauthor] ) ); - //} } ACTION SimpleAssets::burnntt( name owner, vector& assetids, string memo ) { @@ -1080,13 +1033,6 @@ ACTION SimpleAssets::burnntt( name owner, vector& assetids, string mem assets_ntt.erase( itr_asset ); } - - //Send Event as deferred - //for ( auto uniqauthorIt = uniqauthor.begin(); uniqauthorIt != uniqauthor.end(); ++uniqauthorIt ) { - // name keyauthor = move( uniqauthorIt->first ); - // sendEvent( keyauthor, owner, "saeburn"_n, make_tuple( owner, uniqauthor[keyauthor], memo ) ); - //} - SEND_INLINE_ACTION(*this, burnnttlog, { {_self, "active"_n} }, { owner, assetids, memo }); } ACTION SimpleAssets::mdadd( name author, string data ) {