Skip to content

Instantly share code, notes, and snippets.

@tennisonchan
Created January 17, 2022 04:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tennisonchan/b61df7c149d00754f10cb243f2d26905 to your computer and use it in GitHub Desktop.
Save tennisonchan/b61df7c149d00754f10cb243f2d26905 to your computer and use it in GitHub Desktop.
await contract.locked(); // true
const pwdInHex = await web3.eth.getStorageAt(contract.address, 1) // '0x412076657279207374726f6e67207365637265742070617373776f7264203a29'
const pwd = web3.utils.hexToAscii(pwdInHex); // 'A very strong secret password :)'
await contract.unlock(web3.utils.asciiToHex(pwd), {from: player})
await contract.locked(); // false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment