Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
kasrakhosravi authored Nov 8, 2024
2 parents 95c3338 + 2ee1723 commit 972dcb5
Show file tree
Hide file tree
Showing 624 changed files with 35,780 additions and 6,578 deletions.
12 changes: 5 additions & 7 deletions .codeflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,17 @@ build:
- BaldurECR:
name: web
path: ./apps/web/Dockerfile
architecture: arm64
- BaldurECR:
name: docs
path: ./apps/base-docs/Dockerfile
architecture: amd64
- BaldurECR:
name: bridge
path: ./apps/bridge/Dockerfile
- BaldurECR:
name: goerli-bridge
path: ./apps/bridge/Dockerfile
- BaldurECR:
name: sepolia-bridge
path: ./apps/bridge/Dockerfile
architecture: amd64
multi_arch: true

operate:
slack_channels:
- "#base-codeflow-notifications"
- '#base-codeflow-notifications'
3 changes: 1 addition & 2 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
### AUTOGENERATED FILE
### Run `yarn codeowners` to update
./apps/web/ @base-org/based-apps-fe-reviewers
131 changes: 131 additions & 0 deletions .github/workflows/file-size-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
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: Setup environment
# run: |
# apt-get update
# apt-get install -y git bc

- 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 create status check if we have permission (not a fork PR)
if (context.payload.pull_request.head.repo.full_name === context.payload.repository.full_name) {
await github.rest.repos.createCommitStatus({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
sha: context.payload.pull_request.head.sha,
state: hugeFiles ? 'failure' : 'success',
context: 'File Size Check',
description: hugeFiles ? 'Files over 40MB found' : 'All files within size limits',
target_url: `https://github.com/${context.payload.repository.owner.login}/${context.payload.repository.name}/actions/runs/${context.runId}`
});
}
// Comments should work for both fork and non-fork PRs
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);
console.error('Context:', JSON.stringify(context.payload, null, 2));
// Only ignore status check permission errors for fork PRs
if (error.status === 403 && context.payload.pull_request.head.repo.full_name !== context.payload.repository.full_name) {
console.log('Ignoring status check permission error for fork PR');
} else {
core.setFailed(error.message);
}
}
18 changes: 18 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Unit Tests

on:
push:
branches:
- master
pull_request:
branches: [master]

jobs:
Jest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Run Tests
run: |
yarn install
yarn test
49 changes: 48 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
![Base](logo.webp)

# Base Web

Base is a secure, low-cost, developer-friendly Ethereum L2 built to bring the next billion users onchain. It's built on Optimism’s open-source [OP Stack](https://stack.optimism.io/).
Expand Down Expand Up @@ -68,6 +69,52 @@ yarn workspace @app/base-docs dev
yarn workspace @app/bridge dev
```

## Contribution
## Contributing

We welcome contributions to Base! To contribute, please see [CONTRIBUTING.md](CONTRIBUTING.md).

### Updating the Base Ecosystem Page

If you're a builder who wants to add or update your project on the [Base Ecosystem](https://base.org/ecosystem) page, follow these steps:

1. Fork this repository.

2. Create a new branch for your changes.

3. Update the `web/apps/web/src/data/ecosystem.json` with your project information. All fields are required. Each entry should follow this format:

```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"
}
```

- 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

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.

**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.

#### Tips for a successful submission

- App has been live on Base for at least 30 days
- App has a Terms of Service and Privacy Policy
- App supports HTTPS and 301 redirects HTTP requests
- App is not a TGE, ICO, airdrop, claim, or similar
- Active development and community engagement can be observed without issue

---

If you have any questions, please reach out to us in #developer-chat in the [Base Discord](https://base.org/discord).
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.
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.
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 @@ -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 @@ -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,23 +4,23 @@ 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.

---

## Objectives

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

- Verify a contract on the Base Sepolia testnet and interact with it in Etherscan
- Verify a contract on the Base Sepolia testnet and interact with it in [BaseScan]

---

### Verify the Contract

Make sure you still have the address of the contract you deployed in the last article copied to the clipboard.

You can interact with your deployed contract using Remix, the same as before, but it's also possible to interact with it through Etherscan. Paste your address in the search field to find it.
You can interact with your deployed contract using Remix, the same as before, but it's also possible to interact with it through BaseScan. Paste your address in the search field to find it.

On this page, you can review the balance, information about, and all the transactions that have ever occurred with your contract.

Expand Down Expand Up @@ -52,7 +52,7 @@ If you have imports, you'll need to right click on the name of the file and choo

### Interact with the Contract

You can now interact with your contract using Etherscan. Click the _Read Contract_ button. Both of your functions will be listed here and can be tested using the web interface.
You can now interact with your contract using BaseScan. Click the _Read Contract_ button. Both of your functions will be listed here and can be tested using the web interface.

You won't have anything under _Write Contract_ because this contract doesn't have any functions that save data to state.

Expand All @@ -71,5 +71,5 @@ With your contracts verified, you can interact with them using online tools and
[faucet]: https://docs.base.org/tools/network-faucets
[set up]: https://www.youtube.com/watch?v=CZDgLG6jpgw
[coinbase settings]: https://docs.cloud.coinbase.com/wallet-sdk/docs/developer-settings
[etherscan]: https://etherscan.io/
[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 @@ -12,7 +12,7 @@ Remix contains a simulation of a blockchain that you can use to rapidly deploy a

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

- Deploy a contract to the Base Sepolia testnet and interact with it in Etherscan
- Deploy a contract to the Base Sepolia testnet and interact with it in [BaseScan]

---

Expand Down Expand Up @@ -64,6 +64,10 @@ Open the _Deploy & Run Transactions_ tab. Under _Environment_, select _Injected

![Environment](../../assets/images/deployment-to-testnet/select-provider.png)

If that option is not available, you can add it by choosing `Customize this list...`

![Add Injected Wallet](../../assets/images/deployment-to-testnet/add-injected-provider.png)

The first time you do this, your wallet will ask you to confirm that you want to connect this app (Remix) to your wallet.

Once you are connected, you'll see the name of the network below the _Environment_ dropdown.
Expand Down Expand Up @@ -101,5 +105,5 @@ You now have the power to put smart contracts on the blockchain! You've only dep
[set up]: https://www.youtube.com/watch?v=CZDgLG6jpgw
[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
[etherscan]: https://etherscan.io/
[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 @@ -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
4 changes: 2 additions & 2 deletions apps/base-docs/base-learn/docs/error-triage/error-triage.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ The second item, at `0x20` has the error code of `32` hidden in it, which is for
It's sometimes better to just review the code first to see if the error is obvious.

```solidity
unction badGetLastValueFixed() public pure returns (uint) {
function badGetLastValueFixed() public pure returns (uint) {
uint[4] memory arr = [uint(1), 2, 3, 4];
return arr[arr.length-1];
Expand Down 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
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ describe("Lock tests", function () {

Notice that the previous code is logging the sender address and the logs coming from the transaction receipt. You are also decoding the `receipts.logs[0].data` field that contains the information emitted by the event but not in a human-readable way, since it is encoded. For that reason, you can use `AbiCoder` to decode the raw data.

By running `npx harhdat test`, you should be able to see the following:
By running `npx hardhat test`, you should be able to see the following:

```solidity
Lock tests
Expand Down
Loading

0 comments on commit 972dcb5

Please sign in to comment.