tx · GRyM6FrBGLeEMmpwogHbvzV8fWBt6ZjJb5bnDZdTrHz8

3MtKnDmJju2Y4dp9A2ACPr11jDZiW6gmKKK:  -0.01000000 Waves

2022.01.04 21:54 [1864547] smart account 3MtKnDmJju2Y4dp9A2ACPr11jDZiW6gmKKK > SELF 0.00000000 Waves

{ "type": 13, "id": "GRyM6FrBGLeEMmpwogHbvzV8fWBt6ZjJb5bnDZdTrHz8", "fee": 1000000, "feeAssetId": null, "timestamp": 1641322496201, "version": 2, "chainId": 84, "sender": "3MtKnDmJju2Y4dp9A2ACPr11jDZiW6gmKKK", "senderPublicKey": "3itc77jAZTQAcaPCyYEe4KD7h18CvqZZ2JRynZHsuJ61", "proofs": [ "5PHajFwnsB6JSQXXF9WbgDsGADxDaruHgtLdu3FSQ4sop3ZTCyeUcH8nvyvnUC7doCiFpDsNJ6k3etiRMkj1MPUp" ], "script": "base64:AAIFAAAAAAAAABwIAhIFCgMICAgSABIECgIICBIECgIIARIDCgEIAAAABgAAAAAMYWRtaW5BZGRyZXNzCQEAAAALdmFsdWVPckVsc2UAAAACCQAEHQAAAAIFAAAABHRoaXMCAAAABWFkbWluAgAAAAAAAAAAC3RvdGFsU3VwcGx5CQEAAAALdmFsdWVPckVsc2UAAAACCQAEGgAAAAIFAAAABHRoaXMCAAAAC3RvdGFsU3VwcGx5AAAAAAAAAAAAAAAAAAhjdG9rZW5JZAkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEHQAAAAIFAAAABHRoaXMCAAAAB3Rva2VuSWQCAAAAGU5vIGtleSBkVG9rZW5JZCB3YXMgZm91bmQBAAAAB2lzQWRtaW4AAAABAAAADWNhbGxlckFkZHJlc3MDCQAAAAAAAAIFAAAADWNhbGxlckFkZHJlc3MJAAJZAAAAAQUAAAAMYWRtaW5BZGRyZXNzBgcBAAAADHdyaXRlSW50ZWdlcgAAAAIAAAADa2V5AAAADGludGVnZXJWYWx1ZQkBAAAADEludGVnZXJFbnRyeQAAAAI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AA25pbAkAAAIAAAABAgAAACpBZGRyZXNzIGRvZXMgbm90IG1hdGNoIHdpdGggYWRtaW4gYWRkcmVzcyEAAAABaQEAAAASZGVsZXRlU3RvcmFnZUVudHJ5AAAAAQAAAANrZXkDCQEAAAAHaXNBZG1pbgAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQUAAAADa2V5BQAAAANuaWwJAAACAAAAAQIAAAAqQWRkcmVzcyBkb2VzIG5vdCBtYXRjaCB3aXRoIGFkbWluIGFkZHJlc3MhAAAAAKmAxME=", "height": 1864547, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DViLUWzqxZdaPHRsLMMQv8gn7joemuDszN4sb1sFNMXS Next: GGvfrA6NRCJKLMB7uEkTFa8V2dtpZehd8H2sd5c9s6vi Diff:
OldNewDifferences
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let adminAddress = valueOrElse(getString(this, "admin"), "")
5+
6+let totalSupply = valueOrElse(getInteger(this, "totalSupply"), 0)
7+
8+let ctokenId = valueOrErrorMessage(getString(this, "tokenId"), "No key dTokenId was found")
59
610 func isAdmin (callerAddress) = if ((callerAddress == fromBase58String(adminAddress)))
711 then true
1923 then {
2024 let asset = Issue(tokenName, tokenDescription, 0, 8, true)
2125 let tokenId = calculateAssetId(asset)
22-[asset, writeString("admin", adminAddress), IntegerEntry("totalSupply", 0), writeString("dTokenName", tokenName), writeString("dTokenId", toBase58String(tokenId)), IntegerEntry("dTokenDecimals", 8)]
26+[asset, writeString("admin", adminAddress), writeInteger("totalSupply", 0), writeString("tokenName", tokenName), writeString("tokenId", toBase58String(tokenId)), writeInteger("tokenDecimals", 8)]
2327 }
2428 else throw("Pool already setup!")
29+
30+
31+
32+@Callable(i)
33+func buyRound () = if ((size(i.payments) > 0))
34+ then {
35+ let amount = i.payments[0].amount
36+ if ((amount >= 1))
37+ then {
38+ let cTokenAmount = fraction(amount, 21, 1)
39+ let currentTotalSupply = (totalSupply + cTokenAmount)
40+[writeInteger("totalSupply", currentTotalSupply), Reissue(fromBase58String(ctokenId), cTokenAmount, true), ScriptTransfer(i.caller, cTokenAmount, fromBase58String(ctokenId))]
41+ }
42+ else throw("Payment is to small!")
43+ }
44+ else throw("No payment attached!")
2545
2646
2747
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let adminAddress = valueOrElse(getString(this, "admin"), "")
5+
6+let totalSupply = valueOrElse(getInteger(this, "totalSupply"), 0)
7+
8+let ctokenId = valueOrErrorMessage(getString(this, "tokenId"), "No key dTokenId was found")
59
610 func isAdmin (callerAddress) = if ((callerAddress == fromBase58String(adminAddress)))
711 then true
812 else false
913
1014
1115 func writeInteger (key,integerValue) = IntegerEntry(key, integerValue)
1216
1317
1418 func writeString (key,stringValue) = StringEntry(key, stringValue)
1519
1620
1721 @Callable(i)
1822 func setup (adminAddress,tokenName,tokenDescription) = if (!(isDefined(getString(this, "admin"))))
1923 then {
2024 let asset = Issue(tokenName, tokenDescription, 0, 8, true)
2125 let tokenId = calculateAssetId(asset)
22-[asset, writeString("admin", adminAddress), IntegerEntry("totalSupply", 0), writeString("dTokenName", tokenName), writeString("dTokenId", toBase58String(tokenId)), IntegerEntry("dTokenDecimals", 8)]
26+[asset, writeString("admin", adminAddress), writeInteger("totalSupply", 0), writeString("tokenName", tokenName), writeString("tokenId", toBase58String(tokenId)), writeInteger("tokenDecimals", 8)]
2327 }
2428 else throw("Pool already setup!")
29+
30+
31+
32+@Callable(i)
33+func buyRound () = if ((size(i.payments) > 0))
34+ then {
35+ let amount = i.payments[0].amount
36+ if ((amount >= 1))
37+ then {
38+ let cTokenAmount = fraction(amount, 21, 1)
39+ let currentTotalSupply = (totalSupply + cTokenAmount)
40+[writeInteger("totalSupply", currentTotalSupply), Reissue(fromBase58String(ctokenId), cTokenAmount, true), ScriptTransfer(i.caller, cTokenAmount, fromBase58String(ctokenId))]
41+ }
42+ else throw("Payment is to small!")
43+ }
44+ else throw("No payment attached!")
2545
2646
2747
2848 @Callable(i)
2949 func updateStringEntry (key,stringValue) = if (isAdmin(i.caller.bytes))
3050 then [writeString(key, stringValue)]
3151 else throw("Address does not match with admin address!")
3252
3353
3454
3555 @Callable(i)
3656 func updateIntegerEntry (key,integerValue) = if (isAdmin(i.caller.bytes))
3757 then [writeInteger(key, integerValue)]
3858 else throw("Address does not match with admin address!")
3959
4060
4161
4262 @Callable(i)
4363 func deleteStorageEntry (key) = if (isAdmin(i.caller.bytes))
4464 then [DeleteEntry(key)]
4565 else throw("Address does not match with admin address!")
4666
4767

github/deemru/w8io/169f3d6 
29.01 ms