Type
CONTRACT
Validation date
2023-11-14 18:31:27 UTC
Fee
0 UCO

Code (930 B)

  @version 1

# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1699993800 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 >= 1699993800
]

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)) == 0xBC3E157D9A2DE3916FE2C53CDF20D2DFC4B8252B865198467655677589E6C3E9,
  address: (
    valid? = false

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x5f49f012921dd945d8df8f454369445a0e900b1e", 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: 0x000072181206496222FBB38752FCCED316C8936F3030CAE39BF58D41BFEED0CA6263, 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)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    0422EAAC157188A71D1584EAD6E4AD66981844B296BF6A19587908B8A2B4E820AFE74952C1422BA3A9A330F92FB7936FD6C4268750DEEC2A2CA2AC9D

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000196F1EAC6BEA151FD81B17AD4EC9B91E647AC30ABE51FB7F1EC224925D1E0EDF0

Previous signature

E4544FA9C6827BB0395B9596CCB82FC63ADFE59E5023A0184A5F6F5DCF9E601DAC36480B6FB772BBFEBACFD56392C64DE409C91642223B71FFE3794C6BE20100

Origin signature

304502203BFC7C06D63429EF931408EAB5DD6E072C520A995FABE0263FB2EFC4AB241429022100E089E23AF269C05A2E63D7349E665F56C933CA2B377D8A8A2E338D026B7E3BB1

Proof of work

010204D6052E0C6CA9244CDE5F3D664296BDFBA0090B330404C3C16B098758F27965DFEC0D3F25D1365F389C2B6C516195552F8779DEE0796C8C33F1A9C0404F4E3381

Proof of integrity

00345143FF7C00143FDEFF515F2325A020F3512F702CFDE3CC047A2EA0EB6C54EA

Coordinator signature

B6CCD9FBC45FBBE0CE8278FDE77E647E25A257B71950B184A5F97E984729BF61C75A6213335B3EDB1D47AB8801FCA2F6E037E1D9E85A025C2B28DA5FA12E4A0B

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

760FE3A9357C662298C10A5DB3F82B3895A4BF65097FF62E41CC2F7B56B54A2E6A3CFC785DF679D522850DD4EAE31628F815A00D5FBAA7804ED1735D1EF6DA0A

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

79A0AB0D26BAEA098BB80E3AF6ABE4B5B95C7C210EF23526ABA5B9D6C2AEDFDA0F008C2C247FCD76BC2A17D1B1058927E92903EA40BEB9287D7658A4FDC5A909