Skip to content

Commit

Permalink
Update snforge_std to v0.23.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tensojka committed May 20, 2024
1 parent 0ccb54e commit 1b94c75
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 19 deletions.
9 changes: 2 additions & 7 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,21 @@
// "type": "volume"
// }
// ]

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | bash -s -- -v 2.6.3",
"postCreateCommand": "curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | bash -s -- -v 2.6.3; curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh; snfoundryup -v 0.23.0",
"customizations": {
"vscode": {
"extensions": [
"StarkWare.cairo1"
]
}
}

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
}
4 changes: 2 additions & 2 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.10.0#d7

[[package]]
name = "snforge_std"
version = "0.20.1"
source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.20.1#fea2db8f2b20148cc15ee34b08de12028eb42942"
version = "0.23.0"
source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.23.0#f2bff8f796763ada77fe6033ec1b034ceee22abd"
5 changes: 3 additions & 2 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ cairo-version = "2.6.3"
[dependencies]
starknet = ">=2.0.0"
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.10.0" }

[dev-dependencies]
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.23.0" }


# [dev-dependencies] sadly can't use this because we have testing in src/

[lib]

[[target.starknet-contract]]
Expand Down
13 changes: 8 additions & 5 deletions src/testing/setup.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use openzeppelin::token::erc20::interface::{IERC20Dispatcher, IERC20DispatcherTr
use snforge_std::{
BlockId, declare, ContractClassTrait, ContractClass, start_prank, start_warp, CheatTarget
};
use core::ResultTrait;


use konoha::contract::IGovernanceDispatcher;
Expand All @@ -27,10 +28,10 @@ const second_address: felt252 = 0x2;
const admin_addr: felt252 = 0x3;

fn deploy_governance(token_address: ContractAddress) -> IGovernanceDispatcher {
let gov_contract = declare("Governance");
let mut args = ArrayTrait::new();
let gov_contract = declare("Governance").expect('unable to declare governance');
let mut args: Array<felt252> = ArrayTrait::new();
args.append(token_address.into());
let address = gov_contract.deploy(@args).expect('unable to deploy governance');
let (address, _) = gov_contract.deploy(@args).expect('unable to deploy governance');
IGovernanceDispatcher { contract_address: address }
}

Expand All @@ -40,8 +41,10 @@ fn deploy_and_distribute_gov_tokens(recipient: ContractAddress) -> IERC20Dispatc
calldata.append(GOV_TOKEN_INITIAL_SUPPLY);
calldata.append(recipient.into());

let gov_token_contract = declare("FloatingToken");
let token_addr = gov_token_contract.deploy(@calldata).expect('unable to deploy FloatingToken');
let gov_token_contract = declare("FloatingToken").expect('unable to declare FloatingToken');
let (token_addr, _) = gov_token_contract
.deploy(@calldata)
.expect('unable to deploy FloatingToken');
let token: IERC20Dispatcher = IERC20Dispatcher { contract_address: token_addr };

start_prank(CheatTarget::One(token_addr), admin_addr.try_into().unwrap());
Expand Down
2 changes: 1 addition & 1 deletion tests/basic.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ fn test_upgrade_mainnet_to_master() {
top_carm_holders.append(eighth_address);

// declare current and submit proposal
let new_contract: ContractClass = declare("Governance");
let new_contract: ContractClass = declare("Governance").expect('unable to declare governance');
start_prank(CheatTarget::One(gov_contract_addr), scaling_address);
let new_prop_id = dispatcher.submit_proposal(new_contract.class_hash.into(), 1);
loop {
Expand Down
4 changes: 2 additions & 2 deletions tests/test_treasury.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn get_important_addresses() -> (ContractAddress, ContractAddress, ContractAddre
let AMM_contract_address: ContractAddress = testStorage::AMM_CONTRACT_ADDRESS
.try_into()
.unwrap();
let contract = declare("Treasury");
let contract = declare("Treasury").expect('unable to declare');
let mut calldata = ArrayTrait::new();
gov_contract_address.serialize(ref calldata);
AMM_contract_address.serialize(ref calldata);
Expand All @@ -44,7 +44,7 @@ fn get_important_addresses() -> (ContractAddress, ContractAddress, ContractAddre
let contract_address = contract.precalculate_address(@calldata);

prank(CheatTarget::One(contract_address), gov_contract_address, CheatSpan::TargetCalls(1));
let deployed_contract = contract.deploy(@calldata).unwrap();
let (deployed_contract, _) = contract.deploy(@calldata).unwrap();

return (gov_contract_address, AMM_contract_address, deployed_contract,);
}
Expand Down

0 comments on commit 1b94c75

Please sign in to comment.