Type
CONTRACT
Validation date
2023-11-13 18:52:49 UTC
Fee
0 UCO

Code (936 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xd6cf592cbbb705b918c29dcda04803c155de6df0", 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://polygon-mumbai.infura.io/v3/3a7a2dbdbec046a4961550ddf8c7d78a", "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: 0x000024EFC168359BBE0ABF897270CBFABBFF5784622EA02A463BA2EAF7C5219EAFD7, amount: 99.2015
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.2985

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    B7ACB992BBD977018DA45EDC1FE91BCC06AF580E2C5F44A0107C161F30CE28DA268096EB579D5782FDCDB974955882EA0BB0039D95691F80D2845335

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001B657B1F98E3C4B7B10EA4E98CF305CF3E73D069DEBF0C090B017B5F64CD0FECB

Previous signature

84150167A0C2D213071C5A0465613E2249B3506C31CC25E944A70B4C5944851031674DF3173D7BD5514E86F40B15C5DE5285186F3C34020C3D6E339E090CD10F

Origin signature

3045022100F76884A3296263ADAAF85219F0AD5E4357200123B08A87A4FE68C535EFC8AD8F02204E7565E87A523AD23A1AEDA9D30A784A8F4E6637235531DF5B619227865D4037

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

00B3F37BFA0A72CA75DE98622BBCBF2A021639762802B613A2F835E52E30ED8C55

Coordinator signature

2D835F220732BB99FA0C810EBCD530080E3B41138A43C33DD6A4129D68DCA0DCF1F80E3018E2DE3564C1C8F7805A76CAAA8EC4988F72B6589E8BAB264C67750D

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

78A9DC4667443E20D218B5EF88EAB1E4E179DCAA7776F9C11F5A74F55492C821BC0F3DD226BB6D32F2BB496385CD32416F86D59CBBD1CD3CE4AC6A27B5B2400E

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

C65A8C8FCD7707DA3122AE5408261C26EDEF47D52DB916DACB50B247091AD4511011176F50249597C303EFD11CDA4AD6E4F673D428C7A70E764D7CDBAD7F260F