Git Product home page Git Product logo

jlp's People

Contributors

0xsarvesh avatar abhayks1 avatar benjaminbollen avatar gulshanvasnani avatar hobofan avatar jasonklein avatar schemar avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jlp's Issues

Register rule in TokenRules

  • Whitelisted organization worker registers rule
  • Command
    registerRule config.json ruleName ruleAddress ruleABI.
  • Readme update

Setup of OpenST under test framework

There is already executable for setup of openst which deploys below contracts:

  • TokenHolder master copy
  • Gnosis master copy
  • Recovery master copy
  • UserWalletFactory contract
  • ProxyFactory contract
  • CreateAndUserModules

This ticket makes sure openst setup is also there in test framework.

EIP20 Facilitator agent staking

Story

As a user
I want to facilitate stake
Because it should surface errors in the gateways
And it should provide feedback on how to improve the interaction layers

Scenario

Given that I run the facilitate nodejs script
When I pass it an amount argument
Then the script transposes the amount cross-chain
And exits

Given that I run the facilitate nodejs script
When I pass it stake as the direction argument
Then the process facilitates a complete stake process

Info

⚠️ This ticket is only about staking. Redemption will be handled in #7

This is still an EIP20 token and not a branded token with a conversion rate.

Arguments of the facilitation (arguments are ordered without hyphens):

Argument Type Explanation
direction string stake or redeem
amount number Amount to stake, in 10^18 uint256
gateway string Address of the gateway
beneficiary string Address of the beneficiary on the target chain

Example:

$ facilitate stake 1500000000000000000 0x123...

Conceptually two steps (pass on hashlock):

  1. stake
  2. progress

For now hardcode gas prices and gas limits.

Facilitate will transpose EIP20 tokens using gateways directly.

  • Calling "stake" on the gateway and progressing the stake must be done from two different addresses
  • All logging must be done to a file (filename facilitate_yearmonthdayhourminutesecond_randomstring.log)
  • Use winston for logging
  • Use commander like here: mosaicdao/mosaic.js#45

⚠️ Make sure that you align with other CLI tasks on commander and logging structure.
⚠️ Chain access and contract addresses should be read from the config file from #1.

Funding of addresses

Users and facilitators need funding to stake, redeem, and transpose (progress).
There should be a way, like a faucet or similar, to fund addresses in order to easily create new addresses that can be used by the nodejs scripts that do staking, etc.

Branded Token Stake and Mint should use token holder as a beneficiary instead of external account

Branded token stake and mint smoke test currently mint tokens to an external account.
Current work for setting up a user wallet is in progress in PR. Refer: #71.

Once #71 and #73 is merged. This ticket will be ready for development.

Openst setup smoke test needs Organization and UBT address.
Currently hardcoded values of Organization and UBT is being consumed.
As part of this ticket let's remove the hardcoding and consume Organization and UBT address from chainConfig object.

Free testnet facilitator

For Testnet purposes we want to make it easier for people to transfer tokens to the testnet without initially needing to acquire OST on testnet. As paying for the transactions on testnet normally requires having funds on testnet, we want to provide a facilitator that stakes & mints for free on the testnet.

  • We provide a publicly known hashLock in the README, that anyone can use to transfer tokens to testnet
  • The facilitator listens to a single gateway
  • The facilitator listens to all StakeIntentDeclared events on the specified gateway and acts on those with its hashLock
    • Because StakeIntentDeclared doesn't have the hashLock as one of the event fields, we need to listen to all StakeIntentDeclared events, parse the transaction inputs of the transaction, and filter out the ones with the correct hashLock
  • The faciliatator facilitates the transfer without any additional cost to the staker

Improve documentation (episode 1)

  • UBT, improve documentation L102, L133, L134, L168
  • Improve variable names for fee amount, gatewayBase L461
  • rename messageStatus to inboxMessageStatus L245 (also change other methods)
  • OSTPrime, use "base coin" for base token and "OST" for token L58
  • fix comment in message bus L245 "inbox on target"
  • make comments in GatewayBase more general, don't use Stake/Mint terms (L73)
  • in GatewayComposer, document function to explain why mint recalculated
  • in JLP readme, add that deployed anchors is a pre-requisite for UBT setup

(Un)wrapping agent

Story

As a user
I want to wrap and unwrap OST on auxiliary
Because it may reveal bugs
And provide insights into improving the interaction layer

Scenario

Given that I run the ost binary
When I set the direction argument to wrap
And I set the amount argument to n
Then it wraps n OST
And exits

Given that I run the ost binary
When I set the direction argument to unwrap
And I set the amount argument to n
Then it unwraps n OST
And exits

