8 | | - | let bdmsSC = base58'3PG2vMhK5CPqsCDodvLGzQ84QkoHXCJ3oNP' |
---|
9 | | - | |
---|
10 | | - | let swopFiNsbtUsdn = base58'3P2V63Xd6BviDkeMzxhUw2SJyojByRz8a8m' |
---|
11 | | - | |
---|
12 | | - | let swopFiUsdnWaves = base58'3PHaNgomBkrvEL2QnuJarQVJa71wjw9qiqG' |
---|
13 | | - | |
---|
14 | | - | let wavesAmount = 1000000000 |
---|
15 | | - | |
---|
16 | | - | @Callable(i) |
---|
17 | | - | func bdsm () = { |
---|
18 | | - | let startWavesAmount = wavesBalance(this).regular |
---|
19 | | - | if ((startWavesAmount == startWavesAmount)) |
---|
20 | | - | then { |
---|
21 | | - | let startUsdnAmount = assetBalance(this, usdnAssetId) |
---|
22 | | - | if ((startUsdnAmount == startUsdnAmount)) |
---|
23 | | - | then { |
---|
24 | | - | let startNsbtAmount = assetBalance(this, nsbtAssetId) |
---|
25 | | - | if ((startNsbtAmount == startNsbtAmount)) |
---|
26 | | - | then { |
---|
27 | | - | let r = invoke(Address(bdmsSC), "buyNsbt", nil, [AttachedPayment(unit, wavesAmount)]) |
---|
28 | | - | if ((r == r)) |
---|
29 | | - | then { |
---|
30 | | - | let swopNsbtAmount = (assetBalance(this, nsbtAssetId) - startNsbtAmount) |
---|
31 | | - | if ((swopNsbtAmount == swopNsbtAmount)) |
---|
32 | | - | then { |
---|
33 | | - | let sbu = invoke(Address(swopFiNsbtUsdn), "exchange", [1000000], [AttachedPayment(nsbtAssetId, swopNsbtAmount)]) |
---|
34 | | - | if ((sbu == sbu)) |
---|
35 | | - | then { |
---|
36 | | - | let swopUsdnAmount = (assetBalance(this, usdnAssetId) - startUsdnAmount) |
---|
37 | | - | if ((swopUsdnAmount == swopUsdnAmount)) |
---|
38 | | - | then { |
---|
39 | | - | let suw = invoke(Address(swopFiUsdnWaves), "exchange", [(wavesAmount + 10000000)], [AttachedPayment(usdnAssetId, swopUsdnAmount)]) |
---|
40 | | - | if ((suw == suw)) |
---|
41 | | - | then nil |
---|
42 | | - | else throw("swap usdn to waves error") |
---|
43 | | - | } |
---|
44 | | - | else throw("Strict value is not equal to itself.") |
---|
45 | | - | } |
---|
46 | | - | else throw("swap nsbt to usdn error") |
---|
47 | | - | } |
---|
48 | | - | else throw("Strict value is not equal to itself.") |
---|
49 | | - | } |
---|
50 | | - | else throw("bad req") |
---|
51 | | - | } |
---|
52 | | - | else throw("Strict value is not equal to itself.") |
---|
53 | | - | } |
---|
54 | | - | else throw("Strict value is not equal to itself.") |
---|
55 | | - | } |
---|
56 | | - | else throw("Strict value is not equal to itself.") |
---|
57 | | - | } |
---|