Added option to fund predefined dev accounts in Algorand deployment (#1997)
This commit is contained in:
parent
95fd892bec
commit
a6d76f4382
|
@ -206,22 +206,18 @@ class PortalCore:
|
|||
|
||||
return self.kmdAccounts
|
||||
|
||||
def getTemporaryAccount(self, client: AlgodClient) -> Account:
|
||||
if len(self.accountList) == 0:
|
||||
sks = [account.generate_account()[0] for i in range(3)]
|
||||
self.accountList = [Account(sk) for sk in sks]
|
||||
|
||||
def _fundFromGenesis(self, accountList, fundingAmt, client):
|
||||
genesisAccounts = self.getGenesisAccounts()
|
||||
suggestedParams = client.suggested_params()
|
||||
|
||||
txns: List[transaction.Transaction] = []
|
||||
for i, a in enumerate(self.accountList):
|
||||
for i, a in enumerate(accountList):
|
||||
fundingAccount = genesisAccounts[i % len(genesisAccounts)]
|
||||
txns.append(
|
||||
transaction.PaymentTxn(
|
||||
sender=fundingAccount.getAddress(),
|
||||
receiver=a.getAddress(),
|
||||
amt=self.FUNDING_AMOUNT,
|
||||
amt=fundingAmt,
|
||||
sp=suggestedParams,
|
||||
)
|
||||
)
|
||||
|
@ -233,11 +229,36 @@ class PortalCore:
|
|||
]
|
||||
|
||||
client.send_transactions(signedTxns)
|
||||
|
||||
self.waitForTransaction(client, signedTxns[0].get_txid())
|
||||
|
||||
def getTemporaryAccount(self, client: AlgodClient) -> Account:
|
||||
if len(self.accountList) == 0:
|
||||
sks = [account.generate_account()[0] for i in range(3)]
|
||||
self.accountList = [Account(sk) for sk in sks]
|
||||
self._fundFromGenesis(self.accountList, self.FUNDING_AMOUNT, client)
|
||||
|
||||
return self.accountList.pop()
|
||||
|
||||
def fundDevAccounts(self, client: AlgodClient):
|
||||
devAcctsMnemonics = [
|
||||
"provide warfare better filter glory civil help jacket alpha penalty van fiber code upgrade web more curve sauce merit bike satoshi blame orphan absorb modify",
|
||||
"album neglect very nasty input trick annual arctic spray task candy unfold letter drill glove sword flock omit dial rather session mesh slow abandon slab",
|
||||
"blue spring teach silent cheap grace desk crack agree leave tray lady chair reopen midnight lottery glove congress lounge arrow fine junior mirror above purchase",
|
||||
"front rifle urge write push dynamic oil vital section blast protect suffer shoulder base address teach sight trap trial august mechanic border leaf absorb attract",
|
||||
"fat pet option agree father glue range ancient curtain pottery search raven club save crane sting gift seven butter decline image toward kidney above balance"
|
||||
]
|
||||
|
||||
accountList = []
|
||||
accountFunding = 400000000000000 # 400M algos
|
||||
|
||||
for mnemo in devAcctsMnemonics:
|
||||
acc = Account.FromMnemonic(mnemo)
|
||||
print('Funding dev account {} with {} uALGOs'.format(acc.addr, accountFunding))
|
||||
accountList.append(acc)
|
||||
|
||||
self._fundFromGenesis(accountList, accountFunding, client)
|
||||
|
||||
|
||||
def getAlgodClient(self) -> AlgodClient:
|
||||
return AlgodClient(self.ALGOD_TOKEN, self.ALGOD_ADDRESS)
|
||||
|
||||
|
@ -1413,6 +1434,8 @@ class PortalCore:
|
|||
|
||||
parser.add_argument('--mnemonic', type=str, help='account mnemonic', default="")
|
||||
|
||||
parser.add_argument('--fundDevAccounts', action='store_true', help='Fund predetermined set of devnet accounts')
|
||||
|
||||
parser.add_argument('--core_approve', type=str, help='core approve teal', default="teal/core_approve.teal")
|
||||
parser.add_argument('--core_clear', type=str, help='core clear teal', default="teal/core_clear.teal")
|
||||
|
||||
|
@ -1591,6 +1614,13 @@ class PortalCore:
|
|||
response = self.bootGuardians(vaa, self.client, self.foundation, self.coreid)
|
||||
pprint.pprint(response.__dict__)
|
||||
|
||||
if args.fundDevAccounts:
|
||||
if not args.devnet:
|
||||
print("Missing required parameter: --devnet")
|
||||
sys.exit(0)
|
||||
|
||||
self.fundDevAccounts(self.client)
|
||||
|
||||
if __name__ == "__main__":
|
||||
core = PortalCore()
|
||||
core.main()
|
||||
|
|
|
@ -18,4 +18,5 @@ fi
|
|||
|
||||
sleep 2
|
||||
|
||||
pipenv run python3 admin.py --devnet --boot
|
||||
pipenv run python3 admin.py --devnet --boot --fundDevAccounts
|
||||
|
||||
|
|
|
@ -33,6 +33,25 @@
|
|||
|
||||
The terra testnet can be used just like a normal localterra network (can be selected in finder and station).
|
||||
|
||||
### Algorand
|
||||
|
||||
The `admin.py` deployment tool can be used to generate a set of five prefunded accounts using the `--fundDevAccounts` option, with the following addresses and mnemonics:
|
||||
|
||||
DEV7AREMQSPWWDDFFJ3A5OIMMDCZN4YT5U2MQBN76Y4J5ERQQ3MWPIHUYA 800M ALGO
|
||||
provide warfare better filter glory civil help jacket alpha penalty van fiber code upgrade web more curve sauce merit bike satoshi blame orphan absorb modify
|
||||
|
||||
DEVBE5BIDJV6SWV7E3XPLB5DXZG2JYCWHGXBAQH6WNBZA3G7SQQ5HUJQII
|
||||
album neglect very nasty input trick annual arctic spray task candy unfold letter drill glove sword flock omit dial rather session mesh slow abandon slab
|
||||
|
||||
DEV3AURNEWR5TRFXIOBP2VTCTZIS52Q3XJHNJ57M4IZLMNZ5ABQ6M7AL6E
|
||||
blue spring teach silent cheap grace desk crack agree leave tray lady chair reopen midnight lottery glove congress lounge arrow fine junior mirror above purchase
|
||||
|
||||
DEVKKFRWGS4EX2GP5PLMFOXAH5TBBSWFD6G2D564FHVDXH55QSPXJKAHIU
|
||||
front rifle urge write push dynamic oil vital section blast protect suffer shoulder base address teach sight trap trial august mechanic border leaf absorb attract
|
||||
|
||||
DEVKPY5JA6IJED3KBS7Z6J2ZXAUVWIJLABNAYVVLOXXIVSBH32FA2Z4BWY
|
||||
fat pet option agree father glue range ancient curtain pottery search raven club save crane sting gift seven butter decline image toward kidney above balance
|
||||
|
||||
### devnet guardian addresses
|
||||
|
||||
see [../scripts/devnet-consts.json](../scripts/devnet-consts.json)
|
||||
|
|
Loading…
Reference in New Issue