Skip to content

Commit

Permalink
celo: move to mainnet (#7040)
Browse files Browse the repository at this point in the history
* celo: move to mainnet

* Update new_bounty.html
  • Loading branch information
thelostone-mc authored Jul 2, 2020
1 parent aeb9578 commit ee69999
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 20 deletions.
17 changes: 8 additions & 9 deletions app/assets/v2/js/pages/bounty_details2.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ Vue.mixin({
url = `https://blockscout.com/etc/mainnet/tx/${txn}`;
break;

case 'CELO':
case 'cUSD':
case 'cGLD':
url = `https://alfajores-blockscout.celo-testnet.org/tx/${txn}`;
url = `https://explorer.celo.org/tx/${txn}`;
break;

case 'ZIL':
Expand All @@ -75,9 +75,9 @@ Vue.mixin({
url = `https://blockscout.com/etc/mainnet/address/${address}`;
break;

case 'CELO':
case 'cUSD':
case 'cGLD':
url = `https://alfajores-blockscout.celo-testnet.org/address/${address}`;
url = `https://explorer.celo.org/address/${address}`;
break;

case 'ZIL':
Expand All @@ -101,13 +101,14 @@ Vue.mixin({
`ethereum:${address}`;
break;

case 'cUSD':
case 'CELO':
qr_string = value ?
`celo:0xa561131a1c8ac25925fb848bca45a74af61e5a38/transfer(address,uint256)?args=[${address},${value}]` :
`celo:0xa561131a1c8ac25925fb848bca45a74af61e5a38/transfer(address)?args=[${address}]`;
break;

case 'cGLD':
case 'cUSD':
// TODO: Wire in when we know the address
qr_string = value ?
`celo:${address}?value=${value}` :
`celo:${address}`;
Expand All @@ -123,8 +124,6 @@ Vue.mixin({
return qr_string;
},
syncBounty: function() {
// NOT USED FOR NOW UNTIL MIGRATION OF ETH BOUNTIES TO VUE
// ALSO THEN NO SENSE TO MIGRATE BECAUSE STANDARD BOUNTIES REMOVAL
let vm = this;

if (!localStorage[document.issueURL]) {
Expand Down Expand Up @@ -258,8 +257,8 @@ Vue.mixin({
tenant = 'ETC';
break;

case 'CELO':
case 'cUSD':
case 'cGLD':
tenant = 'CELO';
break;

Expand Down
2 changes: 1 addition & 1 deletion app/assets/v2/js/pages/new_bounty.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
load_tokens();
needWalletConnection();

const qr_tokens = [ 'ETC', 'cGLD', 'cUSD', 'ZIL' ];
const qr_tokens = [ 'ETC', 'cUSD', 'CELO', 'ZIL' ];
const fiat_tokens = ['USD'];

const isQRToken = tokenName => qr_tokens.includes(tokenName);
Expand Down
9 changes: 3 additions & 6 deletions app/dashboard/sync/celo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@

def find_txn_on_celo_explorer(fulfillment, network='mainnet'):
token_name = fulfillment.token_name
if token_name != 'cGLD' and token_name != 'cUSD':
if token_name != 'cUSD' and token_name != 'CELO':
return None

funderAddress = fulfillment.bounty.bounty_owner_address
amount = fulfillment.payout_amount
payeeAddress = fulfillment.fulfiller_address

# TODO: UPDATE WITH MAINNET URL. Using alfajores until then
blockscout_url = f'https://alfajores-blockscout.celo-testnet.org/api?module=account&action=tokentx&address={funderAddress}'

blockscout_url = f'https://explorer.celo.org/api?module=account&action=tokentx&address={funderAddress}'
blockscout_response = requests.get(blockscout_url).json()
if blockscout_response['message'] and blockscout_response['result']:
for txn in blockscout_response['result']:
Expand All @@ -33,8 +31,7 @@ def get_celo_txn_status(txnid, network='mainnet'):
if not txnid:
return None

# TODO: UPDATE WITH MAINNET URL. Using alfajores until then
blockscout_url = f'https://alfajores-blockscout.celo-testnet.org/api?module=transaction&action=gettxinfo&txhash={txnid}'
blockscout_url = f'https://explorer.celo.org/api?module=transaction&action=gettxinfo&txhash={txnid}'

blockscout_response = requests.get(blockscout_url).json()

Expand Down
2 changes: 0 additions & 2 deletions app/dashboard/templates/dashboard/hackathon/new_bounty.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,9 @@ <h1 class="text-center">Fund Prize</h1>
<input type="radio" name="bounty_chain" id="102_chain" value="102" v-model="chainId"><img class="mr-2" src="{% static 'v2/images/chains/zilliqa.svg' %}" alt="" width="24"> Zilliqa
</label>

{% if is_staff %}
<label class="btn btn-radio chain-btn d-flex align-items-center mr-2 mb-2 font-weight-bold py-2 px-4" :class="{'active': chainId === '42220'}">
<input type="radio" name="bounty_chain" id="42220_chain" value="42220" v-model="chainId"><img class="mr-2" src="{% static 'v2/images/chains/celo.svg' %}" alt="" width="24"> Celo
</label>
{% endif %}

<label class="btn btn-radio chain-btn d-flex align-items-center mr-2 mb-2 font-weight-bold py-2 px-4" :class="{'active': chainId === '717171'}">
<input type="radio" name="bounty_chain" id="717171_chain" value="717171" v-model="chainId"> Other
Expand Down
4 changes: 2 additions & 2 deletions app/dashboard/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ def sync_payout(fulfillment):
elif fulfillment.payout_type == 'qr':
if token_name == 'ETC':
sync_etc_payout(fulfillment)
elif token_name == 'cUSD' or token_name == 'cGLD':
elif token_name == 'CELO' or token_name == 'cUSD':
sync_celo_payout(fulfillment)
elif token_name == 'ZIL':
sync_zil_payout(fulfillment)
Expand Down Expand Up @@ -593,7 +593,7 @@ def build_profile_pairs(bounty):
elif bounty.tenant == 'ZIL':
addr = f"https://viewblock.io/zilliqa/address/{fulfillment.fulfiller_address}"
elif bounty.tenant == 'CELO':
addr = f"https://alfajores-blockscout.celo-testnet.org/address/{fulfillment.fulfiller_address}"
addr = f"https://explorer.celo.org/address/{fulfillment.fulfiller_address}"
elif bounty.tenant == 'ETC':
addr = f"https://blockscout.com/etc/mainnet/address/{fulfillment.fulfiller_address}"
else:
Expand Down

0 comments on commit ee69999

Please sign in to comment.