Skip to content

Commit

Permalink
fix(TxHelpers): Use BigNumber in auction end block calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
nduchak committed Nov 11, 2019
1 parent 06129de commit 777c012
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions es/tx/builder/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,11 @@ export function computeBidFee (domain, startFee = NAME_FEE, increment = NAME_FEE

export function computeAuctionEndBlock (domain, claimHeight) {
return R.cond([
[R.lt(5), R.always(NAME_BID_TIMEOUTS[4] + claimHeight)],
[R.lt(9), R.always(NAME_BID_TIMEOUTS[8] + claimHeight)],
[R.lte(NAME_BID_MAX_LENGTH), R.always(NAME_BID_TIMEOUTS[12] + claimHeight)],
[R.T, R.always(claimHeight)]
])(domain.replace('.chain', '').length)
[R.lt(5), R.always(NAME_BID_TIMEOUTS[4].plus(claimHeight))],
[R.lt(9), R.always(NAME_BID_TIMEOUTS[8].plus(claimHeight))],
[R.lte(NAME_BID_MAX_LENGTH), R.always(NAME_BID_TIMEOUTS[12].plus(claimHeight))],
[R.T, R.always(BigNumber(claimHeight))]
])(domain.replace('.chain', '').length).toString(10)
}

export default {
Expand Down
8 changes: 4 additions & 4 deletions es/tx/builder/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ export const NAME_BID_RANGES = {
// # ref: https://github.com/aeternity/aeternity/blob/72e440b8731422e335f879a31ecbbee7ac23a1cf/apps/aecore/src/aec_governance.erl#L273
// # name bid timeouts
export const NAME_BID_TIMEOUTS = {
13: 0,
12: NAME_BID_TIMEOUT_BLOCKS, // # 480 blocks
8: 31 * NAME_BID_TIMEOUT_BLOCKS, // # 14880 blocks
4: 62 * NAME_BID_TIMEOUT_BLOCKS // # 29760 blocks
13: BigNumber(0),
12: BigNumber(NAME_BID_TIMEOUT_BLOCKS), // # 480 blocks
8: BigNumber(31).times(NAME_BID_TIMEOUT_BLOCKS), // # 14880 blocks
4: BigNumber(62).times(NAME_BID_TIMEOUT_BLOCKS) // # 29760 blocks
}

// # Tag constant for ids (type uint8)
Expand Down

0 comments on commit 777c012

Please sign in to comment.