@@ -8,13 +8,11 @@ use sr_eth_primitives::{
8
8
Bloom , EthAddress , H64 , U128 ,
9
9
} ;
10
10
use std:: str:: FromStr ;
11
- use support:: { assert_ok , assert_err } ;
11
+ use support:: { assert_err , assert_ok } ;
12
12
13
- use sr_primitives:: { AccountId32 , traits:: Dispatchable } ;
13
+ use sr_primitives:: { traits:: Dispatchable , AccountId32 } ;
14
14
15
- use staking:: {
16
- RewardDestination , StakingBalances , StakingLedger , TimeDepositItem
17
- } ;
15
+ use staking:: { RewardDestination , StakingBalances , StakingLedger , TimeDepositItem } ;
18
16
19
17
use darwinia_support:: StakingLock ;
20
18
@@ -167,27 +165,27 @@ fn verify_redeem_kton() {
167
165
// totalDifficulty
168
166
assert_ok ! ( EthRelay :: init_genesis_header( & header, 0x68e4ea361f7a78_u64 ) ) ;
169
167
170
- let expect_account_id = <Test as Trait >:: DetermineAccountId :: account_id_for ( & hex ! ( "2a92ae5b41feba5ee68a61449c557efa9e3b894a6461c058ec2de45429adb44546" ) ) . unwrap ( ) ;
168
+ let expect_account_id = <Test as Trait >:: DetermineAccountId :: account_id_for ( & hex ! ( "2a92ae5b41feba5ee68a61449c557efa9e3b894a6461c058ec2de45429adb44546" ) ) . unwrap ( ) ;
171
169
172
170
// 0.123456789123456789 KTON
173
- assert_eq ! ( EthBacking :: parse_token_redeem_proof( & proof_record, "KtonBurndropTokens" ) , Ok ( ( expect_account_id. clone( ) , 123456789 ) ) ) ;
174
-
171
+ assert_eq ! ( EthBacking :: parse_token_redeem_proof( & proof_record, "KtonBurndropTokens" ) , Ok ( ( expect_account_id. clone( ) , 123456789 ) ) ) ;
172
+
175
173
let id1 = AccountId32 :: from ( [ 0 ; 32 ] ) ;
176
- // If expect_account_id doesn't exist, redeem should fail
177
- assert_err ! ( EthBacking :: redeem_kton( Origin :: signed( id1. clone( ) ) , proof_record. clone( ) ) , "beneficiary account must pre-exist" ) ;
174
+ // If expect_account_id doesn't exist, redeem should fail
175
+ assert_err ! ( EthBacking :: redeem_kton( Origin :: signed( id1. clone( ) ) , proof_record. clone( ) ) , "beneficiary account must pre-exist" ) ;
178
176
179
177
let kton_locked_before = EthBacking :: kton_locked ( ) ;
180
-
181
- let _ = KtonModule :: deposit_creating ( & expect_account_id, 1 ) ;
182
- assert_ok ! ( EthBacking :: redeem_kton( Origin :: signed( id1. clone( ) ) , proof_record. clone( ) ) ) ;
183
178
184
- assert_eq ! ( KtonModule :: free_balance( & expect_account_id) , 123456789 + 1 ) ;
179
+ let _ = KtonModule :: deposit_creating ( & expect_account_id, 1 ) ;
180
+ assert_ok ! ( EthBacking :: redeem_kton( Origin :: signed( id1. clone( ) ) , proof_record. clone( ) ) ) ;
181
+
182
+ assert_eq ! ( KtonModule :: free_balance( & expect_account_id) , 123456789 + 1 ) ;
185
183
186
184
let kton_locked_after = EthBacking :: kton_locked ( ) ;
187
185
assert_eq ! ( kton_locked_after + 123456789 , kton_locked_before) ;
188
186
189
- // shouldn't redeem twice
190
- assert_err ! ( EthBacking :: redeem_kton( Origin :: signed( id1. clone( ) ) , proof_record. clone( ) ) , "Kton For This Proof - ALREADY BEEN REDEEMED" ) ;
187
+ // shouldn't redeem twice
188
+ assert_err ! ( EthBacking :: redeem_kton( Origin :: signed( id1. clone( ) ) , proof_record. clone( ) ) , "Kton For This Proof - ALREADY BEEN REDEEMED" ) ;
191
189
} ) ;
192
190
}
193
191
@@ -248,15 +246,15 @@ fn verify_redeem_deposit() {
248
246
let id1 = AccountId32 :: from ( [ 0 ; 32 ] ) ;
249
247
250
248
let controller = AccountId32 :: from ( [ 1 ; 32 ] ) ;
251
-
249
+
252
250
let _ = RingModule :: deposit_creating ( & expect_account_id, 1 ) ;
253
251
assert_ok ! (
254
252
staking:: Call :: <Test >:: bond(
255
253
controller. clone( ) ,
256
254
StakingBalances :: Ring ( 1 ) ,
257
255
RewardDestination :: Controller ,
258
256
0 ) . dispatch( Origin :: signed( expect_account_id. clone( ) ) )
259
- ) ;
257
+ ) ;
260
258
assert_ok ! ( EthBacking :: redeem_deposit( Origin :: signed( id1. clone( ) ) , proof_record. clone( ) ) ) ;
261
259
262
260
assert_eq ! ( RingModule :: free_balance( & expect_account_id) , 1234000000000 + 1 ) ;
@@ -284,4 +282,3 @@ fn verify_redeem_deposit() {
284
282
fn verify_insurficient_backing_assets ( ) {
285
283
// TODO
286
284
}
287
-
0 commit comments