tx · FPZNpUXmPxD2Riwn1tuBYngQxsx4hEnQwGH8xidYmQQu 3N3pV3T1urpdCHM9sGhsPhtEWwbqNkBDvbu: -0.01000000 Waves 2022.02.14 19:44 [1923551] smart account 3N3pV3T1urpdCHM9sGhsPhtEWwbqNkBDvbu > SELF 0.00000000 Waves
{ "type": 13, "id": "FPZNpUXmPxD2Riwn1tuBYngQxsx4hEnQwGH8xidYmQQu", "fee": 1000000, "feeAssetId": null, "timestamp": 1644857100796, "version": 1, "sender": "3N3pV3T1urpdCHM9sGhsPhtEWwbqNkBDvbu", "senderPublicKey": "8fNFr4G93aDzDBK1k8cyYWVXo7aRQP4xBGtBSJdSvfc8", "proofs": [ "28niSBcoxVNiKDooTrsLysPtHqZFwuqhY8WrwRzeDTcD4rGbjaVtnHdUvJxusqhah236CLzfPsNUteeNpTQViyf1" ], "script": "base64:AAIFAAAAAAAAABQIAhIJCgcIAQEBAQEIEgMKAQESAAAAAB8AAAAAA1NFUAIAAAACX18BAAAAD2dldFN0cmluZ09yRmFpbAAAAAIAAAAHYWRkcmVzcwAAAANrZXkJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAdhZGRyZXNzBQAAAANrZXkJAAEsAAAAAgkAASwAAAACAgAAAA9tYW5kYXRvcnkgdGhpcy4FAAAAA2tleQIAAAAPIGlzIG5vdCBkZWZpbmVkAQAAABFrZXlGYWN0b3J5QWRkcmVzcwAAAAACAAAAHCVzJXNfX2NvbmZpZ19fZmFjdG9yeUFkZHJlc3MAAAAAGElkeEZhY3RvcnlDZmdTdGFraW5nRGFwcAAAAAAAAAAAAQAAAAAZSWR4RmFjdG9yeUNmZ0Jvb3N0aW5nRGFwcAAAAAAAAAAAAgAAAAAUSWR4RmFjdG9yeUNmZ0lkb0RhcHAAAAAAAAAAAAMAAAAAFUlkeEZhY3RvcnlDZmdUZWFtRGFwcAAAAAAAAAAABAAAAAAZSWR4RmFjdG9yeUNmZ0VtaXNzaW9uRG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JAQAAAARCdXJuAAAAAgUAAAAHYXNzZXRJZAUAAAAJcG10QW1vdW50CQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAAEsAAAAAgIAAAAXJXMlcyVzX19oaXN0b3J5X19idXJuX18JAAJYAAAAAQgFAAAAAWkAAAANdHJhbnNhY3Rpb25JZAkABLkAAAACCQAETAAAAAICAAAABiVkJWQlZAkABEwAAAACCQABpAAAAAEFAAAABmhlaWdodAkABEwAAAACCQABpAAAAAEIBQAAAAlsYXN0QmxvY2sAAAAJdGltZXN0YW1wCQAETAAAAAIJAAGkAAAAAQUAAAAJcG10QW1vdW50BQAAAANuaWwFAAAAA1NFUAUAAAADbmlsAAAAAHGrVQs=", "chainId": 84, "height": 1923551, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let SEP = "__" | |
5 | + | ||
6 | + | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), (("mandatory this." + key) + " is not defined")) | |
7 | + | ||
8 | + | ||
9 | + | func keyFactoryAddress () = "%s%s__config__factoryAddress" | |
10 | + | ||
11 | + | ||
12 | + | let IdxFactoryCfgStakingDapp = 1 | |
13 | + | ||
14 | + | let IdxFactoryCfgBoostingDapp = 2 | |
15 | + | ||
16 | + | let IdxFactoryCfgIdoDapp = 3 | |
17 | + | ||
18 | + | let IdxFactoryCfgTeamDapp = 4 | |
19 | + | ||
20 | + | let IdxFactoryCfgEmissionDapp = 5 | |
21 | + | ||
22 | + | let IdxFactoryCfgRestDapp = 6 | |
23 | + | ||
24 | + | let IdxFactoryCfgSlippageDapp = 7 | |
25 | + | ||
26 | + | let IdxFactoryCfgGwxRewardDapp = 10 | |
27 | + | ||
28 | + | func keyFactoryCfg () = "%s__factoryConfig" | |
29 | + | ||
30 | + | ||
31 | + | func keyFactoryLp2AssetsMapping (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
32 | + | ||
33 | + | ||
34 | + | func keyFactoryLpList () = "%s__lpTokensList" | |
35 | + | ||
36 | + | ||
37 | + | func keyFactoryLpAssetToPoolContractAddress (lpAssetStr) = makeString(["%s%s%s", lpAssetStr, "mappings__lpAsset2PoolContract"], SEP) | |
38 | + | ||
39 | + | ||
40 | + | func keyFactoryPoolWeight (contractAddress) = makeString(["%s%s", "poolWeight", contractAddress], SEP) | |
41 | + | ||
42 | + | ||
43 | + | func readFactoryAddressOrFail () = addressFromStringValue(getStringOrFail(this, keyFactoryAddress())) | |
44 | + | ||
45 | + | ||
46 | + | func readLpList () = split(valueOrElse(getString(readFactoryAddressOrFail(), keyFactoryLpList()), ""), SEP) | |
47 | + | ||
48 | + | ||
49 | + | func readFactoryCfgOrFail (factory) = split(getStringOrFail(factory, keyFactoryCfg()), SEP) | |
50 | + | ||
51 | + | ||
52 | + | func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp]) | |
53 | + | ||
54 | + | ||
55 | + | func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp]) | |
56 | + | ||
57 | + | ||
58 | + | func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp]) | |
59 | + | ||
60 | + | ||
61 | + | func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp]) | |
62 | + | ||
63 | + | ||
64 | + | func keyConfig () = "%s__config" | |
65 | + | ||
66 | + | ||
67 | + | func keyRatePerBlockMaxCurrent () = "%s%s__ratePerBlockMax__current" | |
68 | + | ||
69 | + | ||
70 | + | func keyRatePerBlockMaxStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlockMax__start", toString(timestamp), toString(block)], SEP) | |
71 | + | ||
72 | + | ||
73 | + | func keyRatePerBlockCurrent () = "%s%s__ratePerBlock__current" | |
74 | + | ||
75 | + | ||
76 | + | func keyRatePerBlockStartFrom (timestamp,block) = makeString(["%s%s%d%d__ratePerBlock__start", toString(timestamp), toString(block)], SEP) | |
77 | + | ||
78 | + | ||
79 | + | func keyEmissionStartBlock () = "%s%s__emission__startBlock" | |
80 | + | ||
81 | + | ||
82 | + | func keyEmissionDurationInBlocks () = "%s%s__emission__duration" | |
83 | + | ||
84 | + | ||
85 | + | func keyEmissionEndBlock () = "%s%s__emission__endBlock" | |
86 | + | ||
87 | + | ||
88 | + | @Callable(i) | |
89 | + | func constructor (factoryAddress,ratePerBlockMax,ratePerBlock,emissionStartBlock,emissionDuration,emissionStartTimestamp,wxAssetIdStr) = if ((i.caller != this)) | |
90 | + | then throw("permissions denied") | |
91 | + | 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))] | |
92 | + | ||
93 | + | ||
94 | + | ||
95 | + | @Callable(i) | |
96 | + | func emit (amount) = if ((0 >= amount)) | |
97 | + | then $Tuple2(nil, nil) | |
98 | + | else { | |
99 | + | let factoryContract = readFactoryAddressOrFail() | |
100 | + | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
101 | + | let stakingContract = getStakingAddressOrFail(factoryCfg) | |
102 | + | let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg) | |
103 | + | let caller = i.caller | |
104 | + | if (if ((caller != stakingContract)) | |
105 | + | then (caller != gwxRewardsContract) | |
106 | + | else false) | |
107 | + | then throw("permissions denied") | |
108 | + | else { | |
109 | + | let wxAssetIdStr = split(getStringOrFail(this, keyConfig()), SEP)[1] | |
110 | + | let wxAssetId = fromBase58String(wxAssetIdStr) | |
111 | + | $Tuple2([ScriptTransfer(caller, amount, wxAssetId)], [wxAssetId]) | |
112 | + | } | |
113 | + | } | |
114 | + | ||
115 | + | ||
116 | + | ||
117 | + | @Callable(i) | |
118 | + | func burn () = { | |
119 | + | let factoryContract = readFactoryAddressOrFail() | |
120 | + | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
121 | + | let boostingContract = getBoostingAddressOrFail(factoryCfg) | |
122 | + | if ((size(i.payments) != 1)) | |
123 | + | then throw("exact one payment is allowed") | |
124 | + | else { | |
125 | + | let pmt = i.payments[0] | |
126 | + | let assetId = value(pmt.assetId) | |
127 | + | let pmtAmount = pmt.amount | |
128 | + | let wxAssetId = fromBase58String(split(getStringOrFail(this, keyConfig()), SEP)[1]) | |
129 | + | if ((assetId != wxAssetId)) | |
130 | + | then throw("invalid wxAssetId is passed") | |
131 | + | else if ((i.caller != boostingContract)) | |
132 | + | then throw("permissions denied") | |
133 | + | else [Burn(assetId, pmtAmount), StringEntry(("%s%s%s__history__burn__" + toBase58String(i.transactionId)), makeString(["%d%d%d", toString(height), toString(lastBlock.timestamp), toString(pmtAmount)], SEP))] | |
134 | + | } | |
135 | + | } | |
136 | + | ||
137 | + |
github/deemru/w8io/026f985 18.95 ms ◑