-
Notifications
You must be signed in to change notification settings - Fork 7
/
withdrawals_test.go
54 lines (40 loc) · 1018 Bytes
/
withdrawals_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main
import (
"log"
"testing"
"github.com/samott/crash-backend/config"
"github.com/shopspring/decimal"
)
var cfg *config.CrashConfig;
func init() {
var err error;
cfg, err = config.LoadConfig("./crash_test.yaml");
if err != nil {
log.Fatal("failed to load config", err);
}
if err != nil {
log.Fatal("failed to connect to database", "error", err)
return;
}
if err != nil {
log.Fatal("bank construction failed", err);
}
}
func TestWithdrawal(t *testing.T) {
amount, _ := decimal.NewFromString("1");
_, sig, err := createWithdrawalRequest(
"0x1111111111111111111111111111111111111111",
amount,
"eth",
1,
0,
cfg,
);
if err != nil {
log.Fatal("Failed to create withdrawal request: ", err);
}
expectedSig := "0x4aaa23c780b7c15b65bb33e283b7e3be3b364b61bfe1e02060d63cf2cfc6edf56f6e1f8312dcf9323239637b03bf5f89c9a80a6967e20da0a6b8e9a43fbaa0011b";
if sig != expectedSig {
log.Fatal("Incorrect signature for withdrawal request: ", sig, " vs. ", expectedSig);
}
}