tx · 3LapG6R7tHyCvhzxeDJreDFqL3uefc2BH2XJNEQK39pa 3MxiJLrY6Qa5bSYxxSFHSG5bVV2n59x1MGn: -0.01400000 Waves 2022.05.18 12:47 [2056937] smart account 3MxiJLrY6Qa5bSYxxSFHSG5bVV2n59x1MGn > SELF 0.00000000 Waves
{ "type": 13, "id": "3LapG6R7tHyCvhzxeDJreDFqL3uefc2BH2XJNEQK39pa", "fee": 1400000, "feeAssetId": null, "timestamp": 1652867276920, "version": 2, "chainId": 84, "sender": "3MxiJLrY6Qa5bSYxxSFHSG5bVV2n59x1MGn", "senderPublicKey": "9M1hAsbWkVP73NKHvZezCkamwZfSdkejc3b8sejqT98D", "proofs": [ "2xgvvzto4vG3RfMxH4omWvuHQsk2RpC4KK9y3EEXXibMT3ATipHZvc9kwf9yE7XEGS3keag7QwG3up29zsCSa6pV" ], "script": "base64:AAIFAAAAAAAAAAgIAhIECgIBAQAAACAAAAAACXNlcGFyYXRvcgIAAAABXwAAAAANc2hhcmVEZWNpbWFscwAN4Lazp2QAAAAAAAASa2V5Q2hhckN1cnJlbnRMYW5kAgAAABFjaGFyX2N1cnJlbnRfbGFuZAAAAAAfa2V5Q2hhckluaXRpYWxHZW5lcmF0ZWRTdXBwbGllcwIAAAAfY2hhcl9pbml0aWFsX2dlbmVyYXRlZF9zdXBwbGllcwAAAAAQa2V5TGFuZFB5cm9Qb3dlcgIAAAAPbGFuZF9weXJvX3Bvd2VyAAAAABBrZXlMYW5kQXF1YVBvd2VyAgAAAA9sYW5kX2FxdWFfcG93ZXIAAAAAEWtleUxhbmRUZXJyYVBvd2VyAgAAABBsYW5kX3RlcnJhX3Bvd2VyAAAAABBrZXlMYW5kQWVyb1Bvd2VyAgAAAA9sYW5kX2Flcm9fcG93ZXIAAAAAF2tleUNoYXJJbml0aWFsUHlyb1NoYXJlAgAAABdjaGFyX2luaXRpYWxfcHlyb19zaGFyZQAAAAAXa2V5Q2hhckluaXRpYWxBcXVhU2hhcmUCAAAAF2NoY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AAADEludGVnZXJFbnRyeQAAAAIJAQAAAAR3aXRoAAAAAgUAAAAQa2V5TGFuZEFlcm9Qb3dlcgUAAAALY3VycmVudExhbmQJAAGRAAAAAgUAAAATb2xkTGFuZE5ld0VsZW1Qb3dlcgAAAAAAAAAAAwUAAAADbmlsCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgUAAAADbmlsCQAETgAAAAIJAAROAAAAAgkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkBAAAABHdpdGgAAAACBQAAABJrZXlDaGFyQ3VycmVudExhbmQFAAAABmNoYXJJZAUAAAAGbGFuZElkBQAAAANuaWwFAAAADmpvaW5pbmdBY3Rpb25zBQAAAA5leGl0aW5nQWN0aW9ucwkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleYHftKo=", "height": 2056937, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FQ6hkEt3dQ2Y4TgAUvv9d9ogU2PVsLT93nNPv12VjSZP Next: HZbJruGLQVyqmptfspxsKMnM7YqWwNAsYUfQkEgubWa3 Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let separator = "_" | |
5 | 5 | ||
6 | - | let | |
6 | + | let shareDecimals = 1000000000000000000 | |
7 | 7 | ||
8 | - | let | |
8 | + | let keyCharCurrentLand = "char_current_land" | |
9 | 9 | ||
10 | - | let | |
10 | + | let keyCharInitialGeneratedSupplies = "char_initial_generated_supplies" | |
11 | 11 | ||
12 | - | let govAddr = addressFromStringValue("3MyxfwvbueUBynYHfQsutNXZNqNozGiMnsG") | |
12 | + | let keyLandPyroPower = "land_pyro_power" | |
13 | + | ||
14 | + | let keyLandAquaPower = "land_aqua_power" | |
15 | + | ||
16 | + | let keyLandTerraPower = "land_terra_power" | |
17 | + | ||
18 | + | let keyLandAeroPower = "land_aero_power" | |
19 | + | ||
20 | + | let keyCharInitialPyroShare = "char_initial_pyro_share" | |
21 | + | ||
22 | + | let keyCharInitialAquaShare = "char_initial_aqua_share" | |
23 | + | ||
24 | + | let keyCharInitialTerraShare = "char_initial_terra_share" | |
25 | + | ||
26 | + | let keyCharInitialAeroShare = "char_initial_aero_share" | |
27 | + | ||
28 | + | let keyCharTotalIncome = "char_total_income" | |
29 | + | ||
30 | + | let keyAddressTotalIncome = "address_total_income" | |
31 | + | ||
32 | + | let govApp = addressFromStringValue("3MyxfwvbueUBynYHfQsutNXZNqNozGiMnsG") | |
13 | 33 | ||
14 | 34 | let keyEcosystemAddresses = "ecosystem_addresses" | |
15 | 35 | ||
16 | 36 | let keyTotalLands = "total_lands" | |
17 | 37 | ||
18 | - | let | |
38 | + | let keyTokenEmissionRate = "token_emission_rate" | |
19 | 39 | ||
20 | - | let | |
40 | + | let charsApp = addressFromStringValue("3NA3LRSigk6knLZ16uTzcdLNow2EQZtXTaJ") | |
21 | 41 | ||
22 | 42 | let keyOwner = "owner" | |
23 | 43 | ||
24 | - | func invokChecks (callerAddr) = if ((isDataStorageUntouched(govAddr) != false)) | |
44 | + | let keyNaturalPyroBonus = "natural_pyro_bonus" | |
45 | + | ||
46 | + | let keyNaturalAquaBonus = "natural_aqua_bonus" | |
47 | + | ||
48 | + | let keyNaturalTerraBonus = "natural_terra_bonus" | |
49 | + | ||
50 | + | let keyNaturalAeroBonus = "natural_aero_bonus" | |
51 | + | ||
52 | + | func invokeChecks (callerAddr) = if ((isDataStorageUntouched(govApp) != false)) | |
25 | 53 | then throw("Governing app not ready") | |
26 | 54 | else { | |
27 | - | let ecosystemAddresses = getStringValue( | |
55 | + | let ecosystemAddresses = getStringValue(govApp, keyEcosystemAddresses) | |
28 | 56 | if ((contains(ecosystemAddresses, toString(callerAddr)) != false)) | |
29 | 57 | then throw("Access denied") | |
30 | - | else | |
58 | + | else true | |
31 | 59 | } | |
32 | 60 | ||
33 | 61 | ||
34 | - | func with (a,b) = ((toString(b) + separator) + a) | |
62 | + | func with (a,b) = { | |
63 | + | let c = match b { | |
64 | + | case isInt: Int => | |
65 | + | toString(isInt) | |
66 | + | case isStr: String => | |
67 | + | isStr | |
68 | + | case _ => | |
69 | + | throw("Matching issue in with function") | |
70 | + | } | |
71 | + | ((c + separator) + a) | |
72 | + | } | |
73 | + | ||
74 | + | ||
75 | + | func getCharNaturalElemBonus (charId) = [getIntegerValue(charsApp, with(keyNaturalPyroBonus, charId)), getIntegerValue(charsApp, with(keyNaturalAquaBonus, charId)), getIntegerValue(charsApp, with(keyNaturalTerraBonus, charId)), getIntegerValue(charsApp, with(keyNaturalAeroBonus, charId))] | |
76 | + | ||
77 | + | ||
78 | + | func getLandElemPower (landId) = [valueOrElse(getInteger(this, with(keyLandPyroPower, landId)), 0), valueOrElse(getInteger(this, with(keyLandAquaPower, landId)), 0), valueOrElse(getInteger(this, with(keyLandTerraPower, landId)), 0), valueOrElse(getInteger(this, with(keyLandAeroPower, landId)), 0)] | |
79 | + | ||
80 | + | ||
81 | + | func calcNewLandElemPower (landId,charNaturalElemBonus) = { | |
82 | + | let newLandElemPower = getLandElemPower(landId) | |
83 | + | [(newLandElemPower[0] + charNaturalElemBonus[0]), (newLandElemPower[1] + charNaturalElemBonus[1]), (newLandElemPower[2] + charNaturalElemBonus[2]), (newLandElemPower[3] + charNaturalElemBonus[3])] | |
84 | + | } | |
85 | + | ||
86 | + | ||
87 | + | func calcOldLandElemPower (oldLandElemPower,charNaturalElemBonus) = [(oldLandElemPower[0] - charNaturalElemBonus[0]), (oldLandElemPower[1] - charNaturalElemBonus[1]), (oldLandElemPower[2] - charNaturalElemBonus[2]), (oldLandElemPower[3] - charNaturalElemBonus[3])] | |
88 | + | ||
89 | + | ||
90 | + | func calcCharElemShares (charNaturalBonus,landElemPower) = [fraction(shareDecimals, charNaturalBonus[0], landElemPower[0]), fraction(shareDecimals, charNaturalBonus[1], landElemPower[1]), fraction(shareDecimals, charNaturalBonus[2], landElemPower[2]), fraction(shareDecimals, charNaturalBonus[3], landElemPower[3])] | |
91 | + | ||
92 | + | ||
93 | + | func calcCharIncome (charId,oldLandElemPower,charNaturalElemBonus,currentGeneratedSupplies) = { | |
94 | + | let oldLandCharCurrentElemShares = calcCharElemShares(oldLandElemPower, charNaturalElemBonus) | |
95 | + | let oldLandCharAverageElemShares = [((getIntegerValue(this, with(keyCharInitialPyroShare, charId)) + oldLandCharCurrentElemShares[0]) / 2), ((getIntegerValue(this, with(keyCharInitialAquaShare, charId)) + oldLandCharCurrentElemShares[1]) / 2), ((getIntegerValue(this, with(keyCharInitialTerraShare, charId)) + oldLandCharCurrentElemShares[2]) / 2), ((getIntegerValue(this, with(keyCharInitialAeroShare, charId)) + oldLandCharCurrentElemShares[3]) / 2)] | |
96 | + | let charEligibleSupplies = (((currentGeneratedSupplies - getIntegerValue(this, with(keyCharInitialGeneratedSupplies, charId))) / getIntegerValue(govApp, keyTotalLands)) / 4) | |
97 | + | (((fraction(charEligibleSupplies, oldLandCharAverageElemShares[0], shareDecimals) + fraction(charEligibleSupplies, oldLandCharAverageElemShares[1], shareDecimals)) + fraction(charEligibleSupplies, oldLandCharAverageElemShares[2], shareDecimals)) + fraction(charEligibleSupplies, oldLandCharAverageElemShares[3], shareDecimals)) | |
98 | + | } | |
35 | 99 | ||
36 | 100 | ||
37 | 101 | @Callable(i) | |
38 | - | func bindCharToLand (charId,landId) = valueOrElse(invokChecks(i.caller), if ((getStringValue(charsAddr, with(keyOwner, charId)) != toBase58String(i.caller.bytes))) | |
39 | - | then throw("Caller doesn't own this char") | |
40 | - | else if (if ((1 > landId)) | |
41 | - | then true | |
42 | - | else (landId > getIntegerValue(govAddr, keyTotalLands))) | |
43 | - | then throw("Unknown land") | |
44 | - | else { | |
45 | - | let currentGeneratedTokensResult = invoke(govAddr, "getGeneratedSupplies", nil, nil) | |
46 | - | if ((currentGeneratedTokensResult == currentGeneratedTokensResult)) | |
47 | - | then { | |
48 | - | let currentGeneratedTokens = match currentGeneratedTokensResult { | |
49 | - | case isInt: Int => | |
50 | - | isInt | |
51 | - | case _ => | |
52 | - | throw("Invok result") | |
102 | + | func charMovingLand (charId,landId) = if ((invokeChecks(i.caller) != true)) | |
103 | + | then throw() | |
104 | + | else { | |
105 | + | let callerAddr = toBase58String(i.caller.bytes) | |
106 | + | if ((getStringValue(charsApp, with(keyOwner, charId)) != callerAddr)) | |
107 | + | then throw("Caller doesn't own this char") | |
108 | + | else if (if ((0 > landId)) | |
109 | + | then true | |
110 | + | else (landId > getIntegerValue(govApp, keyTotalLands))) | |
111 | + | then throw("Not a land") | |
112 | + | else { | |
113 | + | let currentLand = valueOrElse(getInteger(this, with(keyCharCurrentLand, charId)), 0) | |
114 | + | if ((currentLand == landId)) | |
115 | + | then throw("Char already on that land") | |
116 | + | else { | |
117 | + | let charNaturalElemBonus = getCharNaturalElemBonus(charId) | |
118 | + | let oldLandElemPower = getLandElemPower(currentLand) | |
119 | + | let currentGeneratedSuppliesResult = invoke(govApp, "getGeneratedSupplies", nil, nil) | |
120 | + | if ((currentGeneratedSuppliesResult == currentGeneratedSuppliesResult)) | |
121 | + | then { | |
122 | + | let currentGeneratedSupplies = match currentGeneratedSuppliesResult { | |
123 | + | case isInt: Int => | |
124 | + | isInt | |
125 | + | case _ => | |
126 | + | throw("Bad invoke result") | |
127 | + | } | |
128 | + | let joiningActions = if ((landId != 0)) | |
129 | + | then { | |
130 | + | let newLandNewElemPower = calcNewLandElemPower(landId, charNaturalElemBonus) | |
131 | + | let newLandCharElemShares = calcCharElemShares(charNaturalElemBonus, newLandNewElemPower) | |
132 | + | [IntegerEntry(with(keyLandPyroPower, landId), newLandNewElemPower[0]), IntegerEntry(with(keyLandAquaPower, landId), newLandNewElemPower[1]), IntegerEntry(with(keyLandTerraPower, landId), newLandNewElemPower[2]), IntegerEntry(with(keyLandAeroPower, landId), newLandNewElemPower[3]), IntegerEntry(with(keyCharInitialGeneratedSupplies, charId), currentGeneratedSupplies), IntegerEntry(with(keyCharInitialPyroShare, charId), newLandCharElemShares[0]), IntegerEntry(with(keyCharInitialAquaShare, charId), newLandCharElemShares[1]), IntegerEntry(with(keyCharInitialTerraShare, charId), newLandCharElemShares[2]), IntegerEntry(with(keyCharInitialAeroShare, charId), newLandCharElemShares[3])] | |
133 | + | } | |
134 | + | else [DeleteEntry(with(keyCharInitialGeneratedSupplies, charId)), DeleteEntry(with(keyCharInitialPyroShare, charId)), DeleteEntry(with(keyCharInitialAquaShare, charId)), DeleteEntry(with(keyCharInitialTerraShare, charId)), DeleteEntry(with(keyCharInitialAeroShare, charId))] | |
135 | + | let exitingActions = if ((currentLand != 0)) | |
136 | + | then { | |
137 | + | let sendTokensToAddress = invoke(govApp, "sendTokensToAddress", [calcCharIncome(charId, oldLandElemPower, charNaturalElemBonus, currentGeneratedSupplies), i.caller.bytes], nil) | |
138 | + | if ((sendTokensToAddress == sendTokensToAddress)) | |
139 | + | then { | |
140 | + | let charTokenIncome = match sendTokensToAddress { | |
141 | + | case isInt: Int => | |
142 | + | isInt | |
143 | + | case _ => | |
144 | + | throw("Invoke issue") | |
145 | + | } | |
146 | + | let newCharTotalIncome = (valueOrElse(getInteger(this, with(keyCharTotalIncome, charId)), 0) + charTokenIncome) | |
147 | + | let newAddressTotalIncome = (valueOrElse(getInteger(this, with(keyAddressTotalIncome, callerAddr)), 0) + charTokenIncome) | |
148 | + | let oldLandNewElemPower = calcOldLandElemPower(oldLandElemPower, charNaturalElemBonus) | |
149 | + | [IntegerEntry(with(keyCharTotalIncome, charId), newCharTotalIncome), IntegerEntry(with(keyAddressTotalIncome, callerAddr), newCharTotalIncome), IntegerEntry(with(keyLandPyroPower, currentLand), oldLandNewElemPower[0]), IntegerEntry(with(keyLandAquaPower, currentLand), oldLandNewElemPower[1]), IntegerEntry(with(keyLandTerraPower, currentLand), oldLandNewElemPower[2]), IntegerEntry(with(keyLandAeroPower, currentLand), oldLandNewElemPower[3])] | |
150 | + | } | |
151 | + | else throw("Strict value is not equal to itself.") | |
152 | + | } | |
153 | + | else nil | |
154 | + | (([IntegerEntry(with(keyCharCurrentLand, charId), landId)] ++ joiningActions) ++ exitingActions) | |
155 | + | } | |
156 | + | else throw("Strict value is not equal to itself.") | |
157 | + | } | |
53 | 158 | } | |
54 | - | [IntegerEntry(with(keyCurrentLand, charId), landId), IntegerEntry(with(keyStartingHeight, charId), height), IntegerEntry(with(keyStartingGeneratedSupplies, charId), currentGeneratedTokens)] | |
55 | - | } | |
56 | - | else throw("Strict value is not equal to itself.") | |
57 | - | }) | |
159 | + | } | |
58 | 160 | ||
59 | 161 | ||
60 | 162 | @Verifier(tx) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let separator = "_" | |
5 | 5 | ||
6 | - | let | |
6 | + | let shareDecimals = 1000000000000000000 | |
7 | 7 | ||
8 | - | let | |
8 | + | let keyCharCurrentLand = "char_current_land" | |
9 | 9 | ||
10 | - | let | |
10 | + | let keyCharInitialGeneratedSupplies = "char_initial_generated_supplies" | |
11 | 11 | ||
12 | - | let govAddr = addressFromStringValue("3MyxfwvbueUBynYHfQsutNXZNqNozGiMnsG") | |
12 | + | let keyLandPyroPower = "land_pyro_power" | |
13 | + | ||
14 | + | let keyLandAquaPower = "land_aqua_power" | |
15 | + | ||
16 | + | let keyLandTerraPower = "land_terra_power" | |
17 | + | ||
18 | + | let keyLandAeroPower = "land_aero_power" | |
19 | + | ||
20 | + | let keyCharInitialPyroShare = "char_initial_pyro_share" | |
21 | + | ||
22 | + | let keyCharInitialAquaShare = "char_initial_aqua_share" | |
23 | + | ||
24 | + | let keyCharInitialTerraShare = "char_initial_terra_share" | |
25 | + | ||
26 | + | let keyCharInitialAeroShare = "char_initial_aero_share" | |
27 | + | ||
28 | + | let keyCharTotalIncome = "char_total_income" | |
29 | + | ||
30 | + | let keyAddressTotalIncome = "address_total_income" | |
31 | + | ||
32 | + | let govApp = addressFromStringValue("3MyxfwvbueUBynYHfQsutNXZNqNozGiMnsG") | |
13 | 33 | ||
14 | 34 | let keyEcosystemAddresses = "ecosystem_addresses" | |
15 | 35 | ||
16 | 36 | let keyTotalLands = "total_lands" | |
17 | 37 | ||
18 | - | let | |
38 | + | let keyTokenEmissionRate = "token_emission_rate" | |
19 | 39 | ||
20 | - | let | |
40 | + | let charsApp = addressFromStringValue("3NA3LRSigk6knLZ16uTzcdLNow2EQZtXTaJ") | |
21 | 41 | ||
22 | 42 | let keyOwner = "owner" | |
23 | 43 | ||
24 | - | func invokChecks (callerAddr) = if ((isDataStorageUntouched(govAddr) != false)) | |
44 | + | let keyNaturalPyroBonus = "natural_pyro_bonus" | |
45 | + | ||
46 | + | let keyNaturalAquaBonus = "natural_aqua_bonus" | |
47 | + | ||
48 | + | let keyNaturalTerraBonus = "natural_terra_bonus" | |
49 | + | ||
50 | + | let keyNaturalAeroBonus = "natural_aero_bonus" | |
51 | + | ||
52 | + | func invokeChecks (callerAddr) = if ((isDataStorageUntouched(govApp) != false)) | |
25 | 53 | then throw("Governing app not ready") | |
26 | 54 | else { | |
27 | - | let ecosystemAddresses = getStringValue( | |
55 | + | let ecosystemAddresses = getStringValue(govApp, keyEcosystemAddresses) | |
28 | 56 | if ((contains(ecosystemAddresses, toString(callerAddr)) != false)) | |
29 | 57 | then throw("Access denied") | |
30 | - | else | |
58 | + | else true | |
31 | 59 | } | |
32 | 60 | ||
33 | 61 | ||
34 | - | func with (a,b) = ((toString(b) + separator) + a) | |
62 | + | func with (a,b) = { | |
63 | + | let c = match b { | |
64 | + | case isInt: Int => | |
65 | + | toString(isInt) | |
66 | + | case isStr: String => | |
67 | + | isStr | |
68 | + | case _ => | |
69 | + | throw("Matching issue in with function") | |
70 | + | } | |
71 | + | ((c + separator) + a) | |
72 | + | } | |
73 | + | ||
74 | + | ||
75 | + | func getCharNaturalElemBonus (charId) = [getIntegerValue(charsApp, with(keyNaturalPyroBonus, charId)), getIntegerValue(charsApp, with(keyNaturalAquaBonus, charId)), getIntegerValue(charsApp, with(keyNaturalTerraBonus, charId)), getIntegerValue(charsApp, with(keyNaturalAeroBonus, charId))] | |
76 | + | ||
77 | + | ||
78 | + | func getLandElemPower (landId) = [valueOrElse(getInteger(this, with(keyLandPyroPower, landId)), 0), valueOrElse(getInteger(this, with(keyLandAquaPower, landId)), 0), valueOrElse(getInteger(this, with(keyLandTerraPower, landId)), 0), valueOrElse(getInteger(this, with(keyLandAeroPower, landId)), 0)] | |
79 | + | ||
80 | + | ||
81 | + | func calcNewLandElemPower (landId,charNaturalElemBonus) = { | |
82 | + | let newLandElemPower = getLandElemPower(landId) | |
83 | + | [(newLandElemPower[0] + charNaturalElemBonus[0]), (newLandElemPower[1] + charNaturalElemBonus[1]), (newLandElemPower[2] + charNaturalElemBonus[2]), (newLandElemPower[3] + charNaturalElemBonus[3])] | |
84 | + | } | |
85 | + | ||
86 | + | ||
87 | + | func calcOldLandElemPower (oldLandElemPower,charNaturalElemBonus) = [(oldLandElemPower[0] - charNaturalElemBonus[0]), (oldLandElemPower[1] - charNaturalElemBonus[1]), (oldLandElemPower[2] - charNaturalElemBonus[2]), (oldLandElemPower[3] - charNaturalElemBonus[3])] | |
88 | + | ||
89 | + | ||
90 | + | func calcCharElemShares (charNaturalBonus,landElemPower) = [fraction(shareDecimals, charNaturalBonus[0], landElemPower[0]), fraction(shareDecimals, charNaturalBonus[1], landElemPower[1]), fraction(shareDecimals, charNaturalBonus[2], landElemPower[2]), fraction(shareDecimals, charNaturalBonus[3], landElemPower[3])] | |
91 | + | ||
92 | + | ||
93 | + | func calcCharIncome (charId,oldLandElemPower,charNaturalElemBonus,currentGeneratedSupplies) = { | |
94 | + | let oldLandCharCurrentElemShares = calcCharElemShares(oldLandElemPower, charNaturalElemBonus) | |
95 | + | let oldLandCharAverageElemShares = [((getIntegerValue(this, with(keyCharInitialPyroShare, charId)) + oldLandCharCurrentElemShares[0]) / 2), ((getIntegerValue(this, with(keyCharInitialAquaShare, charId)) + oldLandCharCurrentElemShares[1]) / 2), ((getIntegerValue(this, with(keyCharInitialTerraShare, charId)) + oldLandCharCurrentElemShares[2]) / 2), ((getIntegerValue(this, with(keyCharInitialAeroShare, charId)) + oldLandCharCurrentElemShares[3]) / 2)] | |
96 | + | let charEligibleSupplies = (((currentGeneratedSupplies - getIntegerValue(this, with(keyCharInitialGeneratedSupplies, charId))) / getIntegerValue(govApp, keyTotalLands)) / 4) | |
97 | + | (((fraction(charEligibleSupplies, oldLandCharAverageElemShares[0], shareDecimals) + fraction(charEligibleSupplies, oldLandCharAverageElemShares[1], shareDecimals)) + fraction(charEligibleSupplies, oldLandCharAverageElemShares[2], shareDecimals)) + fraction(charEligibleSupplies, oldLandCharAverageElemShares[3], shareDecimals)) | |
98 | + | } | |
35 | 99 | ||
36 | 100 | ||
37 | 101 | @Callable(i) | |
38 | - | func bindCharToLand (charId,landId) = valueOrElse(invokChecks(i.caller), if ((getStringValue(charsAddr, with(keyOwner, charId)) != toBase58String(i.caller.bytes))) | |
39 | - | then throw("Caller doesn't own this char") | |
40 | - | else if (if ((1 > landId)) | |
41 | - | then true | |
42 | - | else (landId > getIntegerValue(govAddr, keyTotalLands))) | |
43 | - | then throw("Unknown land") | |
44 | - | else { | |
45 | - | let currentGeneratedTokensResult = invoke(govAddr, "getGeneratedSupplies", nil, nil) | |
46 | - | if ((currentGeneratedTokensResult == currentGeneratedTokensResult)) | |
47 | - | then { | |
48 | - | let currentGeneratedTokens = match currentGeneratedTokensResult { | |
49 | - | case isInt: Int => | |
50 | - | isInt | |
51 | - | case _ => | |
52 | - | throw("Invok result") | |
102 | + | func charMovingLand (charId,landId) = if ((invokeChecks(i.caller) != true)) | |
103 | + | then throw() | |
104 | + | else { | |
105 | + | let callerAddr = toBase58String(i.caller.bytes) | |
106 | + | if ((getStringValue(charsApp, with(keyOwner, charId)) != callerAddr)) | |
107 | + | then throw("Caller doesn't own this char") | |
108 | + | else if (if ((0 > landId)) | |
109 | + | then true | |
110 | + | else (landId > getIntegerValue(govApp, keyTotalLands))) | |
111 | + | then throw("Not a land") | |
112 | + | else { | |
113 | + | let currentLand = valueOrElse(getInteger(this, with(keyCharCurrentLand, charId)), 0) | |
114 | + | if ((currentLand == landId)) | |
115 | + | then throw("Char already on that land") | |
116 | + | else { | |
117 | + | let charNaturalElemBonus = getCharNaturalElemBonus(charId) | |
118 | + | let oldLandElemPower = getLandElemPower(currentLand) | |
119 | + | let currentGeneratedSuppliesResult = invoke(govApp, "getGeneratedSupplies", nil, nil) | |
120 | + | if ((currentGeneratedSuppliesResult == currentGeneratedSuppliesResult)) | |
121 | + | then { | |
122 | + | let currentGeneratedSupplies = match currentGeneratedSuppliesResult { | |
123 | + | case isInt: Int => | |
124 | + | isInt | |
125 | + | case _ => | |
126 | + | throw("Bad invoke result") | |
127 | + | } | |
128 | + | let joiningActions = if ((landId != 0)) | |
129 | + | then { | |
130 | + | let newLandNewElemPower = calcNewLandElemPower(landId, charNaturalElemBonus) | |
131 | + | let newLandCharElemShares = calcCharElemShares(charNaturalElemBonus, newLandNewElemPower) | |
132 | + | [IntegerEntry(with(keyLandPyroPower, landId), newLandNewElemPower[0]), IntegerEntry(with(keyLandAquaPower, landId), newLandNewElemPower[1]), IntegerEntry(with(keyLandTerraPower, landId), newLandNewElemPower[2]), IntegerEntry(with(keyLandAeroPower, landId), newLandNewElemPower[3]), IntegerEntry(with(keyCharInitialGeneratedSupplies, charId), currentGeneratedSupplies), IntegerEntry(with(keyCharInitialPyroShare, charId), newLandCharElemShares[0]), IntegerEntry(with(keyCharInitialAquaShare, charId), newLandCharElemShares[1]), IntegerEntry(with(keyCharInitialTerraShare, charId), newLandCharElemShares[2]), IntegerEntry(with(keyCharInitialAeroShare, charId), newLandCharElemShares[3])] | |
133 | + | } | |
134 | + | else [DeleteEntry(with(keyCharInitialGeneratedSupplies, charId)), DeleteEntry(with(keyCharInitialPyroShare, charId)), DeleteEntry(with(keyCharInitialAquaShare, charId)), DeleteEntry(with(keyCharInitialTerraShare, charId)), DeleteEntry(with(keyCharInitialAeroShare, charId))] | |
135 | + | let exitingActions = if ((currentLand != 0)) | |
136 | + | then { | |
137 | + | let sendTokensToAddress = invoke(govApp, "sendTokensToAddress", [calcCharIncome(charId, oldLandElemPower, charNaturalElemBonus, currentGeneratedSupplies), i.caller.bytes], nil) | |
138 | + | if ((sendTokensToAddress == sendTokensToAddress)) | |
139 | + | then { | |
140 | + | let charTokenIncome = match sendTokensToAddress { | |
141 | + | case isInt: Int => | |
142 | + | isInt | |
143 | + | case _ => | |
144 | + | throw("Invoke issue") | |
145 | + | } | |
146 | + | let newCharTotalIncome = (valueOrElse(getInteger(this, with(keyCharTotalIncome, charId)), 0) + charTokenIncome) | |
147 | + | let newAddressTotalIncome = (valueOrElse(getInteger(this, with(keyAddressTotalIncome, callerAddr)), 0) + charTokenIncome) | |
148 | + | let oldLandNewElemPower = calcOldLandElemPower(oldLandElemPower, charNaturalElemBonus) | |
149 | + | [IntegerEntry(with(keyCharTotalIncome, charId), newCharTotalIncome), IntegerEntry(with(keyAddressTotalIncome, callerAddr), newCharTotalIncome), IntegerEntry(with(keyLandPyroPower, currentLand), oldLandNewElemPower[0]), IntegerEntry(with(keyLandAquaPower, currentLand), oldLandNewElemPower[1]), IntegerEntry(with(keyLandTerraPower, currentLand), oldLandNewElemPower[2]), IntegerEntry(with(keyLandAeroPower, currentLand), oldLandNewElemPower[3])] | |
150 | + | } | |
151 | + | else throw("Strict value is not equal to itself.") | |
152 | + | } | |
153 | + | else nil | |
154 | + | (([IntegerEntry(with(keyCharCurrentLand, charId), landId)] ++ joiningActions) ++ exitingActions) | |
155 | + | } | |
156 | + | else throw("Strict value is not equal to itself.") | |
157 | + | } | |
53 | 158 | } | |
54 | - | [IntegerEntry(with(keyCurrentLand, charId), landId), IntegerEntry(with(keyStartingHeight, charId), height), IntegerEntry(with(keyStartingGeneratedSupplies, charId), currentGeneratedTokens)] | |
55 | - | } | |
56 | - | else throw("Strict value is not equal to itself.") | |
57 | - | }) | |
159 | + | } | |
58 | 160 | ||
59 | 161 | ||
60 | 162 | @Verifier(tx) | |
61 | 163 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
62 | 164 |
github/deemru/w8io/169f3d6 47.87 ms ◑