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

Are there any examples of this?? [SIM-227] #84

Open
BlockChainScript opened this issue Oct 25, 2021 · 3 comments
Open

Are there any examples of this?? [SIM-227] #84

BlockChainScript opened this issue Oct 25, 2021 · 3 comments

Comments

@BlockChainScript
Copy link

No description provided.

@cgewecke
Copy link
Contributor

@BlockChainScript Could you describe what you're trying to do?

@BlockChainScript
Copy link
Author

No matter what I do, I always receive some incredible errors. I don’t even know how to initialize a tokenSets instance normally or how to configure a valid SetJSConfig.
There is no example that makes it difficult to use.

My code:

import dotenv from 'dotenv'

import {providers} from 'ethers'
import Web3 from 'web3'
import Set, {SetJSConfig} from 'set.js'

dotenv.config()

const config: SetJSConfig = {
    ethersProvider: new providers.JsonRpcProvider(process.env.POLYGON_PROVIDER_URL!),
    web3Provider: new Web3.providers.HttpProvider(process.env.POLYGON_PROVIDER_URL!),
    basicIssuanceModuleAddress: '',
    controllerAddress: '',
    debtIssuanceModuleAddress: '',
    governanceModuleAddress: '',
    masterOracleAddress: '',
    navIssuanceModuleAddress: '',
    protocolViewerAddress: '',
    setTokenCreatorAddress: '',
    streamingFeeModuleAddress: '',
    tradeModuleAddress: ''
}

const tokenSets = new Set(config)

async function run() {
    console.log(await tokenSets.priceOracle.getPriceAsync('0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', '0x2791bca1f2de4661ed88a30c99a7a9449aa84174'))
    process.exit()
}

run()

Errors like these:
Error: resolver or addr is not configured for ENS name (argument="name", value="", code=INVALID_ARGUMENT, version=contracts/5.5.0)
or
Error: unknown account #0 (operation="getAddress", code=UNSUPPORTED_OPERATION, version=providers/5.4.5)

@rootulp
Copy link
Contributor

rootulp commented Dec 18, 2021

Hi @BlockChainScript ! Sorry about that. I have been in a similar position so I can relate. It looks like you're trying to initialize SetJS on Polygon so I think https://github.com/SetProtocol/index-ui/blob/master/src/utils/setjsApi.ts#L149-L164 could be a helpful example.

Also, I think it's a good idea to verify the addresses provided in the SetJSConfig against the addresses listed here

@cgewecke cgewecke changed the title Are there any examples of this?? Are there any examples of this?? [SIM-227] Apr 11, 2022
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

No branches or pull requests

3 participants