Type
CONTRACT
Validation date
2023-11-15 19:55:47 UTC
Fee
0 UCO

Code (929 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x0ce215fadd556334b9460424bf4cb0639484a1db", 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: 0x00002058D607CBF792C23CC2389F4785D54ECBC695EFABF8856BBA051252962DBDE1, amount: 0.0992015, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.985e-4, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    163E75D976C28CC90B570CE89377CCEE1ACA5279C15EAC32ABDAB8A62E1951929648FF4A09B2CC524966416ABBB1FA3D50089D119049AAAEACBC8B79

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

000144B8E17F47F2415F3AD63B2D563B879F06860523C01D81D60F126F9655E61F0B

Previous signature

F30E3103352F7AE9ACD8898867AF983E5213CAFE08B3ECE4B0A2144D5D08803260FEA877E010F8E61D26037A42D8EE12992C946F68C65650AAF24083C41CC309

Origin signature

3045022100869FBF34873F502EA6D522B0932F52B7AA938F12614C0D296B55321F9241D29502205505587696E189EBF7E523D153E7E308CA403898D7296A7E55DF010EFA0E66FE

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

0022EABE4A2C8C8A2D5CC1EB246CDDBBF958636B3BD47D99ABD08B0B6898CA86AD

Coordinator signature

94FCFFE144B49282D3BD6C06C1EEE344D51F5BB4F28F9EF5AC1CCF5F71AD158EC32BFDD75F7EA10E3A313F05562A36B19DEFDF191F998C995B5F07310F14D801

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

8937F071207BF879D02A06B0BD9883C1B99DAFDDC2119A409CBE1DD80F0BBAF511D2AA05730AA1ADB58270600039C1E9DCB9E24D10E959FC75553BE24057ED02

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

0674FEBB7AD2F63A8E54270DC5B1C3FC6BA1D2599F909BD23C886725EFBDED11238B6F4045B3B8F81B1342B5308FAB064CA162EA96AF6C7C1DE0DE995B328E09