Skip to content

Commit 476c360

Browse files
authored
[DFI-598] Renamed denom (#193)
1 parent 6949e70 commit 476c360

69 files changed

Lines changed: 297 additions & 297 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/app.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ func NewDnServiceApp(logger log.Logger, db dbm.DB, config *config.VMConfig, invC
234234
app.InitializeVMDataServer(config.DataListen)
235235
app.InitializeVMConnection(config.Address)
236236

237-
// Reduce ConsensusPower reduction coefficient (1 dfi == 1 power unit)
238-
// 1 dfi == 1000000000000000000
237+
// Reduce ConsensusPower reduction coefficient (1 xfi == 1 power unit)
238+
// 1 xfi == 1000000000000000000
239239
sdk.PowerReduction = sdk.NewIntFromBigInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil))
240240

241241
var err error

app/cli_test.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ func TestOracle_CLI(t *testing.T) {
241241
go cliTester.PrintEvents(t, wsChs, "oracle")
242242

243243
nomineeAddr := ct.Accounts["nominee"].Address
244-
assetCode := dnTypes.AssetCode("eth_dfi")
244+
assetCode := dnTypes.AssetCode("eth_xfi")
245245
assetOracle1, assetOracle2, assetOracle3 := ct.Accounts["oracle1"].Address, ct.Accounts["oracle2"].Address, ct.Accounts["oracle3"].Address
246246

247247
// check add asset Tx
@@ -962,8 +962,8 @@ func TestMarkets_CLI(t *testing.T) {
962962
ownerAddr := ct.Accounts["validator1"].Address
963963

964964
// add markets
965-
ct.TxMarketsAdd(ownerAddr, cliTester.DenomBTC, cliTester.DenomDFI).CheckSucceeded()
966-
ct.TxMarketsAdd(ownerAddr, cliTester.DenomETH, cliTester.DenomDFI).CheckSucceeded()
965+
ct.TxMarketsAdd(ownerAddr, cliTester.DenomBTC, cliTester.DenomXFI).CheckSucceeded()
966+
ct.TxMarketsAdd(ownerAddr, cliTester.DenomETH, cliTester.DenomXFI).CheckSucceeded()
967967

968968
// check addMarket Tx
969969
{
@@ -981,7 +981,7 @@ func TestMarkets_CLI(t *testing.T) {
981981

982982
// already existing market
983983
{
984-
tx := ct.TxMarketsAdd(ownerAddr, cliTester.DenomBTC, cliTester.DenomDFI)
984+
tx := ct.TxMarketsAdd(ownerAddr, cliTester.DenomBTC, cliTester.DenomXFI)
985985
tx.CheckFailedWithSDKError(markets.ErrMarketExists)
986986
}
987987
}
@@ -994,14 +994,14 @@ func TestMarkets_CLI(t *testing.T) {
994994
q.CheckFailedWithErrorSubstring("wrong ID")
995995
}
996996

997-
// existing marketID (btc-dfi)
997+
// existing marketID (btc-xfi)
998998
{
999999
q, market := ct.QueryMarketsMarket(dnTypes.NewIDFromUint64(0))
10001000
q.CheckSucceeded()
10011001

10021002
require.Equal(t, market.ID.UInt64(), uint64(0))
10031003
require.Equal(t, market.BaseAssetDenom, cliTester.DenomBTC)
1004-
require.Equal(t, market.QuoteAssetDenom, cliTester.DenomDFI)
1004+
require.Equal(t, market.QuoteAssetDenom, cliTester.DenomXFI)
10051005
}
10061006
}
10071007

@@ -1052,7 +1052,7 @@ func TestMarkets_CLI(t *testing.T) {
10521052

10531053
// check quoteDenom filter
10541054
{
1055-
quoteDenom := cliTester.DenomDFI
1055+
quoteDenom := cliTester.DenomXFI
10561056
q, markets := ct.QueryMarketsList(-1, -1, nil, &quoteDenom)
10571057
q.CheckSucceeded()
10581058

@@ -1064,7 +1064,7 @@ func TestMarkets_CLI(t *testing.T) {
10641064
// check multiple filters
10651065
{
10661066
baseDeno := cliTester.DenomBTC
1067-
quoteDenom := cliTester.DenomDFI
1067+
quoteDenom := cliTester.DenomXFI
10681068
q, markets := ct.QueryMarketsList(-1, -1, &baseDeno, &quoteDenom)
10691069
q.CheckSucceeded()
10701070

@@ -1077,12 +1077,12 @@ func TestOrders_CLI(t *testing.T) {
10771077
t.Parallel()
10781078

10791079
const (
1080-
DecimalsDFI = "1000000000000000000"
1080+
DecimalsXFI = "1000000000000000000"
10811081
DecimalsETH = "1000000000000000000"
10821082
DecimalsBTC = "100000000"
10831083
)
10841084

1085-
oneDfi := sdk.NewUintFromString(DecimalsDFI)
1085+
oneXfi := sdk.NewUintFromString(DecimalsXFI)
10861086
oneBtc := sdk.NewUintFromString(DecimalsBTC)
10871087
oneEth := sdk.NewUintFromString(DecimalsETH)
10881088
accountBalances := []cliTester.StringPair{
@@ -1095,8 +1095,8 @@ func TestOrders_CLI(t *testing.T) {
10951095
Value: sdk.NewUint(100000000).Mul(oneEth).String(),
10961096
},
10971097
{
1098-
Key: cliTester.DenomDFI,
1099-
Value: sdk.NewUint(100000000).Mul(oneDfi).String(),
1098+
Key: cliTester.DenomXFI,
1099+
Value: sdk.NewUint(100000000).Mul(oneXfi).String(),
11001100
},
11011101
}
11021102
accountOpts := []cliTester.AccountOption{
@@ -1114,15 +1114,15 @@ func TestOrders_CLI(t *testing.T) {
11141114
ownerAddr1 := ct.Accounts[accountOpts[0].Name].Address
11151115
ownerAddr2 := ct.Accounts[accountOpts[1].Name].Address
11161116
marketID0, marketID1 := dnTypes.NewIDFromUint64(0), dnTypes.NewIDFromUint64(1)
1117-
assetCode0, assetCode1 := dnTypes.AssetCode("btc_dfi"), dnTypes.AssetCode("eth_dfi")
1117+
assetCode0, assetCode1 := dnTypes.AssetCode("btc_xfi"), dnTypes.AssetCode("eth_xfi")
11181118

11191119
wsStop, wsChs := ct.CheckWSsSubscribed(false, "TestOrders_CLI", []string{"message.module='orders'"}, 10)
11201120
defer wsStop()
11211121
go cliTester.PrintEvents(t, wsChs, "orders")
11221122

11231123
// add market
1124-
ct.TxMarketsAdd(ownerAddr1, cliTester.DenomBTC, cliTester.DenomDFI).CheckSucceeded()
1125-
ct.TxMarketsAdd(ownerAddr1, cliTester.DenomETH, cliTester.DenomDFI).CheckSucceeded()
1124+
ct.TxMarketsAdd(ownerAddr1, cliTester.DenomBTC, cliTester.DenomXFI).CheckSucceeded()
1125+
ct.TxMarketsAdd(ownerAddr1, cliTester.DenomETH, cliTester.DenomXFI).CheckSucceeded()
11261126

11271127
// check AddOrder Tx
11281128
{

app/common_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ func GenTx(msgs []sdk.Msg, accnums []uint64, seq []uint64, priv ...crypto.PrivKe
516516
return auth.NewStdTx(msgs, fee, sigs, memo)
517517
}
518518

519-
// GenDefCoins returns Coins with dfi amount.
519+
// GenDefCoins returns Coins with xfi amount.
520520
func GenDefCoins(t *testing.T) sdk.Coins {
521521
coins, err := sdk.ParseCoins("1000000000000000000000" + dnConfig.MainDenom)
522522
if t != nil {

app/integ_app_test.go

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -77,39 +77,39 @@ module Swap {
7777
const createSwapScriptSrcFmt = `
7878
script {
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

9393
const swapSwapScriptSrcFmt = `
9494
script {
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
114114
func 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)

app/integ_linux_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ func TestIntegVM_CommunicationUDSOverDocker(t *testing.T) {
2222
const script = `
2323
script {
2424
use 0x1::Account;
25-
use 0x1::DFI;
25+
use 0x1::XFI;
2626
2727
fun main(account: &signer) {
28-
let dfi = Account::withdraw_from_sender<DFI::T>(account, 1);
29-
Account::deposit_to_sender<DFI::T>(account, dfi);
28+
let xfi = Account::withdraw_from_sender<XFI::T>(account, 1);
29+
Account::deposit_to_sender<XFI::T>(account, xfi);
3030
}
3131
}
3232
`

app/integ_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ func TestInteg_ConsensusFailure(t *testing.T) {
2929
const script = `
3030
script {
3131
use 0x1::Account;
32-
use 0x1::DFI;
32+
use 0x1::XFI;
3333
3434
fun main(account: &signer, recipient: address, amount: u128) {
35-
Account::pay_from_sender<DFI::T>(account, recipient, amount);
35+
Account::pay_from_sender<XFI::T>(account, recipient, amount);
3636
}
3737
}
3838
`
@@ -95,11 +95,11 @@ func TestIntegVM_ExecuteScriptViaCLI(t *testing.T) {
9595
const script = `
9696
script {
9797
use 0x1::Account;
98-
use 0x1::DFI;
98+
use 0x1::XFI;
9999
100100
fun main(account: &signer, amount: u128) {
101-
let dfi = Account::withdraw_from_sender<DFI::T>(account, amount);
102-
Account::deposit_to_sender<DFI::T>(account, dfi);
101+
let xfi = Account::withdraw_from_sender<XFI::T>(account, amount);
102+
Account::deposit_to_sender<XFI::T>(account, xfi);
103103
}
104104
}
105105
`
@@ -182,11 +182,11 @@ func TestIntegVM_ExecuteScriptViaREST(t *testing.T) {
182182
const script = `
183183
script {
184184
use 0x1::Account;
185-
use 0x1::DFI;
185+
use 0x1::XFI;
186186
187187
fun main(account: &signer, amount: u128) {
188-
let dfi = Account::withdraw_from_sender<DFI::T>(account, amount);
189-
Account::deposit_to_sender<DFI::T>(account, dfi);
188+
let xfi = Account::withdraw_from_sender<XFI::T>(account, amount);
189+
Account::deposit_to_sender<XFI::T>(account, xfi);
190190
}
191191
}
192192
`
@@ -507,11 +507,11 @@ func TestIntegVM_CommunicationUDS(t *testing.T) {
507507
const script = `
508508
script {
509509
use 0x1::Account;
510-
use 0x1::DFI;
510+
use 0x1::XFI;
511511
512512
fun main(account: &signer) {
513-
let dfi = Account::withdraw_from_sender<DFI::T>(account, 1);
514-
Account::deposit_to_sender<DFI::T>(account, dfi);
513+
let xfi = Account::withdraw_from_sender<XFI::T>(account, 1);
514+
Account::deposit_to_sender<XFI::T>(account, xfi);
515515
}
516516
}
517517
`

0 commit comments

Comments
 (0)