Skip to content

Commit

Permalink
assert ASC or that the caller is the spender
Browse files Browse the repository at this point in the history
  • Loading branch information
Thykof committed Jul 18, 2024
1 parent 349284d commit 32c9455
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions smart-contract/assembly/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ export function asyncSendFT(binaryArgs: StaticArray<u8>): void {
const schedule = args
.nextSerializable<Schedule>()
.expect('Schedule is missing or invalid');

// assert ASC or that the caller is the spender
assert(
Context.callee() === Context.caller() ||
Context.caller() === new Address(schedule.spender),
'Unauthorized',
);

// send token
sendFT(schedule);

Expand Down

0 comments on commit 32c9455

Please sign in to comment.