Type
CONTRACT
Validation date
2023-11-21 20:12:19 UTC
Fee
0 UCO

Code (936 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x60a98b1cf8f10ae70c84ac66d5d252069d52b4fd", 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: 1.98403
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.00597

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    957B50E2D8EF3E1BD645A0AD1506A26E3D4E8849D3F9A1D7561C0E95C4902BB8EE24BC5FD9628AE8E1EA78ABDEBB8D525C341DE3A085AA1536240022

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001CF127F123F02B37D06A89AA1288EF8DC4F6832CE2077EEE7BB711943D1BC9BC7

Previous signature

5DEF7F6A7BA4A554D4EFB26D6481BFE45B3DFFBBD8E14A7FDC5CF279C1659F0CB70F83CB8232BCF5BFE311D9288798134FFF510FEF8A0D36C7144B3358C13B0B

Origin signature

304402203A8CE3AC258B94023F5DF189146DE6E0B4C15FEF87E3C5476642DFC2545896B7022004D2BBCD6D3D9EE23C77091BD05DC98476823778F4D49CF5DB54E78980752626

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

0085BEC049E46E84E742510B24927AEAFEA35E0A4FF54E4B499CCF762CA0C74C81

Coordinator signature

471128FE1F760C9E2904FC17267A2E6C87D5A88C32737F6C8983375FF6F22CA83C333BF0D4146A2731DD0F998BE54F6068190016E0594D8656BC7C3E459FD60F

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

0A799111E2E99EB6CA1B4D49A27C4D8F63085A462E187CCBAD4836EE589CD1CEDB46C365BF4F3FB6A7FCA27C9CC17C6100180F5360833E5FCE4F795CE76CFA09

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

00985B056A346147EBF86694C0DC0E835937E09C8127D4386C8C98C5693465C5CEA8E2C652D8216A206A9922A11705EC474B2DB743743F03419B15E2C24DD70F