Skip to content

Commit

Permalink
minor update and copy-pasta error
Browse files Browse the repository at this point in the history
  • Loading branch information
bh2smith committed Aug 11, 2023
1 parent 38f51fe commit ca430b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/airdrop/encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from src.airdrop.allocation import Allocation, AIRDROP_CONTRACT, MAX_U128
from src.multisend import build_multisend_from_data
from src.safe import SafeTransaction, encode_exec_transaction
from web3 import Web3


def encode_redeem(allocation: Allocation) -> SafeTransaction:
Expand All @@ -19,7 +20,7 @@ def encode_redeem(allocation: Allocation) -> SafeTransaction:
"""

return SafeTransaction(
to=AIRDROP_CONTRACT.address,
to=Web3.to_checksum_address(allocation.contract),
value=0,
data=AIRDROP_CONTRACT.encodeABI("redeem", allocation.as_redeem_params()),
operation=SafeOperation.CALL,
Expand Down Expand Up @@ -71,7 +72,7 @@ def encode_claim(
# Could also use allocation.as_claim_params(beneficiary) - not sure what is better.
claim_params = [allocation.vestingId, beneficiary, MAX_U128]
return SafeTransaction(
to=AIRDROP_CONTRACT.address,
to=Web3.to_checksum_address(allocation.contract),
value=0,
data=AIRDROP_CONTRACT.encodeABI(str(method), claim_params),
operation=SafeOperation.CALL,
Expand Down
6 changes: 4 additions & 2 deletions src/airdrop/tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from gnosis.safe.multi_send import MultiSendTx

from src.airdrop.allocation import Allocation
from src.airdrop.encode import build_and_sign_redeem
from src.airdrop.encode import build_and_sign_redeem, build_and_sign_claim


class AirdropCommand(Enum):
Expand Down Expand Up @@ -43,13 +43,15 @@ def transactions_for(
print(f"Using Parent Safe {parent.address} as Beneficiary")
for child, allocation_list in allocations.items():
transactions += [
build_and_sign_redeem(
build_and_sign_claim(
safe=parent,
sub_safe=child,
allocation=allocation,
beneficiary=parent.address,
)
for allocation in allocation_list
]

return transactions

raise EnvironmentError(f"Invalid airdrop command: {command}")

0 comments on commit ca430b8

Please sign in to comment.