Skip to content

Commit

Permalink
v1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ansigroup committed Feb 26, 2020
1 parent fc47bdd commit 1bd18ed
Show file tree
Hide file tree
Showing 8 changed files with 437 additions and 196 deletions.
29 changes: 20 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ https://github.com/CryptoLions/SimpleAssets/blob/master/include/SimpleAssets.hpp
canceloffer (owner, [assetid1,..,assetidn])
claim (claimer, [assetid1,..,assetidn])
delegate (owner, to, [assetid1,..,assetidn], period, memo)
undelegate (owner, from, [assetid1,..,assetidn])
delegate (owner, to, [assetid1,..,assetidn], period, redelegate, memo)
undelegate (owner, [assetid1,..,assetidn])
delegatemore (owner, assetid, period)
attach (owner, assetidc, [assetid1,..,assetidn])
Expand Down Expand Up @@ -214,13 +214,14 @@ authors {
## Delegates
```
delegates{
uint64_t assetid; // asset id offered for claim;
name owner; // asset owner;
name delegatedto; // who can claim this asset;
uint64_t cdate; // offer create date;
uint64_t 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.
string memo; // memo from action parameters. Max 64 length.
uint64_t assetid; // asset id offered for claim;
name owner; // asset owner;
name delegatedto; // who can claim this asset;
uint64_t cdate; // offer create date;
uint64_t 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.
bool redelegate; // redelegate is allow more redelegate for to account or not.
string memo; // memo from action parameters. Max 64 length.
}
```
Expand Down Expand Up @@ -517,6 +518,16 @@ saRes1.send();
-----------------
# Change Logs

## Change Log v1.4.0
- re-delegate assets. (lender of assets can allow them to be re-lent)
- New parameter `bool redelegate` added in delegate action, which allows asset re-delegation.
- New field `bool redelegate` added in table `delegates` => require migration in case of self- deployed contract !!!
- In `undelegate` action parameter `from` was removed. (identity of borrower is available in the delegates table)
- Fixed transfer of empty assets array
- Error messages improved for clarity
- Code refactoring


## Change Log v1.3.0
- Upgrade work with latest Contract Development Toolkit (CDT v1.6.3).
(Resolves this compilation [issue](https://github.com/EOSIO/eosio.cdt/issues/527))
Expand Down
43 changes: 39 additions & 4 deletions build/SimpleAssets/SimpleAssets.abi
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,32 @@
}
]
},
{
"name": "changeauthor",
"base": "",
"fields": [
{
"name": "author",
"type": "name"
},
{
"name": "newauthor",
"type": "name"
},
{
"name": "owner",
"type": "name"
},
{
"name": "assetids",
"type": "uint64[]"
},
{
"name": "memo",
"type": "string"
}
]
},
{
"name": "claim",
"base": "",
Expand Down Expand Up @@ -429,6 +455,10 @@
"name": "period",
"type": "uint64"
},
{
"name": "redelegate",
"type": "bool"
},
{
"name": "memo",
"type": "string"
Expand Down Expand Up @@ -713,6 +743,10 @@
"name": "period",
"type": "uint64"
},
{
"name": "redelegate",
"type": "bool"
},
{
"name": "memo",
"type": "string"
Expand Down Expand Up @@ -893,10 +927,6 @@
"name": "owner",
"type": "name"
},
{
"name": "from",
"type": "name"
},
{
"name": "assetids",
"type": "uint64[]"
Expand Down Expand Up @@ -1017,6 +1047,11 @@
"type": "cancelofferf",
"ricardian_contract": "---\nspec_version: 0.0.2\ntitle: Cancels offer of FTs\nsummary: Cancels offer of FTs \nicon: https://cryptolions.io/assets/images/sa-icons-256/cancelofferf.png#9c35f488e2c53464f430e0e31e5a4b3bd2e914fe3b6db126722166a8a408fa83\n---\n\nInput parameters:\n`owner` - riginal owner of the FT\n`ftofferids` - id of the FT offer\n\nTERM\nThis Contract expires at the conclusion of code execution.\nby CryptoLions [ https://cryptolions.io ]"
},
{
"name": "changeauthor",
"type": "changeauthor",
"ricardian_contract": "---\nspec_version: 0.0.2\ntitle: Change author of assets\nsummary: Change author of assets\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": "claim",
"type": "claim",
Expand Down
Binary file modified build/SimpleAssets/SimpleAssets.wasm
Binary file not shown.
46 changes: 45 additions & 1 deletion external_test/unit_tests.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#sudo apt-get install bc
#./unit_tests.sh alexnag12345 alexnag1tran PW5KUxSPhXY1YSH9risb7CVpTXzwH7DEVK84wQBugoy1uqBjo5Twm
#./unit_tests.sh simpleasset5 alexnag1tran PW5KUxSPhXY1YSH9risb7CVpTXzwH7DEVK84wQBugoy1uqBjo5Twm

echo "Test account where deployed SimpleAsset: " $1
echo "Account second to test transfer: " $2
Expand Down Expand Up @@ -292,6 +292,7 @@ function READ_ONE_ASSET
sleep $WAIT_TIME
size=$(./cleos.sh get table $ACC $SCOPE sassets | jq -r '.rows | length')
asset_ids=$(./cleos.sh get table $ACC $SCOPE sassets | jq -r '.rows[].id')
asset_author=$(./cleos.sh get table $ACC $SCOPE sassets | jq -r '.rows[].author')

if (( size > 1 ))
then
Expand Down Expand Up @@ -1142,8 +1143,51 @@ function TEST_CREATENTT_CLAIMNTT_BURNNTT
CLEAN_NTTASSETS_TABLE ${ACC_TO}
}

function PUSH_CHANGEAUTHOR
{
sleep $WAIT_TIME
echo "changeauthor action"

output=$(./cleos.sh push action ${ACC} changeauthor '{ "author":"'${ACC}'", "newauthor":"'${ACC_TO}'", "owner":"'${ACC}'" ,"assetids":['${result_asset_id}'],"memo":"mdata"}' -p $ACC@active 2>&1)

if [[ $output =~ "${ACC} <= ${ACC}" ]]
then
echo "Success"
else
echo "Error"
echo "Output: " $output
exit 1
fi
}

function TEST_CHANGEAUTHOR
{
echo "----------------------------------- TEST_CHANGEAUTHOR ----------------------------------------------------------------"
CLEAN_ASSETS_TABLE

PUSH_CREATE_ASSET

READ_ONE_ASSET

PUSH_CHANGEAUTHOR

READ_ONE_ASSET

if [ "$asset_author" = "$ACC_TO" ]
then
echo "Success. changeauthor ACTION test was successfully passed"
else
echo "asset_author: " $asset_author
echo "Error. Author was not changed"
exit 1
fi
}

unlock_wallet

# 2019-11-01 This test created after adding changeauthor action
TEST_CHANGEAUTHOR

# 2019-10-02 This test created after adding createntt claimntt burnntt actions
TEST_CREATENTT_CLAIMNTT_BURNNTT

Expand Down
Loading

0 comments on commit 1bd18ed

Please sign in to comment.