Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
kcars-sys committed Dec 26, 2024
2 parents dbb1c49 + 97c256a commit 6950fd4
Show file tree
Hide file tree
Showing 219 changed files with 5,495 additions and 3,435 deletions.
107 changes: 107 additions & 0 deletions .github/workflows/file-size-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: File Size Checker

# Add required permissions
permissions:
contents: read
pull-requests: write
statuses: write

on:
pull_request:
types: [opened, synchronize]

jobs:
check-file-sizes:
name: File Size Check
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check file sizes
id: check-sizes
run: |
# Initialize variables for tracking findings
large_files=""
huge_files=""
# Get all files in the PR
echo "Files changed in PR:"
git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}
for file in $(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}); do
if [ -f "$file" ]; then
size=$(stat -c%s "$file")
size_mb=$(echo "scale=2; $size/1048576" | bc)
echo "Checking $file: ${size_mb}MB"
# Check for files over 40MB
if (( $(echo "$size_mb > 40" | bc -l) )); then
huge_files="${huge_files}* ${file} (${size_mb}MB)\n"
# Check for files over 10MB
elif (( $(echo "$size_mb > 10" | bc -l) )); then
large_files="${large_files}* ${file} (${size_mb}MB)\n"
fi
fi
done
# Print findings for debugging
echo "Large files found:"
echo -e "$large_files"
echo "Huge files found:"
echo -e "$huge_files"
# Set outputs for use in next steps
echo "large_files<<EOF" >> $GITHUB_OUTPUT
echo -e "$large_files" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "huge_files<<EOF" >> $GITHUB_OUTPUT
echo -e "$huge_files" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
# Fail if huge files are found
if [ ! -z "$huge_files" ]; then
echo "❌ Files over 40MB found!"
exit 1
fi
- name: Update Status and Comment
if: always()
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const hugeFiles = `${{ steps.check-sizes.outputs.huge_files }}`;
const largeFiles = `${{ steps.check-sizes.outputs.large_files }}`;
try {
// Only comment if issues were found
if (hugeFiles || largeFiles) {
let comment = '## ⚠️ File Size Check Results\n\n';
if (hugeFiles) {
comment += '### 🚫 Files over 40MB (Not Allowed):\n' + hugeFiles + '\n';
comment += '**These files must be removed from git history before the PR can be merged.**\n\n';
}
if (largeFiles) {
comment += '### ⚠️ Large Files (Over 10MB):\n' + largeFiles + '\n';
comment += 'Consider reducing the size of these files if possible.\n';
}
await github.rest.issues.createComment({
issue_number: context.payload.pull_request.number,
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
body: comment
});
}
} catch (error) {
console.error('Error:', error);
core.setFailed(error.message);
}
13 changes: 10 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
// Prettier
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true, // use ⌘-K S to format without saving
"editor.formatOnSave": true, // use ⌘-K S (or Ctrl-K S) to format without saving

// Disable built-in formatters
"html.format.enable": false,
Expand All @@ -15,8 +15,15 @@
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},

// ESLint
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.codeActionsOnSave": ["source.fixAll.eslint"],
"eslint.packageManager": "yarn",
"eslint.useESLintClass": true,
Expand Down
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,24 +86,31 @@ If you're a builder who wants to add or update your project on the [Base Ecosyst
```json
{
"name": "Your Project Name",
"tags": ["category"],
"description": "A brief description of your project (less than 200 characters)",
"url": "https://your-project-url.com",
"imageUrl": "/images/partners/your-project-logo.png"
"imageUrl": "/images/partners/your-project-logo.png",
"category": "Your Project Category",
"subcategory": "Your Project Subcategory"
}
```

- name: Your project's name
- tags: An array with _one_ of the following categories: `bridge`, `dao`, `defi`, `gaming`, `infra`, `nft`, `onramp`, `social`, `wallet`, `security`
- description: A brief description of your project, must be less than 200 characters
- url: Your project's website URL
- imageUrl: Path to your project's logo image
- category: Your project's category, _one_ of: `consumer`, `defi`, `infra`, `onramp`, `wallet`
- subcategory: Your project's subcategory, with the following options associated with each category
- `consumer`: _One_ of `creator`, `crypto taxes`, `dao`, `gaming`, `messaging`, `music`, `nft`, `payments`, `real world`, `social`
- `defi`: _One_ of `dex`, `dex aggregator`, `insurance`, `lending/borrowing`, `liquidity management`, `portfolio`, `stablecoin`, `yield vault`
- `infra`: _One_ of `ai`, `bridge`, `data`, `depin`, `developer tool`, `identity`, `node provider`, `raas`, `security`
- `onramp`: _One_ of `centralized exchange`, `fiat on-ramp`
- `wallet`: _One_ of `account abstraction`, `multisig`, `self-custody`

