|
5 | 5 | // Copyright (c) DUSK NETWORK. All rights reserved. |
6 | 6 |
|
7 | 7 | use dusk_core::abi::ContractError; |
8 | | -use dusk_core::abi::{ContractId, CONTRACT_ID_BYTES}; |
9 | | -use dusk_core::signatures::bls::{ |
10 | | - PublicKey as AccountPublicKey, SecretKey as AccountSecretKey, |
| 8 | +// use dusk_core::abi::{ContractId, CONTRACT_ID_BYTES}; |
| 9 | +// use dusk_core::signatures::bls::{ |
| 10 | +// PublicKey as AccountPublicKey, SecretKey as AccountSecretKey, |
| 11 | +// }; |
| 12 | +// use dusk_core::transfer::data::ContractCall; |
| 13 | +// use dusk_core::transfer::MoonlightTransactionEvent; |
| 14 | +// |
| 15 | +// use rand::rngs::StdRng; |
| 16 | +// use rand::SeedableRng; |
| 17 | +// |
| 18 | +// use emt_core::token::error; |
| 19 | +// use emt_core::token::events; |
| 20 | +use emt_core::allowlist::{Address, Role}; |
| 21 | +use emt_core::{ |
| 22 | + Account, |
| 23 | + // AccountInfo, ZERO_ADDRESS |
11 | 24 | }; |
12 | | -use dusk_core::transfer::data::ContractCall; |
13 | | -use dusk_core::transfer::MoonlightTransactionEvent; |
14 | | - |
15 | | -use rand::rngs::StdRng; |
16 | | -use rand::SeedableRng; |
17 | | - |
18 | | -use emt_core::token::error; |
19 | | -use emt_core::token::events; |
20 | | -use emt_core::{Account, AccountInfo, ZERO_ADDRESS}; |
21 | 25 |
|
22 | 26 | pub mod instantiate; |
23 | 27 | use instantiate::{ |
24 | | - TestSession, HOLDER_ID, INITIAL_BALANCE, INITIAL_HOLDER_BALANCE, |
25 | | - INITIAL_SUPPLY, |
| 28 | + TestSession, |
| 29 | + // HOLDER_ID, INITIAL_EMT_BALANCE |
26 | 30 | }; |
27 | 31 |
|
28 | 32 | #[test] |
29 | 33 | fn deploy() { |
30 | 34 | TestSession::new(); |
31 | 35 | } |
32 | 36 |
|
| 37 | +#[test] |
| 38 | +fn is_allowed() -> Result<(), ContractError> { |
| 39 | + let mut session = TestSession::new(); |
| 40 | + |
| 41 | + let unregistered: [u8; 32] = rand::random(); |
| 42 | + let unregistered = Address::from(&unregistered); |
| 43 | + assert_eq!(session.allowlist_is_allowed(&unregistered)?.data, false); |
| 44 | + |
| 45 | + let role: [u8; 32] = rand::random(); |
| 46 | + let role = Role::from(&role); |
| 47 | + session.allowlist_register(&*TestSession::SK_0, unregistered, role)?; |
| 48 | + |
| 49 | + session.allowlist_remove(&*TestSession::SK_0, &unregistered)?; |
| 50 | + |
| 51 | + Ok(()) |
| 52 | +} |
| 53 | + |
| 54 | +/// Test transfer of ownership to test account. |
| 55 | +#[test] |
| 56 | +fn transfer_ownership() { |
| 57 | + let mut session = TestSession::new(); |
| 58 | + let new_ownership = Account::from(*TestSession::PK_1); |
| 59 | + |
| 60 | + session |
| 61 | + .allowlist_transfer_ownership(&*TestSession::SK_0, &new_ownership) |
| 62 | + .expect("Call should pass"); |
| 63 | + |
| 64 | + assert_eq!( |
| 65 | + session |
| 66 | + .allowlist_ownership() |
| 67 | + .expect("call should pass") |
| 68 | + .data, |
| 69 | + new_ownership |
| 70 | + ); |
| 71 | +} |
| 72 | +/* |
33 | 73 | #[test] |
34 | 74 | fn empty_account() { |
35 | 75 | let mut session = TestSession::new(); |
@@ -450,23 +490,9 @@ fn transfer_from() { |
450 | 490 | "The account should have the transferred amount subtracted from its allowance" |
451 | 491 | ); |
452 | 492 | } |
| 493 | +*/ |
453 | 494 |
|
454 | | -/// Test transfer of ownership to test account. |
455 | | -#[test] |
456 | | -fn transfer_ownership() { |
457 | | - let mut session = TestSession::new(); |
458 | | - let new_ownership = Account::from(*TestSession::PK_2); |
459 | | - |
460 | | - session |
461 | | - .call_token::<_, ()>( |
462 | | - &*TestSession::SK_0, |
463 | | - "transfer_ownership", |
464 | | - &new_ownership, |
465 | | - ) |
466 | | - .expect("Call should pass"); |
467 | | - |
468 | | - assert_eq!(session.ownership(), new_ownership); |
469 | | -} |
| 495 | +/* |
470 | 496 |
|
471 | 497 | /// Test TransferOwnership, RenounceOwnership with wrong ownership |
472 | 498 | /// and check for correct error message. |
@@ -968,3 +994,4 @@ fn test_sanctions() { |
968 | 994 | ) |
969 | 995 | .expect("Transfer should succeed again"); |
970 | 996 | } |
| 997 | +*/ |
0 commit comments