Skip to content

Commit

Permalink
Add symbiotic pufeETH (pufETHs)
Browse files Browse the repository at this point in the history
  • Loading branch information
9inpachi committed Feb 4, 2025
1 parent 3cb562a commit 65d2c65
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 46 deletions.
25 changes: 0 additions & 25 deletions lib/contracts/addresses.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Chain } from '../chains/constants';
import { UnifiToken } from './tokens';

// Source of truth:
// https://github.com/PufferFinance/Deployments-and-ACL/tree/main/docs/deployments
Expand Down Expand Up @@ -28,27 +27,3 @@ export const CONTRACT_ADDRESSES = {
L2RewardManager: '0xF9Dd335bF363b2E4ecFe3c94A86EBD7Dd3Dcf0e7',
},
};

export const NUCLEUS_CONTRACT_ADDRESSES = {
[UnifiToken.unifiETH]: {
[Chain.Mainnet]: {
NucleusBoringVault: '0x196ead472583bc1e9af7a05f860d9857e1bd3dcc',
NucleusAccountant: '0xa9fb7e2922216debe3fd5e1bbe7591ee446dc21c',
NucleusTeller: '0x08eb2eccdf6ebd7aba601791f23ec5b5f68a1d53',
},
},
[UnifiToken.unifiUSD]: {
[Chain.Mainnet]: {
NucleusBoringVault: '0x82c40e07277eBb92935f79cE92268F80dDc7caB4',
NucleusAccountant: '0xe0bDb7b9225A2CeB42998dc2E51D4D3CDeb7e3Be',
NucleusTeller: '0x5d3Fb47FE7f3F4Ce8fe55518f7E4F7D6061B54DD',
},
},
[UnifiToken.unifiBTC]: {
[Chain.Mainnet]: {
NucleusBoringVault: '0x170d847a8320f3b6a77ee15b0cae430e3ec933a0',
NucleusAccountant: '0x2afb28b0561d99b5e00829ec2ef54946a00a35f7',
NucleusTeller: '0x0743647a607822781f9d0a639454e76289182f0b',
},
},
};
8 changes: 3 additions & 5 deletions lib/contracts/handlers/nucleus-accountant-handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { mockAccount, testingUtils } from '../../../test/setup-tests';
import { generateAddress } from '../../../test/mocks/address';
import { Address } from 'viem';
import { UnifiToken } from '../tokens';
import { NUCLEUS_CONTRACT_ADDRESSES } from '../addresses';
import { VAULTS_ADDRESSES } from '../vaults-addresses';

describe('NucleusAccountantHandler', () => {
const contractTestingUtils = testingUtils.generateContractUtils(
Expand Down Expand Up @@ -80,16 +80,14 @@ describe('NucleusAccountantHandler', () => {
.withToken(UnifiToken.unifiBTC)
.getContract();
expect(unifiBTCAccountant.address).toEqual(
NUCLEUS_CONTRACT_ADDRESSES[UnifiToken.unifiBTC][Chain.Mainnet]
.NucleusAccountant,
VAULTS_ADDRESSES[UnifiToken.unifiBTC][Chain.Mainnet].NucleusAccountant,
);

const unifiUSDAcountant = handler
.withToken(UnifiToken.unifiUSD)
.getContract();
expect(unifiUSDAcountant.address).toEqual(
NUCLEUS_CONTRACT_ADDRESSES[UnifiToken.unifiUSD][Chain.Mainnet]
.NucleusAccountant,
VAULTS_ADDRESSES[UnifiToken.unifiUSD][Chain.Mainnet].NucleusAccountant,
);
});
});
4 changes: 2 additions & 2 deletions lib/contracts/handlers/nucleus-accountant-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
GetContractReturnType,
} from 'viem';
import { Chain } from '../../chains/constants';
import { NUCLEUS_CONTRACT_ADDRESSES } from '../addresses';
import { VAULTS_ADDRESSES } from '../vaults-addresses';
import { NUCLEUS_ACCOUNTANT_ABIS } from '../abis/nucleus-accountant-abis';
import { UnifiToken } from '../tokens';

