@aurigami/sdk 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -853,1350 +853,72 @@ var Token = function Token(address, decimals, expiry) {
853
853
  this.expiry = expiry;
854
854
  };
855
855
 
856
- var TokenAmount = /*#__PURE__*/function () {
857
- function TokenAmount(token, amount, isRaw) {
858
- if (isRaw === void 0) {
859
- isRaw = true;
860
- }
861
-
862
- if (isRaw) {
863
- this.rawAmnt = amount;
864
- } else {
865
- this.rawAmnt = new BigNumber(amount).times(decimalFactor(token.decimals)).toFixed(0);
866
- }
867
-
868
- this.token = token;
869
- }
870
-
871
- var _proto = TokenAmount.prototype;
872
-
873
- _proto.formattedAmount = function formattedAmount() {
874
- return new BigNumber(this.rawAmnt).div(decimalFactor(this.token.decimals)).toString();
875
- };
876
-
877
- _proto.rawAmount = function rawAmount() {
878
- return this.rawAmnt;
879
- };
880
-
881
- return TokenAmount;
882
- }();
883
-
884
- var dummyToken = /*#__PURE__*/new Token('0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e', 6);
885
- var dummyPly = /*#__PURE__*/new Token('0x8729438eb15e2c8b576fcc6aecda6a148776c0f5', 18);
886
- var dummyPlyAurora = /*#__PURE__*/new Token('0xE530dC2095Ef5653205CF5ea79F8979a7028065c', 18);
887
- var dummyTokenAmount = /*#__PURE__*/new TokenAmount(dummyToken, '123.456', false);
888
- var dummyZeroTokenAmount = /*#__PURE__*/new TokenAmount(dummyToken, '0');
889
- var dummyTokenAmount2 = /*#__PURE__*/new TokenAmount(dummyToken, '456.123', false);
890
- var dummyTokenAmount3 = /*#__PURE__*/new TokenAmount(dummyToken, '1000.123', false);
891
- var dummyMarketAddress = '0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f';
892
- var dummyUserMarketDetails = {
893
- market: dummyMarketAddress,
894
- depositBalance: dummyTokenAmount2,
895
- borrowBalance: dummyZeroTokenAmount,
896
- isCollateral: true,
897
- maxWithdrawableAmount: dummyTokenAmount
898
- };
899
-
900
- var ethers = /*#__PURE__*/require('ethers');
901
-
902
- var DOLLAR = /*#__PURE__*/new Token('0x0000000000000000000000000000000000000001', 2);
903
- var AVAX_DEFAULT_PROVIDER_URL = 'https://api.avax.network/ext/bc/C/rpc';
904
- var AVAX_DEFAULT_PROVIDER = /*#__PURE__*/new ethers.providers.JsonRpcProvider(AVAX_DEFAULT_PROVIDER_URL);
905
- var dummyPrivateKey = '1111111111111111111111111111111111111111111111111111111111111111';
906
- var AVAX_DEFAULT_SIGNER = /*#__PURE__*/new ethers.Wallet(dummyPrivateKey);
907
-
908
- var abi = [
909
- {
910
- inputs: [
911
- {
912
- internalType: "string",
913
- name: "_name",
914
- type: "string"
915
- },
916
- {
917
- internalType: "string",
918
- name: "_symbol",
919
- type: "string"
920
- },
921
- {
922
- internalType: "uint8",
923
- name: "_decimals",
924
- type: "uint8"
925
- },
926
- {
927
- internalType: "address",
928
- name: "_underlying",
929
- type: "address"
930
- },
931
- {
932
- internalType: "address",
933
- name: "_vault",
934
- type: "address"
935
- }
936
- ],
937
- stateMutability: "nonpayable",
938
- type: "constructor"
939
- },
940
- {
941
- anonymous: false,
942
- inputs: [
943
- {
944
- indexed: true,
945
- internalType: "address",
946
- name: "owner",
947
- type: "address"
948
- },
949
- {
950
- indexed: true,
951
- internalType: "address",
952
- name: "spender",
953
- type: "address"
954
- },
955
- {
956
- indexed: false,
957
- internalType: "uint256",
958
- name: "value",
959
- type: "uint256"
960
- }
961
- ],
962
- name: "Approval",
963
- type: "event"
964
- },
965
- {
966
- anonymous: false,
967
- inputs: [
968
- {
969
- indexed: true,
970
- internalType: "address",
971
- name: "auth",
972
- type: "address"
973
- },
974
- {
975
- indexed: false,
976
- internalType: "uint256",
977
- name: "timestamp",
978
- type: "uint256"
979
- }
980
- ],
981
- name: "LogAddAuth",
982
- type: "event"
983
- },
984
- {
985
- anonymous: false,
986
- inputs: [
987
- {
988
- indexed: true,
989
- internalType: "address",
990
- name: "oldOwner",
991
- type: "address"
992
- },
993
- {
994
- indexed: true,
995
- internalType: "address",
996
- name: "newOwner",
997
- type: "address"
998
- },
999
- {
1000
- indexed: true,
1001
- internalType: "uint256",
1002
- name: "effectiveHeight",
1003
- type: "uint256"
1004
- }
1005
- ],
1006
- name: "LogChangeMPCOwner",
1007
- type: "event"
1008
- },
1009
- {
1010
- anonymous: false,
1011
- inputs: [
1012
- {
1013
- indexed: true,
1014
- internalType: "address",
1015
- name: "oldVault",
1016
- type: "address"
1017
- },
1018
- {
1019
- indexed: true,
1020
- internalType: "address",
1021
- name: "newVault",
1022
- type: "address"
1023
- },
1024
- {
1025
- indexed: true,
1026
- internalType: "uint256",
1027
- name: "effectiveTime",
1028
- type: "uint256"
1029
- }
1030
- ],
1031
- name: "LogChangeVault",
1032
- type: "event"
1033
- },
1034
- {
1035
- anonymous: false,
1036
- inputs: [
1037
- {
1038
- indexed: true,
1039
- internalType: "bytes32",
1040
- name: "txhash",
1041
- type: "bytes32"
1042
- },
1043
- {
1044
- indexed: true,
1045
- internalType: "address",
1046
- name: "account",
1047
- type: "address"
1048
- },
1049
- {
1050
- indexed: false,
1051
- internalType: "uint256",
1052
- name: "amount",
1053
- type: "uint256"
1054
- }
1055
- ],
1056
- name: "LogSwapin",
1057
- type: "event"
1058
- },
1059
- {
1060
- anonymous: false,
1061
- inputs: [
1062
- {
1063
- indexed: true,
1064
- internalType: "address",
1065
- name: "account",
1066
- type: "address"
1067
- },
1068
- {
1069
- indexed: true,
1070
- internalType: "address",
1071
- name: "bindaddr",
1072
- type: "address"
1073
- },
1074
- {
1075
- indexed: false,
1076
- internalType: "uint256",
1077
- name: "amount",
1078
- type: "uint256"
1079
- }
1080
- ],
1081
- name: "LogSwapout",
1082
- type: "event"
1083
- },
1084
- {
1085
- anonymous: false,
1086
- inputs: [
1087
- {
1088
- indexed: true,
1089
- internalType: "address",
1090
- name: "from",
1091
- type: "address"
1092
- },
1093
- {
1094
- indexed: true,
1095
- internalType: "address",
1096
- name: "to",
1097
- type: "address"
1098
- },
1099
- {
1100
- indexed: false,
1101
- internalType: "uint256",
1102
- name: "value",
1103
- type: "uint256"
1104
- }
1105
- ],
1106
- name: "Transfer",
1107
- type: "event"
1108
- },
1109
- {
1110
- inputs: [
1111
- ],
1112
- name: "DOMAIN_SEPARATOR",
1113
- outputs: [
1114
- {
1115
- internalType: "bytes32",
1116
- name: "",
1117
- type: "bytes32"
1118
- }
1119
- ],
1120
- stateMutability: "view",
1121
- type: "function"
1122
- },
1123
- {
1124
- inputs: [
1125
- ],
1126
- name: "PERMIT_TYPEHASH",
1127
- outputs: [
1128
- {
1129
- internalType: "bytes32",
1130
- name: "",
1131
- type: "bytes32"
1132
- }
1133
- ],
1134
- stateMutability: "view",
1135
- type: "function"
1136
- },
1137
- {
1138
- inputs: [
1139
- {
1140
- internalType: "bytes32",
1141
- name: "txhash",
1142
- type: "bytes32"
1143
- },
1144
- {
1145
- internalType: "address",
1146
- name: "account",
1147
- type: "address"
1148
- },
1149
- {
1150
- internalType: "uint256",
1151
- name: "amount",
1152
- type: "uint256"
1153
- }
1154
- ],
1155
- name: "Swapin",
1156
- outputs: [
1157
- {
1158
- internalType: "bool",
1159
- name: "",
1160
- type: "bool"
1161
- }
1162
- ],
1163
- stateMutability: "nonpayable",
1164
- type: "function"
1165
- },
1166
- {
1167
- inputs: [
1168
- {
1169
- internalType: "uint256",
1170
- name: "amount",
1171
- type: "uint256"
1172
- },
1173
- {
1174
- internalType: "address",
1175
- name: "bindaddr",
1176
- type: "address"
1177
- }
1178
- ],
1179
- name: "Swapout",
1180
- outputs: [
1181
- {
1182
- internalType: "bool",
1183
- name: "",
1184
- type: "bool"
1185
- }
1186
- ],
1187
- stateMutability: "nonpayable",
1188
- type: "function"
1189
- },
1190
- {
1191
- inputs: [
1192
- ],
1193
- name: "TRANSFER_TYPEHASH",
1194
- outputs: [
1195
- {
1196
- internalType: "bytes32",
1197
- name: "",
1198
- type: "bytes32"
1199
- }
1200
- ],
1201
- stateMutability: "view",
1202
- type: "function"
1203
- },
1204
- {
1205
- inputs: [
1206
- {
1207
- internalType: "address",
1208
- name: "",
1209
- type: "address"
1210
- },
1211
- {
1212
- internalType: "address",
1213
- name: "",
1214
- type: "address"
1215
- }
1216
- ],
1217
- name: "allowance",
1218
- outputs: [
1219
- {
1220
- internalType: "uint256",
1221
- name: "",
1222
- type: "uint256"
1223
- }
1224
- ],
1225
- stateMutability: "view",
1226
- type: "function"
1227
- },
1228
- {
1229
- inputs: [
1230
- ],
1231
- name: "applyMinter",
1232
- outputs: [
1233
- ],
1234
- stateMutability: "nonpayable",
1235
- type: "function"
1236
- },
1237
- {
1238
- inputs: [
1239
- ],
1240
- name: "applyVault",
1241
- outputs: [
1242
- ],
1243
- stateMutability: "nonpayable",
1244
- type: "function"
1245
- },
1246
- {
1247
- inputs: [
1248
- {
1249
- internalType: "address",
1250
- name: "spender",
1251
- type: "address"
1252
- },
1253
- {
1254
- internalType: "uint256",
1255
- name: "value",
1256
- type: "uint256"
1257
- }
1258
- ],
1259
- name: "approve",
1260
- outputs: [
1261
- {
1262
- internalType: "bool",
1263
- name: "",
1264
- type: "bool"
1265
- }
1266
- ],
1267
- stateMutability: "nonpayable",
1268
- type: "function"
1269
- },
1270
- {
1271
- inputs: [
1272
- {
1273
- internalType: "address",
1274
- name: "spender",
1275
- type: "address"
1276
- },
1277
- {
1278
- internalType: "uint256",
1279
- name: "value",
1280
- type: "uint256"
1281
- },
1282
- {
1283
- internalType: "bytes",
1284
- name: "data",
1285
- type: "bytes"
1286
- }
1287
- ],
1288
- name: "approveAndCall",
1289
- outputs: [
1290
- {
1291
- internalType: "bool",
1292
- name: "",
1293
- type: "bool"
1294
- }
1295
- ],
1296
- stateMutability: "nonpayable",
1297
- type: "function"
1298
- },
1299
- {
1300
- inputs: [
1301
- {
1302
- internalType: "address",
1303
- name: "",
1304
- type: "address"
1305
- }
1306
- ],
1307
- name: "balanceOf",
1308
- outputs: [
1309
- {
1310
- internalType: "uint256",
1311
- name: "",
1312
- type: "uint256"
1313
- }
1314
- ],
1315
- stateMutability: "view",
1316
- type: "function"
1317
- },
1318
- {
1319
- inputs: [
1320
- {
1321
- internalType: "address",
1322
- name: "from",
1323
- type: "address"
1324
- },
1325
- {
1326
- internalType: "uint256",
1327
- name: "amount",
1328
- type: "uint256"
1329
- }
1330
- ],
1331
- name: "burn",
1332
- outputs: [
1333
- {
1334
- internalType: "bool",
1335
- name: "",
1336
- type: "bool"
1337
- }
1338
- ],
1339
- stateMutability: "nonpayable",
1340
- type: "function"
1341
- },
1342
- {
1343
- inputs: [
1344
- {
1345
- internalType: "address",
1346
- name: "newVault",
1347
- type: "address"
1348
- }
1349
- ],
1350
- name: "changeMPCOwner",
1351
- outputs: [
1352
- {
1353
- internalType: "bool",
1354
- name: "",
1355
- type: "bool"
1356
- }
1357
- ],
1358
- stateMutability: "nonpayable",
1359
- type: "function"
1360
- },
1361
- {
1362
- inputs: [
1363
- {
1364
- internalType: "address",
1365
- name: "newVault",
1366
- type: "address"
1367
- }
1368
- ],
1369
- name: "changeVault",
1370
- outputs: [
1371
- {
1372
- internalType: "bool",
1373
- name: "",
1374
- type: "bool"
1375
- }
1376
- ],
1377
- stateMutability: "nonpayable",
1378
- type: "function"
1379
- },
1380
- {
1381
- inputs: [
1382
- ],
1383
- name: "decimals",
1384
- outputs: [
1385
- {
1386
- internalType: "uint8",
1387
- name: "",
1388
- type: "uint8"
1389
- }
1390
- ],
1391
- stateMutability: "view",
1392
- type: "function"
1393
- },
1394
- {
1395
- inputs: [
1396
- ],
1397
- name: "delay",
1398
- outputs: [
1399
- {
1400
- internalType: "uint256",
1401
- name: "",
1402
- type: "uint256"
1403
- }
1404
- ],
1405
- stateMutability: "view",
1406
- type: "function"
1407
- },
1408
- {
1409
- inputs: [
1410
- ],
1411
- name: "delayDelay",
1412
- outputs: [
1413
- {
1414
- internalType: "uint256",
1415
- name: "",
1416
- type: "uint256"
1417
- }
1418
- ],
1419
- stateMutability: "view",
1420
- type: "function"
1421
- },
1422
- {
1423
- inputs: [
1424
- ],
1425
- name: "delayMinter",
1426
- outputs: [
1427
- {
1428
- internalType: "uint256",
1429
- name: "",
1430
- type: "uint256"
1431
- }
1432
- ],
1433
- stateMutability: "view",
1434
- type: "function"
1435
- },
1436
- {
1437
- inputs: [
1438
- ],
1439
- name: "delayVault",
1440
- outputs: [
1441
- {
1442
- internalType: "uint256",
1443
- name: "",
1444
- type: "uint256"
1445
- }
1446
- ],
1447
- stateMutability: "view",
1448
- type: "function"
1449
- },
1450
- {
1451
- inputs: [
1452
- {
1453
- internalType: "uint256",
1454
- name: "amount",
1455
- type: "uint256"
1456
- },
1457
- {
1458
- internalType: "address",
1459
- name: "to",
1460
- type: "address"
1461
- }
1462
- ],
1463
- name: "deposit",
1464
- outputs: [
1465
- {
1466
- internalType: "uint256",
1467
- name: "",
1468
- type: "uint256"
1469
- }
1470
- ],
1471
- stateMutability: "nonpayable",
1472
- type: "function"
1473
- },
1474
- {
1475
- inputs: [
1476
- {
1477
- internalType: "uint256",
1478
- name: "amount",
1479
- type: "uint256"
1480
- }
1481
- ],
1482
- name: "deposit",
1483
- outputs: [
1484
- {
1485
- internalType: "uint256",
1486
- name: "",
1487
- type: "uint256"
1488
- }
1489
- ],
1490
- stateMutability: "nonpayable",
1491
- type: "function"
1492
- },
1493
- {
1494
- inputs: [
1495
- ],
1496
- name: "deposit",
1497
- outputs: [
1498
- {
1499
- internalType: "uint256",
1500
- name: "",
1501
- type: "uint256"
1502
- }
1503
- ],
1504
- stateMutability: "nonpayable",
1505
- type: "function"
1506
- },
1507
- {
1508
- inputs: [
1509
- {
1510
- internalType: "uint256",
1511
- name: "amount",
1512
- type: "uint256"
1513
- },
1514
- {
1515
- internalType: "address",
1516
- name: "to",
1517
- type: "address"
1518
- }
1519
- ],
1520
- name: "depositVault",
1521
- outputs: [
1522
- {
1523
- internalType: "uint256",
1524
- name: "",
1525
- type: "uint256"
1526
- }
1527
- ],
1528
- stateMutability: "nonpayable",
1529
- type: "function"
1530
- },
1531
- {
1532
- inputs: [
1533
- {
1534
- internalType: "address",
1535
- name: "target",
1536
- type: "address"
1537
- },
1538
- {
1539
- internalType: "uint256",
1540
- name: "value",
1541
- type: "uint256"
1542
- },
1543
- {
1544
- internalType: "uint256",
1545
- name: "deadline",
1546
- type: "uint256"
1547
- },
1548
- {
1549
- internalType: "uint8",
1550
- name: "v",
1551
- type: "uint8"
1552
- },
1553
- {
1554
- internalType: "bytes32",
1555
- name: "r",
1556
- type: "bytes32"
1557
- },
1558
- {
1559
- internalType: "bytes32",
1560
- name: "s",
1561
- type: "bytes32"
1562
- },
1563
- {
1564
- internalType: "address",
1565
- name: "to",
1566
- type: "address"
1567
- }
1568
- ],
1569
- name: "depositWithPermit",
1570
- outputs: [
1571
- {
1572
- internalType: "uint256",
1573
- name: "",
1574
- type: "uint256"
1575
- }
1576
- ],
1577
- stateMutability: "nonpayable",
1578
- type: "function"
1579
- },
1580
- {
1581
- inputs: [
1582
- {
1583
- internalType: "address",
1584
- name: "target",
1585
- type: "address"
1586
- },
1587
- {
1588
- internalType: "uint256",
1589
- name: "value",
1590
- type: "uint256"
1591
- },
1592
- {
1593
- internalType: "uint256",
1594
- name: "deadline",
1595
- type: "uint256"
1596
- },
1597
- {
1598
- internalType: "uint8",
1599
- name: "v",
1600
- type: "uint8"
1601
- },
1602
- {
1603
- internalType: "bytes32",
1604
- name: "r",
1605
- type: "bytes32"
1606
- },
1607
- {
1608
- internalType: "bytes32",
1609
- name: "s",
1610
- type: "bytes32"
1611
- },
1612
- {
1613
- internalType: "address",
1614
- name: "to",
1615
- type: "address"
1616
- }
1617
- ],
1618
- name: "depositWithTransferPermit",
1619
- outputs: [
1620
- {
1621
- internalType: "uint256",
1622
- name: "",
1623
- type: "uint256"
1624
- }
1625
- ],
1626
- stateMutability: "nonpayable",
1627
- type: "function"
1628
- },
1629
- {
1630
- inputs: [
1631
- ],
1632
- name: "getAllMinters",
1633
- outputs: [
1634
- {
1635
- internalType: "address[]",
1636
- name: "",
1637
- type: "address[]"
1638
- }
1639
- ],
1640
- stateMutability: "view",
1641
- type: "function"
1642
- },
1643
- {
1644
- inputs: [
1645
- {
1646
- internalType: "address",
1647
- name: "_vault",
1648
- type: "address"
1649
- }
1650
- ],
1651
- name: "initVault",
1652
- outputs: [
1653
- ],
1654
- stateMutability: "nonpayable",
1655
- type: "function"
1656
- },
1657
- {
1658
- inputs: [
1659
- {
1660
- internalType: "address",
1661
- name: "",
1662
- type: "address"
1663
- }
1664
- ],
1665
- name: "isMinter",
1666
- outputs: [
1667
- {
1668
- internalType: "bool",
1669
- name: "",
1670
- type: "bool"
1671
- }
1672
- ],
1673
- stateMutability: "view",
1674
- type: "function"
1675
- },
1676
- {
1677
- inputs: [
1678
- {
1679
- internalType: "address",
1680
- name: "to",
1681
- type: "address"
1682
- },
1683
- {
1684
- internalType: "uint256",
1685
- name: "amount",
1686
- type: "uint256"
1687
- }
1688
- ],
1689
- name: "mint",
1690
- outputs: [
1691
- {
1692
- internalType: "bool",
1693
- name: "",
1694
- type: "bool"
1695
- }
1696
- ],
1697
- stateMutability: "nonpayable",
1698
- type: "function"
1699
- },
1700
- {
1701
- inputs: [
1702
- {
1703
- internalType: "uint256",
1704
- name: "",
1705
- type: "uint256"
1706
- }
1707
- ],
1708
- name: "minters",
1709
- outputs: [
1710
- {
1711
- internalType: "address",
1712
- name: "",
1713
- type: "address"
1714
- }
1715
- ],
1716
- stateMutability: "view",
1717
- type: "function"
1718
- },
1719
- {
1720
- inputs: [
1721
- ],
1722
- name: "mpc",
1723
- outputs: [
1724
- {
1725
- internalType: "address",
1726
- name: "",
1727
- type: "address"
1728
- }
1729
- ],
1730
- stateMutability: "view",
1731
- type: "function"
1732
- },
1733
- {
1734
- inputs: [
1735
- ],
1736
- name: "name",
1737
- outputs: [
1738
- {
1739
- internalType: "string",
1740
- name: "",
1741
- type: "string"
1742
- }
1743
- ],
1744
- stateMutability: "view",
1745
- type: "function"
1746
- },
1747
- {
1748
- inputs: [
1749
- {
1750
- internalType: "address",
1751
- name: "",
1752
- type: "address"
1753
- }
1754
- ],
1755
- name: "nonces",
1756
- outputs: [
1757
- {
1758
- internalType: "uint256",
1759
- name: "",
1760
- type: "uint256"
1761
- }
1762
- ],
1763
- stateMutability: "view",
1764
- type: "function"
1765
- },
1766
- {
1767
- inputs: [
1768
- ],
1769
- name: "owner",
1770
- outputs: [
1771
- {
1772
- internalType: "address",
1773
- name: "",
1774
- type: "address"
1775
- }
1776
- ],
1777
- stateMutability: "view",
1778
- type: "function"
1779
- },
1780
- {
1781
- inputs: [
1782
- ],
1783
- name: "pendingDelay",
1784
- outputs: [
1785
- {
1786
- internalType: "uint256",
1787
- name: "",
1788
- type: "uint256"
1789
- }
1790
- ],
1791
- stateMutability: "view",
1792
- type: "function"
1793
- },
1794
- {
1795
- inputs: [
1796
- ],
1797
- name: "pendingMinter",
1798
- outputs: [
1799
- {
1800
- internalType: "address",
1801
- name: "",
1802
- type: "address"
1803
- }
1804
- ],
1805
- stateMutability: "view",
1806
- type: "function"
1807
- },
1808
- {
1809
- inputs: [
1810
- ],
1811
- name: "pendingVault",
1812
- outputs: [
1813
- {
1814
- internalType: "address",
1815
- name: "",
1816
- type: "address"
1817
- }
1818
- ],
1819
- stateMutability: "view",
1820
- type: "function"
1821
- },
1822
- {
1823
- inputs: [
1824
- {
1825
- internalType: "address",
1826
- name: "target",
1827
- type: "address"
1828
- },
1829
- {
1830
- internalType: "address",
1831
- name: "spender",
1832
- type: "address"
1833
- },
1834
- {
1835
- internalType: "uint256",
1836
- name: "value",
1837
- type: "uint256"
1838
- },
1839
- {
1840
- internalType: "uint256",
1841
- name: "deadline",
1842
- type: "uint256"
1843
- },
1844
- {
1845
- internalType: "uint8",
1846
- name: "v",
1847
- type: "uint8"
1848
- },
1849
- {
1850
- internalType: "bytes32",
1851
- name: "r",
1852
- type: "bytes32"
1853
- },
1854
- {
1855
- internalType: "bytes32",
1856
- name: "s",
1857
- type: "bytes32"
1858
- }
1859
- ],
1860
- name: "permit",
1861
- outputs: [
1862
- ],
1863
- stateMutability: "nonpayable",
1864
- type: "function"
1865
- },
1866
- {
1867
- inputs: [
1868
- {
1869
- internalType: "address",
1870
- name: "_auth",
1871
- type: "address"
1872
- }
1873
- ],
1874
- name: "revokeMinter",
1875
- outputs: [
1876
- ],
1877
- stateMutability: "nonpayable",
1878
- type: "function"
1879
- },
1880
- {
1881
- inputs: [
1882
- {
1883
- internalType: "address",
1884
- name: "_auth",
1885
- type: "address"
1886
- }
1887
- ],
1888
- name: "setMinter",
1889
- outputs: [
1890
- ],
1891
- stateMutability: "nonpayable",
1892
- type: "function"
1893
- },
1894
- {
1895
- inputs: [
1896
- {
1897
- internalType: "address",
1898
- name: "_vault",
1899
- type: "address"
1900
- }
1901
- ],
1902
- name: "setVault",
1903
- outputs: [
1904
- ],
1905
- stateMutability: "nonpayable",
1906
- type: "function"
1907
- },
1908
- {
1909
- inputs: [
1910
- {
1911
- internalType: "bool",
1912
- name: "enabled",
1913
- type: "bool"
1914
- }
1915
- ],
1916
- name: "setVaultOnly",
1917
- outputs: [
1918
- ],
1919
- stateMutability: "nonpayable",
1920
- type: "function"
1921
- },
1922
- {
1923
- inputs: [
1924
- ],
1925
- name: "symbol",
1926
- outputs: [
1927
- {
1928
- internalType: "string",
1929
- name: "",
1930
- type: "string"
1931
- }
1932
- ],
1933
- stateMutability: "view",
1934
- type: "function"
1935
- },
1936
- {
1937
- inputs: [
1938
- ],
1939
- name: "totalSupply",
1940
- outputs: [
1941
- {
1942
- internalType: "uint256",
1943
- name: "",
1944
- type: "uint256"
1945
- }
1946
- ],
1947
- stateMutability: "view",
1948
- type: "function"
1949
- },
1950
- {
1951
- inputs: [
1952
- {
1953
- internalType: "address",
1954
- name: "to",
1955
- type: "address"
1956
- },
1957
- {
1958
- internalType: "uint256",
1959
- name: "value",
1960
- type: "uint256"
1961
- }
1962
- ],
1963
- name: "transfer",
1964
- outputs: [
1965
- {
1966
- internalType: "bool",
1967
- name: "",
1968
- type: "bool"
1969
- }
1970
- ],
1971
- stateMutability: "nonpayable",
1972
- type: "function"
1973
- },
1974
- {
1975
- inputs: [
1976
- {
1977
- internalType: "address",
1978
- name: "to",
1979
- type: "address"
1980
- },
1981
- {
1982
- internalType: "uint256",
1983
- name: "value",
1984
- type: "uint256"
1985
- },
1986
- {
1987
- internalType: "bytes",
1988
- name: "data",
1989
- type: "bytes"
1990
- }
1991
- ],
1992
- name: "transferAndCall",
1993
- outputs: [
1994
- {
1995
- internalType: "bool",
1996
- name: "",
1997
- type: "bool"
1998
- }
1999
- ],
2000
- stateMutability: "nonpayable",
2001
- type: "function"
2002
- },
2003
- {
2004
- inputs: [
2005
- {
2006
- internalType: "address",
2007
- name: "from",
2008
- type: "address"
2009
- },
2010
- {
2011
- internalType: "address",
2012
- name: "to",
2013
- type: "address"
2014
- },
2015
- {
2016
- internalType: "uint256",
2017
- name: "value",
2018
- type: "uint256"
2019
- }
2020
- ],
2021
- name: "transferFrom",
2022
- outputs: [
2023
- {
2024
- internalType: "bool",
2025
- name: "",
2026
- type: "bool"
2027
- }
2028
- ],
2029
- stateMutability: "nonpayable",
2030
- type: "function"
2031
- },
2032
- {
2033
- inputs: [
2034
- {
2035
- internalType: "address",
2036
- name: "target",
2037
- type: "address"
2038
- },
2039
- {
2040
- internalType: "address",
2041
- name: "to",
2042
- type: "address"
2043
- },
2044
- {
2045
- internalType: "uint256",
2046
- name: "value",
2047
- type: "uint256"
2048
- },
2049
- {
2050
- internalType: "uint256",
2051
- name: "deadline",
2052
- type: "uint256"
2053
- },
2054
- {
2055
- internalType: "uint8",
2056
- name: "v",
2057
- type: "uint8"
2058
- },
2059
- {
2060
- internalType: "bytes32",
2061
- name: "r",
2062
- type: "bytes32"
2063
- },
2064
- {
2065
- internalType: "bytes32",
2066
- name: "s",
2067
- type: "bytes32"
2068
- }
2069
- ],
2070
- name: "transferWithPermit",
2071
- outputs: [
2072
- {
2073
- internalType: "bool",
2074
- name: "",
2075
- type: "bool"
2076
- }
2077
- ],
2078
- stateMutability: "nonpayable",
2079
- type: "function"
2080
- },
2081
- {
2082
- inputs: [
2083
- ],
2084
- name: "underlying",
2085
- outputs: [
2086
- {
2087
- internalType: "address",
2088
- name: "",
2089
- type: "address"
2090
- }
2091
- ],
2092
- stateMutability: "view",
2093
- type: "function"
2094
- },
2095
- {
2096
- inputs: [
2097
- ],
2098
- name: "vault",
2099
- outputs: [
2100
- {
2101
- internalType: "address",
2102
- name: "",
2103
- type: "address"
2104
- }
2105
- ],
2106
- stateMutability: "view",
2107
- type: "function"
2108
- },
2109
- {
2110
- inputs: [
2111
- {
2112
- internalType: "uint256",
2113
- name: "amount",
2114
- type: "uint256"
2115
- },
2116
- {
2117
- internalType: "address",
2118
- name: "to",
2119
- type: "address"
2120
- }
2121
- ],
2122
- name: "withdraw",
2123
- outputs: [
2124
- {
2125
- internalType: "uint256",
2126
- name: "",
2127
- type: "uint256"
2128
- }
2129
- ],
2130
- stateMutability: "nonpayable",
2131
- type: "function"
2132
- },
2133
- {
2134
- inputs: [
2135
- {
2136
- internalType: "uint256",
2137
- name: "amount",
2138
- type: "uint256"
2139
- }
2140
- ],
2141
- name: "withdraw",
2142
- outputs: [
2143
- {
2144
- internalType: "uint256",
2145
- name: "",
2146
- type: "uint256"
2147
- }
2148
- ],
2149
- stateMutability: "nonpayable",
2150
- type: "function"
2151
- },
2152
- {
2153
- inputs: [
2154
- ],
2155
- name: "withdraw",
2156
- outputs: [
2157
- {
2158
- internalType: "uint256",
2159
- name: "",
2160
- type: "uint256"
2161
- }
2162
- ],
2163
- stateMutability: "nonpayable",
2164
- type: "function"
2165
- },
2166
- {
2167
- inputs: [
2168
- {
2169
- internalType: "address",
2170
- name: "from",
2171
- type: "address"
2172
- },
2173
- {
2174
- internalType: "uint256",
2175
- name: "amount",
2176
- type: "uint256"
2177
- },
2178
- {
2179
- internalType: "address",
2180
- name: "to",
2181
- type: "address"
2182
- }
2183
- ],
2184
- name: "withdrawVault",
2185
- outputs: [
2186
- {
2187
- internalType: "uint256",
2188
- name: "",
2189
- type: "uint256"
2190
- }
2191
- ],
2192
- stateMutability: "nonpayable",
2193
- type: "function"
2194
- }
2195
- ];
2196
- var IERC20 = {
2197
- abi: abi
856
+ function formatObject(object) {
857
+ return JSON.stringify(object, null, ' ');
858
+ }
859
+ var decimalFactor = function decimalFactor(decimal) {
860
+ return ethers$2.BigNumber.from(10).pow(decimal).toString();
861
+ };
862
+ function validateAndParseAddress(address) {
863
+ try {
864
+ return ethers$2.utils.getAddress(address);
865
+ } catch (error) {
866
+ throw new Error("Invalid address " + address);
867
+ }
868
+ }
869
+
870
+ var TokenAmount = /*#__PURE__*/function () {
871
+ function TokenAmount(token, amount, isRaw) {
872
+ if (isRaw === void 0) {
873
+ isRaw = true;
874
+ }
875
+
876
+ if (isRaw) {
877
+ this.rawAmnt = amount;
878
+ } else {
879
+ this.rawAmnt = new BigNumber(amount).times(decimalFactor(token.decimals)).toFixed(0);
880
+ }
881
+
882
+ this.token = token;
883
+ }
884
+
885
+ var _proto = TokenAmount.prototype;
886
+
887
+ _proto.formattedAmount = function formattedAmount() {
888
+ return new BigNumber(this.rawAmnt).div(decimalFactor(this.token.decimals)).toString();
889
+ };
890
+
891
+ _proto.rawAmount = function rawAmount() {
892
+ return this.rawAmnt;
893
+ };
894
+
895
+ return TokenAmount;
896
+ }();
897
+
898
+ var dummyToken = /*#__PURE__*/new Token('0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e', 6);
899
+ var dummyPly = /*#__PURE__*/new Token('0x8729438eb15e2c8b576fcc6aecda6a148776c0f5', 18);
900
+ var dummyPlyAurora = /*#__PURE__*/new Token('0xE530dC2095Ef5653205CF5ea79F8979a7028065c', 18);
901
+ var dummyTokenAmount = /*#__PURE__*/new TokenAmount(dummyToken, '123.456', false);
902
+ var dummyZeroTokenAmount = /*#__PURE__*/new TokenAmount(dummyToken, '0');
903
+ var dummyTokenAmount2 = /*#__PURE__*/new TokenAmount(dummyToken, '456.123', false);
904
+ var dummyTokenAmount3 = /*#__PURE__*/new TokenAmount(dummyToken, '1000.123', false);
905
+ var dummyMarketAddress = '0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f';
906
+ var dummyUserMarketDetails = {
907
+ market: dummyMarketAddress,
908
+ depositBalance: dummyTokenAmount2,
909
+ borrowBalance: dummyZeroTokenAmount,
910
+ isCollateral: true,
911
+ maxWithdrawableAmount: dummyTokenAmount
2198
912
  };
2199
913
 
914
+ var ethers = /*#__PURE__*/require('ethers');
915
+
916
+ var DOLLAR = /*#__PURE__*/new Token('0x0000000000000000000000000000000000000001', 2);
917
+ var AVAX_DEFAULT_PROVIDER_URL = 'https://api.avax.network/ext/bc/C/rpc';
918
+ var AVAX_DEFAULT_PROVIDER = /*#__PURE__*/new ethers.providers.JsonRpcProvider(AVAX_DEFAULT_PROVIDER_URL);
919
+ var dummyPrivateKey = '1111111111111111111111111111111111111111111111111111111111111111';
920
+ var AVAX_DEFAULT_SIGNER = /*#__PURE__*/new ethers.Wallet(dummyPrivateKey);
921
+
2200
922
  var ethers$1 = /*#__PURE__*/require('ethers');
2201
923
 
2202
924
  var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
@@ -2354,19 +1076,13 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
2354
1076
 
2355
1077
  _this = _SdkRead.apply(this, arguments) || this;
2356
1078
  _this.dummyTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
2357
- var dummyErc20Token;
2358
1079
  return runtime_1.wrap(function _callee6$(_context6) {
2359
1080
  while (1) {
2360
1081
  switch (_context6.prev = _context6.next) {
2361
1082
  case 0:
2362
- dummyErc20Token = new ethers$2.Contract(dummyToken.address, IERC20.abi, _this._providerOrSigner);
2363
- _context6.next = 3;
2364
- return dummyErc20Token.approve(dummyToken.address, 123);
2365
-
2366
- case 3:
2367
- return _context6.abrupt("return", _context6.sent);
1083
+ return _context6.abrupt("return", {});
2368
1084
 
2369
- case 4:
1085
+ case 1:
2370
1086
  case "end":
2371
1087
  return _context6.stop();
2372
1088
  }
@@ -2469,7 +1185,7 @@ var SDK = /*#__PURE__*/function (_BlockchainEntity) {
2469
1185
  return SDK;
2470
1186
  }(BlockchainEntity);
2471
1187
 
2472
- var abi$1 = [
1188
+ var abi = [
2473
1189
  {
2474
1190
  inputs: [
2475
1191
  {
@@ -4031,22 +2747,8 @@ var abi$1 = [
4031
2747
  }
4032
2748
  ];
4033
2749
  var AuToken = {
4034
- abi: abi$1
4035
- };
4036
-
4037
- function formatObject(object) {
4038
- return JSON.stringify(object, null, ' ');
4039
- }
4040
- var decimalFactor = function decimalFactor(decimal) {
4041
- return ethers$2.BigNumber.from(10).pow(decimal).toString();
2750
+ abi: abi
4042
2751
  };
4043
- function validateAndParseAddress(address) {
4044
- try {
4045
- return ethers$2.utils.getAddress(address);
4046
- } catch (error) {
4047
- throw new Error("Invalid address " + address);
4048
- }
4049
- }
4050
2752
 
4051
2753
  var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4052
2754
  _inheritsLoose(MoneyMarketRead, _BlockchainEntityRead);
@@ -4103,19 +2805,13 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
4103
2805
 
4104
2806
  _this2 = _MoneyMarketRead.apply(this, arguments) || this;
4105
2807
  _this2.dummyTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
4106
- var dummyErc20Token;
4107
2808
  return runtime_1.wrap(function _callee2$(_context2) {
4108
2809
  while (1) {
4109
2810
  switch (_context2.prev = _context2.next) {
4110
2811
  case 0:
4111
- dummyErc20Token = new ethers$2.Contract(dummyToken.address, IERC20.abi, _this2._providerOrSigner);
4112
- _context2.next = 3;
4113
- return dummyErc20Token.approve(dummyToken.address, 123);
4114
-
4115
- case 3:
4116
- return _context2.abrupt("return", _context2.sent);
2812
+ return _context2.abrupt("return", {});
4117
2813
 
4118
- case 4:
2814
+ case 1:
4119
2815
  case "end":
4120
2816
  return _context2.stop();
4121
2817
  }