Skip to content

Commit

Permalink
purge: retire gas widget
Browse files Browse the repository at this point in the history
  • Loading branch information
thelostone-mc committed May 14, 2020
1 parent 907aa09 commit 35eead3
Show file tree
Hide file tree
Showing 32 changed files with 65 additions and 785 deletions.
3 changes: 0 additions & 3 deletions app/assets/onepager/js/send.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/* eslint-disable no-console */
var get_gas_price = function() {
if ($('#gasPrice').length) {
return $('#gasPrice').val() * Math.pow(10, 9);
}
if (typeof defaultGasPrice != 'undefined') {
return defaultGasPrice;
}
Expand Down
88 changes: 0 additions & 88 deletions app/assets/v2/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -246,48 +246,6 @@ p a {
float:right;
}

#gas-section .gas-image {
height: 4.5rem;
}

#gas-section .font-body {
margin: 0;
}

#gas-section .recommended-prices {
cursor: pointer;
text-align: center;
}

#gas-section .gas-dark-bg {
background-color: #FAFAFA;
}

#gas-section .gas-rates .active {
font-weight: 600;
background-color: #0ECF7C;
}

#gas-section #metamask_context {
display: none;
}

#gas-section #accordion-set-own-limit {
cursor: pointer;
border-bottom: 1px solid rgba(0,0,0,.1);
border-top: 1px solid rgba(0,0,0,.1);
}

#gas-section #accordion-set-own-limit i {
float: right;
}

#gas-section #default-recommended-gas,
#gas-section .message {
display: none;
text-align: center;
}

.btn-warning,
.btn-success,
.btn-info {
Expand Down Expand Up @@ -685,52 +643,6 @@ input[type=text].loading {
color: #000;
}

.metamask_recc {
width: 45%;
display: inline-block;
}

#metamask_label img {
position: relative;
top: -2px;
}

#metamask_context .red_warning {
background-color: #fbe0d6;
color: #fb9470;
padding: 5px 10px;
border-radius: 2px;
margin-bottom: 15px;
display: block;
}

#metamask_context .red_warning a {
color: #fb9470 !important;
font-weight: bold;
text-decoration: underline;
}

#metamask_context ul {
font-size: 0.85rem;
margin-top: 0.5rem;
padding-left: 1rem;
}

#metamask_context li a {
color: #0D0764;
}

#metamask_context .warning {
text-align: center;
background-color: #ff9800;
border-radius: 5px;
}

#metamask_context .warning a {
color: black;
font-weight: bold;
}

.bottom_notification a {
color: currentColor;
text-decoration: underline;
Expand Down
4 changes: 0 additions & 4 deletions app/assets/v2/css/grants/fund.css
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@
bottom: 2px;
}

#accordion-set-own-limit {
font-size: 12px;
}

