Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#13 [Feature Request] Account::deposit(address, token) auto create a… #14

Merged
merged 3 commits into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions sources/Account.move
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,11 @@ module Account {
to_deposit: Token<TokenType>,
metadata: vector<u8>,
) acquires Account, Balance, AutoAcceptToken {

if (!exists_at(receiver)) {
create_account_with_address<TokenType>(receiver);
};

try_accept_token<TokenType>(receiver);

let deposit_value = Token::value(&to_deposit);
Expand Down
6 changes: 3 additions & 3 deletions spectests/account/basic.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ processed 14 tasks

task 5 'run'. lines 30-41:
{
"gas_used": 119542,
"gas_used": 122853,
"status": {
"Keep": "Executed"
}
Expand Down Expand Up @@ -54,7 +54,7 @@ task 8 'run'. lines 76-95:

task 9 'run'. lines 98-110:
{
"gas_used": 134614,
"gas_used": 137925,
"status": {
"Keep": "Executed"
}
Expand Down Expand Up @@ -86,7 +86,7 @@ task 12 'run'. lines 138-147:

task 13 'run'. lines 150-159:
{
"gas_used": 49638,
"gas_used": 52949,
"status": {
"Keep": "Executed"
}
Expand Down
4 changes: 2 additions & 2 deletions spectests/account/deposit_zero_token.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ processed 4 tasks

task 2 'run'. lines 6-16:
{
"gas_used": 42651,
"gas_used": 45962,
"status": {
"Keep": "Executed"
}
}

task 3 'run'. lines 19-30:
{
"gas_used": 27976,
"gas_used": 31287,
"status": {
"Keep": "Executed"
}
Expand Down
2 changes: 1 addition & 1 deletion spectests/account/txn_prologue_and_epilogue.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ processed 12 tasks

task 3 'run'. lines 8-23:
{
"gas_used": 411278,
"gas_used": 414589,
"status": {
"Keep": "Executed"
}
Expand Down
8 changes: 4 additions & 4 deletions spectests/account/withdraw_capability.exp
Original file line number Diff line number Diff line change
Expand Up @@ -46,31 +46,31 @@ task 7 'run'. lines 58-73:

task 8 'run'. lines 76-88:
{
"gas_used": 119542,
"gas_used": 122853,
"status": {
"Keep": "Executed"
}
}

task 9 'run'. lines 91-103:
{
"gas_used": 138558,
"gas_used": 141869,
"status": {
"Keep": "Executed"
}
}

task 10 'run'. lines 106-117:
{
"gas_used": 92694,
"gas_used": 96005,
"status": {
"Keep": "Executed"
}
}

task 11 'run'. lines 120-132:
{
"gas_used": 126742,
"gas_used": 130053,
"status": {
"Keep": "Executed"
}
Expand Down
10 changes: 5 additions & 5 deletions spectests/block_reward/basic.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ processed 12 tasks

task 3 'run'. lines 7-21:
{
"gas_used": 199568,
"gas_used": 202879,
"status": {
"Keep": "Executed"
}
Expand Down Expand Up @@ -54,23 +54,23 @@ task 6 'run'. lines 61-76:

task 7 'run'. lines 80-96:
{
"gas_used": 514545,
"gas_used": 517856,
"status": {
"Keep": "Executed"
}
}

task 8 'run'. lines 99-115:
{
"gas_used": 391116,
"gas_used": 394427,
"status": {
"Keep": "Executed"
}
}

task 9 'run'. lines 118-133:
{
"gas_used": 206768,
"gas_used": 210079,
"status": {
"Keep": "Executed"
}
Expand All @@ -86,7 +86,7 @@ task 10 'run'. lines 136-150:

task 11 'run'. lines 153-167:
{
"gas_used": 206768,
"gas_used": 210079,
"status": {
"Keep": "Executed"
}
Expand Down
2 changes: 1 addition & 1 deletion spectests/dao/test_dao_failure.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ processed 43 tasks

task 5 'run'. lines 12-29:
{
"gas_used": 303227,
"gas_used": 313160,
"status": {
"Keep": "Executed"
}
Expand Down
8 changes: 4 additions & 4 deletions spectests/dao/test_dao_propose.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ processed 21 tasks

task 4 'run'. lines 10-24:
{
"gas_used": 209424,
"gas_used": 216046,
"status": {
"Keep": "Executed"
}
Expand Down Expand Up @@ -42,7 +42,7 @@ task 9 'run'. lines 87-103:

task 11 'run'. lines 109-127:
{
"gas_used": 167718,
"gas_used": 171029,
"status": {
"Keep": "Executed"
}
Expand All @@ -58,15 +58,15 @@ task 12 'run'. lines 131-151:

task 13 'run'. lines 154-187:
{
"gas_used": 500363,
"gas_used": 503674,
"status": {
"Keep": "Executed"
}
}

task 15 'run'. lines 194-216:
{
"gas_used": 153954,
"gas_used": 157265,
"status": {
"Keep": "Executed"
}
Expand Down
8 changes: 4 additions & 4 deletions spectests/dao/test_mint_dao_proposal.exp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ task 5 'run'. lines 32-52:

task 6 'run'. lines 54-68:
{
"gas_used": 113677,
"gas_used": 116988,
"status": {
"Keep": "Executed"
}
Expand All @@ -26,7 +26,7 @@ task 7 'run'. lines 71-82:

task 8 'run'. lines 85-98:
{
"gas_used": 116661,
"gas_used": 119972,
"status": {
"Keep": "Executed"
}
Expand Down Expand Up @@ -94,15 +94,15 @@ task 14 'run'. lines 156-172:

task 16 'run'. lines 177-198:
{
"gas_used": 154474,
"gas_used": 157785,
"status": {
"Keep": "Executed"
}
}

task 18 'run'. lines 204-222:
{
"gas_used": 158162,
"gas_used": 161473,
"status": {
"Keep": "Executed"
}
Expand Down
2 changes: 1 addition & 1 deletion spectests/nft/identifier_nft.exp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ task 7 'run'. lines 132-140:

task 9 'run'. lines 145-153:
{
"gas_used": 186378,
"gas_used": 193000,
"status": {
"Keep": "Executed"
}
Expand Down
2 changes: 1 addition & 1 deletion spectests/nft/nft_boxminer.exp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ task 4 'run'. lines 59-67:

task 5 'run'. lines 69-79:
{
"gas_used": 253212,
"gas_used": 256523,
"status": {
"Keep": "Executed"
}
Expand Down
2 changes: 1 addition & 1 deletion spectests/offer/offer.exp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ task 7 'run'. lines 53-65:

task 9 'run'. lines 69-82:
{
"gas_used": 89010,
"gas_used": 92321,
"status": {
"Keep": "Executed"
}
Expand Down
4 changes: 2 additions & 2 deletions spectests/on_chain_config/test_onchain_config_dao.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ processed 14 tasks

task 4 'run'. lines 10-21:
{
"gas_used": 209424,
"gas_used": 216046,
"status": {
"Keep": "Executed"
}
Expand Down Expand Up @@ -44,7 +44,7 @@ task 8 'run'. lines 47-60:

task 11 'run'. lines 67-87:
{
"gas_used": 153954,
"gas_used": 157265,
"status": {
"Keep": "Executed"
}
Expand Down
2 changes: 1 addition & 1 deletion spectests/token/burn_and_destroy.exp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ task 4 'run'. lines 25-40:

task 5 'run'. lines 42-55:
{
"gas_used": 113677,
"gas_used": 116988,
"status": {
"Keep": "Executed"
}
Expand Down
2 changes: 1 addition & 1 deletion spectests/token/dummy_token.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ processed 6 tasks

task 3 'run'. lines 8-26:
{
"gas_used": 175531,
"gas_used": 178842,
"status": {
"Keep": "Executed"
}
Expand Down
2 changes: 1 addition & 1 deletion spectests/token/join_and_split.exp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ task 4 'run'. lines 28-47:

task 5 'run'. lines 48-64:
{
"gas_used": 113791,
"gas_used": 117102,
"status": {
"Keep": "Executed"
}
Expand Down
4 changes: 2 additions & 2 deletions spectests/token/my_token.exp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ task 5 'run'. lines 41-58:

task 6 'run'. lines 61-76:
{
"gas_used": 113677,
"gas_used": 116988,
"status": {
"Keep": "Executed"
}
Expand All @@ -26,7 +26,7 @@ task 7 'run'. lines 78-86:

task 8 'run'. lines 89-97:
{
"gas_used": 103246,
"gas_used": 106557,
"status": {
"Keep": "Executed"
}
Expand Down
2 changes: 1 addition & 1 deletion spectests/token/transfer_then_abort.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ processed 5 tasks

task 3 'run'. lines 7-18:
{
"gas_used": 87171,
"gas_used": 90482,
"status": {
"Keep": {
"MoveAbort": [
Expand Down
2 changes: 1 addition & 1 deletion spectests/transaction_fee/distribute_txn_fee.exp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ task 4 'run'. lines 9-20:

task 5 'run'. lines 23-36:
{
"gas_used": 88334,
"gas_used": 91645,
"status": {
"Keep": "Executed"
}
Expand Down
2 changes: 1 addition & 1 deletion spectests/transaction_scripts/create_account.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ processed 4 tasks

task 3 'run'. lines 8-16:
{
"gas_used": 281050,
"gas_used": 284361,
"status": {
"Keep": "Executed"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ task 8 'run'. lines 51-67:

task 9 'run'. lines 70-86:
{
"gas_used": 85761,
"gas_used": 89072,
"status": {
"Keep": "Executed"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ task 8 'run'. lines 48-64:

task 9 'run'. lines 66-83:
{
"gas_used": 85761,
"gas_used": 89072,
"status": {
"Keep": "Executed"
}
Expand Down
2 changes: 1 addition & 1 deletion spectests/transaction_scripts/module_upgrade.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ processed 15 tasks

task 5 'run'. lines 27-39:
{
"gas_used": 327534,
"gas_used": 330845,
"status": {
"Keep": "Executed"
}
Expand Down
4 changes: 2 additions & 2 deletions spectests/transaction_scripts/peer_to_peer.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ processed 5 tasks

task 3 'run'. lines 9-17:
{
"gas_used": 113440,
"gas_used": 116751,
"status": {
"Keep": "Executed"
}
}

task 4 'run'. lines 19-27:
{
"gas_used": 109201,
"gas_used": 112512,
"status": {
"Keep": "Executed"
}
Expand Down
Loading