@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701315120 do
Contract.set_type "transfer"
# Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.00995, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code ""
end
condition triggered_by: transaction, on: refund(), as: [
timestamp: timestamp >= 1701315120
]
actions triggered_by: transaction, on: refund() do
Contract.set_type "transfer"
# Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.00995, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code ""
end
condition triggered_by: transaction, on: reveal_secret(secret), as: [
content: Crypto.hash(String.to_hex(secret)) == 0xB6AD95A538E38B5D3554B31C6284D7A8D5D65CFD2C8F9F61F2B6364D1DBCC18D,
address: (
valid? = false
abi_data = Evm.abi_encode("status()")
tx = [to: "0x556ed5f7fd36d4b096451ea07c271ee5d658c061", 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: 0x00006AFF130BEB6BE9B02B80FFC13DB5EABFB0A7D167BAFC9F2DF8F141D7755FB39F, amount: 0.00992015, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.985e-5, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.set_code ""
end
Content (0 B)
State (0 B)
-
Secret shared with 1 key
Encoded secret
1B24453EA662C46180C41039C682B0719E2BE5A19202C7323D0C9B0CBC530842A8C2C5F323A6786BEEFD742A1CC197A95EC8DB8D7D8F928C4B1C554F
Authorized keys
- 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F
Contract recipients (0)
Inputs (0)
Contract inputs (0)
Unspent outputs (2)
-
From 0000B5C3...4F34At 2023-11-30 01:33:08 UTCAmount 0.360267 UCO
-
From 000011F6...2369At 2023-11-30 01:33:02 UTCAmount 0.00995 0000288B...B827
Previous public key
0001B0B69F9A8CF48DFF3B5679FDCC3BE8F172D8C6876D3D2CB5665BC702AC02A895
Previous signature
B1BF50BC41BB8CA9152A904252C288F7C5AF64D2BD4645193F648C95AFD2094289F8B85EB87A629E41B276E26218A4E861A3D8AA8770805BC368B11CBB672707
Origin signature
3046022100BC41752968838C8BAF2F539CFF01766B5E9C500BBBDC3E67418D74AA6D8ABBD202210080DF047D922BF0A85F3BF5CF726B25E39BD3B7C4F8861E3AC7729E1D870093A0
Proof of work
01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16
Proof of integrity
006F31669B4709A531FC04ADD20B6A1D5796B6515B3AB903D5424B56F514B20C94
Coordinator signature
5E337B732942DBD6061DC5309856DABBCC7B7849BCBA80B3E7A0637DB06D650216F6767A0A0C4320D487C913A41B70D2A5A3037C5039C9152E1A2C40DED8AE03
Validator #1 public key
00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947
Validator #1 signature
FC1B896513317A81E5331C5FA7152231C8C775F1B74A20224761467689E89FFBC79BDE5053C12FBF34F97EC298277E65C95ADF21D8E0FC82DBBAC68CE135380E
Validator #2 public key
0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3
Validator #2 signature
409B2DF4B8E99C8483474B521B4B1F7E5D74399B3A2B03C53BDFB235D61800600EEAB6677E3B59FE5C3D1CDF2B4D31E03EBD00E7124A7545967D5AF2DDC41C03