Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

feat: Airswap integration #245

Merged
merged 5 commits into from Apr 25, 2022
Merged

feat: Airswap integration #245

merged 5 commits into from Apr 25, 2022

Conversation

ghost
Copy link

@ghost ghost commented Apr 24, 2022

Description

Trying to add staked airswap (sAST) to the project. Tutorial was very helpful, but I still have some questions.

Checklist

How to test?

http://localhost:5001/apps/airswap/tokens?groupIds[]=s-ast&network=ethereum


import { AirswapAppDefinition } from './airswap.definition';
import { AirswapContractFactory } from './contracts';
import { EthereumAirswapBalanceFetcher } from './ethereum/airswap.balance-fetcher';
Copy link
Author

Choose a reason for hiding this comment

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

Is airswap.balance-fetcher necessary? Since airswap tokens are already shown on dashboard.

const contract = this.airswapContractFactory.staking({ address, network });
const balance = await contract.balanceOf(account);

return [balance];
Copy link
Author

Choose a reason for hiding this comment

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

Not sure what to do here. How to properly return the balance?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @piersss !

The EthereumAirswapSAstTokenFetcher class should simply be returning an AppTokenPosition that represents the sAST token. You can follow along here for details.

Once you read that, you'll see that:

  • You'll need to build your AppTokenPosition for sAST with AST as an underlying token
  • Your pricePerShare would be 1 since users mint sAST in a 1:1 ratio with deposited AST

Then, you can update your EthereumAirswapBalanceFetcher class following along here. The BalanceFetcher receives the user account as you mentioned above.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you @immasandwich . Making progress here.

Everything looks fine in http://localhost:5001/apps/airswap/balances?addresses[]=<ADDRESS>&network=ethereum. Is there a way to test the dashboard and see if sAST shows up?

Copy link
Contributor

@immasandwich immasandwich Apr 24, 2022

Choose a reason for hiding this comment

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

Not yet unfortunately! But we're quite confident in it working correctly if you're correct on the types being returned.

Looks good to me! Just a few more things:

  • Add the Airswap logo (the AST token image) in airswap/assets/logo.png
  • Delete the yarn.lock file you generated (we use pnpm-lock.json instead, see https://pnpm.io/)

Copy link
Contributor

Choose a reason for hiding this comment

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

Once that's good, we'll merge and do a Studio release, and we'll consume the latest version in Zapper API.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed your feedback, thanks.

The types returned looks correct. It returns the sAST with AST as underlying token.

@ghost ghost requested a review from immasandwich April 25, 2022 19:07
@immasandwich immasandwich merged commit d34cbaa into Zapper-fi:main Apr 25, 2022
This was referenced Apr 25, 2022
@ghost ghost deleted the airswap-integration branch April 29, 2022 18:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants