-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test for Bravos transfer #721
Open
FrancoGiachetta
wants to merge
9
commits into
main
Choose a base branch
from
fede-debug
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
793c278
Debug
fmoletta 91ff796
uncomment tests
FrancoGiachetta cee7bda
Merge branch 'main' into fede-debug
pefontana 767806e
Merge branch 'main' into fede-debug
edg-l e7efb7a
Merge branch 'main' into fede-debug
pefontana f8fa5ef
fix comment
FrancoGiachetta 62a5db9
add comments
FrancoGiachetta 9ba1c94
Merge branch 'main' into fede-debug
edg-l 8cbed7d
Merge branch 'main' into fede-debug
edg-l File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#[starknet::contract] | ||
mod MultiCall { | ||
use starknet::ContractAddress; | ||
use core::debug::PrintTrait; | ||
use core::integer::u256; | ||
#[storage] | ||
struct Storage {} | ||
|
||
#[derive(Drop, Serde)] | ||
pub struct Route { | ||
pub to: ContractAddress, | ||
pub selector: u256, | ||
pub calldata: Span<felt252> | ||
} | ||
|
||
#[external(v0)] | ||
fn multi_route_swap( | ||
self: @ContractState, | ||
token_from_address: ContractAddress, | ||
token_from_amount: u256, | ||
token_to_address: ContractAddress, | ||
token_to_amount: u256, | ||
token_to_min_amount: u256, | ||
beneficiary: ContractAddress, | ||
integrator_fee_amount_bps: u128, | ||
integrator_fee_recipient: ContractAddress, | ||
routes: Span<Route>, | ||
) -> bool { | ||
true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#[starknet::contract] | ||
mod MultiCall { | ||
// use starknet::account::Call; | ||
use starknet::ContractAddress; | ||
use core::debug::PrintTrait; | ||
use core::integer::u256; | ||
#[storage] | ||
struct Storage {} | ||
|
||
#[derive(Drop, Serde)] | ||
pub struct Call { | ||
pub to: ContractAddress, | ||
pub selector: u256, | ||
pub calldata: Span<felt252> | ||
} | ||
|
||
#[external(v0)] | ||
fn fib(self: @ContractState, calls: Span<Call>) -> felt252 { | ||
let mut calls = calls; | ||
loop { | ||
match calls.pop_front() { | ||
Option::Some(call) => { | ||
println!("To {:?}", (*call.to)); | ||
println!("Selector {}", (*call.selector)); | ||
//println!("Call[0] {:?}", (*(*call.calldata).at(0))); | ||
//println!("Call[0] {:?}", (*(*call.calldata).at(1))); | ||
println!("Call[0] {:?}", (*(call.calldata)[0])); | ||
println!("Call[1] {:?}", (*(call.calldata)[1])); | ||
}, | ||
Option::None => { break; }, | ||
} | ||
}; | ||
12 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -178,6 +178,24 @@ fn test_program_cases(program_path: &str) { | |
#[test_case("tests/cases/cairo_vm/contracts/field_sqrt.cairo", &[])] | ||
#[test_case("tests/cases/cairo_vm/contracts/random_ec_point.cairo", &[])] | ||
#[test_case("tests/cases/cairo_vm/contracts/alloc_constant_size.cairo", &[10, 10, 10])] | ||
#[test_case("tests/cases/cairo_vm/contracts/multicall.cairo", &[ | ||
// n_calls | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add in the commented lines what these numbers are? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Further, maybe using the serialized bytes and |
||
// params: 0: contract_address, 1: selector, rest: calldata | ||
6, | ||
// call 1 | ||
12, 17, 3, 2, 1, 2, | ||
// call 2 | ||
13, 18, 4, 3, 1, 2, 3, | ||
// call 3 | ||
17, 16, 5, 20, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, | ||
// call 4 | ||
17, 17, 0, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, | ||
// call 5 | ||
17, 17, 0, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, | ||
// call 6 | ||
17, 17, 0, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, | ||
])] | ||
#[test_case("tests/cases/cairo_vm/contracts/multi_route_swap.cairo", &[1, 2, 2, 1, 2, 2, 2, 2, 1, 1, 2, 0])] | ||
fn test_contract_cases(program_path: &str, args: &[u128]) { | ||
let args = args.iter().map(|&arg| arg.into()).collect_vec(); | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check in the issue,
Can we add the two cases of this contract with the two different data types?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pefontana which is the other calldata's type you are refering to? Because its type was Span when I first saw it.