Skip to content

Commit

Permalink
Transfer only what's necessary for staking for the storage provider
Browse files Browse the repository at this point in the history
role.
  • Loading branch information
jfinkhaeuser committed Apr 9, 2019
1 parent 341226b commit c0f76a0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ async function run_signup(account_file)
console.log('Identity stored in', filename);

// Ok, transfer for staking.
await api.transferForStaking(member_address, role_address);
await api.transferForStaking(member_address, role_address, ROLE_STORAGE);
console.log('Funds transferred.');

// Now apply for the role
Expand Down
5 changes: 0 additions & 5 deletions lib/joystream/substrate/balances.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ class BalancesApi extends IdentitiesApi
return await this.api.tx.balances.transfer(to_decoded, amount)
.signAndSend(from_key);
}

async transferForStaking(from, to)
{
return await this.transfer(from, to, DEFAULT_STAKING_AMOUNT + 100 /*FIXME */);
}
}

module.exports = {
Expand Down
7 changes: 7 additions & 0 deletions lib/joystream/substrate/roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ class RolesApi extends BalancesApi
return await this.hasMinimumBalanceOf(accountId, required);
}

async transferForStaking(from, to, role)
{
const required = await this.requiredBalanceForRoleStaking(role);
return await this.transfer(from, to, required);
}


async applyForRole(roleAccountId, role, memberAccountId)
{
const memberId = await this.memberIdOf(memberAccountId);
Expand Down

0 comments on commit c0f76a0

Please sign in to comment.