4. When adding and/or updating a logo, place a 192x192 pixel PNG file in the `web/apps/web/public/images/partners/`. The file should be named appropriately (e.g., your-project-name.png). The logo should be an App Store or Play Store iconographic version, not a full wordmark.

5. Create a pull request with your changes.

By opening a PR to add your project, you authorize and license to Coinbase on a non-exclusive, worldwide, irrevocable, sublicensable, and royalty free basis to reproduce, distribute, transmit, make available, perform, display, or otherwise use the submitted Multimedia Assets for any purpose, including any marketing or promotional activities related to Base or Coinbase. Any goodwill associated with use of trademarks submitted in your Multimedia Assets will inure to your benefit. You further acknowledge and represent that you have all IP rights in the Multimedia Assets, that the Multimedia Assets do not infringe the rights of any third party, and that you have the right to grant this license to Coinbase.
By opening a PR to add your project, you authorize and license Coinbase on a non-exclusive, worldwide, irrevocable, sublicensable, and royalty-free basis to reproduce, distribute, transmit, make available, perform, display, or otherwise use the submitted Multimedia Assets for any purpose, including any marketing or promotional activities related to Base or Coinbase. Any goodwill associated with use of trademarks submitted in your Multimedia Assets will inure to your benefit. You further acknowledge and represent that you have all IP rights in the Multimedia Assets, that the Multimedia Assets do not infringe the rights of any third party, and that you have the right to grant this license to Coinbase.

**Note:** Submissions do not guarantee inclusion and all submissions are subject to review. Your project must be live on Base to potentially be included. Ensure all information is accurate and up-to-date.

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ By the end of this lesson you should be able to:

By default, `public` functions can be called by **anyone**, without restriction. Often this is desirable. You want any user to be able to see what NFTs are for sale on your platform, sign up for a service, or read various items stored in state.

However, there will be many functions you **don't** want any user to be able to do, such as setting the fee for using the app, or withdrawing all of the funds in the contract! A common pattern to protect these functions is to use `modifier`s to make sure that only the owner can call these functions.
However, there will be many functions you **don't** want any user to be able to do, such as setting the fee for using the app, or withdrawing all funds in the contract! A common pattern to protect these functions is to use `modifier`s to make sure that only the owner can call these functions.

