Skip to content

Commit

Permalink
solved merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
ororopickpocket committed Jun 13, 2022
2 parents 742b99a + f3a0c72 commit a990eb6
Show file tree
Hide file tree
Showing 10 changed files with 283 additions and 73 deletions.
17 changes: 16 additions & 1 deletion scripts/contractInteraction/amm.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,4 +320,19 @@ def printConverterRegistryData():
print("")
print("converters qty:", len(converters))
for i in range (0, len(converters)):
printV1ConverterData(converters[i])
printV1ConverterData(converters[i])

def removeLiquidityV2toMultisig(converter, poolToken, amount, minReturn):
abiFile = open('./scripts/contractInteraction/ABIs/LiquidityPoolV2Converter.json')
abi = json.load(abiFile)
converter = Contract.from_abi("LiquidityPoolV2Converter", address=converter, abi=abi, owner=conf.acct)
print("is active? ", converter.isActive())
print("price oracle", converter.priceOracle())
data = converter.addLiquidity.encode_input(poolToken, amount, minReturn)
print(data)

def getReturnForV2PoolToken(converter, poolToken, amount):
abiFile = open('./scripts/contractInteraction/ABIs/LiquidityPoolV2Converter.json')
abi = json.load(abiFile)
converter = Contract.from_abi("LiquidityPoolV2Converter", address=converter, abi=abi, owner=conf.acct)
print(converter.removeLiquidityReturnAndFee(poolToken, amount))
101 changes: 41 additions & 60 deletions scripts/contractInteraction/contract_interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,83 +34,64 @@ def main():

#used often:

#withdrawRBTCFromWatcher(40e18, conf.contracts['FastBTC'])
#withdrawRBTCFromWatcher(30e18, conf.contracts['multisig'])
#withdrawRBTCFromFastBTCBiDi(19e18, conf.contracts['multisig'])
#bal = getBalance(conf.contracts['SOV'], conf.contracts['Watcher'])
#withdrawTokensFromWatcher(conf.contracts['DoC'], 170000e18, conf.contracts['multisig'])
#print(conf.acct)
#sendTokensFromMultisig(conf.contracts['SOV'], conf.acct, 2336448e18)

#sendTokensFromMultisig(conf.contracts['XUSD'], conf.contracts['Watcher'], 200000e18)
#sendFromMultisig('0xD9ECB390a6a32ae651D5C614974c5570c50A5D89', 30e18)

#sendMYNTFromMultisigToFeeSharingProxy(36632.144056847e18)

'''
for i in range (922, 928):
#confirmWithMS(i)
for i in range (961, 963):
confirmWithMS(i)
checkTx(i)
'''
#confirmWithMS(956)
#confirmWithMS(958)
#missed = getMissedBalance()
#transferSOVtoLM(missed)

#transferRBTCFromFastBTCOffRampToOnRamp(15e18)
#transferRBTCFromFastBTCOffRampToOnRamp(9.6e18)

#missed = getMissedBalance()
#transferSOVtoLM(missed)
#redeemFromAggregatorWithMS(conf.contracts['XUSDAggregatorProxy'], conf.contracts['DoC'], 30000e18)
#sendTokensFromMultisig(conf.contracts['DoC'], conf.contracts['Watcher'], 30000e18)

