-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
507 additions
and
1,121 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import * as dotenv from 'dotenv' | ||
import { MnemonicKey, LCDClient, MsgSubmitProposal, Coins, MsgExecuteContract, MsgCreateAlliance } from '@terra-money/feather.js'; | ||
import * as fs from 'fs'; | ||
|
||
dotenv.config() | ||
|
||
const init = async () => { | ||
// Check if the hub contract is deployed | ||
// and with the proper information stored in the file | ||
if (!fs.existsSync('.lp-hub-addr.log') | ||
|| fs.readFileSync('.lp-hub-addr.log').toString('utf-8') == "") { | ||
console.log(`Pleae deploy the hub contract first or add it's address to the .lp-hub-addr.log file to run this script`); | ||
return; | ||
} | ||
|
||
// Create the LCD Client to interact with the blockchain | ||
const lcd = LCDClient.fromDefaultConfig("testnet"); | ||
|
||
const govAccountAddr = (await lcd.auth.moduleAccountInfo("pisco-1", "gov"))?.baseAccount?.address; | ||
if (govAccountAddr == undefined) { | ||
console.log(`Something went wrong retreiving the governance account from on-chain`); | ||
return; | ||
} | ||
|
||
// Get all information from the deployer wallet | ||
const mk = new MnemonicKey({ mnemonic: process.env.MNEMONIC }); | ||
const wallet = lcd.wallet(mk); | ||
const accAddress = wallet.key.accAddress("terra"); | ||
|
||
try { | ||
const hubAddress = fs.readFileSync('.lp-hub-addr.log').toString('utf-8'); | ||
|
||
const govProposal = new MsgCreateAlliance( | ||
govAccountAddr, | ||
"factory/" + hubAddress + "/ualliancelp", | ||
"100000000000000", | ||
"0", | ||
"1", | ||
undefined, | ||
{ | ||
max: "100000000000000", | ||
min: "100000000000000", | ||
} | ||
) | ||
|
||
const msgSubmitProposal = new MsgSubmitProposal( | ||
[govProposal as any], | ||
Coins.fromString("512000000uluna"), | ||
accAddress, | ||
"Just whitelisting an alliance", | ||
"Just whitelisting an alliance", | ||
"Just whitelisting an alliance", | ||
); | ||
|
||
const tx = await wallet.createAndSignTx({ | ||
msgs: [msgSubmitProposal], | ||
memo: "Just whitelisting an alliance", | ||
chainID: "pisco-1", | ||
}); | ||
const result = await lcd.tx.broadcastSync(tx, "pisco-1"); | ||
console.log(`Proposal to whitelist an Alliance | ||
- Tx Hash: ${result.txhash}`); | ||
} | ||
catch (e) { | ||
console.log(e) | ||
return; | ||
} | ||
} | ||
init(); |
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,59 @@ | ||
import * as dotenv from 'dotenv' | ||
import { MnemonicKey, LCDClient, MsgExecuteContract } from '@terra-money/feather.js'; | ||
import * as fs from 'fs'; | ||
|
||
dotenv.config() | ||
|
||
const init = async () => { | ||
// Check if the hub contract is deployed | ||
// and with the proper information stored in the file | ||
if (!fs.existsSync('.lp-hub-addr.log') | ||
|| fs.readFileSync('.lp-hub-addr.log').toString('utf-8') == "") { | ||
console.log(`Pleae deploy the hub contract first or add it's address to the .lp-hub-addr.log file to run this script`); | ||
return; | ||
} | ||
|
||
// Create the LCD Client to interact with the blockchain | ||
const lcd = LCDClient.fromDefaultConfig("testnet"); | ||
|
||
// Get all information from the deployer wallet | ||
const mk = new MnemonicKey({ mnemonic: process.env.MNEMONIC}); | ||
const wallet = lcd.wallet(mk); | ||
const accAddress = wallet.key.accAddress("terra"); | ||
|
||
try { | ||
const hubAddress = fs.readFileSync('.lp-hub-addr.log').toString('utf-8'); | ||
const msgExecute = new MsgExecuteContract( | ||
accAddress, | ||
hubAddress, | ||
{ | ||
"alliance_delegate" : { | ||
"delegations": [{ | ||
"validator": "terravaloper1zdpgj8am5nqqvht927k3etljyl6a52kwqndjz2", | ||
"amount": "10000000" | ||
}] | ||
} | ||
}, | ||
); | ||
|
||
const tx = await wallet.createAndSignTx({ | ||
msgs: [msgExecute], | ||
memo: "Stake to Alliance Module", | ||
chainID: "pisco-1", | ||
}); | ||
const result = await lcd.tx.broadcastSync(tx, "pisco-1"); | ||
console.log(`Stake to Alliance Module submitted on chain | ||
- Tx Hash: ${result.txhash}`); | ||
} | ||
catch (e) { | ||
console.log(e) | ||
return; | ||
} | ||
} | ||
|
||
try { | ||
init(); | ||
} | ||
catch (e) { | ||
console.log(e) | ||
} |
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,49 @@ | ||
import * as dotenv from 'dotenv' | ||
import { MnemonicKey, LCDClient, MsgInstantiateContract, Coins } from '@terra-money/feather.js'; | ||
import fs from "fs"; | ||
|
||
dotenv.config() | ||
|
||
const init = async () => { | ||
// Create the LCD Client to interact with the blockchain | ||
const lcd = LCDClient.fromDefaultConfig("testnet") | ||
|
||
// Get all information from the deployer wallet | ||
const mk = new MnemonicKey({ mnemonic: process.env.MNEMONIC }); | ||
const wallet = lcd.wallet(mk); | ||
const accAddress = wallet.key.accAddress("terra"); | ||
console.log(`Wallet address: ${accAddress}`) | ||
|
||
try { | ||
// Create the message and broadcast the transaction on chain | ||
const tx = await wallet.createAndSignTx({ | ||
msgs: [new MsgInstantiateContract( | ||
accAddress, | ||
accAddress, | ||
12893, | ||
{ | ||
governance: "terra10d07y265gmmuvt4z0w9aw880jnsr700juxf95n", | ||
controller: accAddress, | ||
astro_reward_denom: "terra167dsqkh2alurx997wmycw9ydkyu54gyswe3ygmrs4lwume3vmwks8ruqnv", | ||
astro_incentives_addr: "terra1ujqta8jx4w7z224q0heunfx4rz57e92kkeyrgmry3yz2qf5z3xlsnrk0eq", | ||
alliance_reward_denom: "uluna", | ||
}, | ||
Coins.fromString("10000000uluna"), | ||
"Instantiate Alliance LP Hub Contract", | ||
)], | ||
memo: "Alliance LP Hub", | ||
chainID: "pisco-1", | ||
}); | ||
const result = await lcd.tx.broadcastSync(tx, "pisco-1") | ||
console.log(`Instantiate tx hash ${result.txhash}`); | ||
await new Promise(resolve => setTimeout(resolve, 7000)) | ||
const txResult : any = await lcd.tx.txInfo(result.txhash, "pisco-1"); | ||
const contractAddr = txResult.logs[0].eventsByType?.instantiate._contract_address[0]; | ||
console.log("Contract stored on chain with contractAddr", contractAddr) | ||
fs.writeFileSync(".lp-hub-addr.log", contractAddr); | ||
} | ||
catch (e) { | ||
console.log(e) | ||
} | ||
} | ||
init(); |
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,52 @@ | ||
import * as dotenv from 'dotenv' | ||
import { MnemonicKey, LCDClient, MsgMigrateContract } from '@terra-money/feather.js'; | ||
import * as fs from 'fs'; | ||
|
||
dotenv.config() | ||
|
||
const init = async () => { | ||
// Check if the hub contract is deployed | ||
// and with the proper information stored in the file | ||
if (!fs.existsSync('.lp-hub-addr.log') | ||
|| fs.readFileSync('.lp-hub-addr.log').toString('utf-8') == "") { | ||
console.log(`Pleae deploy the hub contract first or add it's address to the .lp-hub-addr.log file to run this script`); | ||
return; | ||
} | ||
|
||
// Create the LCD Client to interact with the blockchain | ||
const lcd = LCDClient.fromDefaultConfig("testnet") | ||
|
||
// Get all information from the deployer wallet | ||
const mk = new MnemonicKey({ mnemonic: process.env.MNEMONIC}); | ||
const wallet = lcd.wallet(mk); | ||
const accAddress = wallet.key.accAddress("terra"); | ||
|
||
try { | ||
const hubAddress = fs.readFileSync('.lp-hub-addr.log').toString('utf-8'); | ||
const hubCode = fs.readFileSync('.lp-hub-code-id.log').toString('utf-8'); | ||
|
||
const tx = await wallet.createAndSignTx({ | ||
msgs: [new MsgMigrateContract( | ||
accAddress, | ||
hubAddress, | ||
Number(hubCode), | ||
{} | ||
)], | ||
memo: "Migrate Alliance LP Hub", | ||
chainID: "pisco-1", | ||
}); | ||
const result = await lcd.tx.broadcastSync(tx, "pisco-1"); | ||
console.log(`Migration for Alliance LP Hub submitted on chain ${result.txhash}`); | ||
} | ||
catch (e) { | ||
console.log(e) | ||
return; | ||
} | ||
} | ||
|
||
try { | ||
init(); | ||
} | ||
catch (e) { | ||
console.log(e) | ||
}2 |
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,86 @@ | ||
import * as dotenv from 'dotenv' | ||
import { MnemonicKey, LCDClient, MsgSubmitProposal, Coins, MsgExecuteContract } from '@terra-money/feather.js'; | ||
import * as fs from 'fs'; | ||
|
||
dotenv.config() | ||
|
||
const init = async () => { | ||
// Check if the hub contract is deployed | ||
// and with the proper information stored in the file | ||
if (!fs.existsSync('.lp-hub-addr.log') | ||
|| fs.readFileSync('.lp-hub-addr.log').toString('utf-8') == "") { | ||
console.log(`Pleae deploy the hub contract first or add it's address to the .lp-hub-addr.log file to run this script`); | ||
return; | ||
} | ||
|
||
// Create the LCD Client to interact with the blockchain | ||
const lcd = LCDClient.fromDefaultConfig("testnet"); | ||
|
||
const govAccountAddr = (await lcd.auth.moduleAccountInfo("pisco-1", "gov"))?.baseAccount?.address; | ||
if (govAccountAddr == undefined) { | ||
console.log(`Something went wrong retreiving the governance account from on-chain`); | ||
return; | ||
} | ||
|
||
// Get all information from the deployer wallet | ||
const mk = new MnemonicKey({ mnemonic: process.env.MNEMONIC }); | ||
const wallet = lcd.wallet(mk); | ||
const accAddress = wallet.key.accAddress("terra"); | ||
|
||
try { | ||
const hubAddress = fs.readFileSync('.lp-hub-addr.log').toString('utf-8'); | ||
|
||
const govProposal = new MsgExecuteContract( | ||
govAccountAddr, | ||
hubAddress, | ||
{ | ||
"modify_asset_pairs": [ | ||
{ | ||
asset_info: { native: "factory/terra1zdpgj8am5nqqvht927k3etljyl6a52kwqup0je/stDeck" }, | ||
reward_asset_info: { native: "uluna" }, | ||
delete: false | ||
}, { | ||
asset_info: { cw20: "terra15npavsvzqsnphnda67v5jpr2md4fp7gyexeffnv08wp8tlxn88xsjvxkgx" }, // VKR-ULUN-LP | ||
reward_asset_info: { native: "uluna" }, | ||
delete: false | ||
}, { | ||
asset_info: { cw20: "terra15npavsvzqsnphnda67v5jpr2md4fp7gyexeffnv08wp8tlxn88xsjvxkgx" }, // VKR-ULUN-LP | ||
reward_asset_info: { cw20: "terra167dsqkh2alurx997wmycw9ydkyu54gyswe3ygmrs4lwume3vmwks8ruqnv" }, | ||
delete: false | ||
}, { | ||
asset_info: { cw20: "terra1k2gv5ae4pk7ecc04qs9c5yqkw28cl09mqn85447amt5t2slm7uastaxagl" }, // WETH-ULUN-LP | ||
reward_asset_info: { native: "uluna" }, | ||
delete: false | ||
}, { | ||
asset_info: { cw20: "terra1k2gv5ae4pk7ecc04qs9c5yqkw28cl09mqn85447amt5t2slm7uastaxagl" }, // WETH-ULUN-LP | ||
reward_asset_info: { cw20: "terra167dsqkh2alurx997wmycw9ydkyu54gyswe3ygmrs4lwume3vmwks8ruqnv" }, | ||
delete: false | ||
} | ||
] | ||
} | ||
) | ||
|
||
const msgSubmitProposal = new MsgSubmitProposal( | ||
[govProposal as any], | ||
Coins.fromString("512000000uluna"), | ||
accAddress, | ||
"Just enabling some random assets in Alliance LP Hub Contract", | ||
"Just enabling some random assets in Alliance LP Hub Contract", | ||
"Just enabling some random assets in Alliance LP Hub Contract", | ||
); | ||
|
||
const tx = await wallet.createAndSignTx({ | ||
msgs: [msgSubmitProposal], | ||
memo: "Just enabling some random assets in Alliance LP Hub Contract", | ||
chainID: "pisco-1", | ||
}); | ||
const result = await lcd.tx.broadcastSync(tx, "pisco-1"); | ||
console.log(`Proposal to whitelist some random assets in Alliance LP Hub Contract | ||
- Tx Hash: ${result.txhash}`); | ||
} | ||
catch (e) { | ||
console.log(e) | ||
return; | ||
} | ||
} | ||
init(); |
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,72 @@ | ||
import * as dotenv from 'dotenv' | ||
import { MnemonicKey, LCDClient, MsgExecuteContract, Coins } from '@terra-money/feather.js'; | ||
import * as fs from 'fs'; | ||
|
||
dotenv.config() | ||
|
||
const init = async () => { | ||
// Check if the hub contract is deployed | ||
// and with the proper information stored in the file | ||
if (!fs.existsSync('.lp-hub-addr.log') | ||
|| fs.readFileSync('.lp-hub-addr.log').toString('utf-8') == "") { | ||
console.log(`Pleae deploy the hub contract first or add it's address to the .lp-hub-addr.log file to run this script`); | ||
return; | ||
} | ||
|
||
// Create the LCD Client to interact with the blockchain | ||
const lcd = LCDClient.fromDefaultConfig("testnet"); | ||
|
||
// Get all information from the deployer wallet | ||
const mk = new MnemonicKey({ mnemonic: process.env.MNEMONIC }); | ||
const wallet = lcd.wallet(mk); | ||
const accAddress = wallet.key.accAddress("terra"); | ||
|
||
try { | ||
const hubAddress = fs.readFileSync('.lp-hub-addr.log').toString('utf-8'); | ||
|
||
const stakeCoins = new MsgExecuteContract( | ||
accAddress, | ||
hubAddress, | ||
{ "stake": {} }, | ||
Coins.fromString("10factory/terra1zdpgj8am5nqqvht927k3etljyl6a52kwqup0je/stDeck") | ||
); | ||
|
||
const stakeTokens = new MsgExecuteContract( | ||
accAddress, | ||
"terra15npavsvzqsnphnda67v5jpr2md4fp7gyexeffnv08wp8tlxn88xsjvxkgx", | ||
{ | ||
"send": { | ||
"contract": hubAddress, | ||
"amount": "10", | ||
"msg": "" | ||
} | ||
} | ||
); | ||
|
||
const stakeTokens2 = new MsgExecuteContract( | ||
accAddress, | ||
"terra1k2gv5ae4pk7ecc04qs9c5yqkw28cl09mqn85447amt5t2slm7uastaxagl", | ||
{ | ||
"send": { | ||
"contract": hubAddress, | ||
"amount": "10", | ||
"msg": "" | ||
} | ||
} | ||
); | ||
|
||
const tx = await wallet.createAndSignTx({ | ||
msgs: [stakeCoins, stakeTokens, stakeTokens2], | ||
memo: "Just Staking some tokens", | ||
chainID: "pisco-1", | ||
}); | ||
const result = await lcd.tx.broadcastSync(tx, "pisco-1"); | ||
console.log(`Transaction executed successfully with hash: | ||
- Tx Hash: ${result.txhash}`); | ||
} | ||
catch (e) { | ||
console.log(e) | ||
return; | ||
} | ||
} | ||
init(); |
Oops, something went wrong.