@@ -13,8 +13,10 @@ import (
13
13
"github.com/ethereum/go-ethereum/rpc"
14
14
"github.com/stretchr/testify/require"
15
15
16
+ "github.com/stellar/go/amount"
16
17
"github.com/stellar/go/clients/horizonclient"
17
18
"github.com/stellar/go/protocols/horizon"
19
+ "github.com/stellar/go/txnbuild"
18
20
"github.com/stellar/go/xdr"
19
21
)
20
22
@@ -136,6 +138,17 @@ func TestStellarToEthereumWithdrawal(t *testing.T) {
136
138
WithdrawalWindow : time .Hour ,
137
139
})
138
140
141
+ acct , err := itest .horizonClient .AccountDetail (horizonclient.AccountRequest {AccountID : itest .clientKey .Address ()})
142
+ require .NoError (t , err )
143
+ var before xdr.Int64
144
+ for _ , balance := range acct .Balances {
145
+ if balance .Asset .Type == "native" {
146
+ before = amount .MustParse (balance .Balance )
147
+ break
148
+ }
149
+ }
150
+ require .Greater (t , before , xdr .Int64 (0 ))
151
+
139
152
tx , err := itest .bridgeClient .SubmitStellarDeposit (xdr .MustNewNativeAsset (), "3" , ethereumSenderAddress (t ))
140
153
require .NoError (t , err )
141
154
@@ -156,6 +169,30 @@ func TestStellarToEthereumWithdrawal(t *testing.T) {
156
169
gasPrice ,
157
170
)
158
171
require .Error (t , err )
172
+
173
+ receipt , err := itest .bridgeClient .SubmitEthereumDeposit (
174
+ context .Background (),
175
+ common .HexToAddress (EthereumXLMTokenAddress ),
176
+ itest .clientKey .Address (),
177
+ new (big.Int ).Mul (big .NewInt (3 ), big .NewInt (1e7 )),
178
+ gasPrice ,
179
+ )
180
+ require .NoError (t , err )
181
+
182
+ _ , err = itest .bridgeClient .SubmitStellarWithdrawal (receipt .TxHash .String (), receipt .Logs [0 ].Index )
183
+ require .NoError (t , err )
184
+
185
+ acct , err = itest .horizonClient .AccountDetail (horizonclient.AccountRequest {AccountID : itest .clientKey .Address ()})
186
+ require .NoError (t , err )
187
+ var after xdr.Int64
188
+ for _ , balance := range acct .Balances {
189
+ if balance .Asset .Type == "native" {
190
+ after = amount .MustParse (balance .Balance )
191
+ break
192
+ }
193
+ }
194
+ require .Greater (t , before , xdr .Int64 (0 ))
195
+ require .Equal (t , before , after + txnbuild .MinBaseFee * 2 )
159
196
}
160
197
161
198
func TestStellarRefund (t * testing.T ) {
0 commit comments