Type
CONTRACT
Validation date
2023-11-30 01:44:31 UTC
Fee
0 UCO

Code (949 B)

  @version 1

# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701315780 do
  Contract.set_type "transfer"
  # Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.0995, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code ""
end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
  # Burn the non withdrawed tokens
Contract.add_token_transfer to: 0x00000000000000000000000000000000000000000000000000000000000000000000, amount: 0.0995, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code ""
end

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

    abi_data = Evm.abi_encode("status()")
    tx = [to: "0x121398a785dca933ec2e0032db842c9091e8438a", 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_token_transfer to: 0x00006AFF130BEB6BE9B02B80FFC13DB5EABFB0A7D167BAFC9F2DF8F141D7755FB39F, amount: 0.0992015, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1
Contract.add_token_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 2.985e-4, token_address: 0x00001A4AB7AD0CE2B494C965C66FF2962692A5FE5ECB71B345ABB53BAD88A83A01F1

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    5DB2962F29789CD0E37DC6E85F8F0B53584C336B8DE557F185A9E21BC7B45AF2CA850DF903C1C82DCAD78863DC378F73A3E59765621B5CB14BA1A9F0

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001CDC829CA597171296B29D20AA702A912F064FE32864676F0C3256BE4E3CC649F

Previous signature

4E5269E8EB14EA966DCB786B3B172983E6B47C13C3638914089CFF61D167C1DEB987BD4878BCA960E1B146EA38C851C5F35B32CF068C6393AF9968A83996BD0D

Origin signature

3045022100F9939050CCEECF7768326A0575D73F6D6336A4DB65B0CDDD68B0AA5E71844BF20220510A4BBBC75C57C1D22E5C743771589A52D436429723DB77375994AA3EDCE43C

Proof of work

010204B3B2A53580086B9F36919CF40ABC55904729F78BF43673E216FAC1EB2451DD1E521879C6588F0CB09B150A103A39A73E2816B5ADF51F0721348BA3A66C33023B

Proof of integrity

001DC977404B45A395A2B9DFB4735230E35120B27C86C6A694EA176C3EED227FEC

Coordinator signature

C59225C98DA509CDFFD022CBEB6A303A4E03E9BC4A27052D529C666C223CCF977CB1D6C695D7C8D3F1A36F00B14780A4468971A1CD390799C9009404B373C307

Validator #1 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #1 signature

DF5979F6AB3AC44B53E58D2C281B26E58F4E00682369D51746E7574B0AE5FB786ADDEFB38631F598D6BF53C07935FE460029D41B45ACCC6AB6FDC976BC464304

Validator #2 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #2 signature

AD11B1DC8C6C1BA539D54A6F402A57C99B28372D9D29B4EA3C0AF12FAB034B9C19FF01F0479221B3BED1F0FD703C62B6FB208EAABEBF06E0D08E5B7DFD54B20D