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

feat: add all data to deployment events #1487

Merged
merged 9 commits into from
Nov 8, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,10 @@ describe('deploySingleRequestProxy', () => {

expect(events.length).toBeGreaterThan(0);

const eventData = utils.defaultAbiCoder.decode(['address', 'address'], events[0].data);
const eventData = utils.defaultAbiCoder.decode(
['address', 'address', 'address', 'uint256', 'address'],
events[0].data,
);
MantisClone marked this conversation as resolved.
Show resolved Hide resolved

expect(eventData[0]).toBe(proxyAddress);
});
Expand All @@ -216,7 +219,10 @@ describe('deploySingleRequestProxy', () => {

expect(events.length).toBeGreaterThan(0);

const eventData = utils.defaultAbiCoder.decode(['address', 'address'], events[0].data);
const eventData = utils.defaultAbiCoder.decode(
['address', 'address', 'address', 'uint256', 'address'],
events[0].data,
);
MantisClone marked this conversation as resolved.
Show resolved Hide resolved

expect(eventData[0]).toBe(proxyAddress);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,20 @@ contract SingleRequestProxyFactory is Ownable {
event EthereumSingleRequestProxyCreated(
address proxyAddress,
address payee,
bytes indexed paymentReference
bytes indexed paymentReference,
address feeAddress,
uint256 feeAmount,
address feeProxyUsed
);

event ERC20SingleRequestProxyCreated(
address proxyAddress,
address payee,
address tokenAddress,
bytes indexed paymentReference
bytes indexed paymentReference,
address feeAddress,
uint256 feeAmount,
address feeProxyUsed
);

event ERC20FeeProxyUpdated(address indexed newERC20FeeProxy);
Expand Down Expand Up @@ -64,7 +70,14 @@ contract SingleRequestProxyFactory is Ownable {
_feeAddress,
_feeAmount
);
emit EthereumSingleRequestProxyCreated(address(proxy), _payee, _paymentReference);
emit EthereumSingleRequestProxyCreated(
address(proxy),
_payee,
_paymentReference,
_feeAddress,
_feeAmount,
ethereumFeeProxy
);
return address(proxy);
}

Expand Down Expand Up @@ -93,7 +106,15 @@ contract SingleRequestProxyFactory is Ownable {
erc20FeeProxy
);

emit ERC20SingleRequestProxyCreated(address(proxy), _payee, _tokenAddress, _paymentReference);
emit ERC20SingleRequestProxyCreated(
address(proxy),
_payee,
_tokenAddress,
_paymentReference,
_feeAddress,
_feeAmount,
erc20FeeProxy
);
MantisClone marked this conversation as resolved.
Show resolved Hide resolved
return address(proxy);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ export const singleRequestProxyFactoryArtifact = new ContractArtifact<SingleRequ
address: '0x9d075ae44D859191C121d7522da0Cc3B104b8837',
creationBlockNumber: 0,
},
sepolia: {
address: '0x435E81E12136414e2c09cAFe05E902E23bD46030',
creationBlockNumber: 6965557,
},
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,16 @@ describe('contract: SingleRequestProxyFactory', () => {
expect(proxyAddress).to.not.equal(ethers.constants.AddressZero);
expect(proxyAddress).to.be.properAddress;

// Check if the event was emitted with correct parameters
await expect(tx)
.to.emit(singleRequestProxyFactory, 'EthereumSingleRequestProxyCreated')
.withArgs(proxyAddress, payeeAddress, paymentReference);
.withArgs(
proxyAddress,
payeeAddress,
paymentReference,
feeRecipientAddress,
feeAmount,
ethereumFeeProxy.address,
);

const proxy = (await ethers.getContractAt(
'EthereumSingleRequestProxy',
Expand Down Expand Up @@ -119,10 +125,17 @@ describe('contract: SingleRequestProxyFactory', () => {
expect(proxyAddress).to.not.equal(ethers.constants.AddressZero);
expect(proxyAddress).to.be.properAddress;

// Check if the event was emitted with correct parameters
await expect(tx)
.to.emit(singleRequestProxyFactory, 'ERC20SingleRequestProxyCreated')
.withArgs(proxyAddress, payeeAddress, testToken.address, paymentReference);
.withArgs(
proxyAddress,
payeeAddress,
testToken.address,
paymentReference,
feeRecipientAddress,
feeAmount,
erc20FeeProxy.address,
);

const proxy = (await ethers.getContractAt(
'ERC20SingleRequestProxy',
Expand Down