Created
May 29, 2019 09:20
-
-
Save ppillip/f388c8420027db18bcbcee5006d98d15 to your computer and use it in GitHub Desktop.
ethers 를 활용한 바오밥 연결
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {ethers} from "ethers"; | |
abi = [ | |
{ | |
"constant": true, | |
"inputs": [ | |
{ | |
"name": "", | |
"type": "uint256" | |
} | |
], | |
"name": "adminGroup", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "address" | |
} | |
], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"constant": false, | |
"inputs": [ | |
{ | |
"name": "_toAddCreator", | |
"type": "address" | |
} | |
], | |
"name": "addCreator", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "bool" | |
} | |
], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"constant": false, | |
"inputs": [ | |
{ | |
"name": "_sigStockOwner", | |
"type": "address" | |
} | |
], | |
"name": "changeSigStockOwnership", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "bool" | |
} | |
], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"constant": false, | |
"inputs": [ | |
{ | |
"name": "_admin", | |
"type": "address" | |
}, | |
{ | |
"name": "_num", | |
"type": "uint8" | |
} | |
], | |
"name": "deleteSigStockAdmin", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "bool" | |
} | |
], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"constant": false, | |
"inputs": [ | |
{ | |
"name": "_title", | |
"type": "string" | |
}, | |
{ | |
"name": "_description", | |
"type": "string" | |
}, | |
{ | |
"name": "_creatorRate", | |
"type": "uint256" | |
}, | |
{ | |
"name": "_maxDivideValue", | |
"type": "uint256" | |
} | |
], | |
"name": "createProduct", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "address" | |
} | |
], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"constant": true, | |
"inputs": [ | |
{ | |
"name": "", | |
"type": "address" | |
}, | |
{ | |
"name": "", | |
"type": "uint256" | |
} | |
], | |
"name": "creatorProducts", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "address" | |
} | |
], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"constant": true, | |
"inputs": [], | |
"name": "SIGSTOCK_OWNER", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "address" | |
} | |
], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"constant": false, | |
"inputs": [ | |
{ | |
"name": "_productAddress", | |
"type": "address" | |
} | |
], | |
"name": "addCustomProduct", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "bool" | |
} | |
], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"constant": false, | |
"inputs": [ | |
{ | |
"name": "_admin", | |
"type": "address" | |
}, | |
{ | |
"name": "_num", | |
"type": "uint8" | |
} | |
], | |
"name": "addSigStockAdmin", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "bool" | |
} | |
], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"constant": false, | |
"inputs": [ | |
{ | |
"name": "_toDeleteCreator", | |
"type": "address" | |
} | |
], | |
"name": "deleteCreator", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "bool" | |
} | |
], | |
"payable": false, | |
"stateMutability": "nonpayable", | |
"type": "function" | |
}, | |
{ | |
"constant": true, | |
"inputs": [ | |
{ | |
"name": "_creator", | |
"type": "address" | |
} | |
], | |
"name": "getNumCreatorProduct", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "uint256" | |
} | |
], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"constant": true, | |
"inputs": [ | |
{ | |
"name": "", | |
"type": "address" | |
} | |
], | |
"name": "isCreator", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "bool" | |
} | |
], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"constant": true, | |
"inputs": [ | |
{ | |
"name": "", | |
"type": "address" | |
} | |
], | |
"name": "SIGSTOCK_ADMINS", | |
"outputs": [ | |
{ | |
"name": "", | |
"type": "bool" | |
} | |
], | |
"payable": false, | |
"stateMutability": "view", | |
"type": "function" | |
}, | |
{ | |
"anonymous": false, | |
"inputs": [ | |
{ | |
"indexed": true, | |
"name": "_from", | |
"type": "address" | |
}, | |
{ | |
"indexed": true, | |
"name": "_product", | |
"type": "address" | |
} | |
], | |
"name": "CreatedProduct", | |
"type": "event" | |
}, | |
{ | |
"anonymous": false, | |
"inputs": [ | |
{ | |
"indexed": true, | |
"name": "_from", | |
"type": "address" | |
}, | |
{ | |
"indexed": true, | |
"name": "_product", | |
"type": "address" | |
} | |
], | |
"name": "AddedCustomProduct", | |
"type": "event" | |
}, | |
{ | |
"anonymous": false, | |
"inputs": [ | |
{ | |
"indexed": true, | |
"name": "newCreator", | |
"type": "address" | |
} | |
], | |
"name": "AddedCreator", | |
"type": "event" | |
}, | |
{ | |
"anonymous": false, | |
"inputs": [ | |
{ | |
"indexed": true, | |
"name": "toDeleteCreator", | |
"type": "address" | |
} | |
], | |
"name": "DeletedCreator", | |
"type": "event" | |
}, | |
{ | |
"anonymous": false, | |
"inputs": [ | |
{ | |
"indexed": true, | |
"name": "newAdmin", | |
"type": "address" | |
} | |
], | |
"name": "AddedAdmin", | |
"type": "event" | |
}, | |
{ | |
"anonymous": false, | |
"inputs": [ | |
{ | |
"indexed": true, | |
"name": "toDeleteAdmin", | |
"type": "address" | |
} | |
], | |
"name": "DeletedAdmin", | |
"type": "event" | |
}, | |
{ | |
"anonymous": false, | |
"inputs": [ | |
{ | |
"indexed": true, | |
"name": "_newOwner", | |
"type": "address" | |
} | |
], | |
"name": "ChangedSigStockOwner", | |
"type": "event" | |
} | |
]; | |
contractAddress = "0x96cb79083270e968cbaca419ed7c90bf94ced8ad"; | |
provider = new ethers.providers.JsonRpcProvider('https://api.baobab.klaytn.net:8651'); | |
contract = new ethers.Contract(contractAddress, abi, provider); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment