Skip to content

Commit

Permalink
extended contract interaction script
Browse files Browse the repository at this point in the history
  • Loading branch information
ororopickpocket committed Jun 10, 2021
1 parent 411c156 commit 4467834
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions scripts/contractInteraction/contract_interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ def main():
#swapTokens(0.0013e18, 1, contracts['swapNetwork'], contracts['WRBTC'], contracts['ETHs'])

#buyWRBTC(0.001e18)
confirmWithMS(190)
confirmWithMS(191)
transferTokensFromWallet(contracts['SOV'], contracts['LiquidityMiningProxy'], 10000e18)

def loadConfig():
global contracts, acct
Expand Down Expand Up @@ -1223,6 +1222,10 @@ def setWrapperOnLM():
txId = tx.events["Submission"]["transactionId"]
print("txid",txId);

def setWrapperOnLMFromWallet():
lm = Contract.from_abi("LiquidityMining", address = contracts['LiquidityMiningProxy'], abi = LiquidityMining.abi, owner = acct)
lm.setWrapper(contracts['RBTCWrapperProxy'])

def transferTokensFromWallet(tokenContract, receiver, amount):
token = Contract.from_abi("Token", address= tokenContract, abi = TestToken.abi, owner=acct)
token.transfer(receiver, amount)
Expand All @@ -1246,6 +1249,10 @@ def setLockedSOV(newLockedSOV):
txId = tx.events["Submission"]["transactionId"]
print("txid",txId);

def setLockedSOVFromWallet(newLockedSOV):
lm = Contract.from_abi("LiquidityMining", address = contracts['LiquidityMiningProxy'], abi = LiquidityMining.abi, owner = acct)
lm.setLockedSOV(newLockedSOV)

def setFeesController():
sovryn = Contract.from_abi("sovryn", address=contracts['sovrynProtocol'], abi=interface.ISovrynBrownie.abi, owner=acct)
data = sovryn.setFeesController.encode_input(contracts['FeeSharingProxy'])
Expand All @@ -1265,8 +1272,8 @@ def addPoolsToLM():
multisig = Contract.from_abi("MultiSig", address=contracts['multisig'], abi=MultiSigWallet.abi, owner=acct)
liquidityMining = Contract.from_abi("LiquidityMining", address = contracts['LiquidityMiningProxy'], abi = LiquidityMining.abi, owner = acct)
# TODO prepare pool tokens list
poolTokens = [contracts['(WR)BTC/USDT1'], contracts['(WR)BTC/USDT2'], contracts['(WR)BTC/DOC1'], contracts['(WR)BTC/DOC2'], contracts['(WR)BTC/BPRO1'], contracts['(WR)BTC/BPRO2']]
allocationPoints = [1, 1, 1, 1, 1, 1]
poolTokens = [contracts['(WR)BTC/SUSD1'], contracts['(WR)BTC/SUSD2']]
allocationPoints = [1, 1]
# token weight = allocationPoint / SUM of allocationPoints for all pool tokens
withUpdate = False # can be False if we adding pool tokens before mining started
for i in range(0,len(poolTokens)):
Expand All @@ -1280,6 +1287,19 @@ def addPoolsToLM():
tx = multisig.submitTransaction(liquidityMining.address,0,data)
txId = tx.events["Submission"]["transactionId"]

def addPoolsToLMFromWallet():
liquidityMining = Contract.from_abi("LiquidityMining", address = contracts['LiquidityMiningProxy'], abi = LiquidityMining.abi, owner = acct)
# TODO prepare pool tokens list
poolTokens = [contracts['(WR)BTC/SUSD1'], contracts['(WR)BTC/SUSD2']]
allocationPoints = [1, 1]
# token weight = allocationPoint / SUM of allocationPoints for all pool tokens
withUpdate = False # can be False if we adding pool tokens before mining started
for i in range(0,len(poolTokens)):
print('adding pool', i)
liquidityMining.add(poolTokens[i], allocationPoints[i], withUpdate)
liquidityMining.updateAllPools()


def lookupCurrentPoolReserveBalances(userAddress):
wrbtc = Contract.from_abi("TestToken", address = contracts['WRBTC'], abi = TestToken.abi, owner = acct)
sov = Contract.from_abi("TestToken", address = contracts['SOV'], abi = TestToken.abi, owner = acct)
Expand Down

0 comments on commit 4467834

Please sign in to comment.