Skip to content

Commit

Permalink
fix: sign erc20 transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
marthendalnunes committed Dec 10, 2024
1 parent a239de7 commit 089f429
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type SignDelegationParams = {
erc20: Address;
decimals: number;
amount: string;
timestampAfter?: bigint;
timestampBefore?: bigint;
};

export function useSignErc20TransferDelegation() {
Expand All @@ -40,7 +40,7 @@ export function useSignErc20TransferDelegation() {
erc20,
decimals = 18,
amount = '0',
timestampAfter,
timestampBefore,
}: SignDelegationParams) {
const caveats: DelegationCaveat[] = [
{
Expand All @@ -54,12 +54,12 @@ export function useSignErc20TransferDelegation() {
},
];

if (timestampAfter) {
// If timestampAfter is provided, add a timestamp enforcer
if (timestampBefore) {
// If timestampBefore is provided, add a timestamp enforcer
caveats.push({
enforcer: universalDeployments.TimestampEnforcer,
terms: encodeEnforcerTimestamp({
timestampAfter,
timestampBefore,
}),
args: '0x',
});
Expand Down Expand Up @@ -132,7 +132,7 @@ export function useSignErc20TransferDelegation() {
erc20,
decimals = 18,
amount = '0',
timestampAfter,
timestampBefore,
}: SignDelegationParams) {
const caveats: Omit<DelegationCaveat, 'args'>[] = [
{
Expand All @@ -145,12 +145,12 @@ export function useSignErc20TransferDelegation() {
},
];

if (timestampAfter) {
// If timestampAfter is provided, add a timestamp enforcer
if (timestampBefore) {
// If timestampBefore is provided, add a timestamp enforcer
caveats.push({
enforcer: universalDeployments.TimestampEnforcer,
terms: encodeEnforcerTimestamp({
timestampAfter,
timestampBefore,
}),
});
}
Expand Down

0 comments on commit 089f429

Please sign in to comment.