Parameters

  • Chain: The chain this signer is allowed to interact with.
  • Target: The contract address this signer is allowed to interact with.
  • Deadline: The deadline for this permission as a UTC timestamp in milliseconds.
  • Value Limit: The maximum total amount of native tokens this signer can send.
  • Parameter Rules: The rules that define how this signer is allowed to interact with the target contract.

Single contract permission

Chain chain = Chain.TestnetAbitrumSepolia;
Address contractAddress = new Address("0x33985d320809E26274a72E03268c8a29927Bc6dA");
BigInteger deadline = new BigInteger(DateTimeOffset.UtcNow.ToUnixTimeSeconds() * 1000 + 1000 * 60 * 5000);
BigInteger valueLimit = 0;

IPermissions permissions = new ContractPermissions(chain, contractAddress, deadline, valueLimit);

Permissions with multiple targets

Chain chain = Chain.TestnetAbitrumSepolia;
Address contractAddress1 = new Address("0x7F5c764cBc14f9669B88837ca1490cCa17c31607");
Address contractAddress2 = new Address("0x33985d320809E26274a72E03268c8a29927Bc6dA");

IPermissions permissions = new Permissions(chain,
    new ContractPermissions(contractAddress1, deadline, valueLimit),
    new ContractPermissions(contractAddress2, deadline, valueLimit));

Parameter rules

var rule = new ParameterRule
{
    cumulative = false,
    operation = (int)ParameterOperation.equal,
    value = Array.Empty<byte>(),
    offset = new BigInt(0),
    mask = Array.Empty<byte>(),
};

ContractPermissions permissions = new ContractPermission(...);
permissions.AddRule(rule);