From b8e6c3bb236b9aaad85a63381f7a710d578e0adb Mon Sep 17 00:00:00 2001 From: huy Date: Fri, 25 Oct 2024 11:10:24 -0700 Subject: [PATCH 1/6] Use value from oracle intsead of contract --- scripts/oracle_autoupdate_holesky.ts | 4 ++-- scripts/oracle_autoupdate_mainnet.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/oracle_autoupdate_holesky.ts b/scripts/oracle_autoupdate_holesky.ts index 94537cf9..b2b6e317 100644 --- a/scripts/oracle_autoupdate_holesky.ts +++ b/scripts/oracle_autoupdate_holesky.ts @@ -67,11 +67,11 @@ async function testFunction(credentials: any) { provider ); - const expectedOracleError = await od.oracleError(); + // const expectedOracleError = await od.oracleError(); //console.log('expectedOracleError', expectedOracleError); const sigData = { newTotalYieldAccrued: totalYieldAccrued, - expectedOracleError: expectedOracleError, + expectedOracleError: data.oracleOffset, timeStamp: timestamp, }; //console.log('sigData', sigData); diff --git a/scripts/oracle_autoupdate_mainnet.ts b/scripts/oracle_autoupdate_mainnet.ts index b710738f..60fbc21a 100644 --- a/scripts/oracle_autoupdate_mainnet.ts +++ b/scripts/oracle_autoupdate_mainnet.ts @@ -65,11 +65,11 @@ exports.handler = async function (credentials) { provider ); - const expectedOracleError = await od.oracleError(); + // const expectedOracleError = await od.oracleError(); //console.log('expectedOracleError', expectedOracleError); const sigData = { newTotalYieldAccrued: totalYieldAccrued, - expectedOracleError: expectedOracleError, + expectedOracleError: data.oracleOffset, timeStamp: timestamp, }; //console.log('sigData', sigData); From 73e76e29f4ea961254e42ad1b16fb0afc231fe79 Mon Sep 17 00:00:00 2001 From: huy Date: Fri, 25 Oct 2024 11:19:48 -0700 Subject: [PATCH 2/6] tested --- scripts/oracle_autoupdate_holesky.ts | 7 +++---- scripts/oracle_autoupdate_mainnet.ts | 5 ++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/scripts/oracle_autoupdate_holesky.ts b/scripts/oracle_autoupdate_holesky.ts index b2b6e317..684618bd 100644 --- a/scripts/oracle_autoupdate_holesky.ts +++ b/scripts/oracle_autoupdate_holesky.ts @@ -52,6 +52,7 @@ async function testFunction(credentials: any) { const timestamp = data.timestamp; //console.log('timestamp', timestamp); //console.log('latest timestamp', (await provider.getBlock('latest')).timestamp); + const oracleOffset = data.oracleOffset; const directory = new ethers.Contract( DIRECTORY_ADDRESS, @@ -67,11 +68,9 @@ async function testFunction(credentials: any) { provider ); - // const expectedOracleError = await od.oracleError(); - //console.log('expectedOracleError', expectedOracleError); const sigData = { newTotalYieldAccrued: totalYieldAccrued, - expectedOracleError: data.oracleOffset, + expectedOracleError: oracleOffset, timeStamp: timestamp, }; //console.log('sigData', sigData); @@ -88,7 +87,7 @@ async function testFunction(credentials: any) { // use the callStatic line for local testing, the other for deployment const txResult = await oracle.callStatic.setTotalYieldAccrued(sig, sigData, { gasLimit: 100000 }); // gas limit is set to 100000 because ethers estimated the required amount as 82684 - //const txResult = await oracle.setTotalYieldAccrued(sig, sigData, { gasLimit: 100000}); + const txResult = await oracle.setTotalYieldAccrued(sig, sigData, { gasLimit: 100000}); await txResult.wait(); if (txResult.status === 0) throw new Error(`Transaction reverted: ${txResult}`); diff --git a/scripts/oracle_autoupdate_mainnet.ts b/scripts/oracle_autoupdate_mainnet.ts index 60fbc21a..20af77cb 100644 --- a/scripts/oracle_autoupdate_mainnet.ts +++ b/scripts/oracle_autoupdate_mainnet.ts @@ -50,6 +50,7 @@ exports.handler = async function (credentials) { const timestamp = data.timestamp; //console.log('timestamp', timestamp); //console.log('latest timestamp', (await provider.getBlock('latest')).timestamp); + const oracleOffset = data.oracleOffset; const directory = new ethers.Contract( DIRECTORY_ADDRESS, @@ -65,11 +66,9 @@ exports.handler = async function (credentials) { provider ); - // const expectedOracleError = await od.oracleError(); - //console.log('expectedOracleError', expectedOracleError); const sigData = { newTotalYieldAccrued: totalYieldAccrued, - expectedOracleError: data.oracleOffset, + expectedOracleError: oracleOffset, timeStamp: timestamp, }; //console.log('sigData', sigData); From 05eec90cbc53eb1b9cb6a620797b9cbf61dfd8d8 Mon Sep 17 00:00:00 2001 From: huy Date: Fri, 25 Oct 2024 11:20:35 -0700 Subject: [PATCH 3/6] ok --- scripts/oracle_autoupdate_holesky.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/oracle_autoupdate_holesky.ts b/scripts/oracle_autoupdate_holesky.ts index 684618bd..aeee3c0e 100644 --- a/scripts/oracle_autoupdate_holesky.ts +++ b/scripts/oracle_autoupdate_holesky.ts @@ -85,7 +85,7 @@ async function testFunction(credentials: any) { //return; // use the callStatic line for local testing, the other for deployment - const txResult = await oracle.callStatic.setTotalYieldAccrued(sig, sigData, { gasLimit: 100000 }); + // const txResult = await oracle.callStatic.setTotalYieldAccrued(sig, sigData, { gasLimit: 100000 }); // gas limit is set to 100000 because ethers estimated the required amount as 82684 const txResult = await oracle.setTotalYieldAccrued(sig, sigData, { gasLimit: 100000}); await txResult.wait(); From 15d65e331308fef0f7dab95708d0bbf228d41a05 Mon Sep 17 00:00:00 2001 From: huy Date: Fri, 25 Oct 2024 11:21:41 -0700 Subject: [PATCH 4/6] ok --- scripts/oracle_autoupdate_holesky.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/oracle_autoupdate_holesky.ts b/scripts/oracle_autoupdate_holesky.ts index aeee3c0e..e023b9da 100644 --- a/scripts/oracle_autoupdate_holesky.ts +++ b/scripts/oracle_autoupdate_holesky.ts @@ -85,9 +85,9 @@ async function testFunction(credentials: any) { //return; // use the callStatic line for local testing, the other for deployment - // const txResult = await oracle.callStatic.setTotalYieldAccrued(sig, sigData, { gasLimit: 100000 }); + const txResult = await oracle.callStatic.setTotalYieldAccrued(sig, sigData, { gasLimit: 100000 }); // gas limit is set to 100000 because ethers estimated the required amount as 82684 - const txResult = await oracle.setTotalYieldAccrued(sig, sigData, { gasLimit: 100000}); + // const txResult = await oracle.setTotalYieldAccrued(sig, sigData, { gasLimit: 100000}); await txResult.wait(); if (txResult.status === 0) throw new Error(`Transaction reverted: ${txResult}`); From 7c4dd0ad05b67c023d4bdc38ef141d617840c59a Mon Sep 17 00:00:00 2001 From: huy Date: Fri, 25 Oct 2024 11:22:41 -0700 Subject: [PATCH 5/6] ok --- scripts/oracle_autoupdate_holesky.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/oracle_autoupdate_holesky.ts b/scripts/oracle_autoupdate_holesky.ts index e023b9da..8458ce54 100644 --- a/scripts/oracle_autoupdate_holesky.ts +++ b/scripts/oracle_autoupdate_holesky.ts @@ -87,7 +87,7 @@ async function testFunction(credentials: any) { // use the callStatic line for local testing, the other for deployment const txResult = await oracle.callStatic.setTotalYieldAccrued(sig, sigData, { gasLimit: 100000 }); // gas limit is set to 100000 because ethers estimated the required amount as 82684 - // const txResult = await oracle.setTotalYieldAccrued(sig, sigData, { gasLimit: 100000}); + //const txResult = await oracle.setTotalYieldAccrued(sig, sigData, { gasLimit: 100000}); await txResult.wait(); if (txResult.status === 0) throw new Error(`Transaction reverted: ${txResult}`); From ed27241993a30e665a5fb1ff3cb9de4825dad24a Mon Sep 17 00:00:00 2001 From: huy Date: Fri, 25 Oct 2024 11:27:07 -0700 Subject: [PATCH 6/6] [ok --- scripts/oracle_autoupdate_holesky.ts | 5 ----- scripts/oracle_autoupdate_mainnet.ts | 5 ----- 2 files changed, 10 deletions(-) diff --git a/scripts/oracle_autoupdate_holesky.ts b/scripts/oracle_autoupdate_holesky.ts index 8458ce54..1719f424 100644 --- a/scripts/oracle_autoupdate_holesky.ts +++ b/scripts/oracle_autoupdate_holesky.ts @@ -62,11 +62,6 @@ async function testFunction(credentials: any) { ], provider ); - const od = new ethers.Contract( - await directory.getOperatorDistributorAddress(), - ['function oracleError() public view returns (uint256)'], - provider - ); const sigData = { newTotalYieldAccrued: totalYieldAccrued, diff --git a/scripts/oracle_autoupdate_mainnet.ts b/scripts/oracle_autoupdate_mainnet.ts index 20af77cb..0078141f 100644 --- a/scripts/oracle_autoupdate_mainnet.ts +++ b/scripts/oracle_autoupdate_mainnet.ts @@ -60,11 +60,6 @@ exports.handler = async function (credentials) { ], provider ); - const od = new ethers.Contract( - await directory.getOperatorDistributorAddress(), - ['function oracleError() public view returns (uint256)'], - provider - ); const sigData = { newTotalYieldAccrued: totalYieldAccrued,