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

Claim reward updates #2838

Merged
merged 75 commits into from May 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
411c650
Rename contract functions
liberumed Oct 22, 2019
fcfa8d1
Rename contract events
liberumed Oct 22, 2019
a7bc950
Delete contract functions
liberumed Oct 22, 2019
ceed09c
Add fields to StakingPool and StakingPoolsDelegator required for stak…
liberumed Nov 7, 2019
21dbc70
Remove chain based stakes snapshotting porcess
liberumed Nov 5, 2019
224f5cb
Add blockscout based stakes snapshottting process
liberumed Nov 5, 2019
98a4a69
Exclude snapshotted fields from being nilified
liberumed Nov 6, 2019
2d6f8e9
Update stake reward value defentions and add snapshotted stake reward
liberumed Nov 8, 2019
b7b9761
Change stake snapshotting to simple function
liberumed Nov 8, 2019
09f2776
Fix order for reward ratio responses
liberumed Nov 11, 2019
3c9a5ed
Display “Accounted Stake Amount” and “Current Reward Percent” in dele…
liberumed Nov 11, 2019
7048cfe
Add validator_set_apply_block tcheck before display snapshotted data
liberumed Nov 11, 2019
be8dfef
Get uniq pool mining addresses for snapshotting process
liberumed Nov 12, 2019
b0434f2
Add is_snapshotted check before showing snapshotted data
liberumed Nov 12, 2019
e1679ae
Rename staked_amount field to total_staked_amount
liberumed Nov 12, 2019
d1310b0
Add validator_reward_ratio field and fix staked_ratio value
liberumed Nov 13, 2019
74e723d
Fix fields/variables names
varasev Nov 20, 2019
8bb6669
Fix start_snapshotting function
varasev Nov 20, 2019
d6125b2
Fix round error for reward ratios
varasev Nov 20, 2019
89f10c0
Add links to addresses in Delegators window
varasev Nov 21, 2019
64650a3
Fix tooltip in Delegators window
varasev Nov 21, 2019
c5b69da
Rename some DB fields
varasev Nov 21, 2019
ddffb47
Alert for Show only those I staked into
varasev Nov 21, 2019
91d0a93
Fix snapshotting
varasev Nov 26, 2019
432708d
Improve snapshotting
varasev Nov 27, 2019
073fd44
Add retrieving of validatorMinRewardPercent
varasev Nov 28, 2019
9470099
Fix delegators counter and other improvements
varasev Nov 28, 2019
c233057
Add runner-specific options
varasev Nov 29, 2019
c27052d
Update BlockReward contract ERC balance
varasev Nov 29, 2019
23ccf1d
Refresh BlockReward contract ERC balance without page reloading
varasev Dec 2, 2019
697be30
Remove an excess code from snapshotting
varasev Dec 3, 2019
94dbefe
Remove excess JSON RPCs from snapshotting
varasev Dec 3, 2019
fd6a237
Explicit block number in snapshotting
varasev Dec 3, 2019
23e16bf
Restore snapshots after restart
varasev Dec 3, 2019
d6afcb3
Enhance ContractState.get_token function
varasev Dec 5, 2019
5a0bcdf
Add comments for stakes controller
varasev Dec 5, 2019
bbcc42f
Improve autorefreshing of Validators tab
varasev Dec 5, 2019
5390ba1
Improve the displaying of Stakes Ratio
varasev Dec 6, 2019
f37728d
Add pool list autorefresh informer
varasev Dec 6, 2019
0c34010
Add check for staking token definition
varasev Dec 6, 2019
641aac8
Add render_claim_reward channel message
varasev Dec 10, 2019
6261dbd
Simplify render_claim_reward handling; remove UI freeze
varasev Dec 10, 2019
485efd0
Prevent running parallel Claim Reward tasks
varasev Dec 11, 2019
ee303aa
Don't allow parallel Claim Reward tasks for the same staker
varasev Dec 11, 2019
b2ec8ff
Find the pools an address have ever staked into
varasev Dec 12, 2019
8c04a04
Fix find_claim_reward_pools function
varasev Dec 12, 2019
84c22ba
Cleanups
varasev Dec 13, 2019
07dfe65
Cleanups
varasev Dec 13, 2019
5ebef02
Fetch Claim Reward pools
varasev Dec 13, 2019
4491397
Display drop-down list of Claim Reward pools with amounts
varasev Dec 13, 2019
ab527a1
Retrieve epoch numbers for Claim Reward dialog popup
varasev Dec 16, 2019
5518c4b
Add general elements to Claim Reward dialog popup
varasev Dec 17, 2019
02a4419
Prepare Recalculate button for Claim Reward
varasev Dec 18, 2019
32e13ab
Implement Recalculate button for Claim Reward
varasev Dec 20, 2019
8bd49fe
Handle disconnections on client side and remove excess requests
varasev Dec 23, 2019
ab82f22
Fix staking page refreshing
varasev Dec 24, 2019
42d4390
Comment for timeout and shutdown for stakes_channel
varasev Dec 24, 2019
e8e88ba
Add claimReward transaction signing
varasev Dec 24, 2019
30ac2f2
Claim Reward dialog UI improvements
varasev Dec 25, 2019
14c1d07
Add creationMethod to entry_to_elixir
varasev Jan 14, 2020
3198380
Split eth_getLogs requests
varasev Jan 27, 2020
1cdc234
Replace eth_getLogs with public getter
varasev Jan 30, 2020
1ce8b3a
Rename bridge fee to bridge reward
varasev Feb 20, 2020
dc6708b
Fix tests: mix format and mix credo
vbaranov Apr 1, 2020
10aae54
Fix tests: gettext, eslint
vbaranov Apr 1, 2020
38667bc
Fix tests: dialyzer (add entries to .dialyzer-iggnore)
vbaranov Apr 1, 2020
77b493e
Fix 3 failed tests in stakes_controller_test.exs
vbaranov Apr 2, 2020
7521d64
Fix bug in dropdown with tokens appearance in address view page
vbaranov Apr 2, 2020
3df924d
Fix the order of mock calls in contract_state_test.exs
vbaranov Apr 3, 2020
45f8101
checkNetworkAndAccount function fix and small improvements
varasev May 8, 2020
d5ff9d3
Fix viewing_addresses_test.exs
varasev May 11, 2020
f7c61f4
Update contract_state_test.exs
varasev May 13, 2020
10868c5
mix format contract_state_test.exs
varasev May 13, 2020
f5cafea
Remove excess delegatorShare calls
varasev May 14, 2020
3561943
Update .dialyzer-ignore
varasev May 14, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion .dialyzer-ignore
Expand Up @@ -12,4 +12,6 @@ apps/block_scout_web/lib/block_scout_web/views/layout_view.ex:175: The call 'Eli
apps/explorer/lib/explorer/smart_contract/publisher_worker.ex:6: The pattern 'false' can never match the type 'true'
apps/explorer/lib/explorer/smart_contract/publisher_worker.ex:6: The test 5 == 'infinity' can never evaluate to 'true'
lib/block_scout_web/router.ex:1
lib/phoenix/router.ex:324
lib/phoenix/router.ex:324
lib/explorer/staking/stake_snapshotting.ex:14: Function do_snapshotting/6 has no local return
lib/explorer/staking/stake_snapshotting.ex:179
4 changes: 4 additions & 0 deletions apps/block_scout_web/assets/css/_helpers.scss
Expand Up @@ -29,3 +29,7 @@
height: 0;
visibility: hidden;
}

