diff --git a/.github/workflows/test-on-worldchain.yml b/.github/workflows/test-on-worldchain.yml new file mode 100644 index 0000000..729ce17 --- /dev/null +++ b/.github/workflows/test-on-worldchain.yml @@ -0,0 +1,44 @@ +# This is a basic workflow to help you get started with Actions + +name: Test on Worldchain + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches-ignore: + - master + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + test-on-polygon: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + env: + MNEMONIC: ${{secrets.MNEMONIC}} + POLYGON_RPC_URL: ${{secrets.POLYGON_RPC_URL}} + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + - uses: actions/setup-node@v2 + with: + node-version: '18' + + # Runs a single command using the runners shell + - name: Install packages + run: yarn install + + - name: Compile + run: yarn compile + + - name: Run test + run: yarn test:polygon diff --git a/README.md b/README.md index eec41e4..19e87db 100644 --- a/README.md +++ b/README.md @@ -370,6 +370,7 @@ event Payment( uint256 paymentAmount, uint256 feeAmount, uint256 protocolAmount, + uint256 slippageAmount, address tokenInAddress, address tokenOutAddress, address feeReceiverAddress @@ -426,7 +427,7 @@ yarn test Test single files: ``` -npx hardhat test test/ethereum/pay_with_native.spec.ts --config hardhat.config.ethereum.ts +npx hardhat test test/ethereum/pay_with_exchange_conversion.spec.ts --config hardhat.config.ethereum.ts ``` ### Deploy diff --git a/contracts/DePayRouterV3.sol b/contracts/DePayRouterV3.sol index c916917..cece0f3 100644 --- a/contracts/DePayRouterV3.sol +++ b/contracts/DePayRouterV3.sol @@ -61,6 +61,7 @@ contract DePayRouterV3 is Ownable2Step { uint256 paymentAmount, uint256 feeAmount, uint256 protocolAmount, + uint256 slippageAmount, address tokenInAddress, address tokenOutAddress, address feeReceiverAddress @@ -79,7 +80,7 @@ contract DePayRouterV3 is Ownable2Step { _payIn(payment); _performPayment(payment); _validatePostConditions(payment, balanceInBefore, balanceOutBefore); - _emit(payment); + _emit(payment, balanceOutBefore); return true; } @@ -108,7 +109,7 @@ contract DePayRouterV3 is Ownable2Step { _payIn(payment, permitTransferFromAndSignature); _performPayment(payment); _validatePostConditions(payment, balanceInBefore, balanceOutBefore); - _emit(payment); + _emit(payment, balanceOutBefore); return true; } @@ -142,7 +143,7 @@ contract DePayRouterV3 is Ownable2Step { _payIn(payment); _performPayment(payment); _validatePostConditions(payment, balanceInBefore, balanceOutBefore); - _emit(payment); + _emit(payment, balanceOutBefore); return true; } @@ -297,7 +298,8 @@ contract DePayRouterV3 is Ownable2Step { /// @dev Emits payment event. /// @param payment The payment data. - function _emit(IDePayRouterV3.Payment calldata payment) internal { + function _emit(IDePayRouterV3.Payment calldata payment, uint256 balanceOutBefore) internal { + uint256 balanceOutNow = payment.tokenOutAddress == NATIVE ? address(this).balance : IERC20(payment.tokenOutAddress).balanceOf(address(this)); emit Payment( msg.sender, payment.paymentReceiverAddress, @@ -306,6 +308,7 @@ contract DePayRouterV3 is Ownable2Step { payment.paymentAmount, payment.feeAmount, payment.protocolAmount, + balanceOutNow - balanceOutBefore - payment.protocolAmount, payment.tokenInAddress, payment.tokenOutAddress, payment.feeReceiverAddress diff --git a/flatten/DePayRouterV3.sol b/flatten/DePayRouterV3.sol index d4e00c0..f68bdfd 100644 --- a/flatten/DePayRouterV3.sol +++ b/flatten/DePayRouterV3.sol @@ -847,18 +847,18 @@ contract DePayRouterV3 is Ownable2Step { using SafeERC20 for IERC20; // Custom errors - error PaymentDeadlineReached(); - error WrongAmountPaidIn(); - error ExchangeNotApproved(); - error ExchangeCallMissing(); - error ExchangeCallFailed(); - error ForwardingPaymentFailed(); - error NativePaymentFailed(); - error NativeFeePaymentFailed(); - error PaymentToZeroAddressNotAllowed(); - error InsufficientBalanceInAfterPayment(); - error InsufficientBalanceOutAfterPayment(); - error InsufficientProtocolAmount(); + error PaymentDeadlineReached(); // 0x17e0bcd9 + error WrongAmountPaidIn(); // 0xed0842e3 + error ExchangeNotApproved(); // 0xc35a3932 + error ExchangeCallMissing(); // 0x6b8072c9 + error ExchangeCallFailed(); // 0x6d8040c3 + error ForwardingPaymentFailed(); // 0xc797a224 + error NativePaymentFailed(); // 0xc7abb1a2 + error NativeFeePaymentFailed(); // 0x9f06170c + error PaymentToZeroAddressNotAllowed(); // 0xec3a80da + error InsufficientBalanceInAfterPayment(); // 0x84257541 + error InsufficientBalanceOutAfterPayment(); // 0x808b9612 + error InsufficientProtocolAmount(); // 0x8e1ebd3a /// @notice Address representing the NATIVE token (e.g. ETH, BNB, MATIC, etc.) address constant NATIVE = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; @@ -892,6 +892,7 @@ contract DePayRouterV3 is Ownable2Step { uint256 paymentAmount, uint256 feeAmount, uint256 protocolAmount, + uint256 slippageAmount, address tokenInAddress, address tokenOutAddress, address feeReceiverAddress @@ -910,7 +911,7 @@ contract DePayRouterV3 is Ownable2Step { _payIn(payment); _performPayment(payment); _validatePostConditions(payment, balanceInBefore, balanceOutBefore); - _emit(payment); + _emit(payment, balanceOutBefore); return true; } @@ -939,7 +940,7 @@ contract DePayRouterV3 is Ownable2Step { _payIn(payment, permitTransferFromAndSignature); _performPayment(payment); _validatePostConditions(payment, balanceInBefore, balanceOutBefore); - _emit(payment); + _emit(payment, balanceOutBefore); return true; } @@ -973,7 +974,7 @@ contract DePayRouterV3 is Ownable2Step { _payIn(payment); _performPayment(payment); _validatePostConditions(payment, balanceInBefore, balanceOutBefore); - _emit(payment); + _emit(payment, balanceOutBefore); return true; } @@ -1128,7 +1129,8 @@ contract DePayRouterV3 is Ownable2Step { /// @dev Emits payment event. /// @param payment The payment data. - function _emit(IDePayRouterV3.Payment calldata payment) internal { + function _emit(IDePayRouterV3.Payment calldata payment, uint256 balanceOutBefore) internal { + uint256 balanceOutNow = payment.tokenOutAddress == NATIVE ? address(this).balance : IERC20(payment.tokenOutAddress).balanceOf(address(this)); emit Payment( msg.sender, payment.paymentReceiverAddress, @@ -1137,6 +1139,7 @@ contract DePayRouterV3 is Ownable2Step { payment.paymentAmount, payment.feeAmount, payment.protocolAmount, + balanceOutNow - balanceOutBefore - payment.protocolAmount, payment.tokenInAddress, payment.tokenOutAddress, payment.feeReceiverAddress diff --git a/hardhat.config.shared.ts b/hardhat.config.shared.ts index 1fbb315..b4046c9 100644 --- a/hardhat.config.shared.ts +++ b/hardhat.config.shared.ts @@ -16,7 +16,7 @@ var { OPTIMISM_RPC_URL, AVALANCHE_RPC_URL, POLYGON_ZKEVM_RPC_URL, - ZKSYNC_ERA_RPC_URL, + WORLDCHAIN_RPC_URL, } = process.env const sharedConfig = { @@ -44,5 +44,5 @@ export { OPTIMISM_RPC_URL, AVALANCHE_RPC_URL, POLYGON_ZKEVM_RPC_URL, - ZKSYNC_ERA_RPC_URL, + WORLDCHAIN_RPC_URL, } diff --git a/hardhat.config.worldchain.ts b/hardhat.config.worldchain.ts new file mode 100644 index 0000000..92c2cae --- /dev/null +++ b/hardhat.config.worldchain.ts @@ -0,0 +1,21 @@ +import '@nomiclabs/hardhat-waffle' +import '@nomiclabs/hardhat-ethers' +import { sharedConfig, MNEMONIC, WORLDCHAIN_RPC_URL } from './hardhat.config.shared' + +const hardhatConfig = { + ...sharedConfig, + defaultNetwork: 'hardhat', + networks: { + hardhat: { + accounts: { + mnemonic: MNEMONIC! + }, + forking: { + url: WORLDCHAIN_RPC_URL!, + enabled: true + } + } + } +} + +export default hardhatConfig diff --git a/package.json b/package.json index d365649..d7282b9 100644 --- a/package.json +++ b/package.json @@ -26,10 +26,10 @@ "node": ">=10" }, "devDependencies": { - "@depay/web3-blockchains": "^9.5.1", - "@depay/web3-client-evm": "^10.16.3", - "@depay/web3-exchanges-evm": "^13.2.3", - "@depay/web3-tokens-evm": "^10.1.0", + "@depay/web3-blockchains": "^9.6.7", + "@depay/web3-client-evm": "^10.19.1", + "@depay/web3-exchanges-evm": "^13.11.0", + "@depay/web3-tokens-evm": "^10.4.3", "@nomiclabs/hardhat-ethers": "^2.2.3", "@nomiclabs/hardhat-waffle": "^2.0.6", "@typechain/ethers-v5": "^4.0.0", @@ -67,7 +67,7 @@ "test:gnosis": "npx hardhat test test/gnosis/* --config hardhat.config.gnosis.ts", "test:optimism": "npx hardhat test test/optimism/* --config hardhat.config.optimism.ts", "test:polygon": "npx hardhat test test/polygon/* --config hardhat.config.polygon.ts", - "test": "yarn test:arbitrum && yarn test:avalanche && yarn test:bsc && yarn test:ethereum && yarn test:fantom && yarn test:gnosis && yarn test:optimism && yarn test:polygon", + "test:worldchain": "npx hardhat test test/worldchain/* --config hardhat.config.worldchain.ts", "prepublishOnly": "yarn test", "build": "npx hardhat compile", "flatten": "rimraf flatten && waffle flatten" diff --git a/test/_pay-to-contract-receiver.ts b/test/_pay-to-contract-receiver.ts index 27172c2..d432535 100644 --- a/test/_pay-to-contract-receiver.ts +++ b/test/_pay-to-contract-receiver.ts @@ -124,6 +124,7 @@ export default ({ blockchain, fromToken, fromAccount, toToken, exchange })=>{ paymentAmount, feeAmount, 0, + 0, NATIVE, NATIVE, wallets[2].address @@ -208,6 +209,7 @@ export default ({ blockchain, fromToken, fromAccount, toToken, exchange })=>{ paymentAmount, feeAmount, 0, + 0, fromToken, fromToken, wallets[2].address diff --git a/test/_pay-with-exchange-conversion.ts b/test/_pay-with-exchange-conversion.ts index 3dd6c3e..2966581 100644 --- a/test/_pay-with-exchange-conversion.ts +++ b/test/_pay-with-exchange-conversion.ts @@ -97,6 +97,12 @@ export default ({ blockchain, fromToken, fromAccount, toToken, exchanges })=>{ tokenOut: Blockchains[blockchain].currency.address, amountOutMin: totalAmount }) + console.log({ + blockchain, + tokenIn: fromToken, + tokenOut: Blockchains[blockchain].currency.address, + amountOutMin: totalAmount + }) const transaction = await route.getTransaction({ account: router.address, inputTokenPushed: exchange.type === 'push' }) const callData = getCallData({ @@ -236,6 +242,12 @@ export default ({ blockchain, fromToken, fromAccount, toToken, exchanges })=>{ paymentAmountBN, feeAmountBN, 0, + (amount) => { + expect(amount).to.be.closeTo( + paymentAmountBN.add(feeAmountBN).mul(5).div(1000), // slippage + paymentAmountBN.add(feeAmountBN).mul(1).div(10000) // tollerance + ) + }, route.tokenIn, route.tokenOut, wallets[2].address @@ -441,6 +453,79 @@ export default ({ blockchain, fromToken, fromAccount, toToken, exchanges })=>{ paymentAmountBN, feeAmountBN, 0, + (amount) => { + expect(amount).to.be.closeTo( + paymentAmountBN.add(feeAmountBN).mul(5).div(1000), // slippage + paymentAmountBN.add(feeAmountBN).mul(1).div(10000) // tollerance + ) + }, + route.tokenIn, + route.tokenOut, + wallets[2].address + ) + }) + + it('keeps protocol amount and calculates slippageAmount accordingly', async ()=>{ + + const paymentAmount = 9 + const paymentAmountBN = ethers.utils.parseUnits(paymentAmount.toString(), toDecimals) + const feeAmount = 1 + const feeAmountBN = ethers.utils.parseUnits(feeAmount.toString(), toDecimals) + const protocolAmount = 1 + const protocolAmountBN = ethers.utils.parseUnits(feeAmount.toString(), toDecimals) + const totalAmount = paymentAmount + feeAmount + protocolAmount + + const route = await Exchanges[exchange.name].route({ + blockchain, + tokenIn: Blockchains[blockchain].currency.address, + tokenOut: toToken, + amountOutMin: totalAmount + }) + + const transaction = await route.getTransaction({ account: router.address, inputTokenPushed: exchange.type === 'push' }) + const callData = getCallData({ + address: transaction.to, + api: transaction.api, + provider: wallets[0], + method: transaction.method, + params: transaction.params, + }) + + const paymentReceiverBalanceBefore = await toTokenContract.balanceOf(wallets[1].address) + const feeReceiverBalanceBefore = await toTokenContract.balanceOf(wallets[2].address) + + await expect( + await router.connect(fromAccount)[PAY]({ + amountIn: route.amountIn, + paymentAmount: paymentAmountBN, + feeAmount: feeAmountBN, + protocolAmount: protocolAmountBN, + tokenInAddress: route.tokenIn, + exchangeAddress: transaction.to, + tokenOutAddress: route.tokenOut, + paymentReceiverAddress: wallets[1].address, + feeReceiverAddress: wallets[2].address, + exchangeType: exchange.type === 'pull' ? 1 : 2, + receiverType: 0, + exchangeCallData: callData, + receiverCallData: ZERO, + deadline, + }, { value: route.amountIn }) + ) + .to.emit(router, 'Payment').withArgs( + fromAccount._address, // from + wallets[1].address, // to + deadline, // deadline + route.amountIn, + paymentAmountBN, + feeAmountBN, + protocolAmountBN, + (amount) => { + expect(amount).to.be.closeTo( + paymentAmountBN.add(feeAmountBN).sub(protocolAmountBN).mul(5).div(1000), // slippage + paymentAmountBN.add(feeAmountBN).sub(protocolAmountBN).mul(1).div(10000) // tollerance + ) + }, route.tokenIn, route.tokenOut, wallets[2].address diff --git a/test/_pay-with-native.ts b/test/_pay-with-native.ts index e220fa9..b994aa3 100644 --- a/test/_pay-with-native.ts +++ b/test/_pay-with-native.ts @@ -106,6 +106,7 @@ export default ({ blockchain })=>{ paymentAmount, 0, 0, + 0, NATIVE, NATIVE, ZERO @@ -178,6 +179,7 @@ export default ({ blockchain })=>{ paymentAmount, feeAmount, 0, + 0, NATIVE, NATIVE, wallets[2].address @@ -226,6 +228,7 @@ export default ({ blockchain })=>{ paymentAmount, feeAmount, protocolAmount, + 0, NATIVE, NATIVE, wallets[2].address diff --git a/test/_pay-with-permit2.ts b/test/_pay-with-permit2.ts index 37271ff..1fa37ce 100644 --- a/test/_pay-with-permit2.ts +++ b/test/_pay-with-permit2.ts @@ -126,6 +126,7 @@ export default ({ blockchain, token, tokenHolder })=>{ paymentAmount, feeAmount, 0, + 0, TOKEN, TOKEN, wallets[2].address @@ -260,6 +261,7 @@ export default ({ blockchain, token, tokenHolder })=>{ paymentAmount, feeAmount, 0, + 0, TOKEN, TOKEN, wallets[2].address diff --git a/test/_pay-with-token.ts b/test/_pay-with-token.ts index cfece43..6556ec6 100644 --- a/test/_pay-with-token.ts +++ b/test/_pay-with-token.ts @@ -92,6 +92,7 @@ export default ({ blockchain, token, fromAccount, reversalReason })=>{ paymentAmount, 0, 0, + 0, TOKEN, TOKEN, ZERO @@ -174,6 +175,7 @@ export default ({ blockchain, token, fromAccount, reversalReason })=>{ paymentAmount, feeAmount, protocolAmount, + 0, TOKEN, TOKEN, wallets[2].address diff --git a/test/_pay-with-wrapped-conversion.ts b/test/_pay-with-wrapped-conversion.ts index f7f9883..493de7d 100644 --- a/test/_pay-with-wrapped-conversion.ts +++ b/test/_pay-with-wrapped-conversion.ts @@ -78,6 +78,7 @@ export default ({ blockchain })=>{ paymentAmount, feeAmount, 0, + 0, NATIVE, WRAPPED, wallets[2].address diff --git a/test/arbitrum/pay_with_exchange_conversion.spec.ts b/test/arbitrum/pay_with_exchange_conversion.spec.ts index baf7cf3..957fb55 100644 --- a/test/arbitrum/pay_with_exchange_conversion.spec.ts +++ b/test/arbitrum/pay_with_exchange_conversion.spec.ts @@ -6,6 +6,6 @@ payWithExchangeConversion({ fromAccount: '0xe2823659bE02E0F48a4660e4Da008b5E1aBFdF29', // needs to hold enough fromToken, will be impersonated toToken: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831', // USDC exchanges: [ - { name: 'uniswap_v3', type: 'push' }, + { name: 'uniswap_v3', type: 'pull' }, ] }) diff --git a/test/avalanche/pay_with_exchange_conversion.spec.ts b/test/avalanche/pay_with_exchange_conversion.spec.ts index df9ac26..61409cd 100644 --- a/test/avalanche/pay_with_exchange_conversion.spec.ts +++ b/test/avalanche/pay_with_exchange_conversion.spec.ts @@ -7,5 +7,6 @@ payWithExchangeConversion({ toToken: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E', // USDC exchanges: [ { name: 'trader_joe_v2_1', type: 'pull' }, + { name: 'uniswap_v3', type: 'pull' }, ] }) diff --git a/test/bsc/pay_with_exchange_conversion.spec.ts b/test/bsc/pay_with_exchange_conversion.spec.ts index 8ec749f..88e7f1b 100644 --- a/test/bsc/pay_with_exchange_conversion.spec.ts +++ b/test/bsc/pay_with_exchange_conversion.spec.ts @@ -8,6 +8,6 @@ payWithExchangeConversion({ exchanges: [ { name: 'pancakeswap_v3', type: 'pull' }, { name: 'pancakeswap', type: 'pull' }, - { name: 'uniswap_v3', type: 'push' }, + { name: 'uniswap_v3', type: 'pull' }, ] }) diff --git a/test/ethereum/pay_with_exchange_conversion.spec.ts b/test/ethereum/pay_with_exchange_conversion.spec.ts index 6e38cb6..8730d30 100644 --- a/test/ethereum/pay_with_exchange_conversion.spec.ts +++ b/test/ethereum/pay_with_exchange_conversion.spec.ts @@ -7,6 +7,6 @@ payWithExchangeConversion({ toToken: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC exchanges: [ { name: 'uniswap_v2', type: 'pull' }, - { name: 'uniswap_v3', type: 'push' } + { name: 'uniswap_v3', type: 'pull' } ] }) diff --git a/test/optimism/pay_with_exchange_conversion.spec.ts b/test/optimism/pay_with_exchange_conversion.spec.ts index d8c032c..9dd0aaa 100644 --- a/test/optimism/pay_with_exchange_conversion.spec.ts +++ b/test/optimism/pay_with_exchange_conversion.spec.ts @@ -6,6 +6,6 @@ payWithExchangeConversion({ fromAccount: '0xF977814e90dA44bFA03b6295A0616a897441aceC', // needs to hold enough fromToken, will be impersonated toToken: '0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85', // USDC exchanges: [ - { name: 'uniswap_v3', type: 'push' }, + { name: 'uniswap_v3', type: 'pull' }, ] }) diff --git a/test/polygon/pay_with_exchange_conversion.spec.ts b/test/polygon/pay_with_exchange_conversion.spec.ts index 9f7dfd2..0dea5e5 100644 --- a/test/polygon/pay_with_exchange_conversion.spec.ts +++ b/test/polygon/pay_with_exchange_conversion.spec.ts @@ -6,6 +6,6 @@ payWithExchangeConversion({ fromAccount: '0x62ac55b745F9B08F1a81DCbbE630277095Cf4Be1', // needs to hold enough fromToken, will be impersonated toToken: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', // USDC exchanges: [ - { name: 'uniswap_v3', type: 'push' }, + { name: 'uniswap_v3', type: 'pull' }, ] }) diff --git a/test/worldchain/deadline.spec.ts b/test/worldchain/deadline.spec.ts new file mode 100644 index 0000000..7673967 --- /dev/null +++ b/test/worldchain/deadline.spec.ts @@ -0,0 +1,3 @@ +import deadline from '../_deadline' + +deadline({ blockchain: 'worldchain' }) diff --git a/test/worldchain/pay_to_contract_receiver.spec.ts b/test/worldchain/pay_to_contract_receiver.spec.ts new file mode 100644 index 0000000..7bcebd5 --- /dev/null +++ b/test/worldchain/pay_to_contract_receiver.spec.ts @@ -0,0 +1,9 @@ +import payToContractReceiver from '../_pay-to-contract-receiver' + +payToContractReceiver({ + blockchain: 'worldchain', + fromToken: '0x79A02482A880bCE3F13e09Da970dC34db4CD24d1', // USDCe + fromAccount: '0xDc927Bd56CF9DfC2e3779C7E3D6d28dA1C219969', // needs to hold enough fromToken, will be impersonated + toToken: '0x2cFc85d8E48F8EAB294be644d9E25C3030863003', // WDL + exchange: { name: 'uniswap_v3', type: 'pull' }, +}) diff --git a/test/worldchain/pay_with_exchange_conversion.spec.ts b/test/worldchain/pay_with_exchange_conversion.spec.ts new file mode 100644 index 0000000..d3abf16 --- /dev/null +++ b/test/worldchain/pay_with_exchange_conversion.spec.ts @@ -0,0 +1,11 @@ +import payWithExchangeConversion from '../_pay-with-exchange-conversion' + +payWithExchangeConversion({ + blockchain: 'worldchain', + fromToken: '0x79A02482A880bCE3F13e09Da970dC34db4CD24d1', // USDCe + fromAccount: '0xDc927Bd56CF9DfC2e3779C7E3D6d28dA1C219969', // needs to hold enough fromToken, will be impersonated + toToken: '0x2cFc85d8E48F8EAB294be644d9E25C3030863003', // WDL + exchanges: [ + { name: 'uniswap_v3', type: 'pull' }, + ] +}) diff --git a/test/worldchain/pay_with_native.spec.ts b/test/worldchain/pay_with_native.spec.ts new file mode 100644 index 0000000..6465429 --- /dev/null +++ b/test/worldchain/pay_with_native.spec.ts @@ -0,0 +1,3 @@ +import payWithNative from '../_pay-with-native' + +payWithNative({ blockchain: 'worldchain' }) diff --git a/test/worldchain/pay_with_permit2.spec.ts b/test/worldchain/pay_with_permit2.spec.ts new file mode 100644 index 0000000..0ba17b3 --- /dev/null +++ b/test/worldchain/pay_with_permit2.spec.ts @@ -0,0 +1,7 @@ +import payWithPermit2 from '../_pay-with-permit2' + +payWithPermit2({ + blockchain: 'worldchain', + token: '0x79A02482A880bCE3F13e09Da970dC34db4CD24d1', // USDCe + tokenHolder: '0xDc927Bd56CF9DfC2e3779C7E3D6d28dA1C219969', // needs to hold enough fromToken, will be impersonated +}) diff --git a/test/worldchain/pay_with_token.spec.ts b/test/worldchain/pay_with_token.spec.ts new file mode 100644 index 0000000..ec33f36 --- /dev/null +++ b/test/worldchain/pay_with_token.spec.ts @@ -0,0 +1,8 @@ +import payWithToken from '../_pay-with-token' + +payWithToken({ + blockchain: 'worldchain', + token: '0x79A02482A880bCE3F13e09Da970dC34db4CD24d1', // USDCe + fromAccount: '0xDc927Bd56CF9DfC2e3779C7E3D6d28dA1C219969', // needs to hold enough fromToken, will be impersonated + reversalReason: 'ERC20: transfer amount exceeds allowance', +}) diff --git a/test/worldchain/pay_with_wrapped_conversion.spec.ts b/test/worldchain/pay_with_wrapped_conversion.spec.ts new file mode 100644 index 0000000..b770442 --- /dev/null +++ b/test/worldchain/pay_with_wrapped_conversion.spec.ts @@ -0,0 +1,3 @@ +import payWithWrappedConversion from '../_pay-with-wrapped-conversion' + +payWithWrappedConversion({ blockchain: 'worldchain' }) diff --git a/test/worldchain/various.spec.ts b/test/worldchain/various.spec.ts new file mode 100644 index 0000000..e191ea4 --- /dev/null +++ b/test/worldchain/various.spec.ts @@ -0,0 +1,3 @@ +import various from '../_various.ts' + +various({ blockchain: 'worldchain' }) diff --git a/yarn.lock b/yarn.lock index 88a20f0..7095bcb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -287,25 +287,25 @@ "@babel/helper-validator-identifier" "^7.22.5" to-fast-properties "^2.0.0" -"@depay/web3-blockchains@^9.5.1": - version "9.5.1" - resolved "https://registry.yarnpkg.com/@depay/web3-blockchains/-/web3-blockchains-9.5.1.tgz#1e8f2c65aead5e1cc919f7724bac46fde59f4ba0" - integrity sha512-F3nj+rBxZz0VNifM+x6KsExtnv7cZLuZwsRpkraOMXDnRt1jIJbzX3hrklIVaxvNtVX4kPsOZBVgzay7QVOYhw== - -"@depay/web3-client-evm@^10.16.3": - version "10.16.3" - resolved "https://registry.yarnpkg.com/@depay/web3-client-evm/-/web3-client-evm-10.16.3.tgz#63f736fe8df83b62d2c7d0c9777ccbd7981ffc49" - integrity sha512-q1KmFScKgqCeLtg5v3xaQ12l3xNgyKEIgGBCfPXGbsK3kBaG6actZbAugIsK+GzEGwAetKYoM+MmK5P8bt5r6Q== - -"@depay/web3-exchanges-evm@^13.2.3": - version "13.2.3" - resolved "https://registry.yarnpkg.com/@depay/web3-exchanges-evm/-/web3-exchanges-evm-13.2.3.tgz#2d15850bd49a5c5d4cac4079742134a61bbb31bd" - integrity sha512-MuP0MGilPVECI9hXwLt4whk/ul6TVhTjKegFQV+L3s7HdXevxsPC6TDXd1WQP2u+659l7r6btqqPrSDgEDaWaA== - -"@depay/web3-tokens-evm@^10.1.0": - version "10.1.0" - resolved "https://registry.yarnpkg.com/@depay/web3-tokens-evm/-/web3-tokens-evm-10.1.0.tgz#34251da8cf5891caf5078c1d3a3a3d61fe7dd892" - integrity sha512-bYS1O0WIyOYgStyhTwJRIroPiiIm04jpgqUcp+R0MUx483rG6vkGfsy1eakf9AMd1sJeu0YsM4URLsgJU0LZwQ== +"@depay/web3-blockchains@^9.6.7": + version "9.6.7" + resolved "https://registry.yarnpkg.com/@depay/web3-blockchains/-/web3-blockchains-9.6.7.tgz#467853ef8895f6650041f5df792a343a2047f533" + integrity sha512-RqVsm/aURJ2npRm0/0qr/GiMdBsGSbRA2GpzG75Vy7qODYScbYjA/CitMjhw9ktzGjiFN9oh/ooq9GBjPIhEdA== + +"@depay/web3-client-evm@^10.19.1": + version "10.19.1" + resolved "https://registry.yarnpkg.com/@depay/web3-client-evm/-/web3-client-evm-10.19.1.tgz#88091c94bc9603e2afe7bfb25dceed322ce76181" + integrity sha512-smxAPoq+x6bnp3t4ak6g0AJlkHzjD4WuMwOHhTJ4ct2aLs8EiMu0MA54Zebetk5Udpi7B4QgaZKIpwjEL/0J7A== + +"@depay/web3-exchanges-evm@^13.11.0": + version "13.11.0" + resolved "https://registry.yarnpkg.com/@depay/web3-exchanges-evm/-/web3-exchanges-evm-13.11.0.tgz#5914de87be57d19a34811fd5efe9dcb3fc41e0bb" + integrity sha512-2Nd+tigt9IpJO22jnt/TmG4qZnc9GHBVpug/71kMVNZqraNEhTSY73ma98BIhWrigjNjBxpXiHOVkVq6G1F0AA== + +"@depay/web3-tokens-evm@^10.4.3": + version "10.4.3" + resolved "https://registry.yarnpkg.com/@depay/web3-tokens-evm/-/web3-tokens-evm-10.4.3.tgz#00c4eb6160a95f2b67278a398fef9d796df15093" + integrity sha512-vdxQCRJlsQw2Xd/MzH+iRx+QVto4kKN/vqk6Iyjl9RAC9CnMiHZWrGU4qTo9dl8QDXVaHf6TNNmT4Jj3cJCjqQ== "@ensdomains/ens@^0.4.4": version "0.4.5"