Type
CONTRACT
Validation date
2023-11-12 15:30:49 UTC
Fee
0 UCO

Code (920 B)

  @version 1

# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1699810200 do
  Contract.set_type "transfer"
  # Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 0.995

  Contract.set_code ""
end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
  # Send back UCO to bridge pool
Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 0.995

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x2b0d2217474a51af2ae9cfedb7d78722c158ed68", 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_uco_transfer to: 0x00008DD40CD42287A3C8282065F5BCA7259AC7014CD73109B570E946A977687C7BD0, amount: 0.992015
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.002985

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    CCAD73EDF736D32077211020C9F78EFE6D414A1D0ACA99B0289ED523464C6968E22C416C3A9192EC0F8F5763D5D5EA18741FBEA0A9D46F0FB0E817F6

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00017707BBC05B60CECD32F1DACB79BD54A1518134BCEBA076E47DDF5F16091C777B

Previous signature

DD1A4ABB0951EBF34E989CFC3FCF166B73522B8AF22C87299656BD7999C46859C40BFA46CB460FED5E28F4BAB6260A239726C750137010571FD851E236C20202

Origin signature

3045022100DEBC8CAF4D5049B968AD9631514A6E0632F5B8A8FFB73BD6639E92482F9C7EF702201A841E3D6B8E5254FEA34BF9946A77DE321EF7B7D7D5D90A4262A9961E6EE747

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00FB3BDDEDB4CE036E045491C214D5B394074C72FE6411CB628884B25CEE9CAD4B

Coordinator signature

F28A009E3DBE56A1F753E9109A2FA63B10E254A85E6E7B29765BD7BE73A713B5789C68209480B8CEDD9E5420CF1483E8F315DC202FE20663610EC25B0076C603

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

199FE9BD5808A900EA17EBDAA506A5DAB55A36E5BA13CE3EADB9E4655AD0E59763351136C860832E1540B96238ABC9D30563825396949BDA45BF51A9CB8AC20F

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

FBAF180B18592E82D39C4109D60AE18E01AA8AFDC31ECAFFAEAC684C49D5003D51BBC0E1A0BD086509656039756D286D6204016817E792A91FCF1BDAB1F88F0E