.hidden {
display: none!important;
}
4 changes: 4 additions & 0 deletions apps/block_scout_web/assets/css/components/_modal_status.scss
Expand Up @@ -66,6 +66,10 @@ $modal-status-graph-question: #329ae9 !default;
line-height: 1.5;
margin: 0 0 25px;
text-align: center;

&.m-b-0 {
margin-bottom: 0;
}
}

.modal-status-button-wrapper {
Expand Down
8 changes: 8 additions & 0 deletions apps/block_scout_web/assets/css/components/_stakes_table.scss
Expand Up @@ -86,6 +86,13 @@ $stakes-link-color: $primary !default;
padding: 0 15px;
min-width: 930px;
min-height: 311px;

.refresh-informer {
text-align: right;
padding-top: 15px;
padding-right: 15px;
display: none;
}
}

.stakes-table-th {
Expand Down Expand Up @@ -118,6 +125,7 @@ $stakes-link-color: $primary !default;
.stakes-th-text {
margin-right: 10px;
white-space: nowrap;
text-align: center;
}

.stakes-td {
Expand Down
@@ -0,0 +1,36 @@
.modal-claim-reward {
max-width: 400px;
width: 100%;

@include media-breakpoint-down(sm) {
margin-left: auto;
margin-right: auto;
}
}

.modal-claim-reward {
label {
margin-bottom: 0;
}

p {
margin-bottom: 0.3rem;
width: 100%;

&.m-b-0 {
margin-bottom: 0;
}
}

textarea {
background: #fff!important;
height: 38px;
}

.amounts {
display: grid;
grid-template-rows: 1fr;
grid-template-columns: 1fr 80px;
grid-gap: 2vw;
}
}
Expand Up @@ -93,6 +93,11 @@ $stakes-stats-item-border-color: #fff !default;
.stakes-tr-banned & {
color: $stakes-banned-color;
}

a {
text-decoration: none;
color: $stakes-address-color;
}
}

.stakes-address-active {
Expand Down Expand Up @@ -166,7 +171,7 @@ $stakes-stats-item-border-color: #fff !default;
@include media-breakpoint-down(md) {
grid-column-start: 2;
grid-row-start: 2;
justify-self: end;
justify-self: left;
}

@include media-breakpoint-down(sm) {
Expand Down
1 change: 1 addition & 0 deletions apps/block_scout_web/assets/css/stakes.scss
Expand Up @@ -16,6 +16,7 @@
@import "components/stakes/stakes_progress";
@import "components/stakes/modal_stake";
@import "components/stakes/modal_become_candidate";
@import "components/stakes/modal_claim_reward";
@import "components/stakes/modal_validator_info";
@import "components/stakes/modal_delegators_info";
@import "components/stakes/modal_bottom_disclaimer";
48 changes: 40 additions & 8 deletions apps/block_scout_web/assets/js/lib/modals.js
Expand Up @@ -21,34 +21,59 @@ $(document.body).on('hide.bs.modal', e => {
$currentModal = null
})

export function openModal ($modal) {
export function currentModal () {
return $currentModal
}

export function openModal ($modal, unclosable) {
// Hide all tooltips before showing a modal,
// since they are sticking on top of modal
$('.tooltip').tooltip('hide')

if (unclosable) {
$('.close-modal, .modal-status-button-wrapper', $modal).addClass('hidden')
$('.modal-status-text', $modal).addClass('m-b-0')
}

if ($currentModal) {
modalLocked = false

$currentModal
.one('hidden.bs.modal', () => {
$modal.modal('show')
$currentModal = $modal
if (unclosable) {
modalLocked = true
}
})
.modal('hide')
} else {
$modal.modal('show')
$currentModal = $modal
if (unclosable) {
modalLocked = true
}
}
}

export function lockModal ($modal, $submitButton = null) {
export function lockModal ($modal, $submitButton = null, spinnerText = '') {
$modal.find('.close-modal').attr('disabled', true)

const $button = $submitButton || $modal.find('.btn-add-full')

$button
.attr('data-text', $button.text())
.attr('disabled', true)
.html(spinner)

const $span = $('span', $button)
const waitHtml = spinner + (spinnerText ? ` ${spinnerText}` : '')

if ($span.length) {
$('svg', $button).hide()
$span.html(waitHtml)
} else {
$button.html(waitHtml)
}

modalLocked = true
}
Expand All @@ -57,19 +82,26 @@ export function unlockModal ($modal, $submitButton = null) {
$modal.find('.close-modal').attr('disabled', false)

const $button = $submitButton || $modal.find('.btn-add-full')
const buttonText = $button.attr('data-text')

$button
.text($button.attr('data-text'))
.attr('disabled', false)
$button.attr('disabled', false)

const $span = $('span', $button)
if ($span.length) {
$('svg', $button).show()
$span.text(buttonText)
} else {
$button.text(buttonText)
}

modalLocked = false
}

export function openErrorModal (title, text) {
export function openErrorModal (title, text, unclosable) {
const $modal = $('#errorStatusModal')
$modal.find('.modal-status-title').text(title)
$modal.find('.modal-status-text').html(text)
openModal($modal)
openModal($modal, unclosable)
}

export function openWarningModal (title, text) {
Expand Down
4 changes: 2 additions & 2 deletions apps/block_scout_web/assets/js/lib/validation.js
Expand Up @@ -49,14 +49,14 @@ function updateSubmit ($submit, errors) {
$submit.prop('disabled', !$.isEmptyObject(errors))
}

function displayInputError ($input, message) {
export function displayInputError ($input, message) {
const group = $input.parent('.input-group')

group.addClass('input-status-error')
group.find('.input-group-message').html(message)
}

function hideInputError ($input) {
export function hideInputError ($input) {
const group = $input.parent('.input-group')

group.removeClass('input-status-error')
Expand Down
13 changes: 12 additions & 1 deletion apps/block_scout_web/assets/js/pages/address.js
Expand Up @@ -59,6 +59,14 @@ export function reducer (state = initialState, action) {
}
}

let fetchedTokenBalanceBlockNumber = 0
function loadTokenBalance (blockNumber) {
if (blockNumber > fetchedTokenBalanceBlockNumber) {
fetchedTokenBalanceBlockNumber = blockNumber
setTimeout(loadTokenBalanceDropdown, 1000)
}
}

const elements = {
'[data-selector="channel-disconnected-message"]': {
render ($el, state) {
Expand All @@ -72,7 +80,7 @@ const elements = {
render ($el, state, oldState) {
if (oldState.balance === state.balance) return
$el.empty().append(state.balanceCard)
loadTokenBalanceDropdown()
loadTokenBalance(state.fetchedCoinBalanceBlockNumber)
updateAllCalculatedUsdValues()
}
},
Expand Down Expand Up @@ -127,6 +135,9 @@ if ($addressDetailsPage.length) {
type: 'RECEIVED_UPDATED_BALANCE',
msg: humps.camelizeKeys(msg)
}))
addressChannel.on('token_balance', (msg) => loadTokenBalance(
msg.block_number
))
addressChannel.on('transaction', (msg) => {
store.dispatch({
type: 'RECEIVED_NEW_TRANSACTION',
Expand Down