Skip to content

Commit

Permalink
fix: sso session config update (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
JackHamer09 authored Nov 20, 2024
1 parent 24d41cf commit 1a25aa5
Showing 1 changed file with 36 additions and 10 deletions.
46 changes: 36 additions & 10 deletions content/00.build/30.zksync-sso/5.getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,22 @@ Just 2 steps:
session: {
feeLimit: parseEther("0.1"),
// Allow ETH transfers to a specific address:
transfers: [
// Allow ETH transfers of up to 0.1 ETH to specific address
{
to: "0x188bd99cd7D4d78d4E605Aeea12C17B32CC3135A",
valueLimit: parseEther("0.1"),
},
// Allow ETH transfers to specific address with a limit of 0.1 ETH per hour
// until the session expires
{
to: "0x188bd99cd7D4d78d4E605Aeea12C17B32CC3135A",
valueLimit: {
limit: parseEther("0.1"),
period: BigInt(60 * 60), // 1 hour in seconds
},
},
],
// Allow calling specific smart contracts (e.g. ERC20 transfer):
Expand All @@ -64,18 +74,21 @@ Just 2 steps:
// Optional call constraints (unconstrained othewise):
constraints: [
// Only allow transfers to this address
{
index: 0,
condition: "Equal",
refValue: "0x6cC8cf7f6b488C58AA909B77E6e65c631c204784", // Only allow transfers to this address
refValue: "0x6cC8cf7f6b488C58AA909B77E6e65c631c204784",
},
// Transfer up to 0.2 tokens
{
index: 1,
condition: "LessEqual",
refValue: toHex(parseUnits("0.1", TOKEN.decimals), { size: 32 }), // Limit the transfer amount to 0.1 tokens
limit: parseUnits("0.2", TOKEN.decimals), // Unlimited if omitted
},
],
}
},
],
},
});
Expand Down Expand Up @@ -103,12 +116,22 @@ Just 2 steps:
session: {
feeLimit: parseEther("0.1"),
// Allow ETH transfers to a specific address:
transfers: [
// Allow ETH transfers of up to 0.1 ETH to specific address
{
to: "0x188bd99cd7D4d78d4E605Aeea12C17B32CC3135A",
valueLimit: parseEther("0.1"),
},
// Allow ETH transfers to specific address with a limit of 0.1 ETH per hour
// until the session expires
{
to: "0x188bd99cd7D4d78d4E605Aeea12C17B32CC3135A",
valueLimit: {
limit: parseEther("0.1"),
period: BigInt(60 * 60), // 1 hour in seconds
},
},
],
// Allow calling specific smart contracts (e.g. ERC20 transfer):
Expand All @@ -119,18 +142,21 @@ Just 2 steps:
// Optional call constraints (unconstrained othewise):
constraints: [
// Only allow transfers to this address
{
index: 0,
condition: "Equal",
refValue: "0x6cC8cf7f6b488C58AA909B77E6e65c631c204784", // Only allow transfers to this address
refValue: "0x6cC8cf7f6b488C58AA909B77E6e65c631c204784",
},
// Transfer up to 0.2 tokens
{
index: 1,
condition: "LessEqual",
refValue: toHex(parseUnits("0.1", TOKEN.decimals), { size: 32 }), // Limit the transfer amount to 0.1 tokens
limit: parseUnits("0.2", TOKEN.decimals), // Unlimited if omitted
},
],
}
},
],
},
});
Expand Down

0 comments on commit 1a25aa5

Please sign in to comment.