Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

Commit

Permalink
Add some transaction type checks when passing ABI args
Browse files Browse the repository at this point in the history
  • Loading branch information
algochoi committed Sep 29, 2022
1 parent 7609d45 commit d6447de
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions staking/contracts/contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ def deposit(
# Check the contract isn't paused
is_not_paused(),

# Check previous transaction is of type axfer
Assert(axfer.get().type_enum() == TxnType.AssetTransfer),

# Confirm sender for this appl and the axfer are the same
# Note: Do we need to care if it came from the same address?
Assert(axfer.get().sender() == Txn.sender()),
Expand Down Expand Up @@ -262,6 +265,9 @@ def init(
# Check if admin is initializing the contract
is_admin(),

# Check previous transaction is a payment transaction
Assert(pay.get().type_enum() == TxnType.Payment),

# Check receiver of payment is this smart contract
Assert(pay.get().receiver() == Global.current_application_address()),

Expand Down

0 comments on commit d6447de

Please sign in to comment.