#redeemFromAggregatorWithMS(conf.contracts['XUSDAggregatorProxy'], conf.contracts['USDT'], 100000e18)
#sendTokensFromMultisig(conf.contracts['USDT'], conf.contracts['Watcher'], 100000e18)
'''
vestingAddress = "0x9768eF9F59b030E98f12B2B4C859E5eCbC016633"
fourYearVesting = Contract.from_abi("FourYearVestingLogic", address=vestingAddress, abi=FourYearVestingLogic.abi, owner=conf.acct)
#readMocOracleAddress()

stakingAddress = conf.contracts['Staking']
staking = Contract.from_abi("Staking", address=stakingAddress, abi=Staking.abi, owner=conf.acct)
stakes = staking.getStakes(vestingAddress)
print("Staking Details")
print("=======================================")
print(stakes)
print(fourYearVesting.lastStakingSchedule())
print(fourYearVesting.remainingStakeAmount())
print(fourYearVesting.owner())
print(fourYearVesting.tokenOwner())
print(fourYearVesting.startDate())
fourYearVestingFactory = Contract.from_abi("FourYearVestingFactory", address=conf.contracts['FourYearVestingFactory'], abi=FourYearVestingFactory.abi, owner=conf.acct)
print(fourYearVestingFactory.owner())
data = fourYearVestingFactory.transferOwnership.encode_input("0x511893483DCc1A9A98f153ec8298b63BE010A99f")
#sendWithMultisig(conf.contracts['multisig'], fourYearVestingFactory.address, data, conf.acct)
SOVtoken = Contract.from_abi("SOV", address=conf.contracts['SOV'], abi=SOV.abi, owner=conf.acct)
remainingAmount = 78*10**18
#SOVtoken.approve(vestingAddress, remainingAmount)
lastSchedule = 0
while remainingAmount > 0:
fourYearVesting.stakeTokens(remainingAmount, lastSchedule)
lastSchedule = fourYearVesting.lastStakingSchedule()
remainingAmount = fourYearVesting.remainingStakeAmount()
time.sleep(10)
stakes = staking.getStakes(vestingAddress)
print("Staking Details")
print("=======================================")
print(stakes)
lastSchedule = fourYearVesting.lastStakingSchedule()
print(lastSchedule)
remainingAmount = fourYearVesting.remainingStakeAmount()
print(remainingAmount)
if remainingAmount > 0:
fourYearVesting.stakeTokens(remainingAmount, lastSchedule)
'''
#bal = getBalance(conf.contracts['(WR)BTC/USDT2'], conf.contracts['multisig'])
#removeLiquidityV2toMultisig(conf.contracts['ConverterUSDT'], conf.contracts['(WR)BTC/USDT2'], bal, 1)

#getReturnForV2PoolToken(conf.contracts['ConverterUSDT'], conf.contracts['(WR)BTC/USDT2'], bal)

# # ---------- Transfer ownership to gov ----------
# # core protocol
# transferProtocolOwnershipToGovernance()

# # loan token
# transferBeaconOwnershipToGovernance()
# transferLoanTokenAdminRoleToGovernance()
# transferLoanTokenOwnershipToGovernance()

# # oracles
# transferOracleOwnershipToGovernance()

# # LM
# transferLiquidityMiningOwnershipToGovernance()

# # Governance
# # lockedSOV
# transferLockedSOVOwnershipToGovernance()

#upgradeVesting()
# # Staking
# transferStakingOwnershipToGovernance()

#addVestingAdmin(conf.acct)
#isVestingAdmin(conf.acct)
# # StakingRewards
# transferStakingRewardsOwnershipToGovernance()

readAllVestingContractsForAddress('0x945F5A36998abfC3450d9108f8C1D34Aa18fa48E')
# # VestingRegistry
# transferVestingRegistryOwnershipToGovernance()


9 changes: 8 additions & 1 deletion scripts/contractInteraction/governance.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,11 @@ def queueProposal(id):
def executeProposal(id):
governor = Contract.from_abi("GovernorAlpha", address=conf.contracts['GovernorOwner'], abi=GovernorAlpha.abi, owner=conf.acct)
tx = governor.execute(id)
tx.info()
tx.info()

def transferLockedSOVOwnershipToGovernance():
print("Add LockedSOV admin for address: ", conf.contracts['TimelockAdmin'])
lockedSOV = Contract.from_abi("LockedSOV", address=conf.contracts["LockedSOV"], abi=LockedSOV.abi, owner=conf.acct)
# TODO: Need to check whether we need to remove the other admin or not
data = lockedSOV.addAdmin.encode_input(conf.contracts['TimelockAdmin'])
sendWithMultisig(conf.contracts['multisig'], lockedSOV.address, data, conf.acct)
8 changes: 7 additions & 1 deletion scripts/contractInteraction/liquidity_mining.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,10 @@ def getMissedBalance():
lm = Contract.from_abi("LiquidityMining", address = conf.contracts['LiquidityMiningProxy'], abi = LiquidityMining.abi, owner = conf.acct)
res = lm.getMissedBalance()
print(res/1e18)
return res
return res

