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 1 commit
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
3 changes: 3 additions & 0 deletions sources/Account.move
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,9 @@ module Account {
receiver: address,
to_deposit: Token<TokenType>,
) acquires Account, Balance, AutoAcceptToken {
if (!exists_at(receiver)) {
create_account_with_address<TokenType>(receiver);
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉这个判断应该放在 deposit_with_metadata 里,因为 deposit_with_metadata 也是一个 public 的入口。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的,我再往内部放一下

deposit_with_metadata<TokenType>(receiver, to_deposit, x"")
}

Expand Down
2 changes: 1 addition & 1 deletion spectests/account/deposit_zero_token.exp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ processed 4 tasks

task 2 'run'. lines 6-16:
{
"gas_used": 42651,
"gas_used": 45962,
"status": {
"Keep": "Executed"
}
Expand Down
2 changes: 1 addition & 1 deletion spectests/account/withdraw_capability.exp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ task 8 'run'. lines 76-88:

task 9 'run'. lines 91-103:
{
"gas_used": 138558,
"gas_used": 141869,
"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
6 changes: 3 additions & 3 deletions spectests/dao/test_dao_propose.exp
Original file line number Diff line number Diff line change
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
6 changes: 3 additions & 3 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 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
2 changes: 1 addition & 1 deletion spectests/on_chain_config/test_onchain_config_dao.exp
Original file line number Diff line number Diff line change
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
2 changes: 1 addition & 1 deletion 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 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
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ task 2 'run'. lines 5-16:

task 4 'run'. lines 21-29:
{
"gas_used": 172522,
"gas_used": 175833,
"status": {
"Keep": "Executed"
}
Expand All @@ -26,7 +26,7 @@ task 6 'run'. lines 35-45:

task 8 'run'. lines 51-60:
{
"gas_used": 140767,
"gas_used": 144078,
"status": {
"Keep": "Executed"
}
Expand Down
6 changes: 3 additions & 3 deletions spectests/treasury/linear_withdraw_cap.exp
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ task 2 'run'. lines 5-20:

task 4 'run'. lines 24-40:
{
"gas_used": 142517,
"gas_used": 145828,
"status": {
"Keep": "Executed"
}
}

task 6 'run'. lines 45-61:
{
"gas_used": 142517,
"gas_used": 145828,
"status": {
"Keep": "Executed"
}
}

task 8 'run'. lines 66-83:
{
"gas_used": 139217,
"gas_used": 142528,
"status": {
"Keep": "Executed"
}
Expand Down
2 changes: 1 addition & 1 deletion spectests/treasury/split_linear_cap.exp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ task 2 'run'. lines 7-23:

task 4 'run'. lines 26-45:
{
"gas_used": 165695,
"gas_used": 169006,
"status": {
"Keep": "Executed"
}
Expand Down
2 changes: 1 addition & 1 deletion spectests/upgrade_module_dao_proposal/basic.exp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ task 5 'run'. lines 25-40:

task 6 'run'. lines 42-57:
{
"gas_used": 113677,
"gas_used": 116988,
"status": {
"Keep": "Executed"
}
Expand Down
6 changes: 3 additions & 3 deletions spectests/yield_farming/basic.exp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ task 8 'run'. lines 77-107:

task 9 'run'. lines 110-129:
{
"gas_used": 204230,
"gas_used": 207541,
"status": {
"Keep": "Executed"
}
Expand All @@ -26,7 +26,7 @@ task 10 'run'. lines 134-149:

task 11 'run'. lines 152-171:
{
"gas_used": 168013,
"gas_used": 171324,
"status": {
"Keep": "Executed"
}
Expand All @@ -50,7 +50,7 @@ task 15 'run'. lines 189-202:

task 17 'run'. lines 206-226:
{
"gas_used": 193789,
"gas_used": 197100,
"status": {
"Keep": "Executed"
}
Expand Down
6 changes: 3 additions & 3 deletions spectests/yield_farming/cap_local_store.exp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ task 8 'run'. lines 67-97:

task 9 'run'. lines 101-120:
{
"gas_used": 204230,
"gas_used": 207541,
"status": {
"Keep": "Executed"
}
Expand All @@ -26,7 +26,7 @@ task 10 'run'. lines 122-137:

task 11 'run'. lines 139-158:
{
"gas_used": 179174,
"gas_used": 182485,
"status": {
"Keep": "Executed"
}
Expand All @@ -50,7 +50,7 @@ task 15 'run'. lines 177-190:

task 17 'run'. lines 194-214:
{
"gas_used": 198765,
"gas_used": 202076,
"status": {
"Keep": "Executed"
}
Expand Down