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

Delegates #1309

Merged
merged 50 commits into from
May 27, 2024
Merged

Delegates #1309

merged 50 commits into from
May 27, 2024

Conversation

smartcontrart
Copy link
Contributor

No description provided.

smartcontrart and others added 30 commits December 13, 2023 20:48
…ons to ensure both contracts compile simultaneously
… contract accordingly. Removed the delegateFactory contract
… contract accordingly. Removed the delegateFactory contract
Copy link

openzeppelin-code bot commented May 10, 2024

Delegates

Generated at commit: 97d3d82c5e17a013f467716d9ea4487c165d366f

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
1
1
0
7
25
34
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

Copy link
Contributor Author

@smartcontrart smartcontrart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a bug with the commit message and the wrong one went through.
This PR is to remove an unused folder and revert the custom abis we had to match develop/main

@@ -0,0 +1,19 @@
Copyright 2023 AirSwap
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2024

source/delegate/README.md Outdated Show resolved Hide resolved
if (_senderWallet != msg.sender) revert SenderInvalid();
}
Rule storage rule = rules[_senderWallet][_senderToken][_signerToken];
rule.senderAmount = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would we gain anything by zeroing out the other fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally didn't do it to save on gas. But the additional security might be worth the gas (which won't be much)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about just something like delete rules[_senderWallet][_senderToken][_signerToken];

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely... No idea why I wrote that horror...

}

if (rule.senderAmount < _senderAmount) {
revert InsufficientDelegateAllowance();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"InvalidSenderAmount" to match the above.

}

/**
* @notice Revoke the signatory
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Revoke a manager"

{
"name": "@airswap/delegate",
"version": "4.1.4",
"description": "AirSwap: Trade intent delegates",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"AirSwap: Delegate On-chain Trading Rules"

@smartcontrart smartcontrart merged commit da05cb9 into develop May 27, 2024
1 check passed
smartcontrart added a commit that referenced this pull request Jul 18, 2024
* publish libraries 4.2.1-beta.0

* Bump follow-redirects from 1.15.5 to 1.15.6 (#1302)

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.5 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](follow-redirects/follow-redirects@v1.15.5...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Batch registry call (#1295)

* Created Registry interface and imported in BatchCall

* Created getTokensForStakers

* Ran Prettier

* Switched to solady lib for ERC20 calls

---------

Co-authored-by: Don Mosites <[email protected]>

* Bump express from 4.18.3 to 4.19.2 (#1303)

Bumps [express](https://github.com/expressjs/express) from 4.18.3 to 4.19.2.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](expressjs/express@4.18.3...4.19.2)

---
updated-dependencies:
- dependency-name: express
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump undici from 5.28.3 to 5.28.4 (#1304)

Bumps [undici](https://github.com/nodejs/undici) from 5.28.3 to 5.28.4.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](nodejs/undici@v5.28.3...v5.28.4)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump ejs from 3.1.9 to 3.1.10 (#1308)

Bumps [ejs](https://github.com/mde/ejs) from 3.1.9 to 3.1.10.
- [Release notes](https://github.com/mde/ejs/releases)
- [Commits](mde/ejs@v3.1.9...v3.1.10)

---
updated-dependencies:
- dependency-name: ejs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Delegates (#1309)

* Imported Delegate and Indexer contracts and Fixed Delegate code to allow compilation

* Updated Indexer code to compile with Solidity 0.8.17

* Updated licenses for Delegates and Indexer contracts

* Removed constructor visibility and updated Delegate/Indexer interactions to ensure both contracts compile simultaneously

* Removed the indexer boilerplate and adjusted the delegate placeholder contract accordingly. Removed the delegateFactory contract

* Removed the indexer boilerplate and adjusted the delegate placeholder contract accordingly. Removed the delegateFactory contract

* Removed IDelegateFactoryContract

* Created basics of the swap function for the delegate contract

* Fixed token transfers

* Removed unecessary variable

* Removed unused imports in Delegate tests

* Removed unused imports in Delegate tests

* Fixed transfer amounts

* Updated recipient to delegator in swapERC20

* Renamed signer to delegator and sender to taker

* Renamed signer and sender to delegator and taker for clarity and added tracking of remaining rule allowance

* Created delegate integration test

* Removed unused variables

* updated delegates contract to solady library

* delegates: cleanup deps; remove redundants

* name updates; test quickfix

* prettier

* Renamed _maxDelegatorAmount to _maxSenderAmount for consistency

* Added test to check delegate allowance

* Added internal rule tests

* Implemented Delegate price check

* Separated setting and unsetting rules tests

* Specified DEFAULT_SIGNER_AMOUNT and DEFAULT_SENDER_AMOUNT in tests. Added a test case when SENDER_AMOUNT is above requirements

* Removed test to check if sender can send more token that defined in the rule

* Implemented signatory logic allowing sender to delegate rule setting on their behalf

* Wrote delegate deploy script

* Removed unecessary scripts

* updated deploy.js.d.ts

* Fixed chain name import

* Deployed to Sepolia

* Renamed Signatory to Manager, adjusted tests accordingly

* Deployed to Sepolia

* prettier

* restore abis

* Updated copyright date

* PR comments, added swapERC20 setter and fixed ownership initialization

* zeroed out all fields in the rule when unsetting

* Refactored rule reset on unset

---------

Co-authored-by: Don Mosites <[email protected]>

* @airswap/delegate: update utils version; update yarn.lock

* Prepared neon and neondevnet deployment

* Deployment to Neon Devnet

* Deployed wrapper

* update utils deps to latest

* update neonscan vars

* update env.example

* restore yarn.lock

* Removed Delegates

* Deployed on Neon mainnet

* Verified contracts and transfered ownership on Neon

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: don mosites <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants