Type
CONTRACT
Validation date
2023-12-07 12:36:51 UTC
Fee
0 UCO

Code (938 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x11ed55ed009dfd7c99df27522349ab6e25fe836b", 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: 0x0000A6A865901EF67DF81F22FFB026F5DA4F039AE0E9481B896FF2CF8CA5CAC32364, amount: 0.03472053, token_address: 0x0000288BF6F0E12457B125DC54D2DFA4EB010BE3073CF02E10FB79B696180F55B827
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 1.0447e-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

    32D6A3192E052111D0D7E18201CC9842A205D317DD37F40BC8CDFE21A8BF68D62089A940246CEDC474BCCD89CCA8013E9B7AF27E2F1A4D49ACE4C021

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001B9AB976C39BC8D69D12CC4427653AB98C4E6563718DEC0151EE050766A23D221

Previous signature

026B4534F4058F774DF7A107C36385B32C2C915C14F5466C02B60C4B06C7244B53B171F1CC2ACD07FF1C6C4225E966F2A1232B2343EC401FE5D6BA8F01F73309

Origin signature

3046022100AC53FF75A63DBBD84F28F3B17704B0400710EABDB1A1D080441B573D07C4C25A022100FF7EA0FAA28CF5F7ED19077D827BCBFF0AFC53A7E6ECED597A857531E6CBBCD1

Proof of work

010204892A04DBE05192BCB662689E7E19700F3F7202028EF0A9F20635C4948436ED85A43BA3017281EE97781342DD8F24ED6F583B5FE542830FDB5191A11843A72A61

Proof of integrity

00DF34D708B6619995EF6F5E263E8722F5A903C78C9EC42B8B82EB47AD915CEE88

Coordinator signature

4E20DAE12226D40369976C4FB34A44FC4DEC0B9DB5FE9DE4DE8849EBAF34C5BE53562F408C5463D8E7F02EC713A2B75C45E22E4A28DB77277CF0194A59FF260C

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

FA1681D2E6842645C09E0215A5C9AC7AB64205DC92838D13F14504F419BCCB69BF7EB444F25AF9E33B6C4F4F8D7C837FDA3B72D026E6829C8D9DD55BCED58E0C

Validator #2 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #2 signature

FBB64952CDA4C961FCE756B2BE95EBF6C02522BB0390738B7161BA0AE30D3BB02A1975D7AD71FD59991C8F44EBC9411DD12D2B62101C7CA612B70FE19438FD02