Skip to content

Commit

Permalink
serialize tuples everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
moodysalem committed Nov 7, 2023
1 parent f74c3ec commit 490747c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/airdrop_test.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ use option::{OptionTrait};

fn deploy(token: ContractAddress, root: felt252) -> IAirdropDispatcher {
let mut constructor_args: Array<felt252> = ArrayTrait::new();
Serde::serialize(@token, ref constructor_args);
Serde::serialize(@root, ref constructor_args);
Serde::serialize(@(token, root), ref constructor_args);

let (address, _) = deploy_syscall(
Airdrop::TEST_CLASS_HASH.try_into().unwrap(), 0, constructor_args.span(), true
Expand Down
3 changes: 1 addition & 2 deletions src/call_trait_test.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ fn test_execute_valid_call_data() {
let (token, _) = deploy_token('TIMELOCK', 'TL', 1);

let mut calldata: Array<felt252> = ArrayTrait::new();
Serde::serialize(@contract_address_const::<1>(), ref calldata);
Serde::serialize(@1_u256, ref calldata);
Serde::serialize(@(contract_address_const::<1>(), 1_u256), ref calldata);

let call = Call {
to: token.contract_address,
Expand Down
4 changes: 1 addition & 3 deletions src/governance_token_test.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ fn deploy(
name: felt252, symbol: felt252, supply: u128
) -> (IGovernanceTokenDispatcher, IERC20Dispatcher) {
let mut constructor_args: Array<felt252> = ArrayTrait::new();
Serde::serialize(@name, ref constructor_args);
Serde::serialize(@symbol, ref constructor_args);
Serde::serialize(@supply, ref constructor_args);
Serde::serialize(@(name, symbol, supply), ref constructor_args);

let (address, _) = deploy_syscall(
GovernanceToken::TEST_CLASS_HASH.try_into().unwrap(), 0, constructor_args.span(), true
Expand Down
7 changes: 2 additions & 5 deletions src/timelock_test.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ use option::{OptionTrait};

fn deploy(owner: ContractAddress, delay: u64, window: u64) -> ITimelockDispatcher {
let mut constructor_args: Array<felt252> = ArrayTrait::new();
Serde::serialize(@owner, ref constructor_args);
Serde::serialize(@delay, ref constructor_args);
Serde::serialize(@window, ref constructor_args);
Serde::serialize(@(owner, delay, window), ref constructor_args);

let (address, _) = deploy_syscall(
Timelock::TEST_CLASS_HASH.try_into().unwrap(), 0, constructor_args.span(), true
Expand All @@ -43,8 +41,7 @@ fn transfer_call(
token: IGovernanceTokenDispatcher, recipient: ContractAddress, amount: u256
) -> Call {
let mut calldata: Array<felt252> = ArrayTrait::new();
Serde::serialize(@recipient, ref calldata);
Serde::serialize(@amount, ref calldata);
Serde::serialize(@(recipient, amount), ref calldata);

Call {
to: token.contract_address,
Expand Down

0 comments on commit 490747c

Please sign in to comment.