def transferLiquidityMiningOwnershipToGovernance():
print("Transferring LiquidityMining ownership to: ", conf.contracts['TimelockOwner'])
lm = Contract.from_abi("LiquidityMining", address = conf.contracts['LiquidityMiningProxy'], abi = LiquidityMining.abi, owner = conf.acct)
data = lm.transferOwnership.encode_input(conf.contracts['TimelockOwner'])
sendWithMultisig(conf.contracts['multisig'], lm.address, data, conf.acct)
78 changes: 77 additions & 1 deletion scripts/contractInteraction/loan_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,4 +855,80 @@ def replaceLoanTokenSettingsLowerAdmin():
loanTokenLogicBeaconWrbtc = Contract.from_abi("LoanTokenLogicBeacon", address=conf.contracts['LoanTokenLogicBeaconWrbtc'], abi=LoanTokenLogicBeacon.abi, owner=conf.acct)
print("Registering Loan Protocol Settings Module to LoanTOkenLogicBeaconWrbtc")
data = loanTokenLogicBeaconWrbtc.registerLoanTokenModule.encode_input(loanTokenSettingsLowerAdmin.address)
sendWithMultisig(conf.contracts['multisig'], loanTokenLogicBeaconWrbtc.address, data, conf.acct)
sendWithMultisig(conf.contracts['multisig'], loanTokenLogicBeaconWrbtc.address, data, conf.acct)

def transferBeaconOwnershipToGovernance():
# transfer beacon LM
print("Transferring beacon LM ownserhip to: ", conf.contracts['TimelockOwner'])
loanTokenLogicBeaconLM = Contract.from_abi("loanTokenLogicBeaconLM", address=conf.contracts['LoanTokenLogicBeaconLM'], abi=LoanTokenLogicBeacon.abi, owner=conf.acct)
data = loanTokenLogicBeaconLM.transferOwnership.encode_input(conf.contracts['TimelockOwner'])
sendWithMultisig(conf.contracts['multisig'], loanTokenLogicBeaconLM.address, data, conf.acct)

# transfer beacon wrbtc
print("Transferring beacon WRBTC ownserhip to: ", conf.contracts['TimelockOwner'])
loanTokenLogicBeaconWrbtc = Contract.from_abi("loanTokenLogicBeaconWrbtc", address=conf.contracts['LoanTokenLogicBeaconWrbtc'], abi=LoanTokenLogicBeacon.abi, owner=conf.acct)
data = loanTokenLogicBeaconWrbtc.transferOwnership.encode_input(conf.contracts['TimelockOwner'])
sendWithMultisig(conf.contracts['multisig'], loanTokenLogicBeaconWrbtc.address, data, conf.acct)

def transferLoanTokenAdminRoleToGovernance():
# iDOC
print("Transferring iDOC admin to: ", conf.contracts['TimelockAdmin'])
loanToken = Contract.from_abi("loanToken", address=conf.contracts['iDOC'], abi=LoanTokenLogicStandard.abi, owner=conf.acct)
data = loanToken.setAdmin.encode_input(conf.contracts['TimelockAdmin'])
sendWithMultisig(conf.contracts['multisig'], loanToken.address, data, conf.acct)

# iRBTC
print("Transferring iRBTC admin to: ", conf.contracts['TimelockAdmin'])
loanToken = Contract.from_abi("loanToken", address=conf.contracts['iRBTC'], abi=LoanTokenLogicStandard.abi, owner=conf.acct)
data = loanToken.setAdmin.encode_input(conf.contracts['TimelockAdmin'])
sendWithMultisig(conf.contracts['multisig'], loanToken.address, data, conf.acct)

