Skip to content
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

dependabot/npm_and_yarn/markdown-it-and-markdownlint-cli-13.0.1 #383

Open
BlueGhostxxx opened this issue Sep 15, 2023 · 2 comments
Open

Comments

@BlueGhostxxx
Copy link

CODE_OF_CONDUCT.mdFUNDING.yml.gitattributesREADME.md#> pip3 install solidity_parser #> python3 -m solidity_parser <parse|outline> <path_to_contract.sol> # print parse tree or sourceUnit outlineimport { signTypedData_v4 } from 'eth-sig-util' import { fromRpcSig } from 'ethereumjs-util' // ... other imports import aTokenAbi from "./aTokenAbi.json" // ... setup your web3 provider const aTokenAddress = "ATOKEN_ADDRESS" const aTokenContract = new web3.eth.Contract(aTokenAbi, aTokenAddress) const privateKey = "YOUR_PRIVATE_KEY_WITHOUT_0x" const chainId = 1 const owner = "OWNER_ADDRESS" const spender = "SPENDER_ADDRESS" const value = 100 // Amount the spender is permitted const nonce = 1 // The next valid nonce, use _nonces() const deadline = 1600093162 const permitParams = { types: { EIP712Domain: [ { name: "name", type: "string" }, { name: "version", type: "string" }, { name: "chainId", type: "uint256" }, { name: "verifyingContract", type: "address" }, ], Permit: [ { name: "owner", type: "address" }, { name: "spender", type: "address" }, { name: "value", type: "uint256" }, { name: "nonce", type: "uint256" }, { name: "deadline", type: "uint256" }, ], }, primaryType: "Permit", domain: { name: "aTOKEN_NAME", version: "1", chainId: chainId, verifyingContract: aTokenAddress, }, message: { owner, spender, value, nonce, deadline, }, } const signature = signTypedData_v4( Buffer.from(privateKey, "hex"), { data: permitParams } ) // The signature can now be used to execute the transaction const { v, r, s } = fromRpcSig(signature) await aTokenContract.methods .permit({ owner, spender, value, deadline, v, r, s }) .send() .catch((e) => { throw Error(Error permitting: ${e.message}) })

@BlueGhostxxx
Copy link
Author

CODE_OF_CONDUCT.mdFUNDING.yml.gitattributesREADME.md#> pip3 install solidity_parser #> python3 -m solidity_parser <parse|outline> <path_to_contract.sol> # print parse tree or sourceUnit outlineimport { signTypedData_v4 } from 'eth-sig-util' import { fromRpcSig } from 'ethereumjs-util' // ... other imports import aTokenAbi from "./aTokenAbi.json" // ... setup your web3 provider const aTokenAddress = "ATOKEN_ADDRESS" const aTokenContract = new web3.eth.Contract(aTokenAbi, aTokenAddress) const privateKey = "YOUR_PRIVATE_KEY_WITHOUT_0x" const chainId = 1 const owner = "OWNER_ADDRESS" const spender = "SPENDER_ADDRESS" const value = 100 // Amount the spender is permitted const nonce = 1 // The next valid nonce, use _nonces() const deadline = 1600093162 const permitParams = { types: { EIP712Domain: [ { name: "name", type: "string" }, { name: "version", type: "string" }, { name: "chainId", type: "uint256" }, { name: "verifyingContract", type: "address" }, ], Permit: [ { name: "owner", type: "address" }, { name: "spender", type: "address" }, { name: "value", type: "uint256" }, { name: "nonce", type: "uint256" }, { name: "deadline", type: "uint256" }, ], }, primaryType: "Permit", domain: { name: "aTOKEN_NAME", version: "1", chainId: chainId, verifyingContract: aTokenAddress, }, message: { owner, spender, value, nonce, deadline, }, } const signature = signTypedData_v4( Buffer.from(privateKey, "hex"), { data: permitParams } ) // The signature can now be used to execute the transaction const { v, r, s } = fromRpcSig(signature) await aTokenContract.methods .permit({ owner, spender, value, deadline, v, r, s }) .send() .catch((e) => { throw Error(Error permitting: ${e.message}) })

@github-actions
Copy link

Welcome to OpenRPC! Thank you for taking the time to create an issue. Please review the guidelines

@BlueGhostxxx BlueGhostxxx reopened this Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant