Skip to content

Commit

Permalink
Script: yearn pricer deployer (#408)
Browse files Browse the repository at this point in the history
* yearn pricer deployer

* fix typo

Co-authored-by: Anton Cheng <antonassocareer@gmail.com>

* update README

* chore:update scripts readme

Co-authored-by: Anton Cheng <antonassocareer@gmail.com>
Co-authored-by: Cruz Molina <cruz.adam.molina@gmail.com>
  • Loading branch information
3 people committed May 25, 2021
1 parent 2fce44f commit b605a51
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 55 deletions.
55 changes: 0 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,61 +68,6 @@ Run all integration tests:
$ npm run test:integration
```

## Scripts

### Payable Proxy Contract Deployment

To deploy a new `PayableProxyController.sol`, it is recommended to use the `deployPayableProxyController` truffle script inside the `scripts` folder.

**Input**
```sh
truffle exec scripts/deployPayableProxyController.js --network mainnet --controller 0x7d78c401c69c56cb21f4bf80c53afd92be0BBBBB --pool 0xc02aaa39b223fe8d0a0e5c4f27ead9083c7AAaaa --weth 0x5f4eC3Df9cbd43714FE2740f5E3616155cAGAGAG --gasPrice 50000000000
```

**Output**
```sh
Deploying payable proxy contract on mainnet 🍕
Payable proxy contract deployed! 🎉
Transaction hash: 0xebf12fc6603ee857bcabe1c0c6194XX82639a9888776f7ff6e83a409XXXXXXXX
Deployed contract address: 0x669cC97687c792fc5369d7bdd38cXXXXXXXXXX
```

### Chainlink Pricer Deployment

To deploy a new `ChainlinkPricer.sol`, it is recommended to use the `deployChainlinkPricer` truffle script inside the `scripts` folder.

**Input**
```sh
truffle exec scripts/deployChainlinkPricer.js --network mainnet --controller 0x7d78c401c69c56cb21f4bf80c53afd92be0BBBBB --pool 0xc02aaa39b223fe8d0a0e5c4f27ead9083c7AAaaa --weth 0x5f4eC3Df9cbd43714FE2740f5E3616155cAGAGAG --oracle 0xef196aA0e3Cb8EA6d5720557C3B611Eff6OOOOOO --gasPrice 50000000000
```

**Output**
```sh
Deploying chainlink pricer contract on mainnet 🍕
Chainlink pricer deployed! 🎉
Transaction hash: 0xebf12fc6603ee857bcabe1c0c6194XX82639a9888776f7ff6e83a409XXXXXXXX
Deployed contract address: 0x669cC97687c792fc5369d7bdd38cXXXXXXXXXX
```

### Permit Callee Deployment

The `PermitCallee.sol` contract allow user to call `permit()` function through the Controller Call action.
To deploy a new `PermitCallee.sol`, it is recommended to use the `deployPermitCallee` truffle script inside the `scripts` folder.

**Input**
```sh
truffle exec scripts/deployPermitCallee.js --network kovan --gasPrice 50000000000
```

### TradeCallee Deployment
the `TradeCallee.sol` contract allow to batch 0x trading transactions with Gamma operate actions through the Call action.
To deploy a new `TradeCallee.sol`, it is recommended to use the `deployTrade0x` truffle script inside the `scripts` folder.

**Input**
```sh
truffle exec scripts/deployTrade0x.js --network ropsten --exchange 0xdef1c0ded9bec7f1a1670819833240f027b25eff --weth 0xc778417e063141139fce010982780140aa0cd5ab --controller 0x7e9beaccdccee88558aaa2dc121e52ec6226864e --gas 100000000000
```

## Linting

Clean code is the best code, so we've provided tools to automatically lint your projects.
Expand Down
71 changes: 71 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Scripts

## Payable Proxy Contract Deployment

To deploy a new `PayableProxyController.sol`, it is recommended to use the `deployPayableProxyController` truffle script inside the `scripts` folder.

**Input**
```sh
truffle exec scripts/deployPayableProxyController.js --network mainnet --controller 0x7d78c401c69c56cb21f4bf80c53afd92be0BBBBB --pool 0xc02aaa39b223fe8d0a0e5c4f27ead9083c7AAaaa --weth 0x5f4eC3Df9cbd43714FE2740f5E3616155cAGAGAG --gasPrice 50000000000
```

**Output**
```sh
Deploying payable proxy contract on mainnet 🍕
Payable proxy contract deployed! 🎉
Transaction hash: 0xebf12fc6603ee857bcabe1c0c6194XX82639a9888776f7ff6e83a409XXXXXXXX
Deployed contract address: 0x669cC97687c792fc5369d7bdd38cXXXXXXXXXX
```

## Chainlink Pricer Deployment

To deploy a new `ChainlinkPricer.sol`, it is recommended to use the `deployChainlinkPricer` truffle script inside the `scripts` folder.

**Input**
```sh
truffle exec scripts/deployChainlinkPricer.js --network mainnet --controller 0x7d78c401c69c56cb21f4bf80c53afd92be0BBBBB --pool 0xc02aaa39b223fe8d0a0e5c4f27ead9083c7AAaaa --weth 0x5f4eC3Df9cbd43714FE2740f5E3616155cAGAGAG --oracle 0xef196aA0e3Cb8EA6d5720557C3B611Eff6OOOOOO --gasPrice 50000000000
```

**Output**
```sh
Deploying chainlink pricer contract on mainnet 🍕
Chainlink pricer deployed! 🎉
Transaction hash: 0xebf12fc6603ee857bcabe1c0c6194XX82639a9888776f7ff6e83a409XXXXXXXX
Deployed contract address: 0x669cC97687c792fc5369d7bdd38cXXXXXXXXXX
```

## Permit Callee Deployment

The `PermitCallee.sol` contract allow user to call `permit()` function through the Controller Call action.
To deploy a new `PermitCallee.sol`, it is recommended to use the `deployPermitCallee` truffle script inside the `scripts` folder.

**Input**
```sh
truffle exec scripts/deployPermitCallee.js --network kovan --gasPrice 50000000000
```

## TradeCallee Deployment
the `TradeCallee.sol` contract allow to batch 0x trading transactions with Gamma operate actions through the Call action.
To deploy a new `TradeCallee.sol`, it is recommended to use the `deployTrade0x` truffle script inside the `scripts` folder.

**Input**
```sh
truffle exec scripts/deployTrade0x.js --network ropsten --exchange 0xdef1c0ded9bec7f1a1670819833240f027b25eff --weth 0xc778417e063141139fce010982780140aa0cd5ab --controller 0x7e9beaccdccee88558aaa2dc121e52ec6226864e --gas 100000000000
```

## Yearn Pricer Deployment

To deploy a new `YearnPricer.sol`, it is recommended to use the `deployYearnPricer` truffle script inside the `scripts` folder.

**Input**
```sh
truffle exec scripts/deployYearnPricer.js --network mainnet --yToken 0x7d78c401c69c56cb21f4bf80c53afd92be0BBBBB --underlying 0xc02aaa39b223fe8d0a0e5c4f27ead9083c7AAaaa --oracle 0xef196aA0e3Cb8EA6d5720557C3B611Eff6OOOOOO --gasPrice 50000000000
```

**Output**
```sh
Deploying yearn pricer contract on mainnet 🍕
Yearn pricer deployed! 🎉
Transaction hash: 0xebf12fc6603ee857bcabe1c0c6194XX82639a9888776f7ff6e83a409XXXXXXXX
Deployed contract address: 0x669cC97687c792fc5369d7bdd38cXXXXXXXXXX
```
33 changes: 33 additions & 0 deletions scripts/deployYearnPricer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const yargs = require('yargs')

const YearnPricer = artifacts.require('YearnPricer.sol')

module.exports = async function(callback) {
try {
const options = yargs
.usage(
'Usage: --network <network> --yToken <yToken> --underlying <underlying> --oracle <oracle> --gasPrice <gasPrice> --gasLimit <gasLimit>',
)
.option('network', {describe: 'Network name', type: 'string', demandOption: true})
.option('yToken', {describe: 'yToken address', type: 'string', demandOption: true})
.option('underlying', {describe: 'Underlying address', type: 'string', demandOption: true})
.option('oracle', {describe: 'Oracle module address', type: 'string', demandOption: true})
.option('gasPrice', {describe: 'Gas price in WEI', type: 'string', demandOption: false})
.option('gasLimit', {describe: 'Gas Limit in WEI', type: 'string', demandOption: false}).argv

console.log(`Deploying yearn pricer contract on ${options.network} 🍕`)

const tx = await YearnPricer.new(options.yToken, options.underlying, options.oracle, {
gasPrice: options.gasPrice,
gas: options.gasLimit,
})

console.log('Yearn pricer deployed! 🎉')
console.log(`Transaction hash: ${tx.transactionHash}`)
console.log(`Deployed contract address: ${tx.address}`)

callback()
} catch (err) {
callback(err)
}
}

0 comments on commit b605a51

Please sign in to comment.