@@ -77,39 +77,39 @@ module Swap {
7777const createSwapScriptSrcFmt = `
7878script {
7979 use {{sender}}::Swap;
80- use 0x1::DFI ;
80+ use 0x1::XFI ;
8181 use 0x1::Coins;
8282 use 0x1::Account;
8383
8484 fun main(sender: &signer, amount: u128, price: u128) {
85- let dfi = Account::withdraw_from_sender(sender, amount);
85+ let xfi = Account::withdraw_from_sender(sender, amount);
8686
87- // Deposit DFI coins in exchange to BTC.
88- Swap::create<DFI ::T, Coins::BTC>(sender, dfi , price);
87+ // Deposit XFI coins in exchange to BTC.
88+ Swap::create<XFI ::T, Coins::BTC>(sender, xfi , price);
8989 }
9090}
9191`
9292
9393const swapSwapScriptSrcFmt = `
9494script {
9595 use {{sender}}::Swap;
96- use 0x1::DFI ;
96+ use 0x1::XFI ;
9797 use 0x1::Coins;
9898 use 0x1::Account;
9999
100100 fun main(sender: &signer, seller: address, price: u128) {
101101 let btc = Account::withdraw_from_sender(sender, price);
102102
103103 // Deposit BTC to swap coins.
104- Swap::swap<DFI ::T, Coins::BTC>(sender, seller, btc);
104+ Swap::swap<XFI ::T, Coins::BTC>(sender, seller, btc);
105105 }
106106}
107107`
108108
109109// Test checks Swap Move module without crisis module panic (checks vmauth <-> ccstorage integration).
110110// 1. Issue BTCs to client2
111- // 2. Create Swap to exchange client1 DFIs for BTCs (client1's DFIs are locked within Move module)
112- // 3. Execute Swap transferring BTCs to client1 and DFIs to client2
111+ // 2. Create Swap to exchange client1 XFIs for BTCs (client1's XFIs are locked within Move module)
112+ // 3. Execute Swap transferring BTCs to client1 and XFIs to client2
113113// 4. Verify balances are updated
114114func TestIntegApp_Crisis (t * testing.T ) {
115115 app , dvmAddr , appStop := NewTestDnAppDVM (t , log .AllowInfoWith ("module" , "x/crisis" ))
@@ -137,19 +137,19 @@ func TestIntegApp_Crisis(t *testing.T) {
137137 return diffs
138138 }
139139
140- getDfiBtcAccCoins := func (addr sdk.AccAddress ) (sdk.Coin , sdk.Coin ) {
141- dfiCoin := sdk .NewCoin (dnConfig .MainDenom , sdk .ZeroInt ())
140+ getXfiBtcAccCoins := func (addr sdk.AccAddress ) (sdk.Coin , sdk.Coin ) {
141+ xfiCoin := sdk .NewCoin (dnConfig .MainDenom , sdk .ZeroInt ())
142142 btcCoin := sdk .NewCoin ("btc" , sdk .ZeroInt ())
143143 acc := GetAccountCheckTx (app , addr )
144144 for _ , coin := range acc .GetCoins () {
145145 switch coin .Denom {
146- case dfiCoin .Denom :
147- dfiCoin = coin
146+ case xfiCoin .Denom :
147+ xfiCoin = coin
148148 case btcCoin .Denom :
149149 btcCoin = coin
150150 }
151151 }
152- return dfiCoin , btcCoin
152+ return xfiCoin , btcCoin
153153 }
154154
155155 // compile and deploy module
@@ -185,12 +185,12 @@ func TestIntegApp_Crisis(t *testing.T) {
185185 t .Logf (">> Issue 1.0 btc to client2, supply diff:\n %s" , strings .Join (verboseSuppliesDiff (suppliesDiff ), "\n " ))
186186 }
187187
188- // client1 offers 1.0 DFI for 0.5 BTC
188+ // client1 offers 1.0 XFI for 0.5 BTC
189189 offerAmount , _ := sdk .NewIntFromString ("1000000000000000000" )
190190 priceAmount , _ := sdk .NewIntFromString ("50000000" )
191191
192192 // save client1 balances before Swap lock
193- client1DfiBeforeLock , _ := getDfiBtcAccCoins (client1Addr )
193+ client1XfiBeforeLock , _ := getXfiBtcAccCoins (client1Addr )
194194
195195 // compile and execute create swap script
196196 {
@@ -239,19 +239,19 @@ func TestIntegApp_Crisis(t *testing.T) {
239239
240240 // check client1 balance after Swap lock
241241 {
242- client1DfiAfterLock , _ := getDfiBtcAccCoins (client1Addr )
243- t .Logf ("client1 before/after Swap lock: %s / %s" , client1DfiBeforeLock , client1DfiAfterLock )
242+ client1XfiAfterLock , _ := getXfiBtcAccCoins (client1Addr )
243+ t .Logf ("client1 before/after Swap lock: %s / %s" , client1XfiBeforeLock , client1XfiAfterLock )
244244
245245 // calc expected amount including fee
246- expectedAmount := client1DfiBeforeLock .Amount
246+ expectedAmount := client1XfiBeforeLock .Amount
247247 expectedAmount = expectedAmount .Sub (offerAmount )
248248 expectedAmount = expectedAmount .Sub (sdk .OneInt ())
249- require .True (t , client1DfiAfterLock .Amount .Equal (expectedAmount ))
249+ require .True (t , client1XfiAfterLock .Amount .Equal (expectedAmount ))
250250 }
251251
252252 // save client balances before swap execution
253- client1DfiBeforeExecution , client1BtcBeforeExecution := getDfiBtcAccCoins (client1Addr )
254- client2DfiBeforeExecution , client2BtcBeforeExecution := getDfiBtcAccCoins (client2Addr )
253+ client1XfiBeforeExecution , client1BtcBeforeExecution := getXfiBtcAccCoins (client1Addr )
254+ client2XfiBeforeExecution , client2BtcBeforeExecution := getXfiBtcAccCoins (client2Addr )
255255
256256 // compile and execute swap execute script
257257 {
@@ -287,28 +287,28 @@ func TestIntegApp_Crisis(t *testing.T) {
287287
288288 // check balances after Swap execution
289289 {
290- client1DfiAfterExecution , client1BtcAfterExecution := getDfiBtcAccCoins (client1Addr )
291- client2DfiAfterExecution , client2BtcAfterExecution := getDfiBtcAccCoins (client2Addr )
290+ client1XfiAfterExecution , client1BtcAfterExecution := getXfiBtcAccCoins (client1Addr )
291+ client2XfiAfterExecution , client2BtcAfterExecution := getXfiBtcAccCoins (client2Addr )
292292
293- t .Logf ("client1 before/after Swap execution: %s / %s, %s / %s" , client1DfiBeforeExecution , client1DfiAfterExecution , client1BtcBeforeExecution , client1BtcAfterExecution )
294- t .Logf ("client2 before/after Swap execution: %s / %s, %s / %s" , client2DfiBeforeExecution , client2DfiAfterExecution , client2BtcBeforeExecution , client2BtcAfterExecution )
293+ t .Logf ("client1 before/after Swap execution: %s / %s, %s / %s" , client1XfiBeforeExecution , client1XfiAfterExecution , client1BtcBeforeExecution , client1BtcAfterExecution )
294+ t .Logf ("client2 before/after Swap execution: %s / %s, %s / %s" , client2XfiBeforeExecution , client2XfiAfterExecution , client2BtcBeforeExecution , client2BtcAfterExecution )
295295
296296 // client1
297297 {
298- // dfi
299- require .True (t , client1DfiAfterExecution .IsEqual (client1DfiBeforeExecution ))
298+ // xfi
299+ require .True (t , client1XfiAfterExecution .IsEqual (client1XfiBeforeExecution ))
300300 // btc
301301 expectedBtcAmount := client1BtcBeforeExecution .Amount
302302 expectedBtcAmount = expectedBtcAmount .Add (priceAmount )
303303 require .True (t , client1BtcAfterExecution .Amount .Equal (expectedBtcAmount ))
304304 }
305305 // client2
306306 {
307- // dfi (including fee)
308- expectedDfiAmount := client2DfiBeforeExecution .Amount
309- expectedDfiAmount = expectedDfiAmount .Add (offerAmount )
310- expectedDfiAmount = expectedDfiAmount .Sub (sdk .OneInt ())
311- require .True (t , client2DfiAfterExecution .Amount .Equal (expectedDfiAmount ))
307+ // xfi (including fee)
308+ expectedXfiAmount := client2XfiBeforeExecution .Amount
309+ expectedXfiAmount = expectedXfiAmount .Add (offerAmount )
310+ expectedXfiAmount = expectedXfiAmount .Sub (sdk .OneInt ())
311+ require .True (t , client2XfiAfterExecution .Amount .Equal (expectedXfiAmount ))
312312 // btc
313313 expectedBtcAmount := client2BtcBeforeExecution .Amount
314314 expectedBtcAmount = expectedBtcAmount .Sub (priceAmount )
0 commit comments