-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[aggregator] Fix simulation & view for delayed fields (#12063)
- Loading branch information
1 parent
992ae1d
commit a27c520
Showing
17 changed files
with
217 additions
and
46 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
api/goldens/aptos_api__tests__view_function__test_view_aggregator.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
["10"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "pack_counter" | ||
version = "0.0.0" | ||
|
||
[dependencies] | ||
AptosFramework = { local = "../../../../../aptos-move/framework/aptos-framework" } | ||
|
||
[addresses] | ||
addr = "_" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module addr::counter { | ||
use 0x1::aggregator_v2::{Self, Aggregator}; | ||
|
||
struct Counter has key { | ||
counter: Aggregator<u64>, | ||
} | ||
|
||
fun init_module(account: &signer) { | ||
let counter = Counter { | ||
counter: aggregator_v2::create_aggregator(100), | ||
}; | ||
move_to(account, counter); | ||
} | ||
|
||
public entry fun increment_counter() acquires Counter { | ||
let counter = &mut borrow_global_mut<Counter>(@addr).counter; | ||
aggregator_v2::add(counter, 1); | ||
} | ||
|
||
#[view] | ||
public fun add_and_get_counter_value(): u64 acquires Counter { | ||
let counter = &mut borrow_global_mut<Counter>(@addr).counter; | ||
aggregator_v2::add(counter, 10); | ||
aggregator_v2::read(counter) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.