Type
CONTRACT
Validation date
2023-11-28 09:44:06 UTC
Fee
0 UCO

Code (929 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0xfe016a01abc6ef04ad91f97bcb1e1b6fc9395169", 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://sepolia.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: 0x0000E3E9B897C1EE0DC7FE004AD18B4B23361B00861F0C4DC6FC85FEC6A762FF235C, amount: 49600.75
Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 149.25

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    E6503DADCD4AA8204B5A9F948602869E63E0AE8D436A1195D27D5277DD13639AC7E95A6623B94D9A627C743E9041E01E20E0CA9ECE9186C1098835B6

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001415C0D989FA8E6AB50F4B4DE1DB6C6E36F25E287AAADEB2578E3C92FB36B0C61

Previous signature

091C373E2C99428674E19F5B25B431A85430B5ABF42B2C2BC9FB21B220CF9A48EDE6D70F468AB0E33A5395D4B3906E8C7B88DC88E1C74CFB768498108AD38E02

Origin signature

30450220247E7CB2D2844CE37C2BD4457D7354377A3B277ECDAC7444F215E7AFBFF3EDC402210080B6DFBF2473F50B089CE8C72C6B099194FE8D8E0869C263B1356A6A1117231E

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

00BE9A8AA2704080B80C8E10FE6617B833358A061D945ACA3A78C6A5BB340BA795

Coordinator signature

3FAC6E9D04C06D61D18CEE285466FD380CCDAF060A7F9D21774F6C37B87BB4D2B2E8D0064949A47FB4FDD326E5B954CD01EAD445F8B2F3D243045D64982DB109

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

0F4022206270AE10FCB2ACFAB7FE050290DFF73D3FE577075478F4511F3CE4FED69CDDE686C9DDDA80D2ADF9B10AA98F7107F16CBD1A78FFE9656335A7EAD803

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

98BAF3D859F760363BE7BD65ECC2BD3267C008517B648FD0166604F76D17A3FC31B3FF1F0B5FC46529485BAC1E35268686D9CBF6CDDC87552B3E1A8F5E8ABC08