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

Map reference as contract address #6

Open
stychu opened this issue Jun 7, 2021 · 1 comment
Open

Map reference as contract address #6

stychu opened this issue Jun 7, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@stychu
Copy link

stychu commented Jun 7, 2021

Hello. Is it possible to map a reference from 1 contract call to be passed as a value to another contract call?

So I would like to get a PAIR of a token-BnB and then use that pair address to call getReserves

[
    {
      reference: 'factory',
      contractAddress: factoryAddress,
      abi: factoryABI,
      calls: [
        { reference: 'tokenPair', methodName: 'getPair', methodParameters: [tokenAddress, bnbAddress] },
      ]
    },
    {
      reference: 'liquidity',
      contractAddress: tokenPair,   <-----------------------------------------------------------
      abi: [
        {
          'constant': true,
          'inputs': [],
          'name': 'getReserves',
          'outputs': [
            { 'internalType': 'uint112', 'name': '_reserve0', 'type': 'uint112' },
            { 'internalType': 'uint112', 'name': '_reserve1', 'type': 'uint112' },
            { 'internalType': 'uint32', 'name': '_blockTimestampLast', 'type': 'uint32' }
          ],
          'payable': false,
          'stateMutability': 'view',
          'type': 'function'
        }
      ],
      calls: [
        { methodName: 'getReserves' },
      ]
    }
  ]
@joshstevens19
Copy link
Owner

joshstevens19 commented Jun 7, 2021

Hey this is a great thing to suggest. Right now this does not support this logic. This would be contract changes for now out of scope to put in this library. Will keep this open and when I get some time investigate further. For now that will have to be 2 separate calls. Thanks for the feature request!

@joshstevens19 joshstevens19 added the enhancement New feature or request label Jun 7, 2021
@joshstevens19 joshstevens19 pinned this issue Jun 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants