-
Notifications
You must be signed in to change notification settings - Fork 15
feat: Automate fetching of USDFC contract ABI #263
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
base: main
Are you sure you want to change the base?
Conversation
KEYSTORE ?= | ||
PASSWORD ?= | ||
CHALLENGE_FINALITY ?= | ||
USDFC_PROXY_ADDRESS ?= 0x80B98d3aa09ffff255c3ba4A241111Ff1262F045 |
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.
USDFC_PROXY_ADDRESS ?= 0x80B98d3aa09ffff255c3ba4A241111Ff1262F045 | |
# Mainnet address by default | |
USDFC_PROXY_ADDRESS ?= 0x80B98d3aa09ffff255c3ba4A241111Ff1262F045 |
# Fetches the ABI for a Filecoin proxy contract's implementation and saves it. | ||
# |
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.
# Fetches the ABI for a Filecoin proxy contract's implementation and saves it. | |
# | |
# Fetches the ABI for a Filecoin mainnet proxy contract's implementation and saves it. | |
# |
echo "$IMPL_RESPONSE" | jq '.abi | fromjson' > "$OUTPUT_PATH" || { | ||
# Clean up the potentially empty/corrupt file on failure. | ||
rm -f "$OUTPUT_PATH" 2>/dev/null | ||
die "Failed to parse ABI. The '.abi' field may be missing, null, or not valid JSON." | ||
} |
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.
This should be more graceful - you could send it to a temporary file and then move it to OUTPUT_PATH, but the way this is now, a failure to fetch will leave you with a deleted ABI file in your repo.
lgtm, just some minor notes |
I just saw FilOzone/synapse-sdk#281 (comment) so I'll let @hugomrdias tell us which way this has to go to get it into synapse. |
This change is a precursor to solve FilOzone/synapse-sdk#244. The SDK requires the full USDFC ABI to integrate features that use extensions like ERC-2612 and ERC-3009. This PR provides a reliable, automated way to source that ABI.
Problem
Previously, we used a generic
ERC20
ABI which lacks support for theERC-2612
andERC-3009
specific extensions. This required manual ABI additions and could lead to discrepancies, blocking integration insynapse-sdk
.Solution
tools/fetch-usdfc-abi.sh
, is added. It resolves the USDFC proxy address to its underlying implementation contract and fetches the correct ABIMakefile
is updated to integrate the script. The USDFC ABI can be fetched on-demand with makeabi/Usdfc.abi.json
and is also automatically updated with all other contracts when runningmake update-abi
This streamlines the process of keeping the ABI in sync with the deployed contract and ensures all necessary function definitions are available.