Skip to content

Commit 5aafbdb

Browse files
committed
calling set_deposit
1 parent e2a2f62 commit 5aafbdb

File tree

1 file changed

+28
-7
lines changed

1 file changed

+28
-7
lines changed

sentry/src/application.rs

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,11 @@ pub mod seed {
320320
Dummy, Ethereum,
321321
};
322322
use primitives::{
323-
sentry::campaign_create::CreateCampaign, spender::Spendable, test_util::CAMPAIGNS,
324-
unified_num::FromWhole, Campaign, ChainOf, Deposit, UnifiedNum, ValidatorId,
323+
sentry::campaign_create::CreateCampaign,
324+
spender::Spendable,
325+
test_util::{ADVERTISER, ADVERTISER_2, CAMPAIGNS, LEADER},
326+
unified_num::FromWhole,
327+
BigNum, Campaign, ChainOf, Deposit, UnifiedNum, ValidatorId,
325328
};
326329

327330
use crate::{
@@ -417,19 +420,37 @@ pub mod seed {
417420
let web3_chain_1 = campaign_3.chain.init_web3()?;
418421
let token_1 = Erc20Token::new(&web3_chain_1, campaign_3.token.clone());
419422

420-
// TODO: Call set_balance() and set balance for ADVERTISER & ADVERTISER_2
421-
// large enough for the campaigns + extra on top
423+
let amount = BigNum::from(100);
424+
token_1337
425+
.set_balance(LEADER.to_bytes(), ADVERTISER.to_bytes(), &amount)
426+
.await
427+
.expect("Failed to set balance");
422428

423-
// token_1337.set_balance(from, address, amount)
424-
// token_1.set_balance(from, address, amount)
429+
token_1
430+
.set_balance(LEADER.to_bytes(), ADVERTISER_2.to_bytes(), &amount)
431+
.await
432+
.expect("Failed to set balance");
425433

426434
async fn create_seed_campaign(
427435
app: Application<Ethereum>,
428436
campaign: &ChainOf<Campaign>,
429437
) -> Result<(), Box<dyn std::error::Error>> {
430438
let channel_context = ChainOf::of_channel(campaign);
439+
let campaign_to_create = CreateCampaign::from_campaign(campaign.context.clone());
440+
441+
let auth = Auth {
442+
era: 0,
443+
uid: ValidatorId::from(campaign.context.creator),
444+
chain: campaign.chain.clone(),
445+
};
431446

432-
// TODO: call create_campaign()
447+
create_campaign(
448+
Json(campaign_to_create),
449+
Extension(auth),
450+
Extension(Arc::new(app.clone())),
451+
)
452+
.await
453+
.expect("should create campaign");
433454

434455
let spendable = Spendable {
435456
spender: campaign.context.creator,

0 commit comments

Comments
 (0)