Info

Examples:

$ ost wrap 1.005
$ ost unwrap 0.4

❓How to use addresses? Extra addresses per ost? How funded?

⚠️ Make sure that you align with other CLI tasks on commander and logging structure.
⚠️ Chain access and contract addresses should be read from the config file from #1.

Denominate transactions in USD

As a developer creating a Brand Token economy, I want to be able to denominate some transactions in USD so that the dollar value of a transactions remains constant

  • Use latest PriceOracle npm.
  • Deployment the PriceOracle contract
  • Store the priceOracle address, ownerAddress opsAddress baseCurrency payCurrency in config.json file.
  • Integrate it with test framework.
  • Command
    setupPriceOracle config.json ownerAddress opsAddress baseCurrencyCode payCurrencyCode

OpenST Setup

  • Deployment of master copies.
  • Deployment of CreateAndAddModules contract.
  • Deployment of factory contracts:
    UserWalletFactory contract
    ProxyFactory contract

TokenRules agent

  • Deploy TokenRules as JLP. EIPToken and TokenRules address is passed as an argument.

Usage:

Usage: deploy [options] <organization> <eip20Token>

Options:
  -h, --help  output usage information

Arguments:
  organization             organization contract address on auxiliary chain.
  eip20Token               eip20Token contract address  
  • Readme update.

  • Add proper logging.

Run JLP smoke tests on local geth instances

Currently, JLP tests are assumed to run on "real/live" (1409, "ropsten", etc) geth instances.
The aim of this ticket is to make it possible to run tests on local geth instances (please, see and use two geth-docker-images setup in mosaic-contracts).

Setup EIP20 token

Use mosaic.js as a consumer to achieve the below.

Get in touch with Ben to discuss what we already have and how to access it.

A runnable script should exist that can be used to deploy a relevant setup and output a config. (make it repeatable)
Deploys and links all the contracts listed below.

  • Document the addresses that are set-up as master keys for the organizations
  • Set-up should include:
    • origin:
      • organization
      • gateway
      • EIP20 token for testing
    • auxiliary:
      • organization
      • co-gateway
      • utility token
  • Provide a config file with the addresses of the contracts and the master keys

Example code here: https://openst.gitbook.io/docs/setup

Setup of OpenST

  • Setup of master copies

    • Deployment of CreateAndAddModules contract.
    • Setup of factory contracts.
      UserWalletFactory contract
      ProxyFactory contract
      • Deployment of TokenRules.
      • Deployment of PricerRule.
      • Store the addresses in config.json file.
      • Above will be stitched in openst.js and agent should call the setup.
  • Command:
    setupOpenST config.json

Create User

  • It should create proxy for TH, gnosis safe and recovery.

    • Store the proxy addresses in config.json file.
  • Command

	createUser config.json owners threshold ephemeralKeys sessionKeysSpendingLimit sessionKeyExpirationHeights

EIP20 Facilitator agent redemption

Story

As a user
I want to facilitate redeem
Because it should surface errors in the gateways
And it should provide feedback on how to improve the interaction layers

Scenario

Given that I run the facilitate nodejs script
When I pass it an amount argument
Then the script transposes the amount cross-chain
And exits

Given that I run the facilitate nodejs script
When I pass it redeem as the direction argument
Then the process facilitates a complete redemption process

Info

This is still an EIP20 token and not a branded token with a conversion rate.

Arguments of the facilitation (arguments are ordered without hyphens):

Argument Type Explanation
direction string stake or redeem
amount number Amount to stake, in 10^18 uint256
gateway string Address of the gateway
beneficiary string Address of the beneficiary on the target chain

Example:

$ facilitate redeem1500000000000000000 0x123...

Conceptually two steps (pass on hashlock):

  1. redeem
  2. progress

For now hardcode gas prices and gas limits.

Facilitate will transpose EIP20 tokens in both directions using gateways directly.

  • Calling "redeem" on the co-gateway and progressing the redemption must be done from two different addresses
  • One facilitate script should be able to facilitate in both directions (auxiliaryorigin and originauxiliary)
  • All logging must be done to a file (filename facilitate_yearmonthdayhourminutesecond_randomstring.log)
  • Use winston for logging
  • Use commander like here: mosaicdao/mosaic.js#45

⚠️ Make sure that you align with other CLI tasks on commander and logging structure.
⚠️ Chain access and contract addresses should be read from the config file from #1.

