tx · DwMYXzoHTS8ySHVgiXzVqStdDCzmZ2oSthwBCGEfQ59S 3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA: -0.01400000 Waves 2022.01.28 10:27 [1898503] smart account 3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA > SELF 0.00000000 Waves
{ "type": 13, "id": "DwMYXzoHTS8ySHVgiXzVqStdDCzmZ2oSthwBCGEfQ59S", "fee": 1400000, "feeAssetId": null, "timestamp": 1643354846808, "version": 1, "sender": "3NBqs2vfpyT5cMdUJ97mEJ1Ycp2y8GbAZDA", "senderPublicKey": "H19CeJVbUnfsK8EYs8K6fHxwBH7pLyxw8WCDFu7D4rGQ", "proofs": [ "4zoW3UiGjt1Jt589TLRoUHQLYg3jwTsac5gAyDP6S6UnF62czHWoJpHiM1PGGM1T76t7JScEDEAediBRueYBN1Jd" ], "script": "base64:AAIFAAAAAAAAABcIAhIJCgcIAQEBAQEIEgMKAQgSAwoBAQAAACAAAAAAA1NFUAIAAAACX18BAAAAD2dldFN0cmluZ09yRmFpbAAAAAIAAAAHYWRkcmVzcwAAAANrZXkJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAdhZGRyZXNzBQAAAANrZXkJAAEsAAAAAgkAASwAAAACAgAAAA9tYW5kYXRvcnkgdGhpcy4FAAAAA2tleQIAAAAPIGlzIG5vdCBkZWZpbmVkAQAAABFrZXlGYWN0b3J5QWRkcmVzcwAAAAACAAAAHCVzJXNfX2NvbmZpZ19fZmFjdG9yeUFkZHJlc3MBAAAAFGtleUd3eFJld2FyZHNBZGRyZXNzAAAAAAIAAAAfJXMlc19fY29uZmlnX19nd3hSZXdhcmRzQWRkcmVzcwAAAAAUZ3d4UmV3YXJkc0FkZHJlc3NTdHIJAQAAAA9nZXRTdHJpbmdPckZhaWwAAAACBQAAAAR0aGlzCQEAAAAUa2V5R3d4UmV3YXJkc0FkZHJlc3MAAAAAAAAAABJnd3hSZXdh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eFJld2FyZHNDb250cmFjdAcJAAACAAAAAQIAAAAScGVybWlzc2lvbnMgZGVuaWVkBAAAAAx3eEFzc2V0SWRTdHIJAAGRAAAAAgkABLUAAAACCQEAAAAPZ2V0U3RyaW5nT3JGYWlsAAAAAgUAAAAEdGhpcwkBAAAACWtleUNvbmZpZwAAAAAFAAAAA1NFUAAAAAAAAAAAAQQAAAAJd3hBc3NldElkCQACWQAAAAEFAAAADHd4QXNzZXRJZFN0cgkABRQAAAACCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAABmNhbGxlcgUAAAAGYW1vdW50BQAAAAl3eEFzc2V0SWQFAAAAA25pbAkABEwAAAACBQAAAAl3eEFzc2V0SWQFAAAAA25pbAAAAACn1/i8", "chainId": 84, "height": 1898503, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GntxmzcbzNf4b7cw9yqjGQpfYdaB35rwwASLFcGTaBx6 Next: 2X9kpZjZoMNMzjCLbvvH4jVSqr4Tps5Ra9SZ91rJnBv1 Diff:
Old | New | Differences | |
---|---|---|---|
108 | 108 | let factoryContract = readFactoryAddressOrFail() | |
109 | 109 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
110 | 110 | let stakingContract = getStakingAddressOrFail(factoryCfg) | |
111 | - | let stakingAddressStr = toString(stakingContract) | |
112 | - | let callerStr = toString(i.caller) | |
113 | - | if ((callerStr != stakingAddressStr)) | |
111 | + | let caller = i.caller | |
112 | + | if (if ((caller != stakingContract)) | |
113 | + | then (caller != gwxRewardsContract) | |
114 | + | else false) | |
114 | 115 | then throw("permissions denied") | |
115 | 116 | else { | |
116 | 117 | let wxAssetIdStr = split(getStringOrFail(this, keyConfig()), SEP)[1] | |
117 | 118 | let wxAssetId = fromBase58String(wxAssetIdStr) | |
118 | - | let result = invoke(gwxRewardsContract, "auxEmissionForGwxReward", [amount], nil) | |
119 | - | if ((result == result)) | |
120 | - | then { | |
121 | - | let auxAmount = match result { | |
122 | - | case r: Int => | |
123 | - | r | |
124 | - | case _ => | |
125 | - | throw("Incorrect invoke result") | |
126 | - | } | |
127 | - | $Tuple2([ScriptTransfer(stakingContract, (amount - auxAmount), wxAssetId), ScriptTransfer(gwxRewardsContract, auxAmount, wxAssetId)], [wxAssetId]) | |
128 | - | } | |
129 | - | else throw("Strict value is not equal to itself.") | |
119 | + | $Tuple2([ScriptTransfer(caller, amount, wxAssetId)], [wxAssetId]) | |
130 | 120 | } | |
131 | 121 | } | |
132 | 122 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (("mandatory this." + key) + " is not defined")) | |
7 | 7 | ||
8 | 8 | ||
9 | 9 | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func keyGwxRewardsAddress () = "%s%s__config__gwxRewardsAddress" | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | let gwxRewardsAddressStr = getStringOrFail(this, keyGwxRewardsAddress()) | |
16 | 16 | ||
17 | 17 | let gwxRewardsContract = addressFromStringValue(gwxRewardsAddressStr) | |
18 | 18 | ||
19 | 19 | let IdxFactoryCfgStakingDapp = 1 | |
20 | 20 | ||
21 | 21 | let IdxFactoryCfgBoostingDapp = 2 | |
22 | 22 | ||
23 | 23 | let IdxFactoryCfgIdoDapp = 3 | |
24 | 24 | ||
25 | 25 | let IdxFactoryCfgTeamDapp = 4 | |
26 | 26 | ||
27 | 27 | let IdxFactoryCfgEmissionDapp = 5 | |
28 | 28 | ||
29 | 29 | let IdxFactoryCfgRestDapp = 6 | |
30 | 30 | ||
31 | 31 | let IdxFactoryCfgSlippageDapp = 7 | |
32 | 32 | ||
33 | 33 | func keyFactoryCfg () = "%s__factoryConfig" | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func keyFactoryLpList () = "%s__lpTokensList" | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(this, keyFactoryAddress())) | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP) | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func readFactoryCfgOrFail (factory) = split(getStringOrFail(factory, keyFactoryCfg()), SEP) | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp]) | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp]) | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp]) | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | func keyConfig () = "%s__config" | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | func keyRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current" | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | func keyRatePerBlockMaxStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlockMax__start", toString(timestamp), toString(block)], SEP) | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func keyRatePerBlockStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlock__start", toString(timestamp), toString(block)], SEP) | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | func keyEmissionStartBlock () = "%s%s__emission__startBlock" | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func keyEmissionDurationInBlocks () = "%s%s__emission__duration" | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func keyEmissionEndBlock () = "%s%s__emission__endBlock" | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | @Callable(i) | |
91 | 91 | func constructor (factoryAddress,ratePerBlockMax,ratePerBlock,emissionStartBlock,emissionDuration,emissionStartTimestamp,wxAssetIdStr) = if ((i.caller != this)) | |
92 | 92 | then throw("permissions denied") | |
93 | 93 | else [IntegerEntry(keyRatePerBlockMaxStartFrom(emissionStartTimestamp, emissionStartBlock), ratePerBlockMax), IntegerEntry(keyRatePerBlockMaxCurrent(), ratePerBlockMax), IntegerEntry(keyRatePerBlockStartFrom(emissionStartTimestamp, emissionStartBlock), ratePerBlock), IntegerEntry(keyRatePerBlockCurrent(), ratePerBlock), IntegerEntry(keyEmissionStartBlock(), emissionStartBlock), IntegerEntry(keyEmissionDurationInBlocks(), emissionDuration), IntegerEntry(keyEmissionEndBlock(), (emissionStartBlock + emissionDuration)), StringEntry(keyFactoryAddress(), factoryAddress), StringEntry(keyConfig(), ("%s__" + wxAssetIdStr))] | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | ||
97 | 97 | @Callable(i) | |
98 | 98 | func constructorV2 (gwxRewardsAddress) = if ((this != i.caller)) | |
99 | 99 | then throw("not authorized") | |
100 | 100 | else [StringEntry(keyGwxRewardsAddress(), gwxRewardsAddress)] | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | ||
104 | 104 | @Callable(i) | |
105 | 105 | func emit (amount) = if ((0 >= amount)) | |
106 | 106 | then $Tuple2(nil, nil) | |
107 | 107 | else { | |
108 | 108 | let factoryContract = readFactoryAddressOrFail() | |
109 | 109 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
110 | 110 | let stakingContract = getStakingAddressOrFail(factoryCfg) | |
111 | - | let stakingAddressStr = toString(stakingContract) | |
112 | - | let callerStr = toString(i.caller) | |
113 | - | if ((callerStr != stakingAddressStr)) | |
111 | + | let caller = i.caller | |
112 | + | if (if ((caller != stakingContract)) | |
113 | + | then (caller != gwxRewardsContract) | |
114 | + | else false) | |
114 | 115 | then throw("permissions denied") | |
115 | 116 | else { | |
116 | 117 | let wxAssetIdStr = split(getStringOrFail(this, keyConfig()), SEP)[1] | |
117 | 118 | let wxAssetId = fromBase58String(wxAssetIdStr) | |
118 | - | let result = invoke(gwxRewardsContract, "auxEmissionForGwxReward", [amount], nil) | |
119 | - | if ((result == result)) | |
120 | - | then { | |
121 | - | let auxAmount = match result { | |
122 | - | case r: Int => | |
123 | - | r | |
124 | - | case _ => | |
125 | - | throw("Incorrect invoke result") | |
126 | - | } | |
127 | - | $Tuple2([ScriptTransfer(stakingContract, (amount - auxAmount), wxAssetId), ScriptTransfer(gwxRewardsContract, auxAmount, wxAssetId)], [wxAssetId]) | |
128 | - | } | |
129 | - | else throw("Strict value is not equal to itself.") | |
119 | + | $Tuple2([ScriptTransfer(caller, amount, wxAssetId)], [wxAssetId]) | |
130 | 120 | } | |
131 | 121 | } | |
132 | 122 | ||
133 | 123 |
github/deemru/w8io/169f3d6 41.09 ms ◑