Type
CONTRACT
Validation date
2023-12-06 09:11:09 UTC
Fee
0 UCO

Code (933 B)

  @version 1

# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701860340 do
  Contract.set_type "transfer"
  # Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.0199, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code ""
end

condition triggered_by: transaction, on: refund(), as: [
  timestamp: timestamp >= 1701860340
]

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
  # Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.0199, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code ""
end

condition triggered_by: transaction, on: reveal_secret(secret), as: [
  content: Crypto.hash(String.to_hex(secret)) == 0x39DD8452A0173F6BA7CEBAEEFF7148B32B65CE9B97F424030F70FA6DD4F35CB5,
  address: (
    valid? = false

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xd9162b24957aa9084a479a5a4da815c302d545e8", 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: 0x0000EF7F5DADD1E56D5DD8460A4C5053B1403716AB605B376E343F792A68D1E2F29F, amount: 0.0198403, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 5.97e-5, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    9B4E75A2B6676756CFA9CE33871E22C30FE5F357EA88AC2097E96A9E54C03C45116F0E3AB42C00B3C743E3EFA882B3A1AA7662E7525C9843E6906E4F

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000133D0B3B9482B1E406A013CB205652D34FF48BE302B3856C897B575FB7D5EC02B

Previous signature

9D48E0ADA63303855CA98836E865E7001D25E37617C1BCBE4AED4982FD4AD9B0C87EEAE67939A82C007DCDF53389AF35C03DA5827939EB9C6FD0C00D5825300A

Origin signature

304402206065593C7C6DEFBAAD67BD2D54676E830B2AA93A41D1A67A84C76DCE25AA9AEE02203560FBBF26BBF2A01CA19572BB4D89233DF3E9E1A24F4BD84960ADB65A7A4813

Proof of work

01020451684966573439C38DA99334546FBBDE4A6D96A50B4A4ECBB6572CDBED023F079607407E254421D1779525D11C60D55684F0B403B93B95823554E29D1E2CDB16

Proof of integrity

0080775296D3DD8325334C82129851ECD797866E046D09526C89DA910D8B79137F

Coordinator signature

C4ECB0924DDEE2149B76E6A2C65E50E7E01C498E46FDC523EC1B9E14C8F33D6CA9F615D21C0DE6802DB9120656351C2D9FE9F74260BB3F4C0BDC122B69A13204

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

184CCA1FEA05823EE7B68934817D131B56C06C5E52BD8F355257DD23ED56FE1D854F86F06F3D678D2224FD2B10CD13391E5640019614A1351CF65C815379520A

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

73061930DFD2F32E3E184FDFC9E9D0ADD07A6067DFBC5B4C50AE27509E83E73FB085C9927C5F408428149E96DC431CAF7ED8C8C32D818704AC1DFB114C9B0601