# iXUSD
print("Transferring iXUSD admin to: ", conf.contracts['TimelockAdmin'])
loanToken = Contract.from_abi("loanToken", address=conf.contracts['iXUSD'], abi=LoanTokenLogicStandard.abi, owner=conf.acct)
data = loanToken.setAdmin.encode_input(conf.contracts['TimelockAdmin'])
sendWithMultisig(conf.contracts['multisig'], loanToken.address, data, conf.acct)

# iUSDT
print("Transferring iUSDT admin to: ", conf.contracts['TimelockAdmin'])
loanToken = Contract.from_abi("loanToken", address=conf.contracts['iUSDT'], abi=LoanTokenLogicStandard.abi, owner=conf.acct)
data = loanToken.setAdmin.encode_input(conf.contracts['TimelockAdmin'])
sendWithMultisig(conf.contracts['multisig'], loanToken.address, data, conf.acct)

# iBPro
print("Transferring iBPro admin to: ", conf.contracts['TimelockAdmin'])
loanToken = Contract.from_abi("loanToken", address=conf.contracts['iBPro'], abi=LoanTokenLogicStandard.abi, owner=conf.acct)
data = loanToken.setAdmin.encode_input(conf.contracts['TimelockAdmin'])
sendWithMultisig(conf.contracts['multisig'], loanToken.address, data, conf.acct)

def transferLoanTokenOwnershipToGovernance():
# iDOC
loanToken = Contract.from_abi("loanToken", address=conf.contracts['iDOC'], abi=LoanTokenLogicStandard.abi, owner=conf.acct)
print("Transferring iDOC ownserhip to: ", conf.contracts['TimelockOwner'])
data = loanToken.transferOwnership.encode_input(conf.contracts['TimelockOwner'])
sendWithMultisig(conf.contracts['multisig'], loanToken.address, data, conf.acct)

# iRBTC
loanToken = Contract.from_abi("loanToken", address=conf.contracts['iRBTC'], abi=LoanTokenLogicStandard.abi, owner=conf.acct)
print("Transferring iRBTC ownserhip to: ", conf.contracts['TimelockOwner'])
data = loanToken.transferOwnership.encode_input(conf.contracts['TimelockOwner'])
sendWithMultisig(conf.contracts['multisig'], loanToken.address, data, conf.acct)

# iXUSD
loanToken = Contract.from_abi("loanToken", address=conf.contracts['iXUSD'], abi=LoanTokenLogicStandard.abi, owner=conf.acct)
print("Transferring iXUSD ownserhip to: ", conf.contracts['TimelockOwner'])
data = loanToken.transferOwnership.encode_input(conf.contracts['TimelockOwner'])
sendWithMultisig(conf.contracts['multisig'], loanToken.address, data, conf.acct)

# iUSDT
loanToken = Contract.from_abi("loanToken", address=conf.contracts['iUSDT'], abi=LoanTokenLogicStandard.abi, owner=conf.acct)
print("Transferring iUSDT ownserhip to: ", conf.contracts['TimelockOwner'])
data = loanToken.transferOwnership.encode_input(conf.contracts['TimelockOwner'])
sendWithMultisig(conf.contracts['multisig'], loanToken.address, data, conf.acct)

# iBPro
loanToken = Contract.from_abi("loanToken", address=conf.contracts['iBPro'], abi=LoanTokenLogicStandard.abi, owner=conf.acct)
print("Transferring iBPro ownserhip to: ", conf.contracts['TimelockOwner'])
data = loanToken.transferOwnership.encode_input(conf.contracts['TimelockOwner'])
sendWithMultisig(conf.contracts['multisig'], loanToken.address, data, conf.acct)

