bancor 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/bancor.rb +20 -16
- data/lib/bancor/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae25d17857d3396f99a8c375c8369e71db5365cbd38f5908b52bd5648d70afdb
|
4
|
+
data.tar.gz: 5f2a6eb131ab0b47b2e32eb1a5a01c787517f6048b285eff20225d01873f7cb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10e6f9781b2409186762fbf034a39df7564955d0850f2e4385c9c511724c8e8bd1bf6897e649015f1554180d1afeb31f665d237d60cd58d8006276e8e42ff86e
|
7
|
+
data.tar.gz: 33091d4938eccd6c71d22c82609898ef11038a8e7a1db0b7f6db1bc992e6992a8a514b01a41e97fad9d0b9f98e65c592b55018c757c7755fa397f2b0f9f77099
|
data/Gemfile.lock
CHANGED
data/lib/bancor.rb
CHANGED
@@ -11,32 +11,36 @@ module Bancor
|
|
11
11
|
@crr = crr
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
15
|
-
|
16
|
-
@reserved_token = @reserved_token +
|
17
|
-
@total_supply = @total_supply +
|
14
|
+
def issue_by_reserve_token(amount)
|
15
|
+
smart_token_amount = @total_supply * (((1 + (amount / @reserved_token)) ** @crr) - 1)
|
16
|
+
@reserved_token = @reserved_token + amount
|
17
|
+
@total_supply = @total_supply + smart_token_amount
|
18
18
|
@price = @reserved_token / (@total_supply * @crr)
|
19
|
+
smart_token_amount
|
19
20
|
end
|
20
21
|
|
21
|
-
def
|
22
|
-
|
23
|
-
@reserved_token = @reserved_token -
|
24
|
-
@total_supply = @total_supply -
|
22
|
+
def destroy_by_reserve_token(amount)
|
23
|
+
smart_token_amount = @reserved_token * (1 - ((1 - (amount / @total_supply)) ** (1/@crr)))
|
24
|
+
@reserved_token = @reserved_token - smart_token_amount
|
25
|
+
@total_supply = @total_supply - amount
|
25
26
|
@price = @reserved_token / (@total_supply * @crr)
|
27
|
+
smart_token_amount
|
26
28
|
end
|
27
29
|
|
28
|
-
def
|
29
|
-
|
30
|
-
@total_supply = @total_supply +
|
31
|
-
@reserved_token = @reserved_token +
|
30
|
+
def issue_by_smart_token(amount)
|
31
|
+
transaction_price = @reserved_token * ((((amount / @total_supply) + 1) ** (1/@crr)) - 1)
|
32
|
+
@total_supply = @total_supply + amount
|
33
|
+
@reserved_token = @reserved_token + transaction_price
|
32
34
|
@price = @reserved_token / (@total_supply * @crr)
|
35
|
+
transaction_price
|
33
36
|
end
|
34
37
|
|
35
|
-
def
|
36
|
-
|
37
|
-
@total_supply = @total_supply -
|
38
|
-
@reserved_token = @reserved_token -
|
38
|
+
def destroy_by_smart_token(amount)
|
39
|
+
transaction_price = @reserved_token * (1 - ((1 - (amount / @total_supply)) ** (1/@crr)))
|
40
|
+
@total_supply = @total_supply - amount
|
41
|
+
@reserved_token = @reserved_token - transaction_price
|
39
42
|
@price = @reserved_token / (@total_supply * @crr)
|
43
|
+
transaction_price
|
40
44
|
end
|
41
45
|
end
|
42
46
|
end
|
data/lib/bancor/version.rb
CHANGED