Skip to content

Commit

Permalink
wrap paycall
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans Wang committed Jun 7, 2024
1 parent 1ed076e commit b701763
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/builder/QuarkBuilder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,19 @@ contract QuarkBuilder {
if (assetSymbol == "ETH") {
if (payment.isToken) {
// wrap around paycall
address paycallAddress = getCodeAddress(codeJar, type(Paycall).creationCode);
operations.push(QuarkOperation({
nonce: , // TODO: get next nonce
chainId: chainId,
scriptAddress: paycallAddress,
scriptCalldata: abi.encodeWithSelector(
Paycall.run.selector,
scriptAddress,
abi.encodeWithSelector(TransferActions.transferNativeToken.selector, recipient, amount)
),
scriptSources: scriptSources,
expiry: 99999999999 // TODO: never expire?
}));
} else {
// Native ETH transfer
operations.push(QuarkOperation({
Expand All @@ -407,6 +420,19 @@ contract QuarkBuilder {
} else {
if (payment.isToken) {
// wrap around paycall
address paycallAddress = getCodeAddress(codeJar, type(Paycall).creationCode);
operations.push(QuarkOperation({
nonce: , // TODO: get next nonce
chainId: chainId,
scriptAddress: paycallAddress,
scriptCalldata: abi.encodeWithSelector(
Paycall.run.selector,
scriptAddress,
abi.encodeWithSelector(TransferActions.transferERC20Token.selector, token, recipient, amount)
),
scriptSources: scriptSources,
expiry: 99999999999 // TODO: never expire?
}));
} else {
// ERC20 transfer
operations.push(QuarkOperation({
Expand Down

0 comments on commit b701763

Please sign in to comment.