-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP outstanding requests * Got autoClaimWithdraw Hardhat task working * Added setActionVars Hardhat task Got Defender Actions working * Add await for contract.getAddress() * Downgrade to ethers v5
- Loading branch information
1 parent
d959a32
commit 8af08d0
Showing
18 changed files
with
577 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,236 @@ | ||
[ | ||
{ | ||
"inputs": [], | ||
"name": "CLAIM_DELAY", | ||
"outputs": [ | ||
{ | ||
"internalType": "uint256", | ||
"name": "", | ||
"type": "uint256" | ||
} | ||
], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "addWithdrawalQueueLiquidity", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "uint256", | ||
"name": "requestId", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "claimWithdrawal", | ||
"outputs": [ | ||
{ | ||
"internalType": "uint256", | ||
"name": "amount", | ||
"type": "uint256" | ||
} | ||
], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "uint256[]", | ||
"name": "requestIds", | ||
"type": "uint256[]" | ||
} | ||
], | ||
"name": "claimWithdrawals", | ||
"outputs": [ | ||
{ | ||
"internalType": "uint256[]", | ||
"name": "amounts", | ||
"type": "uint256[]" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "totalAmount", | ||
"type": "uint256" | ||
} | ||
], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "dripper", | ||
"outputs": [ | ||
{ | ||
"internalType": "address", | ||
"name": "", | ||
"type": "address" | ||
} | ||
], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "governor", | ||
"outputs": [ | ||
{ | ||
"internalType": "address", | ||
"name": "", | ||
"type": "address" | ||
} | ||
], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "address", | ||
"name": "_asset", | ||
"type": "address" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "_amount", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "_minimumOusdAmount", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "mint", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "uint256", | ||
"name": "_amount", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "_minimumUnitAmount", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "redeem", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "uint256", | ||
"name": "amount", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "requestWithdrawal", | ||
"outputs": [ | ||
{ | ||
"internalType": "uint256", | ||
"name": "requestId", | ||
"type": "uint256" | ||
}, | ||
{ | ||
"internalType": "uint256", | ||
"name": "queued", | ||
"type": "uint256" | ||
} | ||
], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "uint256", | ||
"name": "_maxSupplyDiff", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "setMaxSupplyDiff", | ||
"outputs": [], | ||
"stateMutability": "nonpayable", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [], | ||
"name": "withdrawalQueueMetadata", | ||
"outputs": [ | ||
{ | ||
"internalType": "uint128", | ||
"name": "queued", | ||
"type": "uint128" | ||
}, | ||
{ | ||
"internalType": "uint128", | ||
"name": "claimable", | ||
"type": "uint128" | ||
}, | ||
{ | ||
"internalType": "uint128", | ||
"name": "claimed", | ||
"type": "uint128" | ||
}, | ||
{ | ||
"internalType": "uint128", | ||
"name": "nextWithdrawalIndex", | ||
"type": "uint128" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
}, | ||
{ | ||
"inputs": [ | ||
{ | ||
"internalType": "uint256", | ||
"name": "requestId", | ||
"type": "uint256" | ||
} | ||
], | ||
"name": "withdrawalRequests", | ||
"outputs": [ | ||
{ | ||
"internalType": "address", | ||
"name": "withdrawer", | ||
"type": "address" | ||
}, | ||
{ | ||
"internalType": "bool", | ||
"name": "claimed", | ||
"type": "bool" | ||
}, | ||
{ | ||
"internalType": "uint40", | ||
"name": "timestamp", | ||
"type": "uint40" | ||
}, | ||
{ | ||
"internalType": "uint128", | ||
"name": "amount", | ||
"type": "uint128" | ||
}, | ||
{ | ||
"internalType": "uint128", | ||
"name": "queued", | ||
"type": "uint128" | ||
} | ||
], | ||
"stateMutability": "view", | ||
"type": "function" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
const { | ||
DefenderRelaySigner, | ||
DefenderRelayProvider, | ||
} = require("defender-relay-client/lib/ethers"); | ||
const { ethers } = require("ethers"); | ||
|
||
const { autoClaimWithdraw } = require("../tasks/liquidity"); | ||
const { mainnet } = require("../utils/addresses"); | ||
const erc20Abi = require("../../abis/ERC20.json"); | ||
const oethARMAbi = require("../../abis/OethARM.json"); | ||
const vaultAbi = require("../../abis/vault.json"); | ||
|
||
// Entrypoint for the Autotask | ||
const handler = async (event) => { | ||
// Initialize defender relayer provider and signer | ||
const provider = new DefenderRelayProvider(event); | ||
const signer = new DefenderRelaySigner(event, provider, { speed: "fastest" }); | ||
|
||
console.log( | ||
`DEBUG env var in handler before being set: "${process.env.DEBUG}"` | ||
); | ||
|
||
// References to contracts | ||
const weth = new ethers.Contract(mainnet.WETH, erc20Abi, signer); | ||
const vault = new ethers.Contract(mainnet.OETHVaultProxy, vaultAbi, signer); | ||
const oethARM = new ethers.Contract(mainnet.OethARM, oethARMAbi, signer); | ||
|
||
try { | ||
await autoClaimWithdraw({ | ||
signer, | ||
weth, | ||
oethARM, | ||
vault, | ||
confirm: false, | ||
}); | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
}; | ||
|
||
module.exports = { handler }; |
Oops, something went wrong.