Expand Down Expand Up @@ -54,7 +54,7 @@ export class NucleusAccountantHandler {
* @returns The viem contract.
*/
public getContract() {
const address = NUCLEUS_CONTRACT_ADDRESSES[this.token][this.chain]
const address = VAULTS_ADDRESSES[this.token][this.chain]
.NucleusAccountant as Address;
const abi = NUCLEUS_ACCOUNTANT_ABIS[this.chain].Accountant;
const client = { public: this.publicClient, wallet: this.walletClient };
Expand Down
8 changes: 3 additions & 5 deletions lib/contracts/handlers/nucleus-boring-vault-handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { mockAccount, testingUtils } from '../../../test/setup-tests';
import { NucleusBoringVaultHandler } from './nucleus-boring-vault-handler';
import { NUCLEUS_BORING_VAULT_ABIS } from '../abis/nucleus-boring-vault-abis';
import { generateAddress } from '../../../test/mocks/address';
import { NUCLEUS_CONTRACT_ADDRESSES } from '../addresses';
import { VAULTS_ADDRESSES } from '../vaults-addresses';
import { UnifiToken } from '../tokens';

describe('NucleusBoringVaultHandler', () => {
Expand Down Expand Up @@ -113,16 +113,14 @@ describe('NucleusBoringVaultHandler', () => {
.withToken(UnifiToken.unifiBTC)
.getContract();
expect(unifiBTCBoringVault.address).toEqual(
NUCLEUS_CONTRACT_ADDRESSES[UnifiToken.unifiBTC][Chain.Mainnet]
.NucleusBoringVault,
VAULTS_ADDRESSES[UnifiToken.unifiBTC][Chain.Mainnet].NucleusBoringVault,
);

const unifiUSDBoringVault = handler
.withToken(UnifiToken.unifiUSD)
.getContract();
expect(unifiUSDBoringVault.address).toEqual(
NUCLEUS_CONTRACT_ADDRESSES[UnifiToken.unifiUSD][Chain.Mainnet]
.NucleusBoringVault,
VAULTS_ADDRESSES[UnifiToken.unifiUSD][Chain.Mainnet].NucleusBoringVault,
);
});
});
4 changes: 2 additions & 2 deletions lib/contracts/handlers/nucleus-boring-vault-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from 'viem';
import { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';
import { NUCLEUS_BORING_VAULT_ABIS } from '../abis/nucleus-boring-vault-abis';
import { NUCLEUS_CONTRACT_ADDRESSES } from '../addresses';
import { VAULTS_ADDRESSES } from '../vaults-addresses';
import { UnifiToken } from '../tokens';

export type PermitParams = {
Expand Down Expand Up @@ -68,7 +68,7 @@ export class NucleusBoringVaultHandler {
* @returns The viem contract.
*/
public getContract() {
const address = NUCLEUS_CONTRACT_ADDRESSES[this.token][this.chain]
const address = VAULTS_ADDRESSES[this.token][this.chain]
.NucleusBoringVault as Address;
const abi = NUCLEUS_BORING_VAULT_ABIS[this.chain].BoringVault;
const client = { public: this.publicClient, wallet: this.walletClient };
Expand Down
8 changes: 3 additions & 5 deletions lib/contracts/handlers/nucleus-teller-handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { generateAddress } from '../../../test/mocks/address';
import { Token, TOKENS_ADDRESSES, UnifiToken } from '../tokens';
import { isHash } from 'viem';
import { mockPermitSignature } from '../../../test/mocks/permit-signature';
import { NUCLEUS_CONTRACT_ADDRESSES } from '../addresses';
import { VAULTS_ADDRESSES } from '../vaults-addresses';

describe('NucleusBoringVaultHandler', () => {
const contractTestingUtils = testingUtils.generateContractUtils(
Expand Down Expand Up @@ -114,14 +114,12 @@ describe('NucleusBoringVaultHandler', () => {
it('should use the given token to call contract functions', async () => {
const unifiBTCTeller = handler.withToken(UnifiToken.unifiBTC).getContract();
expect(unifiBTCTeller.address).toEqual(
NUCLEUS_CONTRACT_ADDRESSES[UnifiToken.unifiBTC][Chain.Mainnet]
.NucleusTeller,
VAULTS_ADDRESSES[UnifiToken.unifiBTC][Chain.Mainnet].NucleusTeller,
);

const unifiUSDTeller = handler.withToken(UnifiToken.unifiUSD).getContract();
expect(unifiUSDTeller.address).toEqual(
NUCLEUS_CONTRACT_ADDRESSES[UnifiToken.unifiUSD][Chain.Mainnet]
.NucleusTeller,
VAULTS_ADDRESSES[UnifiToken.unifiUSD][Chain.Mainnet].NucleusTeller,
);
});
});
4 changes: 2 additions & 2 deletions lib/contracts/handlers/nucleus-teller-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
GetContractReturnType,
} from 'viem';
import { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';
import { NUCLEUS_CONTRACT_ADDRESSES } from '../addresses';
import { VAULTS_ADDRESSES } from '../vaults-addresses';
import { NUCLEUS_TELLER_ABIS } from '../abis/nucleus-teller-abis';
import { Token, TOKENS_ADDRESSES, UnifiToken } from '../tokens';
import { ERC20PermitHandler } from './erc20-permit-handler';
Expand Down Expand Up @@ -81,7 +81,7 @@ export class NucleusTellerHandler {
* @returns The viem contract.
*/
public getContract() {
const address = NUCLEUS_CONTRACT_ADDRESSES[this.token][this.chain]
const address = VAULTS_ADDRESSES[this.token][this.chain]
.NucleusTeller as Address;
const abi = NUCLEUS_TELLER_ABIS[this.chain].Teller;
const client = { public: this.publicClient, wallet: this.walletClient };
Expand Down
8 changes: 8 additions & 0 deletions lib/contracts/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export enum UnifiToken {
unifiETH = 'unifiETH',
unifiUSD = 'unifiUSD',
unifiBTC = 'unifiBTC',
// Symbiotic pufETH.
pufETHs = 'pufETHs',
}

export type AnyToken = Token | UnifiToken;
Expand Down Expand Up @@ -134,6 +136,10 @@ export const TOKENS_ADDRESSES: {
[Chain.Mainnet]: '0x170d847a8320f3b6a77ee15b0cae430e3ec933a0',
[Chain.Holesky]: '0x0000000000000000000000000000000000000000',
},
[UnifiToken.pufETHs]: {
[Chain.Mainnet]: '0x62a4ce0722ee65635c0f8339dd814d549b6f6735',
[Chain.Holesky]: '0x0000000000000000000000000000000000000000',
},
};

export const TOKENS_PERMIT_VERSION: { [key in AnyToken]: string } = {
Expand Down Expand Up @@ -173,6 +179,8 @@ export const TOKENS_PERMIT_VERSION: { [key in AnyToken]: string } = {
[UnifiToken.unifiUSD]: '1',
// https://etherscan.io/address/0x170d847a8320f3b6a77ee15b0cae430e3ec933a0#code#F7#L172
[UnifiToken.unifiBTC]: '1',
// https://etherscan.io/address/0x62a4ce0722ee65635c0f8339dd814d549b6f6735#code#F7#L172
[UnifiToken.pufETHs]: '1',
};

export const TOKENS_SALT: Partial<{
Expand Down
33 changes: 33 additions & 0 deletions lib/contracts/vaults-addresses.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Chain } from '../chains/constants';
import { UnifiToken } from './tokens';

export const VAULTS_ADDRESSES = {
[UnifiToken.unifiETH]: {
[Chain.Mainnet]: {
NucleusBoringVault: '0x196ead472583bc1e9af7a05f860d9857e1bd3dcc',
NucleusAccountant: '0xa9fb7e2922216debe3fd5e1bbe7591ee446dc21c',
NucleusTeller: '0x08eb2eccdf6ebd7aba601791f23ec5b5f68a1d53',
},
},
[UnifiToken.unifiUSD]: {
[Chain.Mainnet]: {
NucleusBoringVault: '0x82c40e07277eBb92935f79cE92268F80dDc7caB4',
NucleusAccountant: '0xe0bDb7b9225A2CeB42998dc2E51D4D3CDeb7e3Be',
NucleusTeller: '0x5d3Fb47FE7f3F4Ce8fe55518f7E4F7D6061B54DD',
},
},
[UnifiToken.unifiBTC]: {
[Chain.Mainnet]: {
NucleusBoringVault: '0x170d847a8320f3b6a77ee15b0cae430e3ec933a0',
NucleusAccountant: '0x2afb28b0561d99b5e00829ec2ef54946a00a35f7',
NucleusTeller: '0x0743647a607822781f9d0a639454e76289182f0b',
},
},
[UnifiToken.pufETHs]: {
[Chain.Mainnet]: {
NucleusBoringVault: '0x62a4ce0722ee65635c0f8339dd814d549b6f6735',
NucleusAccountant: '0xd049ebeaa59b75ba8ee38f9f6830db7293320236',
NucleusTeller: '0xa99a92c505ff92c543d9d48295f1f31024afb31f',
},
},
};

0 comments on commit 65d2c65

Please sign in to comment.