Type
CONTRACT
Validation date
2023-11-15 06:46:30 UTC
Fee
0 UCO

Code (937 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x9cf237d7838d06f78272c1685c15c46457a930aa", 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: 0x00000BC0EBA2DBCE4455B46F5E51AFAABA6EB4C7FBA1D4E2E6DABD55DC70F9A04D6F, amount: 0.00992015
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.985e-5

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    6357EE640541412DEBD5A29DD932B629F19B9F9DC4B724B8FA2C6688B290E9279BFAE825855D73B97CC71656CD65E73A69A4B10682F981761633C7D6

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001E45349E07E5EF6776CF8CF8F8E04FCF8200BA844B133EB703C7115B1CE8B339B

Previous signature

2E9296CE75007D64694C88FFC77A017DA2F921E7A3E64EFB1D471B581910F8157E835D5445C5916A5CF644F1D6E9EB08BE385BFE25252752673DA6D72F4BD10C

Origin signature

304602210097092513BF0053C57B173DA7D796B3C46182287AB3E824EFDE2FF6827E6127BD022100A5EBC7300141BCDC434C2400EF235BD4B7F49623C1B56B94FBD4552D2F9120EF

Proof of work

0101046C39D56B717142B6EE14B0F8B2561ECA458F3D2D12C9977D613F78829419063211F9C21F7BB0D56B6523040A8156BE22B6E9D6332B88ED882574D12AE32F7A45

Proof of integrity

004F29632F41A38C6F9CB3172840B4BBF5A83DDEFB5D6664FED78F06830C96D5E8

Coordinator signature

1BD1C8E0CCE0BA8076A6C330AD375B58008EE90B9502259B98BBEC3CA7C4A1AEFD98868053FAAB9DE07B4B4A8017A53FB779E0555481C53D193ED34DE574710D

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

AC526D19B9E0D593D2C5D871304DC70C09A7CDCBB3C716E842BF344F0A4E2D58645C1949A71972B508FF60D4FC0310DBC9DE3CA55A1662FE35FF509877CE0F0A

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

F4EBF268F2BA94A8B9AB8054CEC9040FE4FFC197DABC40510A1069C251D00F3ED32A4AF659E54638CA34668AB8D037BFC7BF12F7F988C455C1DF63B4CEDD4405