Dear Sir,
I have a smart contract that uses https://github.com/1inch/solidity-utils/blob/e1686b3cfc520303f5b741bf2223173e529bcee4/contracts/mixins/PermitAndCall.sol#L4 to handle permit and action execution in a single transaction.
to call it in js it is possible to use https://github.com/1inch/solidity-utils/blob/master/src/permit.ts#L192
I tiried to reproduce that function in dotnet but no success
Here is eample of how we use that in js test
it("Method: BySig then SponsoredCall then PermitAndCall then deposit", async function () {
const {token, contract} = await baseSetup()
await token.transfer(user_1.address, SIX_USDT)
const permit = await getPermit(
user_1,
token,
'1',
CHAIN_ID,
await contract.getAddress(),
SIX_USDT,
await timestamp() + 100
)
const tokenPermit = ethers.solidityPacked(
['address', 'bytes'],
[await token.getAddress(), permit]
)
const depositCall = contract.interface.encodeFunctionData('deposit', [SIX_USDT, false])
const permitAndCall = contract.interface.encodeFunctionData('permitAndCall', [tokenPermit, depositCall])
const sponsoredCall = {
traits: buildBySigTraits({deadline: 0xffffffffff, nonceType: NonceType.Selector, nonce: 0}),
data: contract.interface.encodeFunctionData('sponsoredCall', [await token.getAddress(), SIX_USDT - FIVE_USDT, permitAndCall, "0x"]),
}
const signature = await user_1.signTypedData(
{ name: 'XXXXX', version: '1', chainId: CHAIN_ID, verifyingContract: await contract.getAddress() },
{ SignedCall: [{ name: 'traits', type: 'uint256' }, { name: 'data', type: 'bytes' }] },
sponsoredCall
)
await contract.bySig(
user_1.address, sponsoredCall, signature
)
expect(await token.balanceOf(user_1.address)).to.be.eq(0n)
expect(await contract.balanceOf(user_1.address)).to.be.eq(SCALED_SIX_USDT - (SIX_USDT - FIVE_USDT))
})
May be some functionality of that package can help to implement that permitAndCall?
Dear Sir,
I have a smart contract that uses https://github.com/1inch/solidity-utils/blob/e1686b3cfc520303f5b741bf2223173e529bcee4/contracts/mixins/PermitAndCall.sol#L4 to handle permit and action execution in a single transaction.
to call it in js it is possible to use https://github.com/1inch/solidity-utils/blob/master/src/permit.ts#L192
I tiried to reproduce that function in dotnet but no success
Here is eample of how we use that in js test
May be some functionality of that package can help to implement that permitAndCall?