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

Deployed mock contracts #100 and approve scripts to aid swaps #99 #108

Merged
merged 8 commits into from
Dec 21, 2023

Conversation

blackbeard002
Copy link
Contributor

@blackbeard002 blackbeard002 commented Nov 23, 2023

Hey @0xneves, mock.ts script to deploy and mint ERC20 and ERC721.

This PR solves #100 and #99 . Ran the scripts on local hardhat.

@blackbeard002 blackbeard002 changed the title feat: deploy mock contracts #100 and feat: approve scripts to aid swaps #99 Deployed mock contracts #100 and approve scripts to aid swaps #99 Nov 23, 2023
Copy link
Contributor

@0xneves 0xneves left a comment

Choose a reason for hiding this comment

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

Hey @blackbeard002 I was reviewing your PR, and I couldn't find the approval scripts referred on the #99, only the deploy script was committed, could you check that, please?

And the indentation of the code you committed is very different than the standard we are using. We are currently using prettier in its standard config, which is set automatically when you add it:

{
  "trailingComma": "es5",
  "tabWidth": 4,
  "semi": false,
  "singleQuote": true
}

Copy link
Contributor

Choose a reason for hiding this comment

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

The file needs to be formatted following the protocol standard.

Copy link
Contributor

Choose a reason for hiding this comment

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

Definition of done:

  • Quotes fixed
  • Deploy Script
  • Mint Script

Detailed

  • Change single quotes to double quotes.
  • Split the file into a deploy script and a mint script for the Mock. This means you run the file and the contract is deployed to the selected network and nothing else. (params: contract as string and valid evm address, abi as any and signer as SignerWithAddress, return: the contract instance (See deploy script in utils))
  • In the second script, make it an external function passing the information needed as parameters without an initializer. (params: contract as Contract, amount as bigint, receiver as string (verify using ethers if it's a valid address, return: response from call).
  • Fix some comments that are not in the same pattern: lacking space between double slashes and lowercase letters.
  • Add overall try catch to display the error correctly instead of breaking the code.

This will facilitate to implement any sort of codes in the future since it will be very modularized.

@blackbeard002
Copy link
Contributor Author

Hey @0xneves I'm sorry I didn't write a seperate script for approve. I assumed it had to be written in the deploy script itself since #99 was a part of #100. My bad, I'll look into it and do the necessary changes along with the indentation.

@0xneves
Copy link
Contributor

0xneves commented Dec 6, 2023

We are thinking from the implementor's perspective where he needs to approve his user assets so they can swap their assets without transferring when the trade is created (btw, the trade created will not check for approvals, it will assume the approvals exist).

@blackbeard002
Copy link
Contributor Author

yeah got the context now

@blackbeard002
Copy link
Contributor Author

Hey @0xneves ready for review.

Copy link
Contributor

@0xneves 0xneves left a comment

Choose a reason for hiding this comment

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

Please help me fix these issues!

Copy link
Contributor

Choose a reason for hiding this comment

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

Definition of done:

  • Quotes fixed
  • Deploy Script
  • Mint Script

Detailed

  • Change single quotes to double quotes.
  • Split the file into a deploy script and a mint script for the Mock. This means you run the file and the contract is deployed to the selected network and nothing else. (params: contract as string and valid evm address, abi as any and signer as SignerWithAddress, return: the contract instance (See deploy script in utils))
  • In the second script, make it an external function passing the information needed as parameters without an initializer. (params: contract as Contract, amount as bigint, receiver as string (verify using ethers if it's a valid address, return: response from call).
  • Fix some comments that are not in the same pattern: lacking space between double slashes and lowercase letters.
  • Add overall try catch to display the error correctly instead of breaking the code.

This will facilitate to implement any sort of codes in the future since it will be very modularized.

Copy link
Contributor

Choose a reason for hiding this comment

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

Definition of done:

  • Quotes fixed
  • Approve Script

Detailed:

  • Change single quotes to double quotes.
  • Remove the main() initializer. Rename the export function into approve. Then add parameters: contract instance as Contract (Signer will already be msg.sender in this case), spender as valid EVM address, amountOrId as bigint, returns transaction response).
  • Remove any sorts of logs.
  • Fix some comments that are not in the same pattern: lacking space between double slashes and lowercase letters.
  • Add overall try catch to display the error correctly instead of breaking the code.

This way the script can be used for both ERC20 and ERC721 functions dynamically.

Copy link
Contributor Author

@blackbeard002 blackbeard002 Dec 8, 2023

Choose a reason for hiding this comment

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

Hey @0xneves,
Also about the single quote to double quotes changes, the prettier config standard you mentioned earlier has "singleQuote": true. So it was all switched to single quotes. should this value be removed or something from the prettier yml? For now I'm changing it to doubleQuote:true since you asked me to change single quotes to double quotes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hey @0xneves, Also about the single quote to double quotes changes, the prettier config standard you mentioned earlier has "singleQuote": true. So it was all switched to single quotes. should this value be removed or something from the prettier yml? For now I'm changing it to doubleQuote:true since you asked me to change single quotes to double quotes.

Hey @blackbeard002
The mentioned issue was fixed in #128

@0xneves
Copy link
Contributor

0xneves commented Dec 19, 2023

Hey @blackbeard002 Talked to you in discord, let's speed this up as it is review for almost a month now 🥵

@blackbeard002
Copy link
Contributor Author

yeah I'm on it

@blackbeard002
Copy link
Contributor Author

Hey @0xneves, ready for review. I've made changes according to the info and params mentioned here on this PR chat. Lemme know if any changes are needed.

Copy link
Contributor

@0xneves 0xneves left a comment

Choose a reason for hiding this comment

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

Awesome @blackbeard002 !!

I'm approving this PR

@0xneves 0xneves merged commit f691528 into blockful-io:main Dec 21, 2023
3 checks passed
@blackbeard002 blackbeard002 deleted the deploy branch May 19, 2024 12:23
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