Skip to content

Commit

Permalink
feat!: make Arbitrum One the default chain
Browse files Browse the repository at this point in the history
  • Loading branch information
chmanie committed Oct 23, 2024
1 parent c84bb1d commit e374bc2
Show file tree
Hide file tree
Showing 30 changed files with 82 additions and 71 deletions.
9 changes: 9 additions & 0 deletions .changeset/brave-impalas-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@colony/colony-js": major
"@colony/events": major
"@colony/tokens": major
"@colony/core": major
"@colony/sdk": major
---

Make Arbitrum One the default network in all cases. While this can be considered a breaking change it does not change any of the APIs.
8 changes: 4 additions & 4 deletions packages/colony-js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { getColonyNetworkClient, ColonRpcEndpoint, Id, Network, Tokens } from '@

const { formatEther } = utils;

const provider = new providers.JsonRpcProvider(ColonyRpcEndpoint.Gnosis);
const provider = new providers.JsonRpcProvider(ColonyRpcEndpoint.ArbitrumOne);

const start = async () => {
// Get a wallet instance
Expand All @@ -35,16 +35,16 @@ const start = async () => {
// Check out the logs to see the wallet address
console.log('Wallet Address:', wallet.address);

// Get a network client instance for Gnosis Chain
// Get a network client instance for ArbitrumOne Chain
const networkClient = getColonyNetworkClient(
Network.Gnosis,
Network.ArbitrumOne,
wallet,
);

// Let's connect to the Meta Colony
const metaColonyClient = await networkClient.getMetaColonyClient()
// And check out it's CLNY funding
const funding = await metaColonyClient.getFundingPotBalance(Id.RootPot, Tokens.Gnosis.CLNY);
const funding = await metaColonyClient.getFundingPotBalance(Id.RootPot, Tokens.ArbitrumOne.CLNY);
// We can also see its address
const { address } = metaColonyClient;
console.info(`${formatEther(funding)} CLNY in root domain of MetaColony with address: ${address}`);
Expand Down
4 changes: 2 additions & 2 deletions packages/colony-js/docs/api/enums/ColonyRpcEndpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ Official Colony RPC2 endpoint (node)

### ArbitrumOne

**ArbitrumOne** = ``"https://arbitrum.colony.io/publicrpc/"``
**ArbitrumOne** = ``"https://app.colony.io/public-rpc/"``

Colony's own RPC2 endpoint for Arbitrum One

___

### ArbitrumSepolia

**ArbitrumSepolia** = ``"https://arbitrum-sepolia.colony.io/publicrpc/"``
**ArbitrumSepolia** = ``"https://arbitrum-sepolia.colony.io/public-rpc/"``

Colony's own RPC2 endpoint for Arbitrum Sepolia testnet

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ HTTP endpoint of the official Colony MetaTransaction (gasless transaction) broad

### ArbitrumOne

**ArbitrumOne** = ``"https://arbitrum.colony.io/metatransaction/arbitrum-one"``
**ArbitrumOne** = ``"https://app.colony.io/metatransaction/arbitrum-one"``

The metatransaction broadcaster endpoint on Arbitrum One

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ HTTP endpoint of the official Colony reputation oracle

### ArbitrumOne

**ArbitrumOne** = ``"https://arbitrum.colony.io/reputation/arbitrum-one"``
**ArbitrumOne** = ``"https://app.colony.io/reputation/arbitrum-one"``

___

Expand Down
6 changes: 3 additions & 3 deletions packages/colony-js/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ const start = async () => {
// Check out the logs to see the wallet address
console.log('Wallet Address:', wallet.address);

// Get a network client instance for Gnosis Chain
// Get a network client instance for Arbitrum One
const networkClient = await getColonyNetworkClient(
Network.Gnosis,
Network.ArbitrumOne,
wallet,
);

// Let's connect to the Meta Colony
const metaColonyClient = await networkClient.getMetaColonyClient()
// And check out it's CLNY funding
const funding = await metaColonyClient.getFundingPotBalance(Id.RootPot, Tokens.Gnosis.CLNY);
const funding = await metaColonyClient.getFundingPotBalance(Id.RootPot, Tokens.ArbitrumOne.CLNY);
// We can also see its address
const { address } = metaColonyClient;
console.info(`${formatEther(funding)} CLNY in root domain of MetaColony with address: ${address}`);
Expand Down
6 changes: 3 additions & 3 deletions packages/colony-js/src/__tests__/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ import getColonyNetworkClient from '../clients/ColonyNetworkClient.js';
let provider: JsonRpcProvider;

beforeAll(async () => {
provider = new providers.JsonRpcProvider(ColonyRpcEndpoint.Gnosis);
provider = new providers.JsonRpcProvider(ColonyRpcEndpoint.ArbitrumOne);
});

describe('ColonyNetwork', () => {
it('Can get the colony network', async () => {
const colonyNetworkClient = getColonyNetworkClient(
Network.Gnosis,
Network.ArbitrumOne,
provider,
);
const metaColonyAddress = await colonyNetworkClient.getMetaColony();
expect(metaColonyAddress).toEqual(
'0xCFD3aa1EbC6119D80Ed47955a87A9d9C281A97B3',
'0xa405A3353Bc7d6048C64BC3663f665A01fF3f43f',
);
});
});
8 changes: 4 additions & 4 deletions packages/core/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export enum ReputationOracleEndpoint {
Xdai = 'https://xdai.colony.io/reputation/xdai',
XdaiQa = 'https://qa-xdai.colony.io/reputation/xdai',
Custom = 'http://localhost:3000',
ArbitrumOne = 'https://arbitrum.colony.io/reputation/arbitrum-one',
ArbitrumOne = 'https://app.colony.io/reputation/arbitrum-one',
ArbitrumSepolia = `https://arbitrum-sepolia.colony.io/reputation/arbitrum-sepolia`,
}

Expand All @@ -89,7 +89,7 @@ export enum MetaTxBroadCasterEndpoint {
/** The metatransaction broadcaster endpoint for a custom network */
Custom = '',
/** The metatransaction broadcaster endpoint on Arbitrum One */
ArbitrumOne = 'https://arbitrum.colony.io/metatransaction/arbitrum-one',
ArbitrumOne = 'https://app.colony.io/metatransaction/arbitrum-one',
/** The metatransaction broadcaster endpoint on Arbitrum Sepolia testnet */
ArbitrumSepolia = `https://arbitrum-sepolia.colony.io/metatransaction/arbitrum-sepolia`,
}
Expand All @@ -111,9 +111,9 @@ export enum ColonyRpcEndpoint {
/** Colony's own RPC2 endpoint for a custom network */
Custom = '',
/** Colony's own RPC2 endpoint for Arbitrum One */
ArbitrumOne = 'https://arbitrum.colony.io/publicrpc/',
ArbitrumOne = 'https://app.colony.io/public-rpc/',
/** Colony's own RPC2 endpoint for Arbitrum Sepolia testnet */
ArbitrumSepolia = 'https://arbitrum-sepolia.colony.io/publicrpc/',
ArbitrumSepolia = 'https://arbitrum-sepolia.colony.io/public-rpc/',
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/helpers/reputation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class ReputationClient {
this.colony = colony;
this.network = network;

const networkName = config?.network || Network.Gnosis;
const networkName = config?.network || Network.ArbitrumOne;
this.endpointUrl =
config?.customEndpointUrl || ReputationOracleEndpoint[networkName];
}
Expand Down
4 changes: 2 additions & 2 deletions packages/events/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# `@colony/events`

This package contains pre-compiled Colony event contract bindings. These bindings contain types and ABIs for all events for all contracts across all versions in the Colony Network. You could use them in conjunction with the [EventManger from Colony SDK](https://docs.colony.io/colonysdk/api/classes/ColonyEventManager):
This package contains pre-compiled Colony event contract bindings. These bindings contain types and ABIs for all events for all contracts across all versions in the Colony Network. You could use them in conjunction with the [EventManager from Colony SDK](https://docs.colony.io/colonysdk/api/classes/ColonyEventManager):

```ts
import { providers } from 'ethers';
Expand All @@ -17,7 +17,7 @@ import {
MetadataType,
} from '@colony/sdk';

const provider = new providers.JsonRpcProvider(ColonyRpcEndpoint.Gnosis);
const provider = new providers.JsonRpcProvider(ColonyRpcEndpoint.ArbitrumOne);

const manager = new ColonyEventManager(provider);
const colonyEventSource = manager.createEventSource(ColonyEventsFactory);
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { providers } from 'ethers';
import { ColonyNetwork, toEth } from '@colony/sdk';

// If MetaMask is installed there will be an `ethereum` object on the `window`
// NOTE: Make sure MetaMask is connected to Gnosis chain (see https://www.xdaichain.com/for-users/wallets/metamask/metamask-setup)
// NOTE: Make sure MetaMask is connected to ArbitrumOne chain (use https://app.colony.io/public-rpc or see https://chainlist.org/chain/42161)
const provider = new providers.Web3Provider(window.ethereum);

// Get the MetaColony's CLNY funding in the root team (id 1)
Expand Down Expand Up @@ -81,7 +81,7 @@ pnpm run examples:browser

### Some notes

These examples will run on Gnosis chain. If you'd like to make transactions, you will need some XDAI. Reach out to us in our [Discord](https://discord.gg/feVZWwysqM) if you're having trouble starting out.
These examples will run on the Arbitrum One chain. If you'd like to make transactions, you will need some ETH on that chain. Reach out to us in our [Discord](https://discord.gg/feVZWwysqM) if you're having trouble starting out.

## Development

Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/docs/api/classes/Colony.md
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ Get the xDAI balance of the team number 2
```typescript
import { constants } from 'ethers';
import { toEth } from '@colony/sdk';
// The `AddressZero` means ETH on mainnet and xDAI on Gnosis chain
// The `AddressZero` means ETH on most networks
const balance = await colony.getBalance(constants.AddressZero, 2);
// This will format the balance as a string in eth and not wei (i.e. 1.0 vs. 1000000000000000000)
console.info(toEth(balance));
Expand Down
10 changes: 5 additions & 5 deletions packages/sdk/docs/api/classes/ColonyNetwork.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ From here you should be able to instantiate all the required instances for Colon
import { providers } from 'ethers';
import { ColonyNetwork, ColonyRpcEndpoint, Tokens } from '@colony/sdk';

// Connect directly to the deployed Colony Network on Gnosis Chain
const provider = new providers.JsonRpcProvider(ColonyRpcEndpoint.Gnosis);
// Connect directly to the deployed Colony Network on Arbitrum One
const provider = new providers.JsonRpcProvider(ColonyRpcEndpoint.ArbitrumOne);
const colonyNetwork = new ColonyNetwork(provider);
// Now you could call functions on the colonyNetwork, like `colonyNetwork.getMetaColony()`
```
Expand All @@ -44,7 +44,7 @@ ___

**network**: [`Network`](../enums/Network.md)

The network the client is connected to. Defaults to Gnosis chain
The network the client is connected to. Defaults to Arbitrum One

___

Expand Down Expand Up @@ -90,7 +90,7 @@ import { Tokens } from '@colony/sdk';
// IPFS hash to an image file
colonyAvatarHash: 'QmS26o1Cmsrx7iw1SSFGEcy22TVDq6VmEZ4XNjpWFyaKUe',
// List of token addresses that the Colony should be initialized with (can be changed later) - excluding ETH and the native token from above
colonyTokens: [Tokens.Gnosis.CLNY],
colonyTokens: [Tokens.ArbitrumOne.CLNY],
}).tx().mined();
})();
```
Expand Down Expand Up @@ -149,7 +149,7 @@ See the [Colony Creation Guide](../../guides/colony-creation.md).
// Create a colony
// (forced transaction example)
await colonyNetwork
// Use USDC on Gnosis chain as the native token
// Use USDC on Arbitrum One as the native token
.createColony('0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83', 'coolony')
.tx().mined();
})();
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/docs/api/classes/OneTxPayment.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ import { Id, Tokens, w } from '@colony/sdk';

// Immediately executing async function
(async function() {
// Pay 10 XDAI (on Gnosis chain) from the root domain to the following address
// Pay 10 CLNY (on ArbitrumOne chain) from the root domain to the following address
// (forced transaction example)
await colony.ext.oneTx.pay(
'0xb77D57F4959eAfA0339424b83FcFaf9c15407461',
w`10`,
Id.RootDomain,
Tokens.Gnosis.XDAI,
Tokens.ArbitrumOne.CLNY,
).tx().mined();
})();
```
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/docs/api/enums/ColonyRpcEndpoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ Official Colony RPC2 endpoint (node)

### ArbitrumOne

**ArbitrumOne** = ``"https://arbitrum.colony.io/publicrpc/"``
**ArbitrumOne** = ``"https://app.colony.io/public-rpc/"``

Colony's own RPC2 endpoint for Arbitrum One

___

### ArbitrumSepolia

**ArbitrumSepolia** = ``"https://arbitrum-sepolia.colony.io/publicrpc/"``
**ArbitrumSepolia** = ``"https://arbitrum-sepolia.colony.io/public-rpc/"``

Colony's own RPC2 endpoint for Arbitrum Sepolia testnet

Expand Down
10 changes: 5 additions & 5 deletions packages/sdk/docs/getting-started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ npm install ethers @colony/sdk

You'll need `ethers` v5.x as a dependency in your project.

## Connecting to Colony on Gnosis Chain
## Connecting to Colony on ArbitrumOne Chain

<Tabs>
<TabItem value="browser" label="In the browser (using MetaMask)" default>
Expand All @@ -41,7 +41,7 @@ import { providers } from 'ethers';
import { ColonyNetwork, toEth } from '@colony/sdk';

// If MetaMask is installed there will be an `ethereum` object on the `window`
// NOTE: Make sure MetaMask is connected to Gnosis chain (see https://docs.gnosischain.com/tools/wallets/metamask)
// NOTE: Make sure MetaMask is connected to ArbitrumOne chain (use https://app.colony.io/public-rpc or see https://chainlist.org/chain/42161)
const provider = new providers.Web3Provider(window.ethereum);

// Get the Colony's XDAI funding in the ROOT pot (id 1)
Expand All @@ -68,12 +68,12 @@ Include the resulting bundle in an HTML file and open it in you favorite browser

```javascript
const { providers, Wallet } = require('ethers');
const { ColonyNetwork } = require('@colony/sdk');
const { ColonyNetwork, ColonyRpcEndpoint } = require('@colony/sdk');

const provider = new providers.JsonRpcProvider('https://xdai.colony.io/rpc/');
const provider = new providers.JsonRpcProvider(ColonyRpcEndpoint.ArbitrumOne);
const wallet = Wallet.createRandom().connect(provider);

// Get the Colony's XDAI funding in the ROOT pot (id 1)
// Get the Colony's CLNY funding in the ROOT pot (id 1)
const start = async () => {
// Create a new connection to the Colony Network contracts using the MetaMask "wallet"
const colonyNetwork = new ColonyNetwork(wallet);
Expand Down
9 changes: 5 additions & 4 deletions packages/sdk/docs/guides/colony-creation.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ These examples assume that the user executing the transactions has funds in thei

## Step 1 - Deploying the Colony contract (and optionally its token)

The most important step. Here the actualy Colony contract will be deployed. This happens by executing a contract method on the `ColonyNetwork` (as opposed to a deploy-transaction):
The most important step. Here the actual Colony contract will be deployed. This happens by executing a contract method on the `ColonyNetwork` (as opposed to a deploy-transaction):

```typescript
import { providers } from 'ethers';
import { ColonyNetwork, ColonyRpcEndpoint, Wallet } from '@colony/sdk';

// Prepare your provider and signer (wallet)
const provider = new providers.JsonRpcProvider(ColonyRpcEndpoint.Gnosis);
const provider = new providers.JsonRpcProvider(ColonyRpcEndpoint.ArbitrumOne);
const wallet = Wallet.createRandom().connect(provider);
// Instantiate Colony Network
const colonyNetwork = new ColonyNetwork(wallet);
Expand All @@ -41,9 +41,10 @@ One can specify the token name, its symbol and even its decimals (even though it
You can also use an already existing token. For that, instead of passing in the token's details as the first argument, just use the token's address (it needs to be in the same chain your Colony is deployed in), like so:

```typescript
// Use USDC on Gnosis chain as the native token
import { Tokens } from '@colony/sdk';
// Use USDC on ArbitrumOne chain as the native token
const [{ colonyAddress }] = await colonyNetwork
.createColony('0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83', 'anothertestname')
.createColony(Tokens.ArbitrumOne.USDC, 'anothertestname')
.tx().mined();
```

Expand Down
6 changes: 3 additions & 3 deletions packages/sdk/examples/browser/src/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import {

const { formatEther, isAddress } = utils;

const provider = new providers.JsonRpcProvider(ColonyRpcEndpoint.Gnosis);
const provider = new providers.JsonRpcProvider(ColonyRpcEndpoint.ArbitrumOne);

// Get the Colony's CLNY funding in the root domain (on Gnosis chain)
// Get the Colony's CLNY funding in the root domain (on Arbitrum One)
const getColonyFunding = async (colonyAddress: string) => {
const colonyNetwork = new ColonyNetwork(provider);
const colony = await colonyNetwork.getColony(colonyAddress);
const funding = await colony.getBalance(Tokens.Gnosis.CLNY);
const funding = await colony.getBalance(Tokens.ArbitrumOne.CLNY);
return formatEther(funding);
};

Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/examples/browser/src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from '../../../src/index.js';
import type { ColonyEvent } from '../../../src/index.js';

const provider = new providers.JsonRpcProvider(ColonyRpcEndpoint.Gnosis);
const provider = new providers.JsonRpcProvider(ColonyRpcEndpoint.ArbitrumOne);
const { isAddress } = utils;

// This event listener will only list for the `DomainAdded` event in the Colony of the user's choice. Run this and then create a Team in that Colony, to see it being picked up here
Expand Down
12 changes: 6 additions & 6 deletions packages/sdk/examples/browser/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ const addColonyRPC = () => {
method: 'wallet_addEthereumChain',
params: [
{
chainId: '0x64',
chainName: 'Gnosis Chain via Colony',
chainId: '0xa4b1',
chainName: 'Arbitrum One via Colony',
nativeCurrency: {
name: 'xDAI',
symbol: 'XDAI',
name: 'Ether',
symbol: 'ETH',
decimals: 18,
},
rpcUrls: [ColonyRpcEndpoint.Gnosis],
blockExplorerUrls: ['https://blockscout.com/xdai/mainnet'],
rpcUrls: [ColonyRpcEndpoint.ArbitrumOne],
blockExplorerUrls: ['https://arbiscan.io/'],
},
],
});
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/examples/browser/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h1>Colony SDK browser demos</h1>
href="https://github.com/JoinColony/colonyStarter">colonyStarter</a> for more information.</p>
<p>Check out the source code for the examples <a
href="https://github.com/JoinColony/colonyJS/tree/main/packages/sdk/examples/browser/src">here</a>.</p>
<p>These demos interact with LIVE Colonies on Gnosis chain. We recommend to use the <a href="#" id="add_rpc">Colony
<p>These demos interact with LIVE Colonies on ArbitrumOne chain. We recommend to use the <a href="#" id="add_rpc">Colony
RPC endpoint</a> directly.</p>
<ul>
<li>
Expand Down
Loading

0 comments on commit e374bc2

Please sign in to comment.