Type
CONTRACT
Validation date
2023-12-01 17:25:07 UTC
Fee
0 UCO

Code (894 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xe614cac79da2dc6bfef9fa22d6bc6d14b55ed09d", 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: 0x0000F25C3DF408399FD5CC26D5A53C4081F6D6600B04B5EF4E41836D384F8B84C772, amount: 1.0e-8
# Transfer fee is less than the minimum decimals

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    D1DB8DF710027E5CE609BF338747922CCF36F188C845023E917BE99215E48442D9D682EB7221F5D18BB4DD3D983803456DF4C9A9F992BAFDD763CEFB

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00019855BF3C781786F93ED3810A8F9CC6C5A0C53C7F5D1E9215DF0E84A2EF3C2DBB

Previous signature

7F26FD6024C4937E8C3452AF44F049FF03D27D8C1073AA46D1E84E6888C68AE910488BC9BBA20EA8D95ABC693F373864703B2E44436A91F144167FEE37D39900

Origin signature

304402207BA9BDF03588F1607E67E1C3C0546413DA092E71C33ABE7EB733CD91F54C17F50220596B507D674AE26F6ECE22734B053493F0DE2B785B148445B385C94E5168D06B

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

00B2CD47A7BB1C17985D9E0D5D1213C5446E32B29A7775CE27E86C36764083406B

Coordinator signature

C65E3670F8402A03889FCD4B527CB724E4A540ED518760FF565C03F891C4D270E8D96B351B5C97379C10FC619A236E8EC9340C9C0B2B272BCEA6ED4E7C0E9A09

Validator #1 public key

000151C124A6211CD402FD1CFE560C5DB51ED0CBEF44B09B21A41206028E7E5942BF

Validator #1 signature

6C6F78C4EB7D9E0EA3F38C6D2182DF62B08B5AA1F404F6FD0E363480FEAFCC8E75AC368613DB0EFDECD4642FF46BE0F7440E124C3215F9FD3B0214DBB723010F

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

817CBFD8BA6C1A715EB9907F8632A136EDB5C5DBAAB86416990197A2122EA6B84FBC1B6E007D4DDD85A49BACF7ADFCD6F4E76158A3366A4D253D78EACABDD80A