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

added bridge (Dai - xDai) #416

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

vignesha22
Copy link

@vignesha22 vignesha22 commented Jul 7, 2021

Issue number

Description

Added a page called Bridge(/bridge) for transferring Dai to xDai and vice versa using etherspot sdk

List of features added/changed

  • Provides a cross chain platform for those who wish to transfer to xDai from Dai or vice versa for the events on the site.

How Has This Been Tested?

Tested locally. Other areas of the code would not get affected since the changes are made only on a seperate page(/bridge) and no other areas are the code of the seperate page conflicts with each other

Screenshots (if appropriate):

Checklist:

  • [ x] My code follows the code style of this project.
  • [ x] My code implements all the required features.

- master
script:
- yarn deploy
notifications:
email:
- [email protected]
- [email protected]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put this back?

this.contract_account = ContractedAccount
this.wallet_address = sdkState.walletAddress
let acc_bal = await this.sdk.getAccountBalances({
tokens: ['0x6b175474e89094c44da98b954eedeac495271d0f']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put this into constant like DAI_MAINNET_CONTRACT_ADDRESS ?

acc_bal.items[1] == null ? 0 : acc_bal.items[1].balance
)
)
this.sokol_sdk = await new Sdk.Sdk(Web3Provider, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sokol network is a testnet for xDAI. is this only for testnet?

@makoto
Copy link
Contributor

makoto commented Aug 7, 2021

Hi. thank you for your contribution. I am having a bit of trouble installing dependencies on my machine. Would you be able to deploy the frontend somewhere and point this to xdai backend so that at least I can check how UI all works?

import React, { Component } from 'react'
import PropTypes from 'prop-types'

class Tab extends Component {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use functional component style as described in our style guide.

import PropTypes from 'prop-types'
import Tab from './Tab'

class Tabs extends Component {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use functional component style as described in our style guide.

}
`

class Bridge extends Component {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use functional component style as described in our style guide.

)
)
this.sokol_sdk = await new Sdk.Sdk(Web3Provider, {
networkName: 'xdai',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it possible to make it switchable between xdai and polygon as we now deploy on both networks?

method: 'eth_accounts'
})
console.log(accounts, provider)
let Web3Provider = await Sdk.MetaMaskWalletProvider.connect()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this solution only work for Metamask? Can it also work for WalletConnect (and Torus)?

if (Number(this.state.amount) >= 10) {
if (Number(this.state.amount) <= Number(this.sokol_bal)) {
let xdai_bridge_address = '0x7301CFA0e1756B71869E93d4e4Dca5c7d0eb0AA6'
let bridge_contract = '0x6A92e97A568f5F58590E8b1f56484e6268CdDC51'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put all contract addresses into constant like const BRIDGE_CONTRACT and place them all on top of the file?

loading: true,
loading_msg: ''
})
if (Number(this.state.amount) >= 10) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this hardcoding commitment to 10 xDAI? Each event can have different commitment amount

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or is this the minimum amount to use the specific bridge? If so, please put that into a constant variable so that it is easier to understand

})
}

xDai_dai = async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a huge logic. can you move to a different file/class and make it reusable?

}
}

Dai_to_xDai = async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems some overwrapping logic with xDAI_to_DAI. Can you generalise so it makes easier to do $MATIC_l1 -> $Matic_l2 . We could also integrate with something like https://li.finance to do cross chain swap so users can deposit with any token they have on their wallet

@makoto
Copy link
Contributor

makoto commented Aug 8, 2021

Screenshot 2021-08-08 at 10 04 18

the DAI balance says 0 despite owning over 300 DAI on Mainnet

@makoto
Copy link
Contributor

makoto commented Aug 8, 2021

I don't fully understand the whole UI. What is Etherspot address and what is it used for?

@vignesha22
Copy link
Author

vignesha22 commented Aug 9, 2021 via email

@makoto
Copy link
Contributor

makoto commented Aug 10, 2021

Thank you for your response.

Just transfer the assets from your key-based wallet to the etherspot wallet and then can make the cross-chain transfer which transfers to your same account on the other chain. Does this mean users have to RSVP on Kickback using the smartcontract account you guys generated? I am kinda using an account as cross chain username so need to think about user flow. Otherwise people get confused why they RSVP with an ETH address they don't recognise.

If you are interested in this product please do let me know we can work something out together

Yeah, definitely interested in finding out more

@vignesha22
Copy link
Author

vignesha22 commented Aug 13, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants