Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
tensojka committed Nov 22, 2023
1 parent 71db268 commit eba1360
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,11 @@ version = 1
[[package]]
name = "governance"
version = "0.2.0"
dependencies = [
"snforge_std",
]

[[package]]
name = "snforge_std"
version = "0.1.0"
source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.10.2#9c04e095cc7e23b0d6223e5ef5b51bbeec1cf6b2"
1 change: 1 addition & 0 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ cairo-version = "2.1.1"

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

[[target.starknet-contract]]
27 changes: 27 additions & 0 deletions tests/basic.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
use starknet::ContractAddress;

use snforge_std::{BlockId, ContractClassTrait, start_prank};

use governance::contract::IGovernanceDispatcher;
use governance::contract::IGovernanceDispatcherTrait;

//#[test]
//#[fork(url: "https://rpc.starknet-testnet.lava.build", block_id: BlockId::Number(904597))]
fn test_submit_proposal() {
let gov_contract_addr: ContractAddress = 0x7ba1d4836a1142c09dde23cb39b2885fe350912591461b5764454a255bdbac6.try_into().unwrap();
let dispatcher = IGovernanceDispatcher { contract_address: gov_contract_addr };
// corresponding govtoken: 0x05151bfdd47826df3669033ea7fb977d3b2d45c4f4d1c439a9edf4062bf34bfa
// has one holder, with 31 CARM: 0x0583a9d956d65628f806386ab5b12dccd74236a3c6b930ded9cf3c54efc722a1
let admin_addr: ContractAddress = 0x0583a9d956d65628f806386ab5b12dccd74236a3c6b930ded9cf3c54efc722a1.try_into().unwrap();
//start_prank(gov_contract_addr, admin_addr);
dispatcher.submit_proposal(0x00, 1);
}

#[test]
#[fork(url: "https://starknet-goerli.infura.io/v3/76467ebfee7944fd9e38f9dffe41df8b", block_id: BlockId::Tag(Latest))]
fn test_forking_functionality() {
let gov_contract_addr: ContractAddress = 0x7ba1d4836a1142c09dde23cb39b2885fe350912591461b5764454a255bdbac6.try_into().unwrap();
let dispatcher = IGovernanceDispatcher { contract_address: gov_contract_addr };
let propdetails = dispatcher.get_proposal_details(1);
assert(propdetails.payload==0x78b4ccacdc1c902281f6f13d94b6d17b1f4c44ff811c01dea504d43a264f611, 'payload not match');
}

0 comments on commit eba1360

Please sign in to comment.