Skip to content

Commit

Permalink
WIP: rewards smaller than delegation
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc committed May 1, 2024
1 parent 835fba2 commit a10129f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/orchestration/test/test-withdraw-reward.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,13 @@ const makeScenario = () => {

const simulate = {
'/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward': _m => {
const rewards = Object.values(delegations).map(({ denom, amount }) => ({
denom,
amount: `${Number(amount) / 100}`,
}));
/** @type {MsgWithdrawDelegatorRewardResponse} */
// @ts-expect-error type says coins: but code says amount:
const response = { amount: Object.values(delegations) };
const response = { amount: rewards };

return txEncode(
response,
Expand Down Expand Up @@ -237,7 +241,7 @@ test('withdraw rewards from staking account holder', async t => {
const { helper } = make(account, storageNode, account.getAccountAddress());
const { validator } = scenario1;
const actual = await E(helper).withdrawReward(validator);
t.deepEqual(actual, [{ denom: 'ustake', value: 200n }]);
t.deepEqual(actual, [{ denom: 'ustake', value: 2n }]);
});

test(`delegate; withdraw rewards`, async t => {
Expand Down Expand Up @@ -271,7 +275,7 @@ test(`delegate; withdraw rewards`, async t => {
const seat = E(zoe).offer(toWithdraw);
const result = await E(seat).getOfferResult();

t.deepEqual(result, [{ denom: 'ustake', value: 200n }]);
t.deepEqual(result, [{ denom: 'ustake', value: 2n }]);
}
});

Expand Down

0 comments on commit a10129f

Please sign in to comment.