Skip to content

Commit

Permalink
Merge pull request #1519 from AmbireTech/bull-run-campaign
Browse files Browse the repository at this point in the history
Fix humanizations
  • Loading branch information
stojnovsky authored Jan 12, 2024
2 parents cb9b971 + 760c6f7 commit 947830b
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 24 deletions.
14 changes: 7 additions & 7 deletions src/lib/humanizers/GMX.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ const GMX = (humanizerInfo) => {
if (extended)
return [
[
'Open GMX position',
'Interact with GMX position',
'from',
{ type: 'token', ...token(humanizerInfo, tokens[tokens.length - 2], -1, true) },
{ type: 'token', ...token(humanizerInfo, tokens[tokens.length - 2], 0, true) },
'to',
{ type: 'token', ...token(humanizerInfo, tokens[0], -1, true) }
{ type: 'token', ...token(humanizerInfo, tokens[0], 0, true) }
]
]
return [
`Open GMX position from ${token(humanizerInfo, tokens[tokens.length - 1], -1)} to ${token(
`Interact with GMX position from ${token(
humanizerInfo,
tokens[0],
-1
)}`
tokens[tokens.length - 1],
0
)} to ${token(humanizerInfo, tokens[0], 0)}`
]
}
}
Expand Down
36 changes: 23 additions & 13 deletions src/lib/humanizers/Lido.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,34 @@ const Lido = (humanizerInfo) => {
const { _amounts, _owner } = unstIfaceETH.parseTransaction(txn).args
if (extended) {
return _owner === txn.from || _owner === '0x0000000000000000000000000000000000000000'
? [
'Request',
'withdrawal from',
{ type: 'address', address: txn.to, name: getName(txn.to) }
]
? [['Request', 'withdrawal from', getAddress(humanizerInfo, txn.to)]]
: [
'Request',
'withdrawal from',
{ type: 'address', address: txn.to, name: getName(txn.to) },
'for',
{ type: 'address', address: _owner, name: getName(_owner) }
[
'Request',
'withdrawal from',
getAddress(humanizerInfo, txn.to),
'for',
getAddress(humanizerInfo, _owner)
]
]
}
return [
_owner === txn.from || _owner === ethers.constants.AddressZero
? [`Request withdrawal from ${getName(txn.to)}`]
: [`Request withdrawal from ${getName(txn.to)} for ${_owner}`]
_owner === txn.from || _owner === '0x0000000000000000000000000000000000000000'
? [`Request withdrawal from ${getName(humanizerInfo, txn.to)}`]
: [`Request withdrawal from ${getName(humanizerInfo, txn.to)} for ${_owner}`]
]
},
[ifaceMATIC.getSighash('requestWithdraw')]: (txn, network, { extended }) => {
const { _amount } = ifaceMATIC.parseTransaction(txn).args
if (extended) {
return [
[
'Withdraw',
{ type: 'token', ...token(humanizerInfo, MATIC_ON_ETH_ADDRESS, _amount, true) }
]
]
}
return [[`Withdraw ${token(humanizerInfo, MATIC_ON_ETH_ADDRESS, _amount)}`]]
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/humanizers/MeanFinance.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const MeanFinance = (humanizerInfo) => {
'for',
{
type: 'token',
...token(humanizerInfo, _to, -1, true)
...token(humanizerInfo, _to, 0, true)
},
`Split into ${_amountOfSwaps} swaps over ${getInterval(
_swapInterval * _amountOfSwaps
Expand Down Expand Up @@ -74,7 +74,7 @@ const MeanFinance = (humanizerInfo) => {
'for',
{
type: 'token',
...token(humanizerInfo, _to, -1, true)
...token(humanizerInfo, _to, 0, true)
},
`Split into ${_amountOfSwaps} swaps over ${getInterval(
_swapInterval * _amountOfSwaps
Expand Down
23 changes: 21 additions & 2 deletions src/lib/humanizers/UniswapV3Pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,25 @@ const UniswapV3Pool = (humanizerInfo) => {
shouldUnwrapNativeToken,
referralCode
] = params
if (orderType === 4) {
return !opts.extended
? [
`Close ${isLong ? 'long' : 'short'} position with ${token(
humanizerInfo,
addresses[4],
-1
)} in ${getName(txn.to)}`
]
: [
[
`Close ${isLong ? 'long' : 'short'} position`,
'with',
{ type: 'token', ...token(humanizerInfo, addresses[4], 0, true) },
'in',
{ type: 'address', address: txn.to, name: getName(humanizerInfo, txn.to) }
]
]
}
return !opts.extended
? [
`Open ${isLong ? 'long' : 'short'} position with collateral ${token(
Expand All @@ -161,7 +180,7 @@ const UniswapV3Pool = (humanizerInfo) => {
[
`Open ${isLong ? 'long' : 'short'} position`,
'with collateral',
{ type: 'token', ...token(humanizerInfo, addresses[4], -1, true) },
{ type: 'token', ...token(humanizerInfo, addresses[4], 0, true) },
'in',
{ type: 'address', address: txn.to, name: getName(humanizerInfo, txn.to) }
]
Expand Down Expand Up @@ -194,7 +213,7 @@ const UniswapV3Pool = (humanizerInfo) => {
? nativeToken(network, _minTokenOut, opts.extended)
: token(humanizerInfo, _tokenOut, _minTokenOut, opts.extended)
return !opts.extended
? [`Swap ${tokenA}} for ${tokenB}`]
? [`Swap ${tokenA} for ${tokenB}`]
: [['Swap', { type: 'token', ...tokenA }, 'for', { type: 'token', ...tokenB }]]
},
[DCAHubCompanion.getSighash('sendBalanceOnContractToRecipient')]: (
Expand Down

0 comments on commit 947830b

Please sign in to comment.