2018-03-07 02:40:11 +03:00
|
|
|
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.ethers=a()}}(function(){return function(){function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}return a}()({1:[function(a,b,c){"use strict";function d(a){var b={};for(var c in a)b[c]=a[c];return b}function e(a,b,c){function i(c,e){return function(){var f={},i=Array.prototype.slice.call(arguments);if(i.length==c.inputs.types.length+1){if(f=i.pop(),"object"!=typeof f)throw new Error("invalid transaction overrides");f=d(f);for(var l in f)if(!h[l])throw new Error("unknown transaction override "+l)}["data","to"].forEach(function(a){if(null!=f[a])throw new Error("cannot override "+a)});var m=c.apply(b,i);switch(f.to=a,f.data=m.data,m.type){case"call":if(e)return Promise.resolve(new g.bigNumberify(0));["gasLimit","gasPrice","value"].forEach(function(a){if(null!=f[a])throw new Error("call cannot override "+a)});var n=null;return null==f.from&&j&&j.getAddress?(n=j.getAddress(),n instanceof Promise||(n=Promise.resolve(n))):n=Promise.resolve(null),n.then(function(a){return a&&(f.from=g.getAddress(a)),k.call(f)}).then(function(a){var b=m.parse(a);return 1===c.outputs.types.length&&(b=b[0]),b});case"transaction":if(!j)return Promise.reject(new Error("missing signer"));if(null!=f.from)throw new Error("transaction cannot override from");if(e)return j&&j.estimateGas?j.estimateGas(f):k.estimateGas(f);if(j.sendTransaction)return j.sendTransaction(f);if(!j.sign)return Promise.reject(new Error("custom signer does not support signing"));null==f.gasLimit&&(f.gasLimit=j.defaultGasLimit||2e6);var o=null;if(f.nonce)o=Promise.resolve(f.nonce);else if(j.getTransactionCount)o=j.getTransactionCount(),o instanceof Promise||(o=Promise.resolve(o));else{var p=j.getAddress();p instanceof Promise||(p=Promise.resolve(p)),o=p.then(function(a){return k.getTransactionCount(a,"pending")})}var q=null;return q=f.gasPrice?Promise.resolve(f.gasPrice):k.getGasPrice(),Promise.all([o,q]).then(function(a){return f.nonce=a[0],f.gasPrice=a[1],j.sign(f)}).then(function(a){return k.sendTransaction(a)})}}}if(!(this instanceof e))throw new Error("missing new");if(b instanceof f||(b=new f(b)),!c)throw new Error("missing signer or provider");var j=c,k=null;c.provider?k=c.provider:(k=c,j=null),g.defineProperty(this,"address",a),g.defineProperty(this,"interface",b),g.defineProperty(this,"signer",j),g.defineProperty(this,"provider",k);var l=k.resolveName(a),m={};g.defineProperty(this,"estimate",m);var n={};g.defineProperty(this,"functions",n);var o={};g.defineProperty(this,"events",o),Object.keys(b.functions).forEach(function(a){var c=b.functions[a],d=i(c,!1);null==this[a]?g.defineProperty(this,a,d):console.log("WARNING: Multiple definitions for "+c),null==n[c]&&(g.defineProperty(n,a,d),g.defineProperty(m,a,i(c,!0)))},this),Object.keys(b.events).forEach(function(a){function c(b){l.then(function(f){if(f==b.address)try{var g=d.parse(b.topics,b.data);b.args=g,b.event=a,b.parse=d.parse,b.removeListener=function(){k.removeListener(d.topics,c)},b.getBlock=function(){return k.getBlock(b.blockHash)},b.getTransaction=function(){return k.getTransaction(b.transactionHash)},b.getTransactionReceipt=function(){return k.getTransactionReceipt(b.transactionHash)},b.eventSignature=d.signature,e.apply(b,Array.prototype.slice.call(g))}catch(h){console.log(h)}})}var d=b.events[a],e=null,f={enumerable:!0,get:function(){return e},set:function(a){a||(a=null),!a&&e?k.removeListener(d.topics,c):a&&!e&&k.on(d.topics,c),e=a}},g="on"+a.toLowerCase();null==this[g]&&Object
|
|
|
|
var Ga=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Ga>>>26)|0,Ga&=67108863,d=Math.imul(M,la),e=Math.imul(M,ma),e=e+Math.imul(N,la)|0,f=Math.imul(N,ma),d=d+Math.imul(J,oa)|0,e=e+Math.imul(J,pa)|0,e=e+Math.imul(K,oa)|0,f=f+Math.imul(K,pa)|0;var Ha=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Ha>>>26)|0,Ha&=67108863,d=Math.imul(M,oa),e=Math.imul(M,pa),e=e+Math.imul(N,oa)|0,f=Math.imul(N,pa);var Ia=(j+d|0)+((8191&e)<<13)|0;return j=(f+(e>>>13)|0)+(Ia>>>26)|0,Ia&=67108863,i[0]=qa,i[1]=ra,i[2]=sa,i[3]=ta,i[4]=ua,i[5]=va,i[6]=wa,i[7]=xa,i[8]=ya,i[9]=za,i[10]=Aa,i[11]=Ba,i[12]=Ca,i[13]=Da,i[14]=Ea,i[15]=Fa,i[16]=Ga,i[17]=Ha,i[18]=Ia,0!==j&&(i[19]=j,c.length++),c};Math.imul||(z=j),f.prototype.mulTo=function(a,b){var c,d=this.length+a.length;return c=10===this.length&&10===a.length?z(this,a,b):d<63?j(this,a,b):d<1024?k(this,a,b):l(this,a,b)},m.prototype.makeRBT=function(a){for(var b=new Array(a),c=f.prototype._countBits(a)-1,d=0;d<a;d++)b[d]=this.revBin(d,c,a);return b},m.prototype.revBin=function(a,b,c){if(0===a||a===c-1)return a;for(var d=0,e=0;e<b;e++)d|=(1&a)<<b-e-1,a>>=1;return d},m.prototype.permute=function(a,b,c,d,e,f){for(var g=0;g<f;g++)d[g]=b[a[g]],e[g]=c[a[g]]},m.prototype.transform=function(a,b,c,d,e,f){this.permute(f,a,b,c,d,e);for(var g=1;g<e;g<<=1)for(var h=g<<1,i=Math.cos(2*Math.PI/h),j=Math.sin(2*Math.PI/h),k=0;k<e;k+=h)for(var l=i,m=j,n=0;n<g;n++){var o=c[k+n],p=d[k+n],q=c[k+n+g],r=d[k+n+g],s=l*q-m*r;r=l*r+m*q,q=s,c[k+n]=o+q,d[k+n]=p+r,c[k+n+g]=o-q,d[k+n+g]=p-r,n!==h&&(s=i*l-j*m,m=i*m+j*l,l=s)}},m.prototype.guessLen13b=function(a,b){var c=1|Math.max(b,a),d=1&c,e=0;for(c=c/2|0;c;c>>>=1)e++;return 1<<e+1+d},m.prototype.conjugate=function(a,b,c){if(!(c<=1))for(var d=0;d<c/2;d++){var e=a[d];a[d]=a[c-d-1],a[c-d-1]=e,e=b[d],b[d]=-b[c-d-1],b[c-d-1]=-e}},m.prototype.normalize13b=function(a,b){for(var c=0,d=0;d<b/2;d++){var e=8192*Math.round(a[2*d+1]/b)+Math.round(a[2*d]/b)+c;a[d]=67108863&e,c=e<67108864?0:e/67108864|0}return a},m.prototype.convert13b=function(a,b,c,e){for(var f=0,g=0;g<b;g++)f+=0|a[g],c[2*g]=8191&f,f>>>=13,c[2*g+1]=8191&f,f>>>=13;for(g=2*b;g<e;++g)c[g]=0;d(0===f),d(0===(f&-8192))},m.prototype.stub=function(a){for(var b=new Array(a),c=0;c<a;c++)b[c]=0;return b},m.prototype.mulp=function(a,b,c){var d=2*this.guessLen13b(a.length,b.length),e=this.makeRBT(d),f=this.stub(d),g=new Array(d),h=new Array(d),i=new Array(d),j=new Array(d),k=new Array(d),l=new Array(d),m=c.words;m.length=d,this.convert13b(a.words,a.length,g,d),this.convert13b(b.words,b.length,j,d),this.transform(g,f,h,i,d,e),this.transform(j,f,k,l,d,e);for(var n=0;n<d;n++){var o=h[n]*k[n]-i[n]*l[n];i[n]=h[n]*l[n]+i[n]*k[n],h[n]=o}return this.conjugate(h,i,d),this.transform(h,i,m,f,d,e),this.conjugate(m,f,d),this.normalize13b(m,d),c.negative=a.negative^b.negative,c.length=a.length+b.length,c.strip()},f.prototype.mul=function(a){var b=new f(null);return b.words=new Array(this.length+a.length),this.mulTo(a,b)},f.prototype.mulf=function(a){var b=new f(null);return b.words=new Array(this.length+a.length),l(this,a,b)},f.prototype.imul=function(a){return this.clone().mulTo(a,this)},f.prototype.imuln=function(a){d("number"==typeof a),d(a<67108864);for(var b=0,c=0;c<this.length;c++){var e=(0|this.words[c])*a,f=(67108863&e)+(67108863&b);b>>=26,b+=e/67108864|0,b+=f>>>26,this.words[c]=67108863&f}return 0!==b&&(this.words[c]=b,this.length++),this},f.prototype.muln=function(a){return this.clone().imuln(a)},f.prototype.sqr=function(){return this.mul(this)},f.prototype.isqr=function(){return this.imul(this.clone())},f.prototype.pow=function(a){var b=i(a);if(0===b.length)return new f(1);for(var c=this,d=0;d<b.length&&0===b[d];d++,c=c.sqr());if(++d<b.length)for(var e=c.sqr();d<b.length;d++,e=e.sqr())0!==b[d]&&(c=c.mul(e));return c},f.prototype.iushln=function(a){d("number"==typeof a&&a>=0);var b,c=a%26,e=(a-c)/26,f=67108863>>>26-c<<26-c;if(0!==c){var g=0;for(b=0;b<this.length;b++){var h=this.words[b]&f,i=(0|this.words[b])-h<<c;this.words[b]=i|g,g=h>>>26-c}g&&(this.words[b]=g,this.length++)}if(0!==e){for(b=this.length-1;b>=0;b--)this.words[b+e]=this.words[b];for(b=0;b<e
|
|
|
|
return b},32,!1),w=function(a,b){return{localName:b,name:"boolean",type:"boolean",encode:function(a){return v.encode(a?1:0)},decode:function(b,c){var d=v.decode(b,c);return{consumed:d.consumed,value:a("boolean",!d.value.isZero())}}}},x=function(a,b,c){var d="bytes"+b;return{localName:c,name:d,type:d,encode:function(a){if(a=o.arrayify(a),32===b)return a;var c=new Uint8Array(32);return c.set(a),c},decode:function(c,e){return c.length<e+32&&n("invalid bytes"+b),{consumed:32,value:a(d,o.hexlify(c.slice(e,e+b)))}}}},y=function(a,b){return{localName:b,name:"address",type:"address",encode:function(a){a=o.arrayify(o.getAddress(a));var b=new Uint8Array(32);return b.set(a,12),b},decode:function(b,c){return b.length<c+32&&n("invalid address"),{consumed:32,value:a("address",o.getAddress(o.hexlify(b.slice(c+12,c+32))))}}}},z=function(a,b){return{localName:b,name:"bytes",type:"bytes",encode:function(a){return d(o.arrayify(a))},decode:function(b,c){var d=e(b,c);return d.value=a("bytes",o.hexlify(d.value)),d},dynamic:!0}},A=function(a,b){return{localName:b,name:"string",type:"string",encode:function(a){return d(o.toUtf8Bytes(a))},decode:function(b,c){var d=e(b,c);return d.value=a("string",o.toUtf8String(d.value)),d},dynamic:!0}},B={address:y,bool:w,string:A,bytes:z};o.defineProperty(m.prototype,"encode",function(a,b,c){arguments.length<3&&(c=b,b=a,a=null),b.length!==c.length&&n("types/values mismatch",{types:b,values:c});var d=[];return b.forEach(function(b,c){d.push(l(this.coerceFunc,b,a?a[c]:void 0))},this),o.hexlify(j(this.coerceFunc,d).encode(c))}),o.defineProperty(m.prototype,"decode",function(a,b,c){arguments.length<3&&(c=b,b=a,a=null),c=o.arrayify(c);var d=[];return b.forEach(function(b,c){d.push(l(this.coerceFunc,b,a?a[c]:void 0))},this),j(this.coerceFunc,d).decode(c,0).value}),o.defineProperty(m,"defaultCoder",new m),b.exports=m},{"../utils/address":9,"../utils/bignumber.js":10,"../utils/convert.js":11,"../utils/properties.js":13,"../utils/throw-error":14,"../utils/utf8.js":15}],9:[function(a,b,c){function d(a){"string"==typeof a&&a.match(/^0x[0-9A-Fa-f]{40}$/)||i("invalid address",{input:a}),a=a.toLowerCase();for(var b=a.substring(2).split(""),c=0;c<b.length;c++)b[c]=b[c].charCodeAt(0);b=h.arrayify(j(b)),a=a.substring(2).split("");for(var c=0;c<40;c+=2)b[c>>1]>>4>=8&&(a[c]=a[c].toUpperCase()),(15&b[c>>1])>=8&&(a[c+1]=a[c+1].toUpperCase());return"0x"+a.join("")}function e(a){return Math.log10?Math.log10(a):Math.log(a)/Math.LN10}function f(a,b){var c=null;if("string"!=typeof a&&i("invalid address",{input:a}),a.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==a.substring(0,2)&&(a="0x"+a),c=d(a),a.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&c!==a&&i("invalid address checksum",{input:a,expected:c});else if(a.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(a.substring(2,4)!==l(a)&&i("invalid address icap checksum",{input:a}),c=new g(a.substring(4),36).toString(16);c.length<40;)c="0"+c;c=d("0x"+c)}else i("invalid address",{input:a});if(b){for(var e=new g(c.substring(2),16).toString(36).toUpperCase();e.length<30;)e="0"+e;return"XE"+l("XE00"+e)+e}return c}var g=a("bn.js"),h=a("./convert"),i=a("./throw-error"),j=a("./keccak256"),k=9007199254740991,l=function(){for(var a={},b=0;b<10;b++)a[String(b)]=String(b);for(var b=0;b<26;b++)a[String.fromCharCode(65+b)]=String(10+b);var c=Math.floor(e(k));return function(b){b=b.toUpperCase(),b=b.substring(4)+b.substring(0,2)+"00";for(var d=b.split(""),e=0;e<d.length;e++)d[e]=a[d[e]];for(d=d.join("");d.length>=c;){var f=d.substring(0,c);d=parseInt(f,10)%97+d.substring(f.length)}for(var g=String(98-parseInt(d,10)%97);g.length<2;)g="0"+g;return g}}();b.exports={getAddress:f}},{"./convert":11,"./keccak256":12,"./throw-error":14,"bn.js":4}],10:[function(a,b,c){function d(a){if(!(this instanceof d))throw new Error("missing new");i.isHexString(a)?("0x"==a&&(a="0x0"),a=new g(a.substring(2),16)):"string"==typeof a&&"-"===a[0]&&i.isHexString(a.substring(1))?a=new g(a.substring(3),16).mul(d.constantNegativeOne._bn):"string"==typeof a&&a.match(/^-?[0-9]*$/)?(""==a&&(a="0"),a=new g(a)):"number"==typeof a&&parseInt(a)==a?a=new g
|