Skip to content

Commit

Permalink
chore: add Contract page for ExecuteRelayCall
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ42 committed Nov 8, 2023
1 parent 4b5e88e commit caf13ec
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 2 deletions.
62 changes: 62 additions & 0 deletions docs/contracts/overview/ExecuteRelayCall.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
sidebar_position: 5
---

# Execute Relay Call

## Validity timestamps

:::info

Use this website to generate validity timestamps for specific date and time.

:::

It is possible to make signatures for relay executions valid for specific time periods. This is done by constructing a **validity timestamp** that can be passed as the `uint256 validityTimestamp` parameter to `executeRelayCall` and `executeRelayCallBatch` functions.

Below are examples of constructing different **validity timestamps**:

### Example 1: only from a specific date / time.

Valid only from the 1st June 2024 (midnight).

Timestamp for _1st June 2024_ = `1717200000` (decimal) = `0x665A6480` (hex)

```
valid from timestamp 1717200000
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
0x000000000000000000000000665A648000000000000000000000000000000000
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
valid until indefinitely
```

### Example 2: set an expiry date

Valid until 31st January 2025, 5pm CET.

Timestamp for _31st January 2025 (5pm CET)_ = `1738339200` (decimal) = `0x679CF380` (hex)


```
valid from anytime
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
0x00000000000000000000000000000000000000000000000000000000679CF380
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
valid until 31st January 2025 (5pm CET)
```

### Example 3: valid during a specific period


Valid from 1st January 2024 (midnight CET) to 1st April 2024 (midnight CET)

- Timestamp for _1st January 2024 (midnight)_ = `1704063600` (decimal) = `0x6591F270` (hex)
- Timestamp for _1st April 2024 (midnight)_ = `1711926000` (decimal) = `0x6609EAF0` (hex)

```
valid from
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
0x0000000000000000000000006591F2700000000000000000000000006609EAF0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
valid until
```
2 changes: 1 addition & 1 deletion docs/standards/universal-profile/lsp6-key-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ Dapps can then leverage the relay execution features to create their own busines

![LSP6 Key Manager Relay Service](/img/standards/lsp6/lsp6-relay-execution.jpeg)

An essential aspect to consider in relay execution is the time validity of the execution signature. It's sometimes beneficial to limit the execution to be valid within a specific timeframe to prevent potential security risks. For example, if a user signs a relay transaction and the signature is stolen or compromised, the attacker could potentially use this signature indefinitely if there's no validity period set.
An essential aspect to consider in relay execution is the time validity of the execution signature. It's sometimes beneficial to limit the execution to be valid within a specific time frame to prevent potential security risks. For example, if a user signs a relay transaction and the signature is stolen or compromised, the attacker could potentially use this signature indefinitely if there's no validity period set.

To mitigate such risks, adding an optional validity timestamp to the signature could mark the start date and expiry date of its effectiveness. Once the timestamp has passed, the signature is no longer valid, rendering the relay transaction unusable.

Expand Down
2 changes: 1 addition & 1 deletion src/components/ContractCardsGallery/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const Contracts_AccountsInteraction = [
},
{
name: '⛽ LSP25 Execute Relay Call',
url: '',
url: './overview/ExecuteRelayCall',
urlABI: './contracts/LSP25ExecuteRelayCall/LSP25MultiChannelNonce',
description:
'Add Meta Transactions on your contract to enable gas-less transactions and more easily onboard new users.',
Expand Down

0 comments on commit caf13ec

Please sign in to comment.