Type
CONTRACT
Validation date
2023-11-29 18:36:06 UTC
Fee
0 UCO

Code (938 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    6B26D1EFB5DA2D20BC50A75CE99C8452AFBD3CFE026D34A413C42497F4BB6608AE56259496605FA2CCF8B04ECF37E4379177362CCC78A89774C1CFA4

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

0001CB8F7047E6E57079EF2A9B5DC80CF397B0D03273C486DF1B45B6906E89B64801

Previous signature

E328085EEBAE13E0D2EB883F6DE143BECAC3495DA5FC76C38E5D0830EEC76D1FB2C4624863120AD26E39BC371075E21FC9D1B84559DB0BEE8F6DAA4BF98B510C

Origin signature

3046022100C3BBD2B355447DA1E9382E65E6914BEA370434B2D3F41483BE59A517D4BD7FAD022100FC92FF987AE3505356FFC1290771C84172E141DAA70B93342E56684CAEFBA20C

Proof of work

010104AB672F1E69B064D192819F1797C1926F158DBA8F3924AC732B4C4D70D0C8EA0A0D6506E5896C9C2524D2BE26CB5016287E1816A597C408008BA36FCB154A7765

Proof of integrity

00199BFEF175D44F9D9847EBE8B9909ED3FFE286FA5141941617A126AA0F83C2A4

Coordinator signature

E91FB5D60409C8FB3D1576067BA41404222EBB579D60BE4FBC67DE49A5FFECD7077A6244AF547B9DD987EAAA60200E089A56C85D9649BCD79FB4DC5347F67502

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

C72A6B55E5486E7FA9190F0D56B03772DAA40EFF123B273B25C4168E0FFF5FAC8034B453B3A9922CAD482F95194473F12E02A580294F7E2327A9C1423C8AE607

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

6810A981E393589446D18BA745431EB602EF12CF1970D40D68D780464358361F2EB445342B34174E756F99BFDD8C2ED46FFCB52D50372513FB41A7407BFE4208