#gitcoin-grant-section .custom {
width: 4.25rem;
position: relative;
Expand Down
6 changes: 1 addition & 5 deletions app/assets/v2/js/grants/cancel_subscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@ $(document).ready(() => {
let realTokenAmount = Number(data.amount_per_period * 10 ** decimals);
let amountSTR = realTokenAmount.toLocaleString('fullwide', { useGrouping: false });

let realGasPrice = $('#gasPrice').val() * Math.pow(10, 9);

web3.eth.getAccounts(function(err, accounts) {

deployedToken.methods.approve(data.contract_address, web3.utils.toTwosComplement(0)).send({from: accounts[0], gasPrice: realGasPrice})
deployedToken.methods.approve(data.contract_address, web3.utils.toTwosComplement(0)).send({from: accounts[0]})
.on('transactionHash', function(transactionHash) {
$('#sub_end_approve_tx_id').val(transactionHash);
const linkURL = get_etherscan_url(transactionHash);
Expand All @@ -56,7 +54,6 @@ $(document).ready(() => {
data.token_address, // testing token
web3.utils.toTwosComplement(amountSTR), // data.amount_per_period
web3.utils.toTwosComplement(data.real_period_seconds), // data.period_seconds
web3.utils.toTwosComplement(realGasPrice), // data.gas_price
web3.utils.toTwosComplement(nonce), // nonce
data.signature // contributor_signature
];
Expand All @@ -66,7 +63,6 @@ $(document).ready(() => {
...parts
).send({
from: accounts[0],
gasPrice: realGasPrice,
gas: web3.utils.toHex(gas_amount(document.location.href)),
gasLimit: web3.utils.toHex(gas_amount(document.location.href))
})
Expand Down
3 changes: 1 addition & 2 deletions app/assets/v2/js/grants/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,7 @@ $(document).ready(function() {
deployedSubscription.methods.endContract()
.send({
from: accounts[0],
gas: 3000000,
gasPrice: web3.utils.toHex($('#gasPrice').val() * Math.pow(10, 9))
gas: 3000000
}).on('transactionHash', function(transactionHash) {
grant_cancel_tx_id = $('#grant_cancel_tx_id').val();
const linkURL = get_etherscan_url(transactionHash);
Expand Down
13 changes: 3 additions & 10 deletions app/assets/v2/js/grants/fund.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ var set_form_disabled = function(is_disabled) {
$(document).ready(function() {


// _alert({ message: gettext('Note: Brave users seem to have issues while contributing to Grants while using both Brave Wallet and MetaMask. We recommend disabling one. For more info, see this <a target="_blank" href="https://github.com/brave/brave-browser/issues/6053">issue</a>') }, 'warning');

// set defaults
var set_defaults = function() {
var lookups = {
Expand Down Expand Up @@ -281,8 +279,7 @@ $(document).ready(function() {
web3.eth.sendTransaction({
from: accounts[0],
to: to_address,
value: to_addr_amount,
gasPrice: parseInt(web3.utils.toHex($('#gasPrice').val() * Math.pow(10, 9)))
value: to_addr_amount
}, function(err, txid) {
indicateMetamaskPopup(1);
if (err) {
Expand Down Expand Up @@ -339,8 +336,7 @@ $(document).ready(function() {
web3.eth.sendTransaction({
from: accounts[0],
to: gitcoinDonationAddress,
value: gitcoin_amount,
gasPrice: parseInt(web3.utils.toHex($('#gasPrice').val() * Math.pow(10, 9)))
value: gitcoin_amount
}, success_callback);
}
});
Expand Down Expand Up @@ -408,7 +404,6 @@ $(document).ready(function() {
web3.utils.toTwosComplement(approvalSTR)
).send({
from: accounts[0],
gasPrice: web3.utils.toHex(parseInt($('#gasPrice').val() * Math.pow(10, 9))),
gas: web3.utils.toHex(gas_amount(document.location.href)),
gasLimit: web3.utils.toHex(gas_amount(document.location.href))
}).on('error', function(error) {
Expand Down Expand Up @@ -506,7 +501,6 @@ const subscribeToGrant = (transactionHash) => {
'frequency_unit': $('#frequency_unit').val(),
'token_address': selected_token,
'token_symbol': $('#token_symbol').val(),
'gas_price': $('#gas_price').val(),
'sub_new_approve_tx_id': transactionHash,
'num_tx_approved': $('#period').val(),
'network': $('#network').val(),
Expand Down Expand Up @@ -652,8 +646,7 @@ const splitPayment = (account, toFirst, toSecond, valueFirst, valueSecond) => {
indicateMetamaskPopup();
deployedSplitter.methods.splitTransfer(toFirst, toSecond, valueFirst, valueSecond, tokenAddress).send({
from: account,
gas: web3.utils.toHex(100000),
gasPrice: parseInt(web3.utils.toHex($('#gasPrice').val() * Math.pow(10, 9)))
gas: web3.utils.toHex(100000)
}).on('error', function(error) {
console.log('1', error);
indicateMetamaskPopup(1);
Expand Down
16 changes: 0 additions & 16 deletions app/assets/v2/js/grants/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,21 +149,6 @@ const init = () => {
// trusted relayer
web3.utils.toChecksumAddress(data.trusted_relayer)
];
} else if ($('#contract_version').val() == 0) {
args = [
// admin_address
web3.utils.toChecksumAddress(data.admin_address),
// required token
web3.utils.toChecksumAddress(data.denomination),
// required tokenAmount
web3.utils.toTwosComplement(0),
// data.frequency
web3.utils.toTwosComplement(0),
// data.gas_price
web3.utils.toTwosComplement(0),
// contract version
web3.utils.toTwosComplement(0)
];
}

web3.eth.getAccounts(function(err, accounts) {
Expand All @@ -174,7 +159,6 @@ const init = () => {
arguments: args
}).send({
from: accounts[0],
gasPrice: web3.utils.toHex($('#gasPrice').val() * Math.pow(10, 9)),
gas: web3.utils.toHex(gas_amount(document.location.href)),
gasLimit: web3.utils.toHex(gas_amount(document.location.href))
}).on('error', function(error) {
Expand Down
3 changes: 1 addition & 2 deletions app/assets/v2/js/pages/bulk_payout.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,13 @@ $(document).ready(function($) {
});
}
};

var bounty = web3.eth.contract(bounty_abi).at(bounty_address());
var gas_dict = { gasPrice: web3.toHex($('#gasPrice').val() * Math.pow(10, 9)) };

indicateMetamaskPopup();
web3.eth.getAccounts(function(_, accounts) {
bounty.killBounty(
$('#standard_bounties_id').val(),
gas_dict,
{from: accounts[0]},
callback
);
Expand Down
5 changes: 1 addition & 4 deletions app/assets/v2/js/pages/cancel_bounty/ETH.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,7 @@ const ethCancelBounty = data => {
web3.eth.getAccounts(function(_, accounts) {
bounty.killBounty(
bountyId,
{
from: accounts[0],
gasPrice: web3.toHex($('#gasPrice').val() * Math.pow(10, 9))
},
{ from: accounts[0] },
final_callback
);
});
Expand Down
6 changes: 1 addition & 5 deletions app/assets/v2/js/pages/create_bounty/ETH.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ const ethCreateBounty = async (data) => {
{
from: account,
value: eth_amount,
gasPrice: web3.toHex($('#gasPrice').val() * Math.pow(10, 9)),
gas: web3.toHex(318730),
gasLimit: web3.toHex(318730)
},
Expand All @@ -232,7 +231,6 @@ const ethCreateBounty = async (data) => {
handleTokenAuth().then(() => {
const fee = Number((Number(data.amount) * FEE_PERCENTAGE).toFixed(4));
const to_address = '0x00De4B13153673BCAE2616b67bf822500d325Fc3';
const gas_price = web3.toHex($('#gasPrice').val() * Math.pow(10, 9));

indicateMetamaskPopup();
if (FEE_PERCENTAGE == 0) {
Expand All @@ -243,7 +241,6 @@ const ethCreateBounty = async (data) => {
to: to_address,
from: account,
value: web3.toWei(fee, 'ether'),
gasPrice: gas_price
}, function(error, txnId) {
indicateMetamaskPopup(true);
if (error) {
Expand All @@ -262,7 +259,7 @@ const ethCreateBounty = async (data) => {
const amountInWei = fee * 1.0 * Math.pow(10, token.decimals);
const token_contract = web3.eth.contract(token_abi).at(tokenAddress);

token_contract.transfer(to_address, amountInWei, { gasPrice: gas_price },
token_contract.transfer(to_address, amountInWei,
function(error, txnId) {
indicateMetamaskPopup(true);
if (error) {
Expand Down Expand Up @@ -305,7 +302,6 @@ const ethCreateBounty = async (data) => {
to: '0x00De4B13153673BCAE2616b67bf822500d325Fc3',
from: web3.account,
value: web3.toWei(ethFeaturedPrice, 'ether'),
gasPrice: web3.toHex($('#gasPrice').val() * Math.pow(10, 9)),
gas: web3.toHex(318730),
gasLimit: web3.toHex(318730)
},
Expand Down
5 changes: 1 addition & 4 deletions app/assets/v2/js/pages/fulfill_bounty/ETH.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,7 @@ const ethFulfillBounty = data => {
bounty.fulfillBounty(
bountyId,
document.ipfsDataHash,
{
from: accounts[0],
gasPrice: web3.toHex($('#gasPrice').val() * Math.pow(10, 9))
},
{ from: accounts[0] },
web3Callback
);
});
Expand Down
9 changes: 3 additions & 6 deletions app/assets/v2/js/pages/increase_bounty.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ $(document).ready(async function() {
{
from: account,
value: ethAmount,
gas: web3.toHex(652690),
gasPrice: web3.toHex($('#gasPrice').val() * Math.pow(10, 9))
gas: web3.toHex(652690)
},
web3Callback
);
Expand All @@ -231,7 +230,6 @@ $(document).ready(async function() {

if (act_as_funder) {
const to_address = '0x00De4B13153673BCAE2616b67bf822500d325Fc3';
const gas_price = web3.toHex($('#gasPrice').val() * Math.pow(10, 9));
const fee = (Number($('#summary-bounty-amount').html()) * FEE_PERCENTAGE).toFixed(4);

indicateMetamaskPopup();
Expand All @@ -242,8 +240,7 @@ $(document).ready(async function() {
web3.eth.sendTransaction({
to: to_address,
from: account,
value: web3.toWei(fee, 'ether'),
gasPrice: gas_price
value: web3.toWei(fee, 'ether')
}, function(error, txnId) {
indicateMetamaskPopup(true);
if (error) {
Expand All @@ -257,7 +254,7 @@ $(document).ready(async function() {
const amountInWei = fee * 1.0 * Math.pow(10, token.decimals);
const token_contract = web3.eth.contract(token_abi).at(tokenAddress);

token_contract.transfer(to_address, amountInWei, { gasPrice: gas_price }, function(error, txnId) {
token_contract.transfer(to_address, amountInWei, function(error, txnId) {
indicateMetamaskPopup(true);
if (error) {
_alert({ message: gettext('Unable to pay bounty fee. Please try again.') }, 'error');
Expand Down
3 changes: 0 additions & 3 deletions app/assets/v2/js/pages/kudos_send.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/* eslint-disable no-console */

var get_gas_price = function() {
if ($('#gasPrice').length) {
return $('#gasPrice').val() * Math.pow(10, 9);
}
if (typeof defaultGasPrice != 'undefined') {
return defaultGasPrice;
}
Expand Down
2 changes: 1 addition & 1 deletion app/assets/v2/js/pages/process_bounty.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ window.onload = function() {
// just sent payout
var send_payout = function() {
web3.eth.getAccounts(function(_, accounts) {
bounty.acceptFulfillment(bountyId, fulfillmentId, {gasPrice: web3.toHex($('#gasPrice').val() * Math.pow(10, 9)), from: accounts[0]}, final_callback);
bounty.acceptFulfillment(bountyId, fulfillmentId, {from: accounts[0]}, final_callback);
});
};

Expand Down
Loading

0 comments on commit 35eead3

Please sign in to comment.