@@ -3,6 +3,7 @@ package bridge
3
3
import (
4
4
"context"
5
5
"encoding/base64"
6
+ "encoding/binary"
6
7
"fmt"
7
8
"github.com/Gravity-Tech/gravity-node-data-extractor/v2/extractors"
8
9
"github.com/Gravity-Tech/gravity-node-data-extractor/v2/helpers"
@@ -144,14 +145,15 @@ func (provider *ErgoToErgoExtractionBridge) ExtractDirectTransferRequest(ctx con
144
145
//newAmount := int64(float64(amount) * sourceDecimals / destinationDecimals)
145
146
newAmount := bigAmount .
146
147
Mul (bigAmount , destinationDecimals ).
147
- Div (bigAmount , sourceDecimals )
148
+ Div (bigAmount , sourceDecimals ). Int64 ()
148
149
fmt .Println (newAmount )
149
150
150
151
result := []byte {'m' }
151
152
newAmountBytes := make ([]byte , 32 )
153
+ binary .BigEndian .PutUint64 (newAmountBytes , uint64 (newAmount ))
152
154
var RequestIdBytes [32 ]byte
153
155
result = append (result , rqId .FillBytes (RequestIdBytes [:])... )
154
- result = append (result , newAmount . FillBytes ( newAmountBytes [:]) ... )
156
+ result = append (result , newAmountBytes [:]... )
155
157
receiver := []byte (rq .Receiver )
156
158
result = append (result , receiver [:]... )
157
159
@@ -191,14 +193,16 @@ func (provider *ErgoToErgoExtractionBridge) ExtractReverseTransferRequest(ctx co
191
193
192
194
//newAmount := int64(float64(amount) * sourceDecimals / destinationDecimals)
193
195
newAmount := bigAmount .
194
- Mul (bigAmount , sourceDecimals ).
195
- Div (bigAmount , destinationDecimals )
196
+ Mul (bigAmount , destinationDecimals ).
197
+ Div (bigAmount , sourceDecimals ).Int64 ()
198
+ fmt .Println (newAmount )
196
199
197
- result := []byte {'u ' }
200
+ result := []byte {'m ' }
198
201
newAmountBytes := make ([]byte , 32 )
202
+ binary .BigEndian .PutUint64 (newAmountBytes , uint64 (newAmount ))
199
203
var RequestIdBytes [32 ]byte
200
204
result = append (result , rqId .FillBytes (RequestIdBytes [:])... )
201
- result = append (result , newAmount . FillBytes ( newAmountBytes [:]) ... )
205
+ result = append (result , newAmountBytes [:]... )
202
206
receiver := []byte (rq .Receiver )
203
207
result = append (result , receiver [:]... )
204
208
0 commit comments