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

Gyro APRs - Add different treatment for Gyro pools protocol swap fee percentage #512

Merged
merged 8 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion balancer-js/examples/pools/aprs/aprs.polygon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const { pools } = sdk;

const main = async () => {
const pool = await pools.find(
'0x216690738aac4aa0c4770253ca26a28f0115c595000000000000000000000b2c'
'0xf0ad209e2e969eaaa8c882aac71f02d8a047d5c2000200000000000000000b49'
);

if (pool) {
Expand Down
324 changes: 324 additions & 0 deletions balancer-js/src/lib/abi/GyroConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,324 @@
[
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "bytes32",
"name": "key",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "uint256",
"name": "previousValue",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "newValue",
"type": "uint256"
}
],
"name": "ConfigChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "bytes32",
"name": "key",
"type": "bytes32"
}
],
"name": "ConfigFrozen",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "bytes32",
"name": "key",
"type": "bytes32"
}
],
"name": "ConfigUnset",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "newGovernor",
"type": "address"
}
],
"name": "GovernorChangeRequested",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "oldGovernor",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "newGovernor",
"type": "address"
}
],
"name": "GovernorChanged",
"type": "event"
},
{
"inputs": [],
"name": "acceptGovernance",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newGovernor",
"type": "address"
}
],
"name": "changeGovernor",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "key",
"type": "bytes32"
}
],
"name": "freeze",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "key",
"type": "bytes32"
},
{
"internalType": "address",
"name": "defaultValue",
"type": "address"
}
],
"name": "getAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "key",
"type": "bytes32"
}
],
"name": "getAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "key",
"type": "bytes32"
}
],
"name": "getConfigMeta",
"outputs": [
{
"internalType": "uint8",
"name": "",
"type": "uint8"
},
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "key",
"type": "bytes32"
}
],
"name": "getUint",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "governor",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "key",
"type": "bytes32"
}
],
"name": "hasKey",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_governor",
"type": "address"
}
],
"name": "initialize",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "listKeys",
"outputs": [
{
"internalType": "bytes32[]",
"name": "",
"type": "bytes32[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pendingGovernor",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "key",
"type": "bytes32"
},
{
"internalType": "address",
"name": "newValue",
"type": "address"
}
],
"name": "setAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "key",
"type": "bytes32"
},
{
"internalType": "uint256",
"name": "newValue",
"type": "uint256"
}
],
"name": "setUint",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "key",
"type": "bytes32"
}
],
"name": "unset",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
3 changes: 3 additions & 0 deletions balancer-js/src/lib/constants/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const BALANCER_NETWORK_CONFIG: Record<Network, BalancerNetworkConfig> = {
lidoRelayer: '0xdcdbf71A870cc60C6F9B621E28a7D3Ffd6Dd4965',
veBal: '0xC128a9954e6c874eA3d62ce62B468bA073093F25',
veBalProxy: '0x6f5a2eE11E7a772AeB5114A20d0D7c0ff61EB8A0',
gyroConfigProxy: '0xac89cc9d78bbad7eb3a02601b4d65daa1f908aa6',
...addressesByNetwork[Network.MAINNET].contracts,
},
tokens: {
Expand Down Expand Up @@ -86,6 +87,7 @@ export const BALANCER_NETWORK_CONFIG: Record<Network, BalancerNetworkConfig> = {
multicall: '0xa1B2b503959aedD81512C37e9dce48164ec6a94d',
poolDataQueries: '0x84813aA3e079A665C0B80F944427eE83cBA63617',
gaugeClaimHelper: '0xaeb406b0e430bf5ea2dc0b9fe62e4e53f74b3a33',
gyroConfigProxy: '0xfdc2e9e03f515804744a40d0f8d25c16e93fbe67',
...addressesByNetwork[Network.POLYGON].contracts,
},
tokens: {
Expand Down Expand Up @@ -219,6 +221,7 @@ export const BALANCER_NETWORK_CONFIG: Record<Network, BalancerNetworkConfig> = {
contracts: {
multicall: '0x2dc0e2aa608532da689e89e237df582b783e552c',
poolDataQueries: '0x6B5dA774890Db7B7b96C6f44e6a4b0F657399E2e',
gyroConfigProxy: '0x32acb44fc929339b9f16f0449525cc590d2a23f3',
...addressesByNetwork[Network.OPTIMISM].contracts,
},
tokens: {
Expand Down
12 changes: 12 additions & 0 deletions balancer-js/src/modules/contracts/contracts.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import {
GaugeClaimHelper__factory,
GearboxLinearPoolFactory,
GearboxLinearPoolFactory__factory,
GyroConfig,
GyroConfig__factory,
LidoRelayer,
LidoRelayer__factory,
LiquidityGaugeV5__factory,
Expand Down Expand Up @@ -54,6 +56,7 @@ export interface ContractInstances {
eulerLinearPoolFactory?: EulerLinearPoolFactory;
gaugeClaimHelper?: GaugeClaimHelper;
gearboxLinearPoolFactory?: GearboxLinearPoolFactory;
gyroConfig?: GyroConfig;
lidoRelayer?: LidoRelayer;
liquidityGauge: ContractFactory;
multicall: Multicall;
Expand Down Expand Up @@ -173,6 +176,14 @@ export class Contracts {
provider
);
}
let gyroConfig: undefined | GyroConfig;
if (this.contractAddresses.gyroConfigProxy) {
gyroConfig = GyroConfig__factory.connect(
this.contractAddresses.gyroConfigProxy,
provider
);
}

this.instances = {
aaveLinearPoolFactory,
balancerHelpers,
Expand All @@ -183,6 +194,7 @@ export class Contracts {
eulerLinearPoolFactory,
gaugeClaimHelper,
gearboxLinearPoolFactory,
gyroConfig,
liquidityGauge: this.getLiquidityGauge,
lidoRelayer,
multicall,
Expand Down
Loading
Loading