21 changes: 15 additions & 6 deletions scripts/contractInteraction/mainnet_contracts.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@
"(WR)BTC/RIF": "0xAE66117C8105a65D914fB47d37a127E879244319",
"(WR)BTC/MYNT": "0x36263Ac99ecdCf1aB20513d580b7d8D32d3c439D",
"LiquidityMiningConfigToken": "0x513B0f20027BDc6bc2fE9e28A9d4B40d20730Dca",
"FishPoolOracle": "0x95576a065fD880e6C6621dBfAB54FdB9f827C783",
"FishPoolOracle": "0x2D78E4dc352872Aa6ca12B40d18301Ff6DBE5ECB",
"XUSDPoolOracle": "0xD08eDf687418dF0107bAbCc8Fcab9064F3A6fc05",
"ETHPoolOracle": "0x9C9E06a23EE640A20DaAEd58E69012bB0742A098",
"MOCPoolOracle": "0xfF7ffCC3d0952C0133D4568C87ef4DeC72E4FddF",
"BNBPoolOracle": "0x57B7B2feeA4ed576e899568F42dF272017E3d8CD",
"ETHPoolOracle": "0xD6CcacF91c3ca6705aD3047a55dC7760c5ADF1F4",
"MOCPoolOracle": "0x8Cda228A6870D7B3a9Fe1e42604b35F39Fbc5D59",
"BNBPoolOracle": "0x66464BED2420Ab2e7c2d06A9eEb67d06D7E10eAC",
"SOVPoolOracle": "0x4290243b7F3aEF0F6922dAd4F9F8d321ee320fBd",
"RIFPoolOracle": "0x15e6B67d5bCd57232104A891f466578b28f447D9",
"MYNTPoolOracle": "0x1C11180b6730661090634cfD9F2510a1acA26fAf",
"RIFPoolOracle": "0x6C339235Bad0381C3bb6CaCecA68C941e81a4bDc",
"MYNTPoolOracle": "0x3f9fe40Cf3013d7B8E5517B166b909911d5AFcC2",
"og": "0x81d25201D044f178883599Be1934FF53FDA98acD",
"multisig": "0x924f5ad34698Fd20c90Fe5D5A8A0abd3b42dc711",
"PriceFeeds": "0x437AC62769f386b2d238409B7f0a7596d36506e4",
Expand All @@ -75,6 +75,15 @@
"USDTPriceFeed": "0xed80ccde8baeff2dbfc70d3028a27e501fa0d7d5",
"PriceFeedsMOC": "0x391fe8a92a7FC626A25F30E8c19B92bf8BE37FD3",
"SOVPriceFeedOnProtocol": "0xA266aA67e2a25B0CCa460DEAfcacC81D17341a0D",
"MOCPriceFeedsV1Pool": "0xfF7ffCC3d0952C0133D4568C87ef4DeC72E4FddF",
"BProPriceFeeds": "0x389e2447e1397A8e485D658a44D845a324A338Cf",
"SOVPriceFeeds": "0xA266aA67e2a25B0CCa460DEAfcacC81D17341a0D",
"ETHsPriceFeeds": "0x9C9E06a23EE640A20DaAEd58E69012bB0742A098",
"BNBsPriceFeeds": "0xfb9898367e61B2e0CCE6C529dD5307996fAbd155",
"XUSDPriceFeeds": "0xEd80Ccde8bAeFf2dBFC70d3028a27e501Fa0D7D5",
"FISHPriceFeeds": "0x95576a065fD880e6C6621dBfAB54FdB9f827C783",
"RIFPriceFeeds": "0x15e6B67d5bCd57232104A891f466578b28f447D9",
"MYNTPriceFeeds": "0x1C11180b6730661090634cfD9F2510a1acA26fAf",
"CSOV1": "0x0106F2fFBF6A4f5DEcE323d20E16E2037E732790",
"CSOV2": "0x7f7Dcf9DF951C4A332740e9a125720DA242A34ff",
"governorVault": "0xC7A1637b37190a456b017897207bceb2A29f19b9",
Expand Down
Loading

0 comments on commit a990eb6

Please sign in to comment.