-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
How to call fallback function of a contract? #182
Comments
This is a good idea to add to the Interface object, for completion. However, it is not strictly needed. Calling the default function can be achieved simply by sending a transaction to the contraxct: var tx = {
to: contractAddress,
value: ethers.utils.parseEther("1.0")
};
wallet.sendTransaction(tx).then(function(tx) {
console.log(tx);
}); You bring up an interesting thing I had not considered though... Can the default function |
Whats the status on this? |
@GregTheGreek Still has not been added. I'm still mulling it over, especially insight of the new Solidity changes. There almost either needs to be zero functions to do this, or two separate options (of which, for any given situation, only one would be valid, I think?)... Both seem correct, but zero seems cleaner. :p I still need to catch up on the "received" Solidity feature. |
For now, I think the best way to perform these operations is to rely on manually sending to the contract address. I may consider adding a function for But please re-open if you feel this is something that is important to be part of a Contract object. Thanks! :) |
So how can we get data returned from fallback() function of proxy contract? |
Hey @psytron, if your fallback function returns a value and you directly calling the contract using const result = await provider.call({
to: contractAddress,
data: '0x1234..' // encoded data
}) If your proxy contract is a minimal proxy contract like EIP-1167, then you can simply pass the proxy address to the Contract. const myContract = new ethers.Contract(proxyAddr, implementationAbi, provider); |
Marvelous. Thank You @zemse |
Welcome :) |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Does
Contract
API support calling a fallback function? (both payable and non-payable)I don't find any documentation on this! I tried the following which fails
The text was updated successfully, but these errors were encountered: