@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701387900 do
Contract.set_type "transfer"
# Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.08955, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701387900
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.08955, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0x851160F8460B39A4D7B6A1B0F9D55C7EE13AFBD1E712ED63AA056D6713E72075,
address: (
valid? = false
abi_data = Evm.abi_encode("status()")
tx = [to: "0xdb7b6843dfebc2af663407ef22a488aa1f6f0965", data: "0x#{abi_data}"]
request = [jsonrpc: "2.0", id: "1", method: "eth_call", params: [tx, "latest"]]
headers = ["Content-Type": "application/json"]
body = Json.to_string(request)
res = Http.request("https://data-seed-prebsc-1-s2.bnbchain.org:8545", "POST", headers, body)
if res.status == 200 && Json.is_valid?(res.body) do
response = Json.parse(res.body)
result = Map.get(response, "result")
if result != nil do
decoded_abi = Evm.abi_decode("(uint)", result)
# Withdrawn status is 1
valid? = List.at(decoded_abi, 0) == 1
end
end
valid?
)
]
actions triggered_by: transaction, on: reveal_secret(secret) do
Contract.set_type "transfer"
Contract.add_token_transfer to: 0x0000064F114419DD1BA0B495E4B596513A180BCC4F58643496F0919DCC3B6313BEA1, amount: 0.08928135, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.6865e-4, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code ""
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
DF08BA86AA6F605EF62B6D6DDD2421757AB6A5919DFF2DA809BCC01C13E864CF115CE96A7325E124C2F30D19608B1DA1BB7A656B34184C110376AE51
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 00007C11...B30AAt 2023-11-30 21:45:25 UTCAmount 0.34865973 UCO
-
From 00006B8B...3EEEAt 2023-11-30 21:45:21 UTCAmount 0.08955 0000288B...B827
Previous public key
00012B1F2B652D7DD10E87DC75B664D92F98EC1751DBC99BC8930E826C91D7982B10
Previous signature
1706F45B488AA3C58A31C8963DA7ABAA80E0CEEEC3A8BFA23D87CDF1F80B7A728E9542A497641114A45B172CADFA00D56F19E9EBC20F8F082B33455A67A4FE04
Origin signature
304402207B3992C0417134C2F881994DEE284765B8F7D7E528522D2DB0DD5AF2CF2954060220491A8DEF0421F8146268CD5E63DE79DE3D6B5A79976BABCF9D4B01E3AA1466CC
Proof of work
01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16
Proof of integrity
002789E3724E947D2B2E100DCF83BFAD3FEE7D4C01C86A3D228B91C532CD766183
Coordinator signature
1AF15C2B9A5FA7C6AE0C769506F545BC7610E9F6183B3ECB3C8E4F28A4397A99188F6E8B6DCF466A15B923CCF1241E0823EF5A9930DEE1F24BE54778245D830C
Validator #1 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #1 signature
40DE05BB5E43B6BD346E71F73988CB7882971C46778AA2C630A911FE79C8043916989428E407746645EE89794FF327BEC162203045CD2C53B8A4A8C14579CA00
Validator #2 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #2 signature
7E44F7659A3DAF435D6BE6B285A8384E55970A1240112B615976C21CD5A2D901255AA95475A33AD746FDE6B76325035CF8358758CA5D60DB1FFE90C4C8C96301