smarttokenlabs / tokenscript-templates Goto Github PK
View Code? Open in Web Editor NEWTokenScript Templates Repository
TokenScript Templates Repository
Whilst developing the ENS-1155 solution there were issues found when trying to renew a tokens expiry, to mimic the same functionality via the ENS-721 solution.
Steps to re-create the issue:
Expected error:
Error: cannot estimate gas; transaction may fail or may require manual gas limit [ See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT ] (reason="execution reverted", method="estimateGas", transaction={"from":"0x7abaEd470E89820738B5e58874dFa7a77F9Cd44d","to":"0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85","data":"0xc475abff22bc263f964cc8eb063fab871e2501b69d210341f05969918ff6e3afd73f92060000000000000000000000000000000000000000000000000000000001e13380","accessList":null}, error={"code":-32000,"message":"execution reverted"}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.7.2)
Towards investigating this issue - when re-creating this scenario with Ethers JS the transaction can reach the wallet for confirmation.
const contractAddress = '0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85';
const contractABI = [
{
"constant": false,
"inputs": [
{ "internalType": "uint256", "name": "id", "type": "uint256" },
{ "internalType": "uint256", "name": "duration", "type": "uint256" }
],
"name": "renew",
"outputs": [
{ "internalType": "uint256", "name": "", "type": "uint256" }
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
];
async function renewContract() {
var wallet = 'YOUR_WALLET_SIGNER';
const contract = new _ethers.Contract(contractAddress, contractABI, wallet);
const id = 'token id'; (decimal)
const duration = 31536000n;
try {
const transaction = await contract.renew(id, duration, { gasLimit: 200000 });
await transaction.wait();
console.log('Transaction successful:', transaction.hash);
} catch (error) {
console.error('Transaction failed:', error.message);
}
}
renewContract();
At this time, I'm unsure if this is a TS issue or if there is a misconfiguration on my side.
cc: @futantan
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.