Skip to content

Commit

Permalink
Merge branch 'staging' of github.com:hop-exchange/hop into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelmota committed Sep 20, 2024
2 parents e739da7 + 846d4b3 commit 082d117
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/hop-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hop-protocol/hop-node",
"version": "0.0.24",
"version": "0.0.25",
"description": "The V1 Hop Node for Hop Protocol",
"author": "Authereum Labs, Inc.",
"license": "MIT",
Expand Down
1 change: 1 addition & 0 deletions packages/hop-node/src/cli/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import './transfersTable.js'
import './unbondedTransferRoots.js'
import './unsettledRoots.js'
import './unstake.js'
import './unwind.js'
import './unwithdrawnTransfers.js'
import './updateConfig.js'
import './verifyAwsSigner.js'
Expand Down
54 changes: 54 additions & 0 deletions packages/hop-node/src/cli/unwind.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { wallets } from '#wallets/index.js'
import { ChainSlug } from '@hop-protocol/sdk'
import { actionHandler, root, parseString } from './shared/index.js'

root
.command('unwind')
.description('Unwind ERC20')
.option('--to <address>', 'To address', parseString)
.action(actionHandler(main))

async function main (source: any) {
const { to } = source

if (!to) {
throw new Error('to is required')
}

const gnosisChain = ChainSlug.Gnosis
const gnosisWallet = wallets.get(gnosisChain)

const opChain = ChainSlug.Optimism
const opWallet = wallets.get(opChain)

const recipient = to

const stETHAddress = '0x6C76971f98945AE98dD7d4DFcA8711ebea946eA6'
const opAddress = '0x4200000000000000000000000000000000000042'

// 236504013705435798
const stETHData = `0xa9059cbb000000000000000000000000${to.substring(2)}00000000000000000000000000000000000000000000000003483b25bcddda96`
// 65681465303725250000
const opData = `0xa9059cbb000000000000000000000000${to.substring(2)}0000000000000000000000000000000000000000000000038f8370b2cbb015d0`

console.log('Sending OP')
await opWallet.sendTransaction({
value: '0',
to: opAddress,
data: opData
})

console.log('Sending stETH')
await gnosisWallet.sendTransaction({
value: '0',
to: stETHAddress,
data: stETHData
})

console.log('Sending DAI')
await gnosisWallet.sendTransaction({
value: '27000000000000000000',
to: recipient
})
}

0 comments on commit 082d117

Please sign in to comment.