Comments (3)
👀
from contracts.
Withdrawing native tokens from to a smart account throws unpredictable gas error. This is preventing our users to use 1Inch API to swap ERC tokens into Native tokens.
Digging more into this I've created a minimal code to reproduce the issue, by trying to unwrap WMATIC tokens for MATIC on Mumbai:
import { config } from "dotenv" import { AbstractWallet, PrivateKeyWallet, SmartWallet, SmartWalletConfig } from "@thirdweb-dev/wallets"; import { Mumbai } from "@thirdweb-dev/chains"; import { ThirdwebSDK } from "@thirdweb-dev/sdk"; import { utils } from "ethers"; import { WETH_ABI } from "./ABI/weth"; config() async function withdraw(wallet: AbstractWallet) { const sdkSmart = await ThirdwebSDK.fromWallet(wallet, Mumbai); const wmaticAddress = "0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889"; const wmaticContract = await sdkSmart.getContract(wmaticAddress, WETH_ABI) const data = await wmaticContract.call('withdraw', [utils.parseEther('0.1')]) console.log('data: ', data) } async function createTransaction() { console.log("creating account") const privateKey = process.env.PRIVATE_KEY as string; const personalWallet = new PrivateKeyWallet(privateKey); console.log("personalWallet: ", await personalWallet.getAddress()); const config: SmartWalletConfig = { chain: Mumbai, factoryAddress: process.env.FACTORY_ADDRESS as string, secretKey: process.env.SECRET_KEY as string, gasless: true, // enable or disable gasless transactions }; const smartWallet = new SmartWallet(config); await smartWallet.connect({ personalWallet, }); console.log("smartWallet: ", await smartWallet.getAddress()); console.log("Unwrapping with personal wallet") await withdraw(personalWallet) console.log("Unwrapping with smart wallet") await withdraw(smartWallet) } createTransaction()I've tested this script with our version of contract factory (v1.4.0) and the latest one available (v1.5.3), which strangely enough throw a different error in this case:
Managed Account Factory v1.4.0
Reason: Error: gas required exceeds allowance
Managed Account Factory v1.5.3
Reason: execution reverted
from contracts.
Withdrawing native tokens from to a smart account throws unpredictable gas error. This is preventing our users to use 1Inch API to swap ERC tokens into Native tokens.
Digging more into this I've created a minimal code to reproduce the issue, by trying to unwrap WMATIC tokens for MATIC on Mumbai:
import { config } from "dotenv" import { AbstractWallet, PrivateKeyWallet, SmartWallet, SmartWalletConfig } from "@thirdweb-dev/wallets"; import { Mumbai } from "@thirdweb-dev/chains"; import { ThirdwebSDK } from "@thirdweb-dev/sdk"; import { utils } from "ethers"; import { WETH_ABI } from "./ABI/weth"; config() async function withdraw(wallet: AbstractWallet) { const sdkSmart = await ThirdwebSDK.fromWallet(wallet, Mumbai); const wmaticAddress = "0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889"; const wmaticContract = await sdkSmart.getContract(wmaticAddress, WETH_ABI) const data = await wmaticContract.call('withdraw', [utils.parseEther('0.1')]) console.log('data: ', data) } async function createTransaction() { console.log("creating account") const privateKey = process.env.PRIVATE_KEY as string; const personalWallet = new PrivateKeyWallet(privateKey); console.log("personalWallet: ", await personalWallet.getAddress()); const config: SmartWalletConfig = { chain: Mumbai, factoryAddress: process.env.FACTORY_ADDRESS as string, secretKey: process.env.SECRET_KEY as string, gasless: true, // enable or disable gasless transactions }; const smartWallet = new SmartWallet(config); await smartWallet.connect({ personalWallet, }); console.log("smartWallet: ", await smartWallet.getAddress()); console.log("Unwrapping with personal wallet") await withdraw(personalWallet) console.log("Unwrapping with smart wallet") await withdraw(smartWallet) } createTransaction()I've tested this script with our version of contract factory (v1.4.0) and the latest one available (v1.5.3), which strangely enough throw a different error in this case:
Managed Account Factory v1.4.0
Reason: Error: gas required exceeds allowance
Managed Account Factory v1.5.3
Reason: execution reverted
from contracts.
Related Issues (20)
- Multiple currency support in MarketplaceV3 DirectListings contract. HOT 1
- Marketplace: Can't Buy NFT Listed For Free HOT 2
- AA Support for Custom Network HOT 4
- Thirdweb Latest Registry Addresses and Factory Addresses HOT 9
- Add nonReentrant modifier to relevant base contract functions
- Deletion on mapping containing a struct-with-mapping
- Apply checks-effects-integration across repo contracts or use nonReentrant
- Emit appropriate events in initialize function
- Update state variables that could be declared immutable as immutable
- Cache array length
- Contract deployment issue on Redbelly Devnet
- TypeError: Wrong argument count for function call: 2 arguments given but expected 1. - SafeERC20.sol:72
- isAuctionExpired view function is with wrong return value
- Request for Hardhat Deployment Example for TokenStake Contract HOT 1
- [ERC721Base] missing virtual on internal function _msgSender HOT 2
- # Forge projects forge install https://github.com/thirdweb-dev/contracts # Hardhat / npm based projects npm i @thirdweb-dev/contracts
- 0xd7fA7A779ea8c969f3976384d347e434826b8C90
- 0xd7fA7A779ea8c969f3976384d347e434826b8C90
- > Withdrawing native tokens from to a smart account throws unpredictable gas error. This is preventing our users to use 1Inch API to swap ERC tokens into Native tokens.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from contracts.