Skip to content
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

bump: to version 20 #118

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
uses: baptiste0928/cargo-install@v2
with:
crate: soroban-cli
version: "^20.0.0-rc2"
version: "^20.0.0"

- name: Download wasm-files
uses: actions/download-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ debug-assertions = true


[workspace.dependencies.soroban-sdk]
version = "20.0.0-rc2"
version = "20.0.0"
6 changes: 3 additions & 3 deletions contracts/governance/src/participant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ mod test {
#[test]
fn participant_can_only_increase_positive_amounts() {
let env = Env::default();
let mut p = Participant::new(Address::random(&env));
let mut p = Participant::new(Address::generate(&env));
assert_eq!(Err(Error::InvalidAmount), p.increase_balance(0));
assert_eq!(Err(Error::InvalidAmount), p.increase_balance(-1));
p.increase_balance(1).unwrap();
Expand All @@ -137,7 +137,7 @@ mod test {
#[test]
fn participant_can_only_decrease_positive_amounts() {
let env = Env::default();
let mut p = Participant::new(Address::random(&env));
let mut p = Participant::new(Address::generate(&env));
p.increase_balance(5).unwrap();

assert_eq!(Err(Error::InvalidAmount), p.decrease_balance(0));
Expand All @@ -148,7 +148,7 @@ mod test {
#[test]
fn participant_cannot_decrease_more_than_it_has() {
let env = Env::default();
let mut p = Participant::new(Address::random(&env));
let mut p = Participant::new(Address::generate(&env));
p.increase_balance(1).unwrap();
assert_eq!(Err(Error::InsufficientFunds), p.decrease_balance(2));
}
Expand Down
90 changes: 45 additions & 45 deletions contracts/governance/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn cannot_be_initialized_twice() {
sc.env.mock_all_auths();

sc.contract_client.init(
&Address::random(&sc.env),
&Address::generate(&sc.env),
&sc.token_admin_client.address,
&864000,
&5000,
Expand All @@ -30,15 +30,15 @@ fn cannot_be_initialized_twice() {
fn setup_scenario<'a>() -> Scenario<'a> {
let env = Env::default();

let contract_id = env.register_contract(Some(&Address::random(&env)), GovernanceContract);
let contract_id = env.register_contract(Some(&Address::generate(&env)), GovernanceContract);
let contract_client = GovernanceContractClient::new(&env, &contract_id);

let token_admin = Address::random(&env);
let token_admin = Address::generate(&env);
let token_addr = env.register_stellar_asset_contract(token_admin.clone());
let token_admin_client = token::StellarAssetClient::new(&env, &token_addr);
let token_client = token::Client::new(&env, &token_addr);

let curator = Address::random(&env);
let curator = Address::generate(&env);

contract_client.init(
&curator.clone(),
Expand Down Expand Up @@ -78,7 +78,7 @@ fn participant_can_join() {

sc.env.mock_all_auths();

let participant_addr = Address::random(&sc.env);
let participant_addr = Address::generate(&sc.env);
// Add funds to client address (as participant)
sc.token_admin_client.mint(&participant_addr, &1000);

Expand Down Expand Up @@ -147,7 +147,7 @@ fn participant_cant_join_without_enough_funds() {
let sc = setup_scenario();
sc.env.mock_all_auths();

let participant_addr = Address::random(&sc.env);
let participant_addr = Address::generate(&sc.env);
sc.token_admin_client.mint(&participant_addr, &199);

sc.contract_client.join(&participant_addr, &200);
Expand All @@ -160,7 +160,7 @@ fn participant_cant_join_with_negative_stake() {

sc.env.mock_all_auths();

let participant_addr = Address::random(&sc.env);
let participant_addr = Address::generate(&sc.env);
sc.token_admin_client.mint(&participant_addr, &199);

sc.contract_client.join(&participant_addr, &-1);
Expand All @@ -173,7 +173,7 @@ fn participant_cant_join_with_zero_stake() {

sc.env.mock_all_auths();

let participant_addr = Address::random(&sc.env);
let participant_addr = Address::generate(&sc.env);
sc.token_admin_client.mint(&participant_addr, &199);

sc.contract_client.join(&participant_addr, &0);
Expand All @@ -185,7 +185,7 @@ fn participant_can_leave_withdrawing_all_funds() {

sc.env.mock_all_auths();

let participant_addr = Address::random(&sc.env);
let participant_addr = Address::generate(&sc.env);
// Add funds to client address (as participant)
sc.token_admin_client.mint(&participant_addr, &1000);

Expand Down Expand Up @@ -239,7 +239,7 @@ fn participant_can_withdraw_partial_funds() {

sc.env.mock_all_auths();

let participant_addr = Address::random(&sc.env);
let participant_addr = Address::generate(&sc.env);
// Add funds to client address (as participant)
sc.token_admin_client.mint(&participant_addr, &1000);

Expand Down Expand Up @@ -282,7 +282,7 @@ fn participant_cannot_withdraw_more_partial_funds_than_it_has() {

sc.env.mock_all_auths();

let participant_addr = Address::random(&sc.env);
let participant_addr = Address::generate(&sc.env);
// Add funds to client address (as participant)
sc.token_admin_client.mint(&participant_addr, &1000);

Expand All @@ -297,7 +297,7 @@ fn participant_can_deposit_extra_funds() {

sc.env.mock_all_auths();

let participant_addr = Address::random(&sc.env);
let participant_addr = Address::generate(&sc.env);
// Add funds to client address (as participant)
sc.token_admin_client.mint(&participant_addr, &1000);

Expand Down Expand Up @@ -340,7 +340,7 @@ fn non_existent_participant_cannot_stake() {

sc.env.mock_all_auths();

sc.contract_client.withdraw(&Address::random(&sc.env), &1);
sc.contract_client.withdraw(&Address::generate(&sc.env), &1);
}

#[test]
Expand All @@ -350,7 +350,7 @@ fn non_existent_participant_cannot_leave() {

sc.env.mock_all_auths();

sc.contract_client.leave(&Address::random(&sc.env));
sc.contract_client.leave(&Address::generate(&sc.env));
}

#[test]
Expand All @@ -360,7 +360,7 @@ fn non_existent_participant_cannot_withdraw() {

sc.env.mock_all_auths();

sc.contract_client.leave(&Address::random(&sc.env));
sc.contract_client.leave(&Address::generate(&sc.env));
}

#[test]
Expand All @@ -369,7 +369,7 @@ fn curator_can_whitelist_participant() {

sc.env.mock_all_auths();

let participant = &Address::random(&sc.env);
let participant = &Address::generate(&sc.env);
sc.token_admin_client.mint(participant, &1000);

sc.contract_client.join(participant, &200);
Expand Down Expand Up @@ -405,7 +405,7 @@ fn not_existent_participant_cannot_create_proposals() {

sc.env.mock_all_auths();

let participant = &Address::random(&sc.env);
let participant = &Address::generate(&sc.env);
let hash = BytesN::random(&sc.env);

sc.contract_client
Expand All @@ -419,7 +419,7 @@ fn non_whitelisted_participant_cannot_create_proposals() {

sc.env.mock_all_auths();

let participant = &Address::random(&sc.env);
let participant = &Address::generate(&sc.env);
sc.token_admin_client.mint(participant, &1000);

sc.contract_client.join(participant, &200);
Expand All @@ -434,7 +434,7 @@ fn whitelisted_participant_can_create_proposals() {

sc.env.mock_all_auths();

let participant = Address::random(&sc.env);
let participant = Address::generate(&sc.env);
sc.token_admin_client.mint(&participant, &1000);

sc.contract_client.join(&participant, &200);
Expand Down Expand Up @@ -468,7 +468,7 @@ fn whitelisted_participant_can_vote_proposals() {

sc.env.mock_all_auths();

let participant = Address::random(&sc.env);
let participant = Address::generate(&sc.env);
sc.token_admin_client.mint(&participant, &1000);

sc.contract_client.join(&participant, &200);
Expand Down Expand Up @@ -500,7 +500,7 @@ fn non_whitelisted_participant_cant_vote_proposals() {

sc.env.mock_all_auths();

let participant = Address::random(&sc.env);
let participant = Address::generate(&sc.env);
sc.token_admin_client.mint(&participant, &1000);

sc.contract_client.join(&participant, &200);
Expand All @@ -515,7 +515,7 @@ fn non_whitelisted_participant_cant_execute_proposals() {

sc.env.mock_all_auths();

let participant = Address::random(&sc.env);
let participant = Address::generate(&sc.env);
sc.token_admin_client.mint(&participant, &1000);

sc.contract_client.join(&participant, &200);
Expand All @@ -530,8 +530,8 @@ fn only_author_can_execute_proposals() {

sc.env.mock_all_auths();

let participant_1 = Address::random(&sc.env);
let participant_2 = Address::random(&sc.env);
let participant_1 = Address::generate(&sc.env);
let participant_2 = Address::generate(&sc.env);

sc.token_admin_client.mint(&participant_1, &1000);
sc.token_admin_client.mint(&participant_2, &1000);
Expand Down Expand Up @@ -563,8 +563,8 @@ fn whitelisted_participant_can_execute_standard_proposal() {

sc.env.mock_all_auths();

let participant_1 = Address::random(&sc.env);
let participant_2 = Address::random(&sc.env);
let participant_1 = Address::generate(&sc.env);
let participant_2 = Address::generate(&sc.env);

sc.token_admin_client.mint(&participant_1, &1000);
sc.token_admin_client.mint(&participant_2, &1000);
Expand Down Expand Up @@ -622,7 +622,7 @@ fn proposals_can_only_be_executed_once() {

sc.env.mock_all_auths();

let participant_1 = Address::random(&sc.env);
let participant_1 = Address::generate(&sc.env);
sc.token_admin_client.mint(&participant_1, &1000);
sc.contract_client.join(&participant_1, &800);
sc.contract_client.whitelist(&participant_1);
Expand Down Expand Up @@ -659,7 +659,7 @@ fn execute_a_code_upgrade_proposal_flow() {
.deployer()
.upload_contract_wasm(Bytes::from_slice(&sc.env, &bytes));

let participant_1 = Address::random(&sc.env);
let participant_1 = Address::generate(&sc.env);

sc.token_admin_client.mint(&participant_1, &1000);

Expand All @@ -686,7 +686,7 @@ fn execute_a_curator_change_flow() {

sc.env.mock_all_auths();

let participant_1 = Address::random(&sc.env);
let participant_1 = Address::generate(&sc.env);

sc.token_admin_client.mint(&participant_1, &1000);

Expand All @@ -713,9 +713,9 @@ fn join_can_only_be_called_when_initiliazed() {
let env = Env::default();
env.mock_all_auths();

let contract_id = env.register_contract(Some(&Address::random(&env)), GovernanceContract);
let contract_id = env.register_contract(Some(&Address::generate(&env)), GovernanceContract);
let contract_client = GovernanceContractClient::new(&env, &contract_id);
contract_client.join(&Address::random(&env), &200);
contract_client.join(&Address::generate(&env), &200);
}

#[test]
Expand All @@ -724,9 +724,9 @@ fn stake_can_only_be_called_when_initiliazed() {
let env = Env::default();
env.mock_all_auths();

let contract_id = env.register_contract(Some(&Address::random(&env)), GovernanceContract);
let contract_id = env.register_contract(Some(&Address::generate(&env)), GovernanceContract);
let contract_client = GovernanceContractClient::new(&env, &contract_id);
contract_client.stake(&Address::random(&env), &200);
contract_client.stake(&Address::generate(&env), &200);
}

#[test]
Expand All @@ -735,9 +735,9 @@ fn leave_can_only_be_called_when_initiliazed() {
let env = Env::default();
env.mock_all_auths();

let contract_id = env.register_contract(Some(&Address::random(&env)), GovernanceContract);
let contract_id = env.register_contract(Some(&Address::generate(&env)), GovernanceContract);
let contract_client = GovernanceContractClient::new(&env, &contract_id);
contract_client.leave(&Address::random(&env));
contract_client.leave(&Address::generate(&env));
}

#[test]
Expand All @@ -746,9 +746,9 @@ fn withdraw_can_only_be_called_when_initiliazed() {
let env = Env::default();
env.mock_all_auths();

let contract_id = env.register_contract(Some(&Address::random(&env)), GovernanceContract);
let contract_id = env.register_contract(Some(&Address::generate(&env)), GovernanceContract);
let contract_client = GovernanceContractClient::new(&env, &contract_id);
contract_client.withdraw(&Address::random(&env), &100);
contract_client.withdraw(&Address::generate(&env), &100);
}

#[test]
Expand All @@ -757,9 +757,9 @@ fn whitelist_can_only_be_called_when_initiliazed() {
let env = Env::default();
env.mock_all_auths();

let contract_id = env.register_contract(Some(&Address::random(&env)), GovernanceContract);
let contract_id = env.register_contract(Some(&Address::generate(&env)), GovernanceContract);
let contract_client = GovernanceContractClient::new(&env, &contract_id);
contract_client.whitelist(&Address::random(&env));
contract_client.whitelist(&Address::generate(&env));
}

#[test]
Expand All @@ -768,10 +768,10 @@ fn new_proposal_can_only_be_called_when_initiliazed() {
let env = Env::default();
env.mock_all_auths();

let contract_id = env.register_contract(Some(&Address::random(&env)), GovernanceContract);
let contract_id = env.register_contract(Some(&Address::generate(&env)), GovernanceContract);
let contract_client = GovernanceContractClient::new(&env, &contract_id);
contract_client.new_proposal(
&Address::random(&env),
&Address::generate(&env),
&1,
&shared::voting::ProposalPayload::Comment(BytesN::random(&env)),
);
Expand All @@ -783,9 +783,9 @@ fn vote_can_only_be_called_when_initiliazed() {
let env = Env::default();
env.mock_all_auths();

let contract_id = env.register_contract(Some(&Address::random(&env)), GovernanceContract);
let contract_id = env.register_contract(Some(&Address::generate(&env)), GovernanceContract);
let contract_client = GovernanceContractClient::new(&env, &contract_id);
contract_client.vote(&Address::random(&env), &1);
contract_client.vote(&Address::generate(&env), &1);
}

#[test]
Expand All @@ -794,7 +794,7 @@ fn execute_proposal_can_only_be_called_when_initiliazed() {
let env = Env::default();
env.mock_all_auths();

let contract_id = env.register_contract(Some(&Address::random(&env)), GovernanceContract);
let contract_id = env.register_contract(Some(&Address::generate(&env)), GovernanceContract);
let contract_client = GovernanceContractClient::new(&env, &contract_id);
contract_client.execute_proposal(&Address::random(&env), &1);
contract_client.execute_proposal(&Address::generate(&env), &1);
}
Loading
Loading