Closed dev8723 closed 1 year ago
Verified everything on testnet using the examples here, using create_account_and_job
to create a default account and job, create a job account and job, create a job account and a recurring job. and executing all of them successfully.
closed and carry on the work in https://github.com/terra-money/warp-contracts/pull/53/
https://github.com/terra-money/warp-contracts/issues/38 This is the part of exploration on solving asset lock.
Introduce a new endpoint
create_account_and_job
with the ability to create a job account tied to the job that is creating (or a series of recurring job), ideally for jobs that need to spend token (e.g. a limit order job), we will use this endpoint and create a job account, so funds will be isolated from other jobs by nature because only this job (and owner, but no other jobs) can spend the assets of job account.A nice bonus comes with
create_account_and_job
is user can also use it to create job and regular account (maybe we call it default account or primary account) if not exist. So users don't need to include 2 msgs (create_account
,create_job
) in 1 tx to create a job as they do now, we can deprecatecreate_account
if we want to usecreate_account_and_job
in the future.Note: job account is not saved in the
ACCOUNTS
map, so I add aquery_job_account
which takes ajob_id
to query it.Also
assets_to_withdraw
works great with job account to withdraw all assets after job is executed, if we use it on default account it will mess up other pending jobs, but not in job account!