Type
CONTRACT
Validation date
2023-11-30 15:53:14 UTC
Fee
0 UCO

Code (866 B)

@version 1
# Automate the refunding after the given timestamp
actions triggered_by: datetime, at: 1701366780 do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000D0908B3342519EE710DEA10FBD3394E66A558797EEDFB410F82593E0EA92201E, amount: 1
Contract.set_code ""

end

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

actions triggered_by: transaction, on: refund() do
  Contract.set_type "transfer"
# Send back the token to the user address
Contract.add_uco_transfer to: 0x0000D0908B3342519EE710DEA10FBD3394E66A558797EEDFB410F82593E0EA92201E, amount: 1
Contract.set_code ""

end

condition triggered_by: transaction, on: reveal_secret(secret, secret_signature), as: [
  previous_public_key: (
  # Transaction is not yet validated so we need to use previous address
  # to get the genesis address
  previous_address = Chain.get_previous_address()
 Chain.get_genesis_address(previous_address) == 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801
),
  timestamp: transaction.timestamp < 1701366780,
  content: Crypto.hash(String.to_hex(secret)) == 0xC068AEF00A3CAE166DA9341CF4B2CE51FD0D313468F43D32FBA34586FB7B78CD
]

actions triggered_by: transaction, on: reveal_secret(secret, secret_signature) do
  next_code = """
  @version 1

  export fun get_secret() do
    [
      secret: 0x#{secret},
      secret_signature: [
        r: 0x#{secret_signature.r},
        s: 0x#{secret_signature.s},
        v: #{secret_signature.v}
      ]
    ]
  end

  """

  Contract.set_type "transfer"
  Contract.add_uco_transfer to: 0x000018D60115ECE0C7558A46B4693749BF6BEAB524FDDCCF9B10B910619E4EE08801, amount: 0.997
  Contract.add_uco_transfer to: 0x0000749d250560bf06c079832e0e9a24509b1e440a45c33bd9448b41b6a056fc6201, amount: 0.003

  Contract.set_code next_code
end

export fun get_htlc_data() do
  [
    amount: 0.997,
    end_time: 1701366780,
    secret_hash: 0xC068AEF00A3CAE166DA9341CF4B2CE51FD0D313468F43D32FBA34586FB7B78CD,
    secret_hash_signature: [
      r: 0x55999F80E71B0B9C9B3EE72A99CD2594889E5DA170B3D26462E8DC0CEDADE52C,
      s: 0x12B4C8AA4146F9D171C9FC11CFAF9D0ACA19BA8B1D3EC446B8E44929BD779420,
      v: 28
    ]
  ]
end

Content (0 B)

State (0 B)

Movements (0)

Ownerships (1)

  • Secret shared with 1 key

    Encoded secret

    EA542AAD79870C0B23BE90D08DF78541F62641F321FED2B3E5E3321E5222A2167778E3AB2693FBDE77587BCB87BB0EC6F8598E1C8195362DF620C886

    Authorized keys

    • 00017877BCF4122095926A49489009649603AB129822A19EF9D573B8FD714911ED7F

Contract recipients (0)

Inputs (0)

Contract inputs (0)

Unspent outputs (1)

Proofs and signatures

Previous public key

00017CCCB260CDA92EA6AB2A505290AEC99B50C83C271B6F05442E547782CF15D6C5

Previous signature

0621A74FC0C88C6FCF7777E1E9F2A14EBCE53F57C008930592B4E846B1D1A10E80549A9235B6D523F6175FF63A25D8F62E379D9CDF254490C6CA238EC4CB9D03

Origin signature

3044022035B6AD353B28FB2CFFCB75C85531040EDC32C049C055E623C06D1F14DAA76B73022042E194EB4C0332BD73E9EF6BB693FB48A0712C34F609CB277F3EB34954FD2C40

Proof of work

010204E9BB401A767B0C92D5DB139379AAB18E1B449B455F49E3A44F3466B2D38E59F0516B79493A528A95E5A74CF46F79CF12DEB73293458F6A4403D2B3E57D697347

Proof of integrity

00BBB779520CFE1BD640F0B7D5D8E51F18B09C5EFDEEE4A18AFA331CDA299FCF7F

Coordinator signature

73859CC4758962279A9D9631B2C66A73E2A108619DD6C1D1E4EC7060FF99193971CBC7ACE9E512D9840C629149FD28A4E0804D53AA7666471F25A4AEAE99B705

Validator #1 public key

0001B0A94804BF8ECC9897075C6207FF63EF4D339F57A0349888E6B77CD47DB53EF3

Validator #1 signature

58A525E0818192ADC434CAA77EEDDCCA7BD35B9B09BDE5664C87EF18842200601A70CBCD1A799E9CECFD9B2C5EEEC51DCC1ED7266247CB34A287E7FF2AF4C704

Validator #2 public key

00011B58ED42235461734EAF253BD97A80B92899ABCC3BE680D44B6825DD2A88A947

Validator #2 signature

069B67C89D72EA164BC85837B4AF2CA233187C636C38338EEBB3B7C46E0EE1D816E0A49C9F15455A212700F986A94AFDA28B836581A0EA0CF27C88CB68F2F60B