Perform wallet operations

  • Add wallet

  • Revoke wallet

  • Swap wallet

  • Authorize session

  • Revoke session

  • Logout

  • EIP712 signing strategy?

  • Command
    wallet add config.json currentOwner ownerToAdd threshold
    wallet remove config.json currentOwner ownerToRemove threshold
    wallet authorizeSession config.json currentOwner ephemeralKey spendingLimit expirationHeight
    wallet revokeSession config.json currentOwner ephemeralKey

Continuously stake and progress

Branded token stake.

Set up and fund separate keys dedicated to the facilitator process.

Stake a random number within a sensible range. Doesn't need to be huge.

Monitoring would be a separate ticket. For now, we can log in once per day and check that it is still successfully staking.

Continuously redeem and progress

Branded token redeem.

Set up and fund separate keys dedicated to the facilitator process.

Redeem a random number within a sensible range. Doesn't need to be huge.

Monitoring would be a separate ticket. For now, we can log in once per day and check that it is still successfully redeeming.

Setup an auxiliary test chain

In order for us to be able to test on actual chains, we need a test chain setup. As origin we want to use the ethereum ropsten testnet. As auxiliary we want to use one of our own clique-based side-chains.

Get in touch with Ben to discuss what we already have and how to access it.

  • Have a running auxiliary chain
  • Have ethereum nodes running on origin and auxiliary
  • Document access to both chains' nodes so anyone can run applications that access both
  • Document the addresses that are set-up as master keys for the organizations
  • Set-up should include:
    • origin:
      • organization
      • gateway OST
      • OST (to stake base tokens)
      • anchor
    • auxiliary:
      • organization
      • co-gateway OST
      • anchor
      • OSTPrime
  • Provide a config file with the addresses of the contracts, the master keys, and the nodes' endpoints to connect

Anchoring agent

Story

As a chain owner
I want to anchor state roots
Because it is a requirement for the gateways

Scenario

Given that I run the anchor nodejs script
When I don't hit <control+c>
Then the process keeps anchoring

Given that I run the anchor nodejs script
When I set the delay argument to n
Then the anchoring is delayed by n blocks

Info

Argument Explanation
delay The delay to wait in blocks on the source chain before anchoring
direction string of either origin or auxiliary; origin meaning anchor origin's state root to auxiliary
  • Use mosaic.js ContractInteract/Anchor
  • One anchor binary should only anchor in one direction (auxiliaryorigin or originauxiliary)
  • All logging must be done to a file (filename anchor_yearmonthdayhourminutesecond_randomstring.log)
  • Use winston for logging
  • Use commander like here: mosaicdao/mosaic.js#45

ℹ️ Deepesh created example code earlier: https://github.com/deepesh-kn/mosaic.js/tree/examples/Demo

⚠️ Make sure that you align with other CLI tasks on commander and logging structure.
⚠️ Chain access and contract addresses should be read from the config file from #1.

BrandedToken Facilitator agent

Story

As a user
I want to facilitate branded token stake and redeem
Because it should surface errors in branded tokens
And it should provide feedback on how to improve the interaction layers

Scenario

Given that I run the bt binary
When I pass it a sub-command
Then it executes the given sub-command and exits

Info

The binary would have the following sub-commands:

Command Explanation
deploy Deploys a new gateway composer
stake Stakes an amount into the branded token
redeem Redeems an amount out of the branded token
transpose Progresses tokens across chains, should be able to re-use most of the functionality of the facilitate binary (#3)
  • deploy should deploy a new instance of the gateway composer and return the addresses to the command line
  • stake and redeem should stake and redeem a given amount
  • transpose should facilitate the stake/redeem processes

❓Do we need transpose as a command here or would that be taken over by the facilitate command from #3? How would the transpose command work exactly? (see examples)
❓How to use addresses? Extra addresses per bt? How funded?

Examples:

$ bt deploy
$ bt stake 20.00
$ bt redeem 1.5
$ bt transpose stake <?amount?>
$ bt transpose redeem <?amount?>
  • Using the gateway composer and doing the staking must be done from two different addresses
  • All logging must be done to a file (filename bt_yearmonthdayhourminutesecond_randomstring.log)
  • Use winston for logging
  • Use commander like here: mosaicdao/mosaic.js#45

⚠️ Make sure that you align with other CLI tasks on commander and logging structure.
⚠️ Chain access and contract addresses should be read from the config file from #1.

Continuously anchor

Set up and fund separate keys dedicated to the anchor process.

  • Timeout origin to auxiliary should be 60 (seconds).
  • Timeout auxiliary to origin should be 120 (seconds) to not spam ropsten.

Monitoring would be a separate ticket. For now, we can log in once per day and check that it is still successfully anchoring.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.