-
-
Notifications
You must be signed in to change notification settings - Fork 22
Migrate DJED SDK from Web3.js to Ethers.js #34
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
Open
nishantxscooby
wants to merge
1
commit into
DjedAlliance:main
Choose a base branch
from
nishantxscooby:migrate-web3-to-ethers
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
ethers.js v6 .target property contract address💡 Result:
In ethers v6 the Contract/BaseContract address field was renamed from .address to .target. .target can be an address/ENS name/Addressable; to get the resolved address use getAddress(). See the docs and migration notes. [1][2]
Example:
const addrOrName = myContract.target;
const address = await myContract.getAddress();
Sources: [1] ethers v6 docs (BaseContract.target / getAddress). [2] v5→v6 migration notes (renamed address → target).
🏁 Script executed:
Repository: DjedAlliance/StablePay
Length of output: 118
🏁 Script executed:
Repository: DjedAlliance/StablePay
Length of output: 110
🏁 Script executed:
Repository: DjedAlliance/StablePay
Length of output: 762
🏁 Script executed:
Repository: DjedAlliance/StablePay
Length of output: 1298
🏁 Script executed:
Repository: DjedAlliance/StablePay
Length of output: 1578
🏁 Script executed:
Repository: DjedAlliance/StablePay
Length of output: 128
🏁 Script executed:
Repository: DjedAlliance/StablePay
Length of output: 48
🏁 Script executed:
Repository: DjedAlliance/StablePay
Length of output: 48
🏁 Script executed:
Repository: DjedAlliance/StablePay
Length of output: 48
🏁 Script executed:
Repository: DjedAlliance/StablePay
Length of output: 48
🏁 Script executed:
Repository: DjedAlliance/StablePay
Length of output: 1964
🏁 Script executed:
Repository: DjedAlliance/StablePay
Length of output: 364
🏁 Script executed:
Repository: DjedAlliance/StablePay
Length of output: 1518
🌐 Web query:
web3.js contract address property how to access contract address web3.eth.Contract💡 Result:
Use the contract instance's options.address property (stored lowercased). Example:
When creating:
var myContract = new web3.eth.Contract(abi, '0xAbC...');
Read address:
console.log(myContract.options.address); // '0xabc...'
Set or change address:
myContract.options.address = '0x1234...';
(Note: older examples sometimes show contract._address, but the supported API is myContract.options.address.) [1][2]
🏁 Script executed:
Repository: DjedAlliance/StablePay
Length of output: 622
🏁 Script executed:
Repository: DjedAlliance/StablePay
Length of output: 2314
Replace
.targetwith.options.addressfor web3.js contract instances.The code uses
.targetto access contract addresses, butdjed-sdkv1.0.2 bundles web3.js v1.7.3, not ethers.js v6. Web3.js contracts expose the address via the.options.addressproperty, not.target. This affects:this.djedContract.targetwill beundefined, causinggetOracleContractto receive invalid inputthis.oracleAddress = this.oracleContract.targetwill beundefinedthis.stableCoin.targetandthis.reserveCoin.targetwill beundefinedChange all
.targetaccesses to.options.address.🤖 Prompt for AI Agents