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

DelegatedSwapFor event for Delegate #1348

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions source/delegate/contracts/Delegate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ contract Delegate is IDelegate, Ownable {

/**
* @notice Set a Rule
* @param _senderWallet address Address of the sender wallet
* @param _senderWallet address Address of the delegating sender wallet
* @param _senderToken address ERC-20 token the sender would transfer
* @param _senderAmount uint256 Maximum sender amount for the rule
* @param _signerToken address ERC-20 token the signer would transfer
Expand Down Expand Up @@ -80,7 +80,7 @@ contract Delegate is IDelegate, Ownable {

/**
* @notice Unset a Rule
* @param _senderWallet The address of the sender's wallet
* @param _senderWallet address Address of the delegating sender wallet
* @param _senderToken address ERC-20 token the sender would transfer
* @param _signerToken address ERC-20 token the signer would transfer
*/
Expand Down Expand Up @@ -184,8 +184,8 @@ contract Delegate is IDelegate, Ownable {
rules[_senderWallet][_senderToken][_signerToken]
.senderFilledAmount += _senderAmount;

// Emit a DelegateSwap event
emit DelegateSwap(_nonce, _signerWallet);
// Emit a DelegatedSwapFor event
emit DelegatedSwapFor(_senderWallet, _signerWallet, _nonce);
}

/**
Expand Down
6 changes: 5 additions & 1 deletion source/delegate/contracts/interfaces/IDelegate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ interface IDelegate {
}

event Authorize(address signatory, address signer);
event DelegateSwap(uint256 nonce, address signerWallet);
event DelegatedSwapFor(
address indexed senderWallet,
address indexed signerWallet,
uint256 indexed nonce
);
event Revoke(address tmp, address signer);

event SetRule(
Expand Down
6 changes: 3 additions & 3 deletions source/delegate/test/Delegate.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ describe('Delegate Unit', () => {

await expect(
delegate.connect(signer).swap(sender.address, ...order)
).to.emit(delegate, 'DelegateSwap')
).to.emit(delegate, 'DelegatedSwapFor')
})

it('successfully swaps with a manager', async () => {
Expand Down Expand Up @@ -438,7 +438,7 @@ describe('Delegate Unit', () => {

await expect(
delegate.connect(signer).swap(sender.address, ...order)
).to.emit(delegate, 'DelegateSwap')
).to.emit(delegate, 'DelegatedSwapFor')
})

it('fails to swap with no rule', async () => {
Expand Down Expand Up @@ -555,7 +555,7 @@ describe('Delegate Unit', () => {

await expect(
delegate.connect(signer).swap(sender.address, ...order)
).to.emit(delegate, 'DelegateSwap')
).to.emit(delegate, 'DelegatedSwapFor')

const order2 = await createSignedOrderERC20({}, signer)

Expand Down
2 changes: 1 addition & 1 deletion source/delegate/test/DelegateIntegration.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe('Delegate Integration', () => {

await expect(
delegate.connect(signer).swap(sender.address, ...order)
).to.emit(delegate, 'DelegateSwap')
).to.emit(delegate, 'DelegatedSwapFor')

expect(await signerToken.balanceOf(sender.address)).to.equal(
DEFAULT_SIGNER_AMOUNT
Expand Down