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

Mayachain AMM approve #971

Closed
0xp3gasus opened this issue Jan 5, 2024 · 0 comments · Fixed by #978
Closed

Mayachain AMM approve #971

0xp3gasus opened this issue Jan 5, 2024 · 0 comments · Fixed by #978
Assignees

Comments

@0xp3gasus
Copy link
Collaborator

Create in the Mayachain AMM a method to make the approves to the Mayachain router. Take the Thorchain AMM as reference

  async approveTCRouterToSpend(
    asset: Asset,
    amount = MAX_APPROVAL,
    walletIndex = 0,
  ): Promise<ethers.providers.TransactionResponse> {
    const contractAddress = getContractAddressFromAsset(asset)
    const router = await this.thorchainCache.getRouterAddressForChain(asset.chain)

    const approveParams: ApproveParams = {
      contractAddress,
      spenderAddress: router,
      amount: baseAmount(amount.toString(), this.evmClient.config.gasAssetDecimals),
      walletIndex,
    }
    return await this.evmClient.approve(approveParams)
  }
@0xp3gasus 0xp3gasus self-assigned this Jan 10, 2024
@0xp3gasus 0xp3gasus linked a pull request Jan 11, 2024 that will close this issue
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 a pull request may close this issue.

1 participant