Type
CONTRACT
Validation date
2023-11-14 12:22:53 UTC
Fee
0 UCO

Code (936 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x46e6cd9bf3eb63ae0c548e94152ca316c7391973", 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: 0x0000D9E7B4300CC29670CA80010FE23292BEE4AE28057328732A0FF4CF11C319D81A, amount: 9.92015
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.02985

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    0C2D9EC97675232C2E13E8BEDAB89032FF97318B3B350E76CFCD1AFA99384808E35ADE9CD11E87891CC07055BBC65D170AE914FE8A30A87D47DD08D8

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00011D7A755DAF967F5C3FBD732FB71C490A7125775A95A7F26EB814AA38E4467B72

Previous signature

DB47CC2BBA1D602123E94A7C563B13406791518E2DB1B6286D0417AFC5A7895D8C15C7AD2F1CAA99E593A8F8699755676775C2CF535A98BC653E9D102DAD9401

Origin signature

3046022100BB0B255F9323DA6C2B7299741832E20DECC070B7F58446432EB22F1CA23C2210022100A1F59F11414EFC308D9B313899A8E24578969F6500D834E61B352CB16638C4AD

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

0039D2AE2DF9B44FEC0648871128E527F21A10FC95419BD1D2D0A57826F61A977A

Coordinator signature

00015CC7CC76E26CC52484754735E025CE6943398A5145BF357B8985359ADAC0EB37FC179C9B62A319B534B03AF9A3342FC7E24C8A87F7A02AFBD64C252E210C

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

C2C465D5113182E5CE5C030C8E55682756AF7471167A2F8799E914339F6143BB69FEC7349CB319164ACD5FA168B431E83EBF7BC246357E75F819E3895170810C

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

33462BD9F0E4439DE2C222926E7EF9C6FD5D9A1E452A8D9380286E4F9F99FCF68127B21D5CFF865DA13413C275093186E86B1BB35159F92EB7B008F43D965103