Type
CONTRACT
Validation date
2023-11-22 02:39:12 UTC
Fee
0 UCO

Code (923 B)

  @version 1

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

  Contract.set_code ""
end

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

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.018905

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xb47a0972dd2c644f210c844069c444ee784191bf", 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: 0x00001675BECDA24450FAD82114A15B58567979E8E7AEA1CFFC54CE8C1779513EA2AF, amount: 0.01884829
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 5.671e-5

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    9E5B9B5192AB81F70FA1B75ECE71FC31744335E874521F579518093908C0C7685E6A4D5F7DEBDAD1325E8A6AF0F46FB815DEE4609144D2C04AA92F1D

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001B95E46C80138D7CA25CFFB32067B01328FB581164AA69799FF6978F826B020C6

Previous signature

E3ABA93A24379FDDB228EC0EFBB2324DCE2959FCE54EAFE8FA215B12649B3D999FE061396B5653D6BAF0EB735BDB156A3ACAB19ABF755DA53C0B1C83B34FFC09

Origin signature

304402207F122D7C5E8582F7DE14C682E8795588362368588AA77B0B086AC896383C560A022008D53FC58F91FA3DB133F3C14590568C569AC530D0DBFA5965B56CABD9D33001

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

001ABC484C5B128FF805DFC30B11464279B25593FFC73BA55E4319ED4B6509460E

Coordinator signature

5AC11B50232FE858F7A35C9C114067BDE56AAFF1309FAEA338D00E6C2384205DFB3E030719094EF12C709319BE6B96E697D2327A097191708212AFED525F3B06

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

5015D82E6FEB942694E7591596FCFAA88CC1ABDCB66092E4064C82BA6097A5AFEDA33FC9F35204659FEDE027441ECAC55A1462093CB3F3ECA7414C3CE8D32609

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

40EADC52C37AE3F9D0E34FB42C11DF6B8278269E8D388912093F3F601B509BD18CCD52FCDF5AD28474EEE3787FEDD3769D8F393CE7FFC666515DBF52DA28B601