Type
CONTRACT
Validation date
2023-11-16 16:32:24 UTC
Fee
0 UCO

Code (944 B)

  @version 1

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

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

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

  Contract.set_code ""
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    AAB2572A8C6FE717AA10B1F285457B4F2860D0E47A71F1B3C1D56DDAB8F256631AFF4D6CAA0CE31658C9F2EACF2E3C2DE67341C15DA1DDB56F09F8E5

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Proofs and signatures

Previous public key

0001E156310D6967F6016E7FF6E1BB3655CD78DAB7F62722DDA828524DDF6367B1D5

Previous signature

CA1525C58F87A21058B14DA7B345D20CDFFCB03D01047E05C9F0D0A910D645AA9B662990C5C83544DAF4324722795EE61459658D7D36E0EB72355A1A212F0603

Origin signature

30460221009B6EEA8374418B665E3DE75AF8ED9ED91D90E4AF696B768AA0946B1DD2F97520022100CA98AE61D63ED369FBF21A4E270CBEE58368A1512B415D212887EB9FC87ADF1A

Proof of work

010104EB90F7BDD03D5A7FD9B61D9128D7CF24C11F3F7DA96825DA3680C2B6BCC48F1AFCE26E0A5F1A903EDAA4BC9390210A0A4F175847EC2A2BB325BB6D1CE8EC8F90

Proof of integrity

00C94D0DD19C97202DE3AC24786AC8F398EA85D317B1127BE808274B290542767D

Coordinator signature

7C72561F47ACDD02899DBCC9A155CA6F8B026C59A9BC5C9414AEA707A5C452BB717D5ED2DDE9F905E9EE13388C13A3717D3069F965213019C1D7C5BC44256706

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

50F7BB78DC6EECF202F645F3BD2B71FE41B0C0632A712179AFEE989658E0214E798CD7B3796382C7E1CD7CB0E23E87DBD588BC46B7FE33D837CBE5749455EB06

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

8C279840CB4803ABE47BE7FB6B762D243EF1C16E05D02B6AF5CA138BADE48DB8EB4E7B434E39C900BF3865A9133C6CFFC73204C8234B0869EF0EB848B6BFC209