:::caution

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ contract StorageArray {

You cannot use a `storage` array as a function parameter, and you cannot write a function that `return`s a `storage` array.

Storage arrays are dynamic, unless they are declared with an explicit size. However, their functionality is limited compared to other languages. The `.push(value)` function works as expected. the `.pop()` function removes the last value of an array, but it **does not** return that value. You also **may not** use `.pop()` with an index to remove an element from the middle of an array, or to remove more than one element.
Storage arrays are dynamic, unless they are declared with an explicit size. However, their functionality is limited compared to other languages. The `.push(value)` function works as expected. The `.pop()` function removes the last value of an array, but it **does not** return that value. You also **may not** use `.pop()` with an index to remove an element from the middle of an array, or to remove more than one element.

You can use the `delete` keyword with an array. Doing so on an entire array will reset the array to zero length. Calling it on an element within the array will reset that value to its default. It **will not** resize the array!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ The simple and obvious solution is to simply iterate through `numbers` and count
Go ahead and write it on your own. It needs to:

- Instantiate a `uint` to hold the results
- Iterate through all of the values in `numbers` and increment that number if the value is even
- Iterate through all values in `numbers` and increment that number if the value is even
- Return the result

You should end up with something like:
Expand Down Expand Up @@ -170,7 +170,7 @@ uint[] public numbers;
uint numEven;
```

Add a new function called `debugLoadArray` that takes a `uint` called `_number` as an argument, and fills the array by looping through `_numbers` times, pushing each number into the array. **For now, _don't_ update `numEven`**.
Add a new function called `debugLoadArray` that takes a `uint` called `_number` as an argument, and fills the array by looping through `_number` times, pushing each number into the array. **For now, _don't_ update `numEven`**.

<details>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ A function called `adder`. It must:

- Accept two `uint` arguments, called `_a` and `_b`
- Return a `uint` `sum` and a `bool` `error`
- If `_a` + `_b` do not overflow, it should return the `sum` and an `error` of `false`
- If `_a` + `_b` overflow, it should return `0` as the `sum`, and an `error` of `true`
- If `_a` + `_b` does not overflow, it should return the `sum` and an `error` of `false`
- If `_a` + `_b` overflows, it should return `0` as the `sum`, and an `error` of `true`

### Subtractor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Is `public` the most appropriate [visibility specifier]?

It would work, but you won't be calling this function from within the contract, so `external` is more appropriate.

You also need to specify a return type, and we've decided this function should return a string. You'll learn more about this later, but in Solidity, many of the more complex types require you to specify if they are `storage` or `memory`. You can then have your function return a string of `"Hello World!`.
You also need to specify a return type, and we've decided this function should return a string. You'll learn more about this later, but in Solidity, many of the more complex types require you to specify if they are `storage` or `memory`. You can then have your function return a string of `"Hello World!"`.

Don't forget your semicolon. They're mandatory in Solidity!

Expand Down Expand Up @@ -136,7 +136,7 @@ function Greeter(string memory _name) external pure returns (string memory) {

Unfortunately, this does not work in Solidity. The error message you receive is a little confusing:

> TypeError: Operator + not compatible with types literal_string "Hello " and string memory.
> TypeError: Operator + not compatible with types literal_string "Hello" and string memory.
You might think that there is some sort of type casting or conversion error that could be solved by explicitly casting the string literal to string memory, or vice versa. This is a great instinct. Solidity is a very explicit language.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: Verify your contract and interact with it.
hide_table_of_contents: false
---

Once your contract is deployed, you can verify it using a number of popular services. Doing so will let you users have confidence that your contract does what you claim, and will allow you to interact with it using a similar interface to what you used in Remix.
Once your contract is deployed, you can verify it using a number of popular services. Doing so will let your users have confidence that your contract does what you claim, and will allow you to interact with it using a similar interface to what you used in Remix.

---

Expand Down Expand Up @@ -46,7 +46,7 @@ Click the linked address to your contract to return to the contract page. You'll

:::tip

If you have imports, you'll need to right click on the name of the file and choose `Flatten`. Submit the newly generated `filename_flattened.sol` for verification.
If you have imports, you'll need to right-click on the name of the file and choose `Flatten`. Submit the newly generated `filename_flattened.sol` for verification.

:::

Expand All @@ -69,7 +69,7 @@ With your contracts verified, you can interact with them using online tools and
[`sepolia.basescan.org`]: https://sepolia.basescan.org/
[coinbase]: https://www.coinbase.com/wallet
[faucet]: https://docs.base.org/tools/network-faucets
[set up]: https://www.youtube.com/watch?v=CZDgLG6jpgw
[set up]:
[coinbase settings]: https://docs.cloud.coinbase.com/wallet-sdk/docs/developer-settings
[BaseScan]: https://sepolia.basescan.org/
[faucets on the web]: https://coinbase.com/faucets
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ You now have the power to put smart contracts on the blockchain! You've only dep
[coinbase]: https://www.coinbase.com/wallet
[metamask]: https://metamask.io/
[faucet]: https://docs.base.org/tools/network-faucets
[set up]: https://www.youtube.com/watch?v=CZDgLG6jpgw
[set up]:
[coinbase settings]: https://docs.cloud.coinbase.com/wallet-sdk/docs/developer-settings
[Metamask Settings]: https://support.metamask.io/hc/en-us/articles/13946422437147-How-to-view-testnets-in-MetaMask
[BaseScan]: https://sepolia.basescan.org/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ The ERC-20 is a standard that allows for the development of fungible tokens and

By the end of this lesson you should be able to:

- Describe OpenZepplin
- Import the OpenZepplin ERC-20 implementation
- Describe OpenZeppelin
- Import the OpenZeppelin ERC-20 implementation
- Describe the difference between the ERC-20 standard and OpenZeppelin's ERC20.sol
- Build and deploy an ERC-20 compliant token

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ function badRandomLoopFixed() public view returns (uint) {
The `uint` type will _panic_ in the event of an overflow or underflow.

```solidity
function badSubstraction() public pure returns (uint) {
function badSubtraction() public pure returns (uint) {
uint first = 1;
uint second = 2;
return first - second;
Expand Down
2 changes: 1 addition & 1 deletion apps/base-docs/base-learn/docs/etherscan/etherscan-sbs.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ In this article, you'll learn about Etherscan, a blockchain explorer to inspect
By the end of this lesson, you should be able to:

- List some of the features of Etherscan
- Read data from the Bored Apes Yacht Club contract on Etherscan
- Read data from the Bored Ape Yacht Club contract on Etherscan
- Write data to a contract using Etherscan.

---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ Reuse `Lock__factory` but use the connect function and pass the address of the n
✔ should get the unlockTime value
✔ should have the right ether balance
✔ should have the right owner
✔ shouldn"t allow to withdraw before unlock time (51ms)
✔ shouldn"t allow to withdraw a non owner
✔ should allow to withdraw a owner
✔ shouldn't allow to withdraw before unlock time (51ms)
✔ shouldn't allow to withdraw a non owner
✔ should allow to withdraw an owner
6 passing (2s)
```
Expand All @@ -170,7 +170,7 @@ Reuse `Lock__factory` but use the connect function and pass the address of the n

Deploying to a real test network involves configuring the network parameters in the hardhat config file. You need to include parameters such as:

- The JSON RPC url
- The JSON RPC URL
- The account you want to use
- Real test ether or the native Blockchain token for gas costs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ Finally, test that the owner can withdraw. You can manipulate the time similarly
<summary>Reveal code</summary>

```tsx
it('should allow to withdraw a owner', async () => {
it('should allow to withdraw an owner', async () => {
const balanceBefore = await ethers.provider.getBalance(await lockInstance.getAddress());

// Its value will be the one we lock at deployment time.
Expand Down Expand Up @@ -320,7 +320,7 @@ You can then run `npx hardhat test` and you should get:
✔ should have the right owner
✔ shouldn"t allow to withdraw before unlock time (51ms)
✔ shouldn"t allow to withdraw a non owner
✔ should allow to withdraw a owner
✔ should allow to withdraw an owner
6 passing (2s)
```
Expand Down
2 changes: 1 addition & 1 deletion apps/base-docs/base-learn/docs/imports/imports-sbs.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The [docs] start with installation instructions, which we'll return to when we s

Find the documentation for the `EnumerableSet` under _Utils_. This library will allow you to create [sets] of `bytes32`, `address`, and `uint256`. Since they're enumerated, you can iterate through them. Neat!

### Implementing the OpenZeppelin EnumeratedSet
### Implementing the OpenZeppelin EnumerableSet

Create a new file to work in and add the `pragma` and license identifier.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Click the chevron to expand your contract in the Deployed Contracts section of t

![Function Buttons](../../assets/images/introduction-to-solidity/remix-contract-buttons.png)

Let's click the retrieve button first. Before clicking, make a prediction: given that the `number` variable was instantiated without a value, what do you thing the return will be?
Let's click the retrieve button first. Before clicking, make a prediction: given that the `number` variable was instantiated without a value, what do you think the return will be?

Go ahead and click – the result will appear below the button as:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The editor pane loads with the Remix home screen, which contains news, helpful l

![Remix Editor](../../assets/images/introduction-to-solidity/editor-pane.png)

You'll edit your code in the editor pane. It also has most of the features you're expecting, such as syntax and error highlighting. Note that in Remix, errors are not underlines. Instead, you'll see an❗to the left of the line number where the error is present.
You'll edit your code in the editor pane. It also has most of the features you're expecting, such as syntax and error highlighting. Note that in Remix, errors are not underlined. Instead, you'll see an❗to the left of the line number where the error is present.

At the top, you'll see a large green arrow similar to the _Run_ button in other editors. In Solidity, this compiles your code, but it does not run it because you must first deploy your code to the simulated blockchain.

Expand Down
Loading

0 comments on commit 6950fd4

Please sign in to comment.