Skip to content

Commit 00985e7

Browse files
litepresencexeroc
authored andcommitted
add samet fund and credit deal to operations.py
1 parent 1d9a063 commit 00985e7

1 file changed

Lines changed: 290 additions & 0 deletions

File tree

bitsharesbase/operations.py

Lines changed: 290 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,4 +1226,294 @@ def __init__(self, *args, **kwargs):
12261226
)
12271227

12281228

1229+
class Samet_fund_create(GrapheneObject):
1230+
def __init__(self, *args, **kwargs):
1231+
if isArgsThisClass(self, args):
1232+
self.data = args[0].data
1233+
else:
1234+
if len(args) == 1 and len(kwargs) == 0:
1235+
kwargs = args[0]
1236+
super().__init__(
1237+
OrderedDict(
1238+
[
1239+
("fee", Asset(kwargs["fee"])),
1240+
("owner_account", ObjectId(kwargs["owner_account"], "account")),
1241+
("asset_type", ObjectId(kwargs["asset_type"], "asset")),
1242+
("balance", Int64(kwargs["balance"])),
1243+
("fee_rate", Uint32(kwargs["fee_rate"])),
1244+
("extensions", Set([])),
1245+
]
1246+
)
1247+
)
1248+
1249+
1250+
class Samet_fund_delete(GrapheneObject):
1251+
def __init__(self, *args, **kwargs):
1252+
if isArgsThisClass(self, args):
1253+
self.data = args[0].data
1254+
else:
1255+
if len(args) == 1 and len(kwargs) == 0:
1256+
kwargs = args[0]
1257+
super().__init__(
1258+
OrderedDict(
1259+
[
1260+
("fee", Asset(kwargs["fee"])),
1261+
("owner_account", ObjectId(kwargs["owner_account"], "account")),
1262+
("fund_id", ObjectId(kwargs["fund_id"], "samet_fund")),
1263+
("extensions", Set([])),
1264+
]
1265+
)
1266+
)
1267+
1268+
1269+
class Samet_fund_update(GrapheneObject):
1270+
def __init__(self, *args, **kwargs):
1271+
if isArgsThisClass(self, args):
1272+
self.data = args[0].data
1273+
else:
1274+
if len(args) == 1 and len(kwargs) == 0:
1275+
kwargs = args[0]
1276+
super().__init__(
1277+
OrderedDict(
1278+
[
1279+
("fee", Asset(kwargs["fee"])),
1280+
("owner_account", ObjectId(kwargs["owner_account"], "account")),
1281+
("fund_id", ObjectId(kwargs["fund_id"], "samet_fund")),
1282+
("delta_amount", Optional(Asset(kwargs["delta_amount"]))),
1283+
("new_fee_rate", Optional(Uint32(kwargs["new_fee_rate"]))),
1284+
("extensions", Set([])),
1285+
]
1286+
)
1287+
)
1288+
1289+
1290+
class Samet_fund_borrow(GrapheneObject):
1291+
def __init__(self, *args, **kwargs):
1292+
if isArgsThisClass(self, args):
1293+
self.data = args[0].data
1294+
else:
1295+
if len(args) == 1 and len(kwargs) == 0:
1296+
kwargs = args[0]
1297+
super().__init__(
1298+
OrderedDict(
1299+
[
1300+
("fee", Asset(kwargs["fee"])),
1301+
("borrower", ObjectId(kwargs["borrower"], "account")),
1302+
("fund_id", ObjectId(kwargs["fund_id"], "samet_fund")),
1303+
("borrow_amount", Asset(kwargs["borrow_amount"])),
1304+
("extensions", Set([])),
1305+
]
1306+
)
1307+
)
1308+
1309+
1310+
class Samet_fund_repay(GrapheneObject):
1311+
def __init__(self, *args, **kwargs):
1312+
if isArgsThisClass(self, args):
1313+
self.data = args[0].data
1314+
else:
1315+
if len(args) == 1 and len(kwargs) == 0:
1316+
kwargs = args[0]
1317+
super().__init__(
1318+
OrderedDict(
1319+
[
1320+
("fee", Asset(kwargs["fee"])),
1321+
("account", ObjectId(kwargs["account"], "account")),
1322+
("fund_id", ObjectId(kwargs["fund_id"], "samet_fund")),
1323+
("repay_amount", Asset(kwargs["repay_amount"])),
1324+
("fund_fee", Asset(kwargs["fund_fee"])),
1325+
("extensions", Set([])),
1326+
]
1327+
)
1328+
)
1329+
1330+
1331+
class Credit_offer_create(GrapheneObject):
1332+
def __init__(self, *args, **kwargs):
1333+
if isArgsThisClass(self, args):
1334+
self.data = args[0].data
1335+
else:
1336+
if len(args) == 1 and len(kwargs) == 0:
1337+
kwargs = args[0]
1338+
super().__init__(
1339+
OrderedDict(
1340+
[
1341+
("fee", Asset(kwargs["fee"])),
1342+
("owner_account", ObjectId(kwargs["owner_account"], "account")),
1343+
("asset_type", ObjectId(kwargs["asset_type"], "asset")),
1344+
("balance", Int64(kwargs["balance"])),
1345+
("fee_rate", Uint32(kwargs["fee_rate"])),
1346+
(
1347+
"max_duration_seconds",
1348+
Uint32(kwargs["max_duration_seconds"]),
1349+
),
1350+
("min_deal_amount", Int64(kwargs["min_deal_amount"])),
1351+
("enabled", Bool(kwargs["enabled"])(kwargs["enabled"])),
1352+
("auto_disable_time", PointInTime(kwargs["auto_disable_time"])),
1353+
(
1354+
"acceptable_collateral",
1355+
Map(
1356+
[
1357+
[ObjectId(k[0], "asset"), Price(k[1])]
1358+
for k in kwargs["acceptable_collateral"]
1359+
]
1360+
),
1361+
),
1362+
(
1363+
"acceptable_borrowers",
1364+
Map(
1365+
[
1366+
[ObjectId(k[0], "account"), Int64(k[1])]
1367+
for k in kwargs["acceptable_borrowers"]
1368+
]
1369+
),
1370+
),
1371+
("extensions", Set([])),
1372+
]
1373+
)
1374+
)
1375+
1376+
1377+
class Credit_offer_delete(GrapheneObject):
1378+
def __init__(self, *args, **kwargs):
1379+
if isArgsThisClass(self, args):
1380+
self.data = args[0].data
1381+
else:
1382+
if len(args) == 1 and len(kwargs) == 0:
1383+
kwargs = args[0]
1384+
super().__init__(
1385+
OrderedDict(
1386+
[
1387+
("fee", Asset(kwargs["fee"])),
1388+
("owner_account", ObjectId(kwargs["owner_account"], "account")),
1389+
("offer_id", ObjectId(kwargs["offer_id"], "credit_offer")),
1390+
("extensions", Set([])),
1391+
]
1392+
)
1393+
)
1394+
1395+
1396+
class Credit_offer_update(GrapheneObject):
1397+
def __init__(self, *args, **kwargs):
1398+
if isArgsThisClass(self, args):
1399+
self.data = args[0].data
1400+
else:
1401+
if len(args) == 1 and len(kwargs) == 0:
1402+
kwargs = args[0]
1403+
super().__init__(
1404+
OrderedDict(
1405+
[
1406+
("fee", Asset(kwargs["fee"])),
1407+
("owner_account", ObjectId(kwargs["owner_account"], "account")),
1408+
("offer_id", ObjectId(kwargs["offer_id"], "credit_offer")),
1409+
("delta_amount", Optional(Asset(kwargs["fee"]))),
1410+
("fee_rate", Optional(Uint32(kwargs["fee_rate"]))),
1411+
(
1412+
"max_duration_seconds",
1413+
Optional(Uint32(kwargs["max_duration_seconds"])),
1414+
),
1415+
("min_deal_amount", Optional(Int64(kwargs["min_deal_amount"]))),
1416+
("enabled", Optional(Bool(kwargs["enabled"]))),
1417+
(
1418+
"auto_disable_time",
1419+
Optional(PointInTime(kwargs["auto_disable_time"])),
1420+
),
1421+
(
1422+
"acceptable_collateral",
1423+
Optional(
1424+
Map(
1425+
[
1426+
[ObjectId(k[0], "asset"), Price(k[1])]
1427+
for k in kwargs["acceptable_collateral"]
1428+
]
1429+
)
1430+
),
1431+
),
1432+
(
1433+
"acceptable_borrowers",
1434+
Optional(
1435+
Map(
1436+
[
1437+
[ObjectId(k[0], "account"), Int64(k[1])]
1438+
for k in kwargs["acceptable_borrowers"]
1439+
]
1440+
)
1441+
),
1442+
),
1443+
("extensions", Set([])),
1444+
]
1445+
)
1446+
)
1447+
1448+
1449+
class Credit_offer_accept(GrapheneObject):
1450+
def __init__(self, *args, **kwargs):
1451+
if isArgsThisClass(self, args):
1452+
self.data = args[0].data
1453+
else:
1454+
if len(args) == 1 and len(kwargs) == 0:
1455+
kwargs = args[0]
1456+
super().__init__(
1457+
OrderedDict(
1458+
[
1459+
("fee", Asset(kwargs["fee"])),
1460+
("borrower", ObjectId(kwargs["borrower"], "account")),
1461+
("offer_id", ObjectId(kwargs["offer_id"], "credit_offer")),
1462+
("borrow_amount", Asset(kwargs["fee"])),
1463+
("collateral", Asset(kwargs["fee"])),
1464+
("max_fee_rate", Uint32(kwargs["max_fee_rate"])),
1465+
(
1466+
"min_duration_seconds",
1467+
Uint32(kwargs["min_duration_seconds"]),
1468+
),
1469+
("extensions", Set([])),
1470+
]
1471+
)
1472+
)
1473+
1474+
1475+
class Credit_deal_repay(GrapheneObject):
1476+
def __init__(self, *args, **kwargs):
1477+
if isArgsThisClass(self, args):
1478+
self.data = args[0].data
1479+
else:
1480+
if len(args) == 1 and len(kwargs) == 0:
1481+
kwargs = args[0]
1482+
super().__init__(
1483+
OrderedDict(
1484+
[
1485+
("fee", Asset(kwargs["fee"])),
1486+
("account", ObjectId(kwargs["account"], "account")),
1487+
("deal_id", ObjectId(kwargs["deal_id"], "credit_deal")),
1488+
("repay_amount", Asset(kwargs["fee"])),
1489+
("credit_fee", Asset(kwargs["fee"])),
1490+
("extensions", Set([])),
1491+
]
1492+
)
1493+
)
1494+
1495+
1496+
class Credit_deal_expired(GrapheneObject):
1497+
def __init__(self, *args, **kwargs):
1498+
if isArgsThisClass(self, args):
1499+
self.data = args[0].data
1500+
else:
1501+
if len(args) == 1 and len(kwargs) == 0:
1502+
kwargs = args[0]
1503+
super().__init__(
1504+
OrderedDict(
1505+
[
1506+
("fee", Asset(kwargs["fee"])),
1507+
("deal_id", ObjectId(kwargs["deal_id"], "credit_deal")),
1508+
("offer_id", ObjectId(kwargs["offer_id"], "credit_offer")),
1509+
("offer_owner", ObjectId(kwargs["offer_owner"], "account")),
1510+
("borrower", ObjectId(kwargs["borrower"], "account")),
1511+
("unpaid_amount", Asset(kwargs["fee"])),
1512+
("collateral", Asset(kwargs["fee"])),
1513+
("fee_rate", Uint32(kwargs["fee_rate"])),
1514+
]
1515+
)
1516+
)
1517+
1518+
12291519
fill_classmaps()

0 commit comments

Comments
 (0)