This repository has been archived by the owner on Jul 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
1,144 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Clone move-stdlib | ||
rm -rf ./move-stdlib | ||
git clone https://github.com/pontem-network/move-stdlib ./move-stdlib | ||
pushd ./move-stdlib | ||
git checkout release-v1.0.0 | ||
dove build -b | ||
popd | ||
|
||
# Clone pont-stdlib | ||
rm -rf ./pont-stdlib | ||
git clone https://github.com/pontem-network/pont-stdlib.git ./pont-stdlib | ||
pushd ./pont-stdlib | ||
git checkout release-v1.0.0 | ||
dove build -b | ||
popd | ||
|
||
pushd ./user | ||
dove clean | ||
dove build | ||
dove build -b | ||
dove tx "store_u64(42)" | ||
dove tx "emit_event(42)" | ||
dove tx "store_system_block()" | ||
dove tx "store_system_timestamp()" | ||
dove tx "inf_loop()" | ||
dove tx "store_native_balance()" | ||
dove tx "store_token_balance()" | ||
dove tx "as_root(dr)" | ||
dove tx "transfer<0x1::NOX::NOX>(Alice, 2000)" -o=transfer.mvt | ||
dove tx "transfer<0x1::KSM::KSM>(Alice, 2000)" -o=transfer_token.mvt | ||
dove tx "multisig_test()" | ||
dove tx "deposit_bank<0x1::NOX::NOX>(2000)" -o=deposit_bank_pont.mvt | ||
dove tx "deposit_bank<0x1::KSM::KSM>(2000)" -o=deposit_bank_ksm.mvt | ||
dove tx "signer_one()" -o=signer_user.mvt | ||
dove tx "signer_one(root)" -o=signer_root.mvt | ||
popd | ||
|
||
pushd ./root | ||
dove clean | ||
dove build | ||
dove build -b | ||
pushd |
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,2 @@ | ||
build | ||
target |
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,14 @@ | ||
[package] | ||
name = "assets" | ||
dialect = "pont" | ||
dove_version = ">=1.5.5" | ||
|
||
# account_address = "0x0" # dev/null | ||
account_address = "0x1" # std | ||
# account_address = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" # Alice | ||
# account_address = "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty" # Bob | ||
# account_address = "0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48" # Bob | ||
|
||
dependencies = [ | ||
{ git = "https://github.com/pontem-network/pont-stdlib.git", rev = "e9bd26720c06705d2e222833a496fda7c67c8e32" }, | ||
] |
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,17 @@ | ||
[package] | ||
name = "assets" | ||
version = "0.0.1" | ||
authors = [] | ||
dialect = "Pont" | ||
dove_version = ">=1.5.5" | ||
|
||
[addresses] | ||
RootTests = "0x1" | ||
|
||
[dependencies.PontStdlib] | ||
git = "https://github.com/pontem-network/pont-stdlib.git" | ||
rev = "release-v1.0.0" | ||
|
||
[dependencies.MoveStdlib] | ||
git = "https://github.com/pontem-network/move-stdlib.git" | ||
rev = "release-v1.0.0" |
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,11 @@ | ||
enabled = true | ||
section_level_start = 1 | ||
include_private_fun = true | ||
include_specs = true | ||
specs_inlined = true | ||
include_impl = true | ||
toc_depth = 3 | ||
collapsed_sections = true | ||
root_doc_templates = [] | ||
include_dep_diagrams = false | ||
include_call_diagrams = false |
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,14 @@ | ||
module RootTests::EventProxy { | ||
use Std::Event; | ||
|
||
struct U64 has store, drop, copy { val: u64 } | ||
|
||
public fun emit_event(acc: signer, val: u64) { | ||
let event_handle = Event::new_event_handle(&acc); | ||
Event::emit_event( | ||
&mut event_handle, | ||
U64 { val } | ||
); | ||
Event::destroy_handle(event_handle); | ||
} | ||
} |
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,29 @@ | ||
module RootTests::Store { | ||
struct U64 has key { val: u64 } | ||
|
||
struct U128 has key { val: u128 } | ||
|
||
struct Address has key { val: address } | ||
|
||
struct VectorU8 has key { val: vector<u8> } | ||
|
||
public fun store_u64(account: &signer, val: u64) { | ||
let foo = U64 { val: val }; | ||
move_to<U64>(account, foo); | ||
} | ||
|
||
public fun store_u128(account: &signer, val: u128) { | ||
let foo = U128 { val: val }; | ||
move_to<U128>(account, foo); | ||
} | ||
|
||
public fun store_address(account: &signer, val: address) { | ||
let addr = Address { val: val }; | ||
move_to<Address>(account, addr); | ||
} | ||
|
||
public fun store_vector_u8(account: &signer, val: vector<u8>) { | ||
let vec = VectorU8 { val: val }; | ||
move_to<VectorU8>(account, vec); | ||
} | ||
} |
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,2 @@ | ||
build | ||
target |
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,14 @@ | ||
[package] | ||
name = "assets" | ||
dialect = "pont" | ||
dove_version = ">=1.5.5" | ||
|
||
# account_address = "0x0" # dev/null | ||
# account_address = "0x1" # std | ||
# account_address = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" # Alice | ||
account_address = "gkNW9pAcCHxZrnoVkhLkEQtsLsW5NWTC75cdAdxAMs9LNYCYg" # Bob | ||
# account_address = "0x8eaf04151687736326c9fea17e25fc5287613693c912909cb226aa4794f26a48" # Bob | ||
|
||
dependencies = [ | ||
{ git = "https://github.com/pontem-network/pont-stdlib.git", rev = "e9bd26720c06705d2e222833a496fda7c67c8e32" } | ||
] |
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,19 @@ | ||
[package] | ||
name = "assets" | ||
version = "0.0.1" | ||
authors = [] | ||
dialect = "Pont" | ||
dove_version = ">=1.5.5" | ||
|
||
[addresses] | ||
UserTests = "gkNW9pAcCHxZrnoVkhLkEQtsLsW5NWTC75cdAdxAMs9LNYCYg" | ||
Alice = "gkQ5K6EnLRgZkwozG8GiBAEnJyM6FxzbSaSmVhKJ2w8FcK7ih" | ||
Bob = "gkNW9pAcCHxZrnoVkhLkEQtsLsW5NWTC75cdAdxAMs9LNYCYg" | ||
|
||
[dependencies.PontStdlib] | ||
git = "https://github.com/pontem-network/pont-stdlib.git" | ||
rev = "release-v1.0.0" | ||
|
||
[dependencies.MoveStdlib] | ||
git = "https://github.com/pontem-network/move-stdlib.git" | ||
rev = "release-v1.0.0" |
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,11 @@ | ||
enabled = true | ||
section_level_start = 1 | ||
include_private_fun = true | ||
include_specs = true | ||
specs_inlined = true | ||
include_impl = true | ||
toc_depth = 3 | ||
collapsed_sections = true | ||
root_doc_templates = [] | ||
include_dep_diagrams = false | ||
include_call_diagrams = false |
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,8 @@ | ||
script { | ||
use Std::Signer; | ||
|
||
fun as_root(root: signer) { | ||
assert!(Signer::address_of(&root) == @Root, 1); | ||
} | ||
} | ||
|
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,12 @@ | ||
script { | ||
use PontemFramework::PontAccount; | ||
use UserTests::Bank; | ||
|
||
fun deposit_bank<TokenType: key + store>(sender: signer, amount: u64) { | ||
// Withdraw TokenType tokens from sender account. | ||
let tokens = PontAccount::withdraw<TokenType>(&sender, amount); | ||
|
||
Bank::deposit(&sender, tokens); | ||
} | ||
} | ||
|
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,7 @@ | ||
script { | ||
use UserTests::EventProxy; | ||
|
||
fun emit_event(acc: signer, val: u64) { | ||
EventProxy::emit_event(&acc, val); | ||
} | ||
} |
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,11 @@ | ||
script { | ||
fun inf_loop() { | ||
let i = 0; | ||
|
||
loop { | ||
if (i > 1000) { | ||
break | ||
} | ||
} | ||
} | ||
} |
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,8 @@ | ||
script { | ||
use Std::Signer; | ||
|
||
fun multisig_test(account1: signer, account2: signer) { | ||
assert!(Signer::address_of(&account1) == @Alice, 1); // Alice | ||
assert!(Signer::address_of(&account2) == @Bob, 1); // Bob | ||
} | ||
} |
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,11 @@ | ||
script { | ||
use PontemFramework::PontAccount; | ||
use PontemFramework::NOX::NOX; | ||
use Std::Signer; | ||
use UserTests::Store; | ||
|
||
fun store_native_balance(account: signer) { | ||
let balance = PontAccount::balance<NOX>(Signer::address_of(&account)); | ||
Store::store_u64(&account, balance); | ||
} | ||
} |
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,5 @@ | ||
script { | ||
// Just one signer required | ||
fun signer_one(_s: signer) { | ||
} | ||
} |
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,7 @@ | ||
script { | ||
use UserTests::Store; | ||
|
||
fun store_u64(account: signer, val: u64) { | ||
Store::store_u64(&account, val); | ||
} | ||
} |
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,8 @@ | ||
script { | ||
use PontemFramework::PontBlock; | ||
use UserTests::Store; | ||
|
||
fun store_system_block(account: signer) { | ||
Store::store_u64(&account, PontBlock::get_current_block_height()); | ||
} | ||
} |
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,8 @@ | ||
script { | ||
use PontemFramework::PontTimestamp; | ||
use UserTests::Store; | ||
|
||
fun store_system_timestamp(account: signer) { | ||
Store::store_u64(&account, PontTimestamp::now_microseconds()); | ||
} | ||
} |
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,11 @@ | ||
script { | ||
use PontemFramework::PontAccount; | ||
use PontemFramework::KSM::KSM; | ||
use Std::Signer; | ||
use UserTests::Store; | ||
|
||
fun store_token_balance(account: signer) { | ||
let balance = PontAccount::balance<KSM>(Signer::address_of(&account)); | ||
Store::store_u64(&account, balance); | ||
} | ||
} |
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,13 @@ | ||
script { | ||
use PontemFramework::PontAccount; | ||
use Std::Signer; | ||
use UserTests::Store; | ||
|
||
// Transfer from Bob to Alice. | ||
fun transfer<TokenType>(bob: signer, alice: address, to_move: u64) { | ||
PontAccount::pay_from<TokenType>(&bob, alice, to_move); | ||
|
||
let balance = PontAccount::balance<TokenType>(Signer::address_of(&bob)); | ||
Store::store_u64(&bob, balance); | ||
} | ||
} |
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,22 @@ | ||
/// Bank module (stores tokens inside module). | ||
module UserTests::Bank { | ||
use Std::Signer; | ||
use PontemFramework::Token::{Self, Token}; | ||
|
||
struct Storage<phantom TokenType> has key, store { | ||
balance: Token<TokenType>, | ||
} | ||
|
||
public fun deposit<TokenType>(account: &signer, deposit: Token<TokenType>) acquires Storage { | ||
let addr = Signer::address_of(account); | ||
|
||
if (!exists<Storage<TokenType>>(addr)) { | ||
move_to(account, Storage { | ||
balance: deposit | ||
}); | ||
} else { | ||
let storage = borrow_global_mut<Storage<TokenType>>(addr); | ||
Token::deposit<TokenType>(&mut storage.balance, deposit); | ||
} | ||
} | ||
} |
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,16 @@ | ||
module UserTests::EventProxy { | ||
use Std::Event; | ||
|
||
struct U64 has store, drop, copy { val: u64 } | ||
|
||
public fun emit_event(acc: &signer, val: u64) { | ||
let event_handle = Event::new_event_handle(acc); | ||
|
||
Event::emit_event( | ||
&mut event_handle, | ||
U64 { val } | ||
); | ||
|
||
Event::destroy_handle(event_handle); | ||
} | ||
} |